/* ─── Jujiandan Admin Portal CSS ─────────────────────────────────────── */

:root {
  --bg-primary: #0a0c14;
  --bg-secondary: #12141e;
  --bg-card: #181b28;
  --bg-hover: #1e2235;
  --bg-input: #12141e;
  --border: rgba(255,255,255,0.06);
  --text-primary: #e8eaf0;
  --text-secondary: #8b8fa4;
  --text-muted: #5b5f73;
  --accent: #10b981;
  --accent-hover: #059669;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --blue: #3b82f6;
  --purple: #8b5cf6;
  --amber: #f59e0b;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
}

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

body {
  font-family: 'Inter', -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ─── Login ──────────────────────────────────────────────────────────── */

.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #0a0c14 0%, #111827 50%, #0a0c14 100%);
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 48px 40px;
  width: 90%; max-width: 400px;
  box-shadow: var(--shadow);
  text-align: center;
}

.login-logo {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, var(--accent), #06b6d4);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
  color: white;
}

.login-card h1 { font-size: 22px; font-weight: 600; margin-bottom: 4px; }
.login-subtitle { color: var(--text-muted); font-size: 13px; margin-bottom: 32px; }

.input-group { text-align: left; margin-bottom: 16px; }
.input-group label { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; font-weight: 500; }
.input-group input, .input-group select {
  width: 100%; padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: border-color .2s;
}
.input-group input:focus, .input-group select:focus {
  border-color: var(--accent);
}

.error-msg { color: var(--danger); font-size: 13px; margin-bottom: 12px; }

/* ─── Buttons ────────────────────────────────────────────────────────── */

.btn-primary {
  background: var(--accent); color: #fff;
  border: none; border-radius: var(--radius-sm);
  padding: 10px 20px; font-size: 14px; font-weight: 500;
  cursor: pointer; transition: background .2s;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-full { width: 100%; padding: 12px; font-size: 15px; margin-top: 8px; }

.btn-ghost {
  background: none; border: none;
  color: var(--text-secondary); font-size: 13px;
  cursor: pointer; padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: all .2s;
}
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-hover); }

.btn-sm {
  padding: 5px 12px; font-size: 12px;
  border: 1px solid var(--border);
  background: transparent; color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer; transition: all .2s;
}
.btn-sm:hover { border-color: var(--accent); color: var(--accent); }
.btn-sm.danger { color: var(--danger); }
.btn-sm.danger:hover { border-color: var(--danger); }

/* ─── Layout ─────────────────────────────────────────────────────────── */

.main-app { display: flex; height: 100vh; }

.sidebar {
  width: 220px; flex-shrink: 0;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 20px 0;
}

.sidebar-header {
  display: flex; align-items: center; gap: 10px;
  padding: 0 20px 24px;
  color: var(--accent);
  font-size: 18px; font-weight: 700;
}

.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 2px; padding: 0 8px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: var(--radius-sm);
  color: var(--text-secondary); font-size: 14px;
  text-decoration: none; transition: all .2s;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active { background: rgba(16,185,129,.1); color: var(--accent); font-weight: 500; }

.sidebar-footer {
  padding: 16px 20px; border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.admin-info { display: flex; align-items: center; gap: 8px; }
.admin-avatar {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, var(--accent), var(--blue));
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; color: white;
}

.content { flex: 1; padding: 28px 32px; overflow-y: auto; }

/* ─── Pages ──────────────────────────────────────────────────────────── */

.page { display: none; animation: fadeIn .3s ease; }
.page.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.page-header { margin-bottom: 24px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.page-header h2 { font-size: 22px; font-weight: 600; }
.page-actions { display: flex; gap: 10px; align-items: center; }
.text-muted { color: var(--text-muted); font-size: 13px; }

/* ─── Stats Cards ────────────────────────────────────────────────────── */

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 28px; }
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  display: flex; align-items: center; gap: 16px;
  transition: transform .2s, box-shadow .2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.stat-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon.blue { background: rgba(59,130,246,.15); color: var(--blue); }
.stat-icon.green { background: rgba(16,185,129,.15); color: var(--accent); }
.stat-icon.purple { background: rgba(139,92,246,.15); color: var(--purple); }
.stat-icon.amber { background: rgba(245,158,11,.15); color: var(--amber); }

.stat-info { display: flex; flex-direction: column; }
.stat-value { font-size: 24px; font-weight: 700; line-height: 1.2; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ─── Chart ──────────────────────────────────────────────────────────── */

.chart-section {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
}
.chart-section h3 { font-size: 15px; font-weight: 500; margin-bottom: 20px; }

.chart-bar { display: flex; align-items: flex-end; gap: 12px; height: 160px; padding-top: 20px; }
.chart-col {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.chart-col .bar {
  width: 100%; max-width: 48px;
  background: linear-gradient(to top, var(--accent), rgba(16,185,129,.4));
  border-radius: 6px 6px 0 0;
  min-height: 4px; transition: height .5s ease;
}
.chart-col .bar-label { font-size: 11px; color: var(--text-muted); }
.chart-col .bar-value { font-size: 12px; font-weight: 600; color: var(--accent); }

/* ─── Tables ─────────────────────────────────────────────────────────── */

.table-container { overflow-x: auto; }
.data-table {
  width: 100%; border-collapse: collapse;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.data-table th {
  text-align: left; padding: 12px 16px;
  font-size: 12px; font-weight: 500; color: var(--text-muted);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  text-transform: uppercase; letter-spacing: .5px;
}
.data-table td {
  padding: 12px 16px; font-size: 13px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg-hover); }

.empty-state { text-align: center; color: var(--text-muted); padding: 40px !important; }

.search-input {
  padding: 8px 14px; background: var(--bg-input);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-primary); font-size: 13px; outline: none;
  width: 220px; transition: border-color .2s;
}
.search-input:focus { border-color: var(--accent); }

.filter-select {
  padding: 8px 14px; background: var(--bg-input);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-primary); font-size: 13px; outline: none;
}

/* ─── Badges ─────────────────────────────────────────────────────────── */

.badge {
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 500;
  display: inline-block;
}
.badge-green { background: rgba(16,185,129,.15); color: #10b981; }
.badge-red { background: rgba(239,68,68,.15); color: #ef4444; }
.badge-blue { background: rgba(59,130,246,.15); color: #3b82f6; }
.badge-amber { background: rgba(245,158,11,.15); color: #f59e0b; }
.badge-purple { background: rgba(139,92,246,.15); color: #8b5cf6; }
.badge-gray { background: rgba(107,114,128,.15); color: #9ca3af; }

/* ─── Pagination ─────────────────────────────────────────────────────── */

.pagination {
  display: flex; justify-content: center; gap: 6px;
  margin-top: 16px; padding: 8px 0;
}
.pagination button {
  padding: 6px 12px; border: 1px solid var(--border);
  background: var(--bg-card); color: var(--text-secondary);
  border-radius: var(--radius-sm); font-size: 13px;
  cursor: pointer; transition: all .2s;
}
.pagination button:hover { border-color: var(--accent); color: var(--accent); }
.pagination button.active { background: var(--accent); color: white; border-color: var(--accent); }
.pagination button:disabled { opacity: .4; cursor: not-allowed; }

/* ─── Modal ──────────────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,.6); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn .2s ease;
}
.modal-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 14px; width: 480px; max-width: 90vw;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 24px; border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-body { padding: 24px; }
.modal-body .input-group { margin-bottom: 14px; }
.modal-body .btn-primary { margin-top: 8px; }

/* ─── Drawer ─────────────────────────────────────────────────────────── */

.drawer-overlay {
  position: fixed; inset: 0; z-index: 1010;
  background: rgba(0,0,0,.4); backdrop-filter: blur(2px);
  animation: fadeIn .2s ease;
}
.drawer {
  position: fixed; right: 0; top: 0; bottom: 0;
  width: 500px; max-width: 100vw;
  background: var(--bg-card); border-left: 1px solid var(--border);
  z-index: 1020; box-shadow: -10px 0 40px rgba(0,0,0,.4);
  display: flex; flex-direction: column;
  transition: transform .3s cubic-bezier(0.4, 0, 0.2, 1);
}
.drawer.open { transform: translateX(0) !important; }

.drawer-header {
  padding: 20px 24px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.drawer-header h3 { font-size: 18px; font-weight: 600; }

.drawer-tabs {
  display: flex; gap: 20px; padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
}
.drawer-tab {
  padding: 12px 4px; font-size: 13px; font-weight: 500;
  color: var(--text-secondary); cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all .2s;
}
.drawer-tab:hover { color: var(--text-primary); }
.drawer-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.drawer-body { flex: 1; overflow-y: auto; padding: 24px; }
.drawer-pane { display: none; animation: fadeIn .2s; }
.drawer-pane.active { display: block; }


/* ─── Settings ───────────────────────────────────────────────────────── */

.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 20px; }
.settings-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
}
.settings-card h3 { font-size: 15px; font-weight: 600; margin-bottom: 16px; }
.settings-card code { background: var(--bg-input); padding: 2px 8px; border-radius: 4px; font-size: 12px; color: var(--accent); }

.info-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.info-row:last-child { border-bottom: none; }

/* ─── Responsive ─────────────────────────────────────────────────────── */

@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .sidebar { width: 180px; }
}
@media (max-width: 640px) {
  .stats-grid { grid-template-columns: 1fr; }
  .main-app { flex-direction: column; }
  .sidebar { 
    width: 100%; height: auto; padding: 10px; 
    border-right: none; border-bottom: 1px solid var(--border);
  }
  .sidebar-header { display: none; }
  .sidebar-nav { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 8px; }
  .nav-item { padding: 6px 10px; font-size: 12px; }
  .content { padding: 16px; overflow-x: hidden; }
  .settings-grid { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
}
