/* 全局样式 */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Microsoft YaHei', Arial, sans-serif; background: #f5f6fa; color: #333; min-height: 100vh; }

/* 导航栏 */
.navbar { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: #fff; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; box-shadow: 0 2px 8px rgba(0,0,0,0.15); position: sticky; top: 0; z-index: 100; height: 56px; }
.navbar .logo { font-size: 18px; font-weight: bold; cursor: pointer; white-space: nowrap; }
.navbar .nav-links { display: flex; align-items: center; gap: 4px; height: 100%; }
.navbar .nav-links a { color: rgba(255,255,255,0.9); text-decoration: none; font-size: 14px; padding: 8px 14px; border-radius: 8px; transition: all 0.2s; white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
.navbar .nav-links a:hover { background: rgba(255,255,255,0.15); color: #fff; }
.navbar .nav-links a.nav-active { background: rgba(255,255,255,0.25); color: #fff; font-weight: 600; box-shadow: 0 0 0 1px rgba(255,255,255,0.2); }
.navbar .nav-divider { width: 1px; height: 20px; background: rgba(255,255,255,0.2); margin: 0 8px; }
.navbar .user-info { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.navbar .btn-logout { background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.3); color: #fff; padding: 5px 14px; border-radius: 8px; cursor: pointer; font-size: 13px; transition: all 0.2s; }
.navbar .btn-logout:hover { background: rgba(255,255,255,0.3); }

/* 容器 */
.container { max-width: 1200px; margin: 0 auto; padding: 20px; }
.main-container { max-width: 1100px; margin: 0 auto; padding: 20px 24px 40px; }

/* 按钮 */
.btn { display: inline-block; padding: 8px 20px; border: none; border-radius: 8px; font-size: 14px; cursor: pointer; transition: all 0.2s; text-decoration: none; }
.btn-primary { background: linear-gradient(135deg, #667eea, #764ba2); color: #fff; }
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-success { background: #27ae60; color: #fff; }
.btn-danger { background: #e74c3c; color: #fff; }
.btn-warning { background: #f39c12; color: #fff; }
.btn-outline { background: transparent; border: 1px solid #667eea; color: #667eea; }
.btn-sm { padding: 4px 12px; font-size: 12px; }

/* 表单 */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 500; color: #444; }
.form-group input, .form-group textarea, .form-group select { width: 100%; padding: 10px 12px; border: 1px solid #ddd; border-radius: 8px; font-size: 14px; transition: border 0.2s; }
.form-group input:focus, .form-group textarea:focus { outline: none; border-color: #667eea; box-shadow: 0 0 0 3px rgba(102,126,234,0.15); }
.form-group textarea { min-height: 80px; resize: vertical; }

/* 卡片 */
.card { background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 12px rgba(0,0,0,0.08); transition: transform 0.2s, box-shadow 0.2s; cursor: pointer; }
.card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(0,0,0,0.12); }
.card img.cover { width: 100%; height: 180px; object-fit: cover; }
.card .card-body { padding: 12px; }
.card .card-title { font-size: 15px; font-weight: 600; margin-bottom: 6px; color: #222; }
.card .card-meta { font-size: 12px; color: #888; display: flex; gap: 10px; }
.card .card-tags { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 4px; }
.card .tag { background: #eef2ff; color: #667eea; font-size: 11px; padding: 2px 8px; border-radius: 10px; }

/* 画廊网格 */
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; margin-top: 20px; }

/* 详情页 */
.detail-container { max-width: 900px; margin: 20px auto; padding: 0 20px; }
.detail-cover-section { background: #fff; border-radius: 12px; padding: 20px; box-shadow: 0 2px 12px rgba(0,0,0,0.08); }
.detail-cover-main { width: 100%; max-height: 450px; object-fit: contain; border-radius: 8px; background: #f0f0f0; }
.detail-thumbnails { display: flex; gap: 8px; margin-top: 12px; overflow-x: auto; padding-bottom: 8px; }
.detail-thumbnails img { width: 80px; height: 60px; object-fit: cover; border-radius: 6px; cursor: pointer; border: 2px solid transparent; transition: border 0.2s; }
.detail-thumbnails img.active { border-color: #667eea; }
.thumb-wrapper { display: inline-block; cursor: pointer; border: 2px solid transparent; border-radius: 6px; overflow: hidden; width: 80px; height: 56px; transition: border 0.2s; vertical-align: top; }
.thumb-wrapper.active { border-color: #667eea; box-shadow: 0 0 6px rgba(102,126,234,0.5); }
.thumb-wrapper video { pointer-events: none; }
#mainMediaContainer { background: #000; border-radius: 8px; min-height: 300px; }
.detail-info { background: #fff; border-radius: 12px; padding: 20px; margin-top: 16px; box-shadow: 0 2px 12px rgba(0,0,0,0.08); }
.detail-info h2 { font-size: 22px; margin-bottom: 10px; }
.detail-meta { display: flex; gap: 16px; font-size: 13px; color: #888; margin-bottom: 16px; }
.detail-desc { font-size: 14px; line-height: 1.8; color: #555; margin-bottom: 16px; }
.detail-actions { display: flex; gap: 12px; align-items: center; }
.detail-actions .stat { display: flex; align-items: center; gap: 4px; font-size: 14px; color: #666; }
.detail-actions .btn-like { background: #fff; border: 1px solid #e74c3c; color: #e74c3c; padding: 6px 16px; border-radius: 20px; cursor: pointer; font-size: 14px; transition: all 0.2s; }
.detail-actions .btn-like.liked { background: #e74c3c; color: #fff; }

/* 附件列表 */
.attachments { background: #fff; border-radius: 12px; padding: 20px; margin-top: 16px; box-shadow: 0 2px 12px rgba(0,0,0,0.08); }
.attachments h3 { font-size: 16px; margin-bottom: 12px; }
.attachment-item { display: flex; align-items: center; justify-content: space-between; padding: 10px; border: 1px solid #eee; border-radius: 8px; margin-bottom: 8px; transition: background 0.2s; }
.attachment-item:hover { background: #f9f9f9; }
.attachment-item .att-info { display: flex; align-items: center; gap: 10px; }
.attachment-item .att-icon { font-size: 24px; }
.attachment-item .att-name { font-size: 13px; color: #333; }
.attachment-item .att-size { font-size: 11px; color: #999; }
.attachment-item .btn-download { background: #667eea; color: #fff; border: none; padding: 4px 12px; border-radius: 6px; cursor: pointer; font-size: 12px; text-decoration: none; }

/* 登录页 */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.login-box { background: #fff; border-radius: 16px; padding: 40px; width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,0.2); }
.login-box h2 { text-align: center; margin-bottom: 24px; color: #333; }
.login-box .form-group { margin-bottom: 18px; }
.login-box .btn { width: 100%; padding: 12px; font-size: 15px; }
.login-error { color: #e74c3c; font-size: 13px; margin-bottom: 12px; text-align: center; }

/* 上传页 */
.upload-section { background: #fff; border-radius: 12px; padding: 24px; margin-bottom: 20px; box-shadow: 0 2px 12px rgba(0,0,0,0.08); }
.upload-section h3 { font-size: 16px; margin-bottom: 16px; padding-bottom: 8px; border-bottom: 1px solid #eee; }
.drop-zone { border: 2px dashed #ccc; border-radius: 12px; padding: 40px; text-align: center; color: #999; font-size: 14px; cursor: pointer; transition: all 0.2s; margin-bottom: 12px; }
.drop-zone:hover, .drop-zone.dragover { border-color: #667eea; background: #f8f9ff; color: #667eea; }
.file-preview { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.file-preview .file-item { position: relative; width: 100px; height: 100px; border-radius: 8px; overflow: hidden; border: 1px solid #eee; }
.file-preview .file-item img { width: 100%; height: 100%; object-fit: cover; }
.file-preview .file-item .remove-btn { position: absolute; top: 2px; right: 2px; background: rgba(0,0,0,0.6); color: #fff; border: none; border-radius: 50%; width: 20px; height: 20px; cursor: pointer; font-size: 12px; line-height: 20px; text-align: center; }
.file-preview .file-item .file-icon { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 32px; background: #f5f5f5; }

/* 审核页 */
.admin-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 12px rgba(0,0,0,0.08); }
.admin-table th { background: #f8f9fa; padding: 12px; text-align: left; font-size: 13px; color: #666; border-bottom: 1px solid #eee; }
.admin-table td { padding: 12px; font-size: 13px; border-bottom: 1px solid #f0f0f0; }
.admin-table tr:hover { background: #fafbff; }
.status-badge { display: inline-block; padding: 2px 10px; border-radius: 10px; font-size: 12px; }
.status-pending { background: #fff3cd; color: #856404; }
.status-approved { background: #d4edda; color: #155724; }
.status-rejected { background: #f8d7da; color: #721c24; }

/* 分页 */
.pagination { display: flex; justify-content: center; gap: 6px; margin-top: 24px; }
.pagination button { padding: 6px 12px; border: 1px solid #ddd; border-radius: 6px; background: #fff; cursor: pointer; font-size: 13px; }
.pagination button.active { background: #667eea; color: #fff; border-color: #667eea; }
.pagination button:disabled { opacity: 0.5; cursor: not-allowed; }

/* 空状态 */
.empty-state { text-align: center; padding: 60px 20px; color: #999; }
.empty-state .empty-icon { font-size: 64px; margin-bottom: 16px; }
.empty-state p { font-size: 15px; }

/* 加载动画 */
.loading { text-align: center; padding: 40px; color: #999; }
.loading::after { content: ''; display: inline-block; width: 20px; height: 20px; border: 2px solid #667eea; border-top-color: transparent; border-radius: 50%; animation: spin 0.8s linear infinite; margin-left: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 提示消息 */
.toast { position: fixed; top: 70px; right: 20px; padding: 12px 20px; border-radius: 8px; color: #fff; font-size: 14px; z-index: 9999; animation: slideIn 0.3s ease; }
.toast-success { background: #27ae60; }
.toast-error { background: #e74c3c; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* 文件夹树形附件列表 */
.file-tree { margin-top: 8px; }
.folder-item { margin-bottom: 4px; }
.folder-header { display: flex; align-items: center; gap: 6px; padding: 8px 10px; background: #f8f9fa; border-radius: 6px; cursor: pointer; user-select: none; transition: background 0.2s; }
.folder-header:hover { background: #eef2ff; }
.folder-toggle { font-size: 10px; color: #667eea; width: 14px; text-align: center; }
.folder-icon { font-size: 18px; }
.folder-name { font-size: 13px; font-weight: 500; color: #444; flex: 1; }
.folder-count { font-size: 11px; color: #999; }
.folder-children { margin-top: 4px; }

/* 响应式 */
@media (max-width: 768px) {
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
  .navbar { padding: 10px 12px; }
  .navbar .logo { font-size: 16px; }
  .detail-container { padding: 0 10px; }
  .folder-header { padding: 6px 8px; }
  .form-row { flex-direction: column; gap: 0; }
  .modal-box.modal-user { width: 95% !important; }
}

/* ========== 弹窗表单样式 ========== */
.modal-box.modal-user {
  max-width: 520px;
  width: 90%;
  padding: 0;
  overflow: hidden;
}

.modal-box.modal-user .modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px 14px;
  border-bottom: 1px solid #eee;
}

.modal-box.modal-user .modal-header h3 {
  font-size: 18px;
  font-weight: 600;
  color: #333;
  margin: 0;
}

.modal-box.modal-user .modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #999;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s;
}

.modal-box.modal-user .modal-close:hover {
  background: #f0f0f0;
  color: #333;
}

.modal-box.modal-user .modal-body {
  padding: 20px 24px 8px;
}

.modal-box.modal-user .modal-footer {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding: 12px 24px 20px;
  border-top: 1px solid #f0f0f0;
}

.modal-box.modal-user .form-row {
  display: flex;
  gap: 16px;
}

.modal-box.modal-user .form-half {
  flex: 1;
  min-width: 0;
}

.modal-box.modal-user .form-group {
  margin-bottom: 16px;
}

.modal-box.modal-user .form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 500;
  color: #555;
}

.modal-box.modal-user .form-group input,
.modal-box.modal-user .form-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  font-family: 'Microsoft YaHei', Arial, sans-serif;
  line-height: 1.5;
  color: #333;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.modal-box.modal-user .form-group input:focus,
.modal-box.modal-user .form-group select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.12);
}

.modal-box.modal-user .form-group input::placeholder {
  color: #bbb;
  font-size: 13px;
}

/* 自定义复选框行 */
.checkbox-row {
  display: flex !important;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 6px 0;
  margin-bottom: 0 !important;
}

.checkbox-row input[type="checkbox"] {
  width: 18px !important;
  height: 18px;
  margin: 0;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: #667eea;
}

.checkbox-row .checkbox-label {
  font-size: 14px;
  color: #444;
  user-select: none;
}

/* 页脚 */
.footer { background: #fff; border-top: 1px solid #eee; padding: 24px 20px; margin-top: 40px; }
.footer-inner { max-width: 1100px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.footer-links { display: flex; gap: 16px; flex-wrap: wrap; }
.footer-links a { color: #667eea; text-decoration: none; font-size: 14px; }
.footer-links a:hover { text-decoration: underline; }
.footer-copyright { font-size: 13px; color: #999; }
