/* ===== 管理后台样式 ===== */

.admin-header {
  background: rgba(255,255,255,0.98);
  border-bottom: 1px solid #eee;
}

/* 管理面板内容居中 */
#admin-dashboard {
  max-width: 960px;
  margin: 0 auto;
}

.admin-tabs {
  display: flex;
  gap: 4px;
  margin: 20px 0;
  background: #f4f4f8;
  padding: 4px;
  border-radius: 12px;
  overflow-x: auto;
}

.admin-tab {
  flex: 1;
  padding: 12px 20px;
  border: none;
  background: transparent;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.95rem;
  white-space: nowrap;
  color: #666;
  transition: all 0.2s;
}

.admin-tab:hover {
  background: rgba(255,255,255,0.6);
  color: #333;
}

.admin-tab.active {
  background: white;
  color: #667eea;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.admin-tab-content {
  display: none;
}
.admin-tab-content.active {
  display: block;
}

.admin-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}
.admin-toolbar h3 {
  color: #333;
  font-size: 1.1rem;
}

/* 管理列表 */
.admin-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-list-item {
  background: #f8f9fa;
  padding: 16px 20px;
  border-radius: 12px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  transition: background 0.2s;
  border: 1px solid transparent;
}
.admin-list-item:hover {
  background: #f0f2ff;
  border-color: #e0e4ff;
}

.admin-item-info {
  flex: 1;
  min-width: 0;
}

.admin-item-title {
  font-weight: 600;
  color: #333;
  margin-bottom: 4px;
  font-size: 0.95rem;
}

.admin-item-meta {
  font-size: 0.8rem;
  color: #999;
}

.admin-item-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.btn-edit {
  background: #667eea;
  color: white;
  padding: 6px 14px;
  border: none;
  border-radius: 8px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: opacity 0.2s;
}
.btn-edit:hover { opacity: 0.85; }

.btn-delete {
  background: #e74c3c;
  color: white;
  padding: 6px 14px;
  border: none;
  border-radius: 8px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: opacity 0.2s;
}
.btn-delete:hover { opacity: 0.85; }

/* 管理员弹窗 */
.admin-modal-content {
  max-width: 650px;
  max-height: 85vh;
}

/* 弹窗居中（管理后台未加载 modules.css） */
#admin-modal {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  backdrop-filter: blur(4px);
}
#admin-modal .modal-content {
  background: white;
  border-radius: 16px;
  padding: 30px;
  max-width: 500px;
  width: 90%;
  position: relative;
  max-height: 80vh;
  overflow-y: auto;
}
#admin-modal .modal-content.admin-modal-content {
  max-width: 650px;
}
#admin-modal .modal-close {
  position: absolute;
  top: 12px; right: 18px;
  font-size: 1.5rem;
  background: none;
  border: none;
  cursor: pointer;
  color: #999;
  line-height: 1;
}

.admin-form .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.admin-form .form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 10px;
  font-size: 0.9rem;
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
}
.admin-form .form-group textarea:focus {
  outline: none;
  border-color: #667eea;
}

.admin-form .form-group textarea.code-area {
  min-height: 150px;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 0.85rem;
}

.admin-form .form-hint {
  font-size: 0.78rem;
  color: #aaa;
  margin-top: 4px;
}

.file-upload-area {
  border: 2px dashed #ddd;
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  color: #999;
  cursor: pointer;
  transition: border-color 0.2s;
  margin-top: 6px;
}
.file-upload-area:hover {
  border-color: #667eea;
  color: #667eea;
}

.upload-preview {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.upload-preview img {
  height: 80px;
  border-radius: 8px;
  border: 1px solid #eee;
}

/* 上传进度条 */
.upload-progress {
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.progress-bar {
  flex: 1;
  height: 8px;
  background: #e0e0e0;
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #667eea, #764ba2);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 0.8rem;
  color: #667eea;
  font-weight: 600;
  min-width: 40px;
  text-align: right;
}

/* 用户列表 */
.user-role-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 0.75rem;
}
.user-role-badge.admin {
  background: #667eea;
  color: white;
}
.user-role-badge.user {
  background: #e0e0e0;
  color: #666;
}

/* 响应式 */
@media (max-width: 768px) {
  .admin-tabs {
    flex-direction: column;
  }
  .admin-form .form-row {
    grid-template-columns: 1fr;
  }
  .admin-list-item {
    flex-direction: column;
  }
  .admin-item-actions {
    align-self: flex-end;
  }
}
