/* admin/css/style.css - 后台管理系统样式 */

/* ===== Reset ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #0D9488;
  --primary-dark: #0F766E;
  --primary-light: #CCFBF1;
  --primary-ultra: #F0FDFA;
  --accent: #F97316;
  --danger: #DC2626;
  --danger-light: #FEF2F2;
  --success: #16A34A;
  --success-light: #F0FDF4;
  --warning: #F59E0B;
  --warning-light: #FFFBEB;

  --title: #0F172A;
  --text: #334155;
  --text-2: #64748B;
  --text-3: #94A3B8;
  --border: #E2E8F0;
  --border-l: #F1F5F9;
  --bg: #F7F8FA;
  --card: #FFFFFF;
  --sidebar-bg: #0F172A;

  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* ===== Layout ===== */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
  width: 240px;
  background: var(--sidebar-bg);
  color: #fff;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}

.sidebar-title {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.5px;
}

.sidebar-subtitle {
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}

.nav-group-label {
  font-size: 11px;
  color: rgba(255,255,255,0.3);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 16px 12px 8px;
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  color: rgba(255,255,255,0.6);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  margin-bottom: 2px;
}

.nav-item:hover {
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.9);
}

.nav-item.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.3);
}

.nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 12px;
  color: rgba(255,255,255,0.3);
}

/* ===== Main Content ===== */
.main-content {
  flex: 1;
  margin-left: 240px;
  min-height: 100vh;
}

.topbar {
  height: 64px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--title);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
}

.topbar-user:hover {
  background: var(--bg);
}

.topbar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}

.content-area {
  padding: 32px;
}

/* ===== Cards ===== */
.card {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-l);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--title);
}

.card-body {
  padding: 24px;
}

/* ===== Stats Grid ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  opacity: 0.08;
}

.stat-card.teal::before { background: var(--primary); }
.stat-card.orange::before { background: var(--accent); }
.stat-card.blue::before { background: #3B82F6; }
.stat-card.green::before { background: var(--success); }

.stat-label {
  font-size: 13px;
  color: var(--text-2);
  font-weight: 500;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 32px;
  font-weight: 800;
  color: var(--title);
  letter-spacing: -1px;
}

.stat-trend {
  font-size: 12px;
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.stat-trend.up { color: var(--success); }
.stat-trend.down { color: var(--danger); }

/* ===== Table ===== */
.table-wrap {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.table-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-l);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  padding: 12px 24px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--bg);
  border-bottom: 1px solid var(--border-l);
}

td {
  padding: 16px 24px;
  font-size: 14px;
  color: var(--text);
  border-bottom: 1px solid var(--border-l);
}

tr:last-child td { border-bottom: none; }

tr:hover td { background: rgba(247, 248, 250, 0.5); }

/* ===== Badges ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}

.badge-primary { background: var(--primary-ultra); color: var(--primary-dark); }
.badge-accent { background: var(--warning-light); color: var(--warning); }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-gray { background: #F1F5F9; color: var(--text-2); }
.badge-info { background: #EFF6FF; color: #2563EB; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover { background: var(--primary-dark); }

.btn-outline {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-outline:hover { background: var(--bg); border-color: var(--text-3); }

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-sm { padding: 6px 14px; font-size: 13px; }

.btn-text {
  background: transparent;
  color: var(--primary);
  padding: 4px 8px;
}

.btn-text:hover { background: var(--primary-ultra); }

/* ===== Forms ===== */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--title);
  margin-bottom: 8px;
}

.form-label .required { color: var(--danger); }

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text);
  background: #fff;
  transition: all 0.2s;
  font-family: inherit;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.1);
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
}

.form-hint {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 6px;
}

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

/* ===== Upload Area ===== */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg);
}

.upload-area:hover {
  border-color: var(--primary);
  background: var(--primary-ultra);
}

.upload-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.upload-text {
  font-size: 14px;
  color: var(--text-2);
}

.upload-hint {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 4px;
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal-overlay.show { display: flex; }

.modal {
  background: #fff;
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  animation: modalIn 0.3s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-l);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--title);
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--text-2);
  background: transparent;
  border: none;
}

.modal-close:hover { background: var(--bg); }

.modal-body { padding: 24px; }

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-l);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* ===== Content Management Tree ===== */
.content-tree {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tree-item {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--border-l);
  overflow: hidden;
}

.tree-header {
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.tree-header:hover { background: var(--bg); }

.tree-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--title);
  display: flex;
  align-items: center;
  gap: 10px;
}

.tree-count {
  font-size: 12px;
  color: var(--text-3);
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 6px;
}

.tree-children {
  border-top: 1px solid var(--border-l);
  padding: 8px;
}

.tree-child {
  padding: 10px 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tree-child:hover { background: var(--bg); }

.tree-child-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tree-child-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.tree-child-desc {
  font-size: 12px;
  color: var(--text-3);
}

.tree-child-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ===== Video List ===== */
.video-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.video-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border-l);
}

.video-number {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.video-thumb {
  width: 100px;
  height: 60px;
  border-radius: 8px;
  background: linear-gradient(135deg, #E2E8F0, #CBD5E1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.video-info { flex: 1; }

.video-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--title);
}

.video-desc {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 4px;
}

.video-duration {
  font-size: 12px;
  color: var(--text-2);
  background: #fff;
  padding: 2px 8px;
  border-radius: 4px;
}

.video-actions {
  display: flex;
  gap: 8px;
}

/* ===== Spec List ===== */
.spec-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.spec-item {
  display: grid;
  grid-template-columns: 1fr 100px 100px 40px;
  gap: 12px;
  align-items: center;
  padding: 12px;
  background: var(--bg);
  border-radius: 8px;
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}

.empty-icon-large {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.3;
}

.empty-text {
  font-size: 14px;
  color: var(--text-3);
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: #0F172A;
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 2000;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  display: none;
}

.toast.show {
  display: block;
  animation: toastIn 0.3s ease;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
}

/* ===== Misc ===== */
.text-danger { color: var(--danger); font-weight: 600; }
.text-success { color: var(--success); font-weight: 600; }
.text-muted { color: var(--text-3); }
.text-sm { font-size: 12px; }
.text-lg { font-size: 16px; }
.fw-bold { font-weight: 700; }
.cursor-pointer { cursor: pointer; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }

/* ===== Login Overlay ===== */
.login-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(135deg, #0F172A 0%, #134E4A 100%);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-overlay.hidden {
  display: none;
}

.login-card {
  width: 380px;
  max-width: 90vw;
  background: #fff;
  border-radius: 20px;
  padding: 48px 40px 40px;
  text-align: center;
  box-shadow: 0 24px 64px rgba(0,0,0,0.3);
  animation: loginIn 0.4s ease;
}

@keyframes loginIn {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-logo {
  margin-bottom: 24px;
}

.login-logo-icon {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  font-size: 28px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  box-shadow: 0 8px 20px rgba(13, 148, 136, 0.3);
}

.login-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--title);
  margin-bottom: 6px;
}

.login-subtitle {
  font-size: 13px;
  color: var(--text-3);
  margin-bottom: 32px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-input {
  width: 100%;
  height: 48px;
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 0 18px;
  font-size: 15px;
  color: var(--title);
  outline: none;
  transition: border-color 0.2s;
}

.login-input:focus {
  border-color: var(--primary);
}

.login-input::placeholder {
  color: var(--text-3);
}

.login-btn {
  width: 100%;
  height: 48px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
}

.login-btn:hover { opacity: 0.9; }
.login-btn:active { transform: scale(0.98); }

.login-hint {
  margin-top: 20px;
  font-size: 12px;
  color: var(--text-3);
}

/* ===== User Dropdown ===== */
.topbar-user {
  position: relative;
}

.user-arrow {
  font-size: 10px;
  color: var(--text-3);
  margin-left: 2px;
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 160px;
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  padding: 6px;
  display: none;
  z-index: 200;
}

.user-dropdown.show {
  display: block;
  animation: dropIn 0.2s ease;
}

@keyframes dropIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.user-dropdown-item {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background 0.15s;
}

.user-dropdown-item:hover {
  background: var(--bg);
}

.dropdown-icon {
  font-size: 16px;
}

/* ===== Category Tabs ===== */
.cat-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.cat-tab {
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  transition: all 0.2s;
}

.cat-tab:hover {
  background: var(--bg);
  border-color: var(--text-3);
}

.cat-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.25);
}

/* ===== Category Card ===== */
.category-card {
  display: flex;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.category-bar {
  width: 6px;
  flex-shrink: 0;
}

.category-body {
  flex: 1;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* ===== Theme Card ===== */
.theme-card {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--border-l);
  padding: 16px 20px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  transition: box-shadow 0.2s;
}

.theme-card:hover {
  box-shadow: var(--shadow-md);
}

/* ===== Video Params ===== */
.video-params {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.video-param {
  font-size: 11px;
  color: var(--text-2);
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 500;
}

/* ===== Video Actions ===== */
.video-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.video-actions button:disabled {
  cursor: not-allowed;
}

/* ===== Color Input ===== */
input[type="color"].form-input {
  padding: 2px;
  cursor: pointer;
}

/* ===== Toggle Switch ===== */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
  cursor: pointer;
}
.toggle-switch.toggle-sm {
  width: 36px;
  height: 20px;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #CBD5E1;
  border-radius: 24px;
  transition: 0.3s;
}
.toggle-slider:before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.3s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.toggle-switch.toggle-sm .toggle-slider:before {
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
}
.toggle-switch input:checked + .toggle-slider {
  background: var(--primary);
}
.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(20px);
}
.toggle-switch.toggle-sm input:checked + .toggle-slider:before {
  transform: translateX(16px);
}

/* ===== Sort Controls ===== */
.sort-controls {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}
.sort-btn {
  width: 28px;
  height: 22px;
  border: 1px solid var(--border-l);
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  padding: 0;
  line-height: 1;
}
.sort-btn:hover:not(:disabled) {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.sort-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ===== Hidden Item Style ===== */
.is-hidden {
  opacity: 0.5;
}
.category-card.is-hidden .category-bar,
.theme-card.is-hidden,
.video-item.is-hidden {
  opacity: 0.5;
}
