/* ========== 全局重置 ========== */
* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

a {
	text-decoration: none;
	color: inherit;
}

ul {
	list-style: none;
}

button {
	cursor: pointer;
	border: none;
	outline: none;
	font-family: inherit;
	background: none;
}

img {
	display: block;
	max-width: 100%;
}

/* ========== 主体容器 ========== */
body {
	font-family: "Microsoft YaHei", "微软雅黑", -apple-system, sans-serif;
	background: linear-gradient(135deg, #f5f7fa 0%, #e9ecf5 100%);
	color: #333;
	min-height: 100vh;
	line-height: 1.6;
}

.container {
	width: 100%;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
}

/* ========== 顶部头部 ========== */
.header {
	background: linear-gradient(135deg, #6a8dff 0%, #8a6bff 100%);
	color: #fff;
	padding: 50px 20px 60px;
	text-align: center;
	box-shadow: 0 4px 20px rgba(106, 141, 255, 0.25);
}

.header-inner {
	max-width: 1200px;
	margin: 0 auto;
}

.logo {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	margin-bottom: 10px;
}

.logo-icon {
	font-size: 36px;
	color: #ffd966;
	text-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.logo h1 {
	font-size: 32px;
	font-weight: 600;
	letter-spacing: 2px;
}

.subtitle {
	font-size: 15px;
	opacity: 0.9;
	letter-spacing: 1px;
}

/* ========== 主体内容 ========== */
.main {
	flex: 1;
	max-width: 1200px;
	width: 100%;
	margin: -30px auto 0;
	padding: 0 20px 40px;
	position: relative;
	z-index: 2;
}

/* ========== 上传区域 ========== */
.upload-area {
	margin-bottom: 24px;
}

.upload-box {
	background: #fff;
	border: 2px dashed #c5cee0;
	border-radius: 12px;
	padding: 50px 20px;
	text-align: center;
	cursor: pointer;
	transition: all 0.3s ease;
}

.upload-box:hover,
.upload-box.dragover {
	border-color: #6a8dff;
	background: #f5f8ff;
	transform: translateY(-2px);
	box-shadow: 0 8px 24px rgba(106, 141, 255, 0.15);
}

.upload-icon {
	width: 64px;
	height: 64px;
	line-height: 64px;
	margin: 0 auto 16px;
	font-size: 36px;
	color: #6a8dff;
	border: 2px solid #6a8dff;
	border-radius: 50%;
	transition: all 0.3s ease;
}

.upload-box:hover .upload-icon {
	background: #6a8dff;
	color: #fff;
	transform: rotate(90deg);
}

.upload-text {
	font-size: 17px;
	color: #333;
	margin-bottom: 8px;
	font-weight: 500;
}

.upload-tip {
	font-size: 13px;
	color: #999;
}

/* ========== 工具栏 ========== */
.toolbar {
	display: flex;
	justify-content: space-between;
	align-items: center;
	background: #fff;
	border-radius: 10px;
	padding: 14px 20px;
	margin-bottom: 20px;
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
}

.count-label {
	font-size: 14px;
	color: #666;
}

.count-label em {
	font-style: normal;
	color: #6a8dff;
	font-weight: 600;
	font-size: 16px;
	margin: 0 4px;
}

.toolbar-actions {
	display: flex;
	gap: 10px;
}

.btn {
	padding: 8px 16px;
	font-size: 13px;
	border-radius: 6px;
	transition: all 0.25s ease;
	color: #666;
	background: #f5f5f5;
}

.btn:hover {
	background: #e8e8e8;
	color: #333;
}

.btn-danger {
	color: #ff6b6b;
	background: #fff0f0;
}

.btn-danger:hover {
	background: #ffe0e0;
	color: #e64545;
}

.btn-admin {
	color: #6a8dff;
	background: #eef2ff;
}

.btn-admin:hover {
	background: #e0e7ff;
	color: #5878e6;
}

.btn-admin.active {
	color: #fff;
	background: linear-gradient(135deg, #6a8dff 0%, #8a6bff 100%);
}

/* 非管理员模式下隐藏清空按钮 */
#clearBtn {
	display: none;
}

/* ========== 照片画廊 ========== */
.gallery {
	min-height: 300px;
}

.gallery-list {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
	gap: 18px;
}

.gallery-item {
	position: relative;
	background: #fff;
	border-radius: 10px;
	overflow: hidden;
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
	transition: all 0.3s ease;
	animation: fadeInUp 0.4s ease;
}

.gallery-item:hover {
	transform: translateY(-4px);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.gallery-item .img-wrap {
	width: 100%;
	height: 220px;
	overflow: hidden;
	background: #f5f5f5;
	cursor: pointer;
}

.gallery-item .img-wrap img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.4s ease;
}

.gallery-item:hover .img-wrap img {
	transform: scale(1.08);
}

.gallery-item .item-info {
	padding: 10px 14px;
}

.gallery-item .item-name {
	font-size: 13px;
	color: #333;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	margin-bottom: 4px;
}

.gallery-item .item-meta {
	font-size: 12px;
	color: #999;
	display: flex;
	justify-content: space-between;
}

/* 操作按钮（管理员模式，图片下方） */
.gallery-item .item-actions {
	display: flex;
	gap: 8px;
	justify-content: center;
	padding: 8px 0 4px;
}

.action-btn {
	padding: 5px 16px;
	border: none;
	border-radius: 4px;
	background: rgba(0, 0, 0, 0.06);
	color: #555;
	font-size: 13px;
	cursor: pointer;
	transition: all 0.2s ease;
}

.action-btn:hover {
	background: rgba(0, 0, 0, 0.12);
}

.action-btn.delete:hover {
	background: #ff6b6b;
	color: #fff;
}

.action-btn.edit:hover {
	background: #6a8dff;
	color: #fff;
}

/* ========== 空状态 ========== */
.empty-state {
	text-align: center;
	padding: 80px 20px;
	color: #bbb;
}

.empty-state .empty-icon {
	font-size: 64px;
	margin-bottom: 16px;
	opacity: 0.6;
}

.empty-state p {
	font-size: 17px;
	color: #999;
	margin-bottom: 6px;
}

.empty-state span {
	font-size: 13px;
	color: #bbb;
}

.empty-state.hidden {
	display: none;
}

/* ========== 页脚 ========== */
.footer {
	background: #2c2f3a;
	color: #aaa;
	text-align: center;
	padding: 24px 20px;
	font-size: 13px;
}

.footer p:first-child {
	color: #ddd;
	margin-bottom: 4px;
}

/* ========== 预览模态框 ========== */
.modal {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 1000;
	display: none;
}

.modal.show {
	display: block;
}

.modal-mask {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.85);
}

.modal-content {
	position: relative;
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 40px;
}

.modal-img {
	max-width: 90%;
	max-height: 80vh;
	border-radius: 6px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.modal-close {
	position: absolute;
	top: 20px;
	right: 30px;
	width: 44px;
	height: 44px;
	line-height: 44px;
	text-align: center;
	font-size: 30px;
	color: #fff;
	background: rgba(255, 255, 255, 0.15);
	border-radius: 50%;
	transition: all 0.2s ease;
}

.modal-close:hover {
	background: rgba(255, 255, 255, 0.3);
	transform: rotate(90deg);
}

.modal-nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 50px;
	height: 50px;
	line-height: 50px;
	text-align: center;
	font-size: 36px;
	color: #fff;
	background: rgba(255, 255, 255, 0.15);
	border-radius: 50%;
	transition: all 0.2s ease;
}

.modal-nav:hover {
	background: rgba(255, 255, 255, 0.3);
}

.modal-prev {
	left: 30px;
}

.modal-next {
	right: 30px;
}

.modal-info {
	position: absolute;
	bottom: 30px;
	left: 50%;
	transform: translateX(-50%);
	color: #ddd;
	font-size: 13px;
	text-align: center;
	background: rgba(0, 0, 0, 0.5);
	padding: 8px 20px;
	border-radius: 20px;
}

/* ========== 密码验证模态框 ========== */
.pwd-modal {
	z-index: 1100;
}

.pwd-modal .pwd-dialog {
	position: relative;
	width: 360px;
	max-width: 90%;
	background: #fff;
	border-radius: 12px;
	margin: 0 auto;
	top: 50%;
	transform: translateY(-50%);
	overflow: hidden;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
	animation: pwdIn 0.25s ease;
}

@keyframes pwdIn {
	from {
		opacity: 0;
		transform: translateY(-50%) scale(0.9);
	}
	to {
		opacity: 1;
		transform: translateY(-50%) scale(1);
	}
}

.pwd-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 16px 24px;
	background: linear-gradient(135deg, #6a8dff 0%, #8a6bff 100%);
	color: #fff;
}

.pwd-title {
	font-size: 16px;
	font-weight: 600;
}

.pwd-close {
	font-size: 24px;
	color: #fff;
	line-height: 1;
	opacity: 0.8;
	transition: opacity 0.2s ease;
}

.pwd-close:hover {
	opacity: 1;
}

.pwd-body {
	padding: 24px;
}

.pwd-tip {
	font-size: 14px;
	color: #666;
	margin-bottom: 14px;
}

.pwd-input {
	width: 100%;
	padding: 10px 14px;
	font-size: 15px;
	border: 2px solid #e0e0e0;
	border-radius: 8px;
	outline: none;
	transition: border-color 0.2s ease;
	font-family: inherit;
}

.pwd-input:focus {
	border-color: #6a8dff;
}

.pwd-error {
	color: #ff6b6b;
	font-size: 13px;
	margin-top: 8px;
	min-height: 18px;
}

.pwd-footer {
	display: flex;
	justify-content: flex-end;
	gap: 10px;
	padding: 0 24px 20px;
}

.btn-primary {
	color: #fff;
	background: linear-gradient(135deg, #6a8dff 0%, #8a6bff 100%);
}

.btn-primary:hover {
	opacity: 0.9;
	color: #fff;
}

/* ========== 动画 ========== */
@keyframes fadeInUp {
	from {
		opacity: 0;
		transform: translateY(20px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* ========== 响应式适配 ========== */
@media (max-width: 768px) {
	.logo h1 {
		font-size: 24px;
	}

	.upload-box {
		padding: 35px 15px;
	}

	.gallery-list {
		grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
		gap: 12px;
	}

	.gallery-item .img-wrap {
		height: 160px;
	}

	.modal-nav {
		width: 40px;
		height: 40px;
		line-height: 40px;
		font-size: 28px;
	}

	.modal-prev {
		left: 10px;
	}

	.modal-next {
		right: 10px;
	}
}
