/* BuyBuyLemon Admin Styles — Redesigned */
:root {
  --sidebar-w: 240px;
  --header-h: 64px;

  --bg-body: #0a0f1a;
  --bg-card: #111827;
  --bg-card-hover: #1a2235;
  --bg-sidebar: #0d1321;
  --bg-header: #111827;
  --border: #1e293b;
  --border-light: #334155;

  --text: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent: #60a5fa;
  --accent-bg: rgba(96,165,250,0.1);
  --lemon: #facc15;
  --orange: #fb923c;
  --green: #4ade80;
  --red: #f87171;
  --purple: #a78bfa;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
}

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

body {
  font-family: -apple-system, 'Inter', 'Noto Sans SC', system-ui, sans-serif;
  background: var(--bg-body);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

/* ===== Sidebar ===== */
.admin-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  z-index: 100;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}
.sidebar-brand:hover { color: var(--accent); }

.sidebar-nav {
  padding: 0.8rem 0;
  flex: 1;
}

.sidebar-section {
  padding: 0.5rem 1.5rem 0.3rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 1.5rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  transition: all 0.15s;
  border-left: 3px solid transparent;
}
.sidebar-link:hover {
  color: var(--text);
  background: rgba(255,255,255,0.03);
}
.sidebar-link.active {
  color: var(--accent);
  background: var(--accent-bg);
  border-left-color: var(--accent);
  font-weight: 600;
}
.sidebar-link .icon { font-size: 1.1rem; width: 1.4rem; text-align: center; }

.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-muted);
}
.sidebar-footer a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.3rem 0;
}
.sidebar-footer a:hover { color: var(--text); }

/* ===== Main Content ===== */
.admin-main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
}

.admin-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.admin-header-left h1 {
  font-size: 1.1rem;
  font-weight: 600;
}
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.breadcrumb a { color: var(--text-secondary); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }

.admin-header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.admin-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent-bg);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}

.admin-content {
  padding: 1.5rem 2rem;
}

/* ===== Cards ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.card-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.card-header h2 { font-size: 1rem; font-weight: 600; }
.card-body { padding: 1.5rem; }

/* ===== Stats Grid ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: border-color 0.2s;
}
.stat-card:hover { border-color: var(--border-light); }

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.stat-icon.blue { background: rgba(96,165,250,0.12); }
.stat-icon.green { background: rgba(74,222,128,0.12); }
.stat-icon.yellow { background: rgba(250,204,21,0.12); }
.stat-icon.red { background: rgba(248,113,113,0.12); }

.stat-info { flex: 1; }
.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
}
.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-xs);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  font-family: inherit;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent);
  color: #0f172a;
}
.btn-primary:hover { background: #93c5fd; }

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
}
.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-danger {
  background: rgba(248,113,113,0.1);
  color: var(--red);
  border: 1px solid transparent;
}
.btn-danger:hover {
  background: rgba(248,113,113,0.2);
  border-color: rgba(248,113,113,0.3);
}

.btn-sm {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  font-family: inherit;
  text-decoration: none;
  background: var(--border-light);
  color: var(--text-secondary);
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-sm:hover {
  background: #475569;
  color: var(--text);
}
.btn-sm.btn-danger:hover {
  background: rgba(248,113,113,0.2);
  color: var(--red);
}

/* ===== Table ===== */
.table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}
.admin-table th {
  padding: 0.7rem 1rem;
  text-align: left;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--bg-body);
  border-bottom: 1px solid var(--border);
}
.admin-table td {
  padding: 0.75rem 1rem;
  font-size: 0.88rem;
  border-bottom: 1px solid rgba(30,41,59,0.5);
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: rgba(255,255,255,0.02); }

.admin-table .action-cell {
  display: flex;
  gap: 0.4rem;
  flex-wrap: nowrap;
}

/* ===== Status Tags ===== */
.status-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border-radius: 100px;
  font-size: 0.78rem;
  font-weight: 600;
}
.status-pending {
  background: rgba(251,191,36,0.12);
  color: #fbbf24;
}
.status-paid {
  background: rgba(74,222,128,0.12);
  color: #4ade80;
}
.status-shipped {
  background: rgba(96,165,250,0.12);
  color: #60a5fa;
}
.status-delivered {
  background: rgba(167,139,250,0.12);
  color: #a78bfa;
}
.status-cancelled {
  background: rgba(248,113,113,0.12);
  color: #f87171;
}

/* ===== Forms ===== */
.admin-form { max-width: 720px; }
.admin-form .form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}
.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.55rem 0.75rem;
  background: #0f172a;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xs);
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color 0.15s;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-bg);
}
.form-group input::placeholder { color: var(--text-muted); }

.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  padding: 0.4rem 0;
}
.checkbox-group input[type="checkbox"] {
  width: auto;
  accent-color: var(--accent);
}

.status-select {
  padding: 0.35rem;
  background: #0f172a;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xs);
  color: var(--text);
  font-size: 0.8rem;
  font-family: inherit;
}

/* ===== Page Header ===== */
.page-header-wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}
.page-header-wrap h1 { font-size: 1.2rem; font-weight: 600; }

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}
.empty-state .icon { font-size: 2.5rem; margin-bottom: 0.8rem; }
.empty-state p { font-size: 0.9rem; }
.empty-state .btn { margin-top: 1rem; }

/* ===== Alerts ===== */
.alert {
  padding: 0.7rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}
.alert-error {
  background: #fef2f2;
  border: 2px solid #ef4444;
  color: #dc2626;
  font-weight: 700;
}
.alert-success {
  background: rgba(74,222,128,0.1);
  border: 1px solid rgba(74,222,128,0.2);
  color: var(--green);
}
.alert-warning {
  background: rgba(251,191,36,0.1);
  border: 1px solid rgba(251,191,36,0.2);
  color: #fbbf24;
}

/* ===== Backup Page ===== */
.backup-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.backup-stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
}
.backup-stat .val {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
}
.backup-stat .lbl {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

code {
  background: var(--border);
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  font-size: 0.8rem;
}

/* ===== Alert ===== */
.alert-success {
  background: rgba(34,197,94,0.1); border: 1px solid rgba(34,197,94,0.3);
  color: #4ade80; padding: 0.7rem 1rem; border-radius: 8px;
  margin-bottom: 1rem; font-size: 0.85rem;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .admin-sidebar { display: none; }
  .admin-main { margin-left: 0; }
  .admin-content { padding: 1rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
