/* Font loaded via <link> in header.php for reliability */

:root {
  --bg-base: #f0f2f5;
  --bg-card: #ffffff;
  --sidebar-bg: #ffffff;
  --accent-primary: #4f46e5;
  --accent-secondary: #10b981;
  --accent-warning: #f59e0b;
  --accent-danger: #ef4444;
  --accent-blue: #3b82f6;
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --border: #e5e7eb;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-hover: 0 8px 24px rgba(0,0,0,0.12);
}

* { box-sizing: border-box; }

body {
  background: var(--bg-base);
  font-family: 'Inter', sans-serif;
  color: var(--text-primary);
  min-height: 100vh;
  font-size: 14px;
}

/* ── Navbar ── */
.navbar {
  background: #ffffff !important;
  border-bottom: 1px solid var(--border);
  padding: 0.65rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 1050;
  box-shadow: var(--shadow);
}

.navbar-brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--accent-primary) !important;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.navbar .admin-name {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.navbar .btn-logout {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-base);
  border: 1px solid var(--border);
  padding: 0.35rem 0.85rem;
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.15s;
}
.navbar .btn-logout:hover {
  background: var(--accent-danger);
  border-color: var(--accent-danger);
  color: #fff;
}

.navbar .btn-outline-light {
  border-color: var(--border);
  color: var(--text-secondary);
  background: var(--bg-base);
}

/* ── Sidebar ── */
#sidebar {
  min-height: calc(100vh - 56px);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding-top: 0.75rem;
}

#sidebar .nav-link {
  color: var(--text-secondary);
  padding: 9px 14px;
  border-radius: 8px;
  margin: 1px 8px;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 10px;
}

#sidebar .nav-link:hover {
  background: #f3f4f6;
  color: var(--text-primary);
}

#sidebar .nav-link.active {
  background: #eef2ff;
  color: var(--accent-primary);
  font-weight: 600;
}

#sidebar .nav-link i {
  font-size: 1rem;
  width: 18px;
  text-align: center;
  opacity: 0.85;
}

.sidebar-section-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0.5rem 22px 0.25rem;
  margin-top: 0.5rem;
}

/* ── Main ── */
main { background: var(--bg-base); }

/* ── Page Header ── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.page-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: -0.02em;
}
.page-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 20px;
  padding: 0.3rem 0.75rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: #059669;
}

.live-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #10b981;
  animation: pulseDot 2s infinite;
}

.clock-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ── Section Label ── */
.section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-muted);
  margin-bottom: 0.85rem;
}

/* ── Metric Cards ── */
.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.35rem 1.4rem;
  position: relative;
  overflow: hidden;
  transition: all 0.2s ease;
  box-shadow: var(--shadow);
}

.metric-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
  border-color: #d1d5db;
}

.metric-card .card-icon {
  width: 42px; height: 42px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.15rem;
  margin-bottom: 0.9rem;
}

.metric-card .card-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

.metric-card .card-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
  margin-bottom: 0.45rem;
  letter-spacing: -0.02em;
}

.metric-card .card-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Icon bg variants */
.ic-indigo { background: #eef2ff; color: #4f46e5; }
.ic-amber  { background: #fffbeb; color: #d97706; }
.ic-green  { background: #ecfdf5; color: #059669; }
.ic-blue   { background: #eff6ff; color: #2563eb; }
.ic-pink   { background: #fdf2f8; color: #db2777; }
.ic-teal   { background: #f0fdfa; color: #0d9488; }

/* Special card variants */
.mc-profit {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  border-color: transparent;
  color: #fff;
}
.mc-profit .card-label { color: rgba(255,255,255,0.7); }
.mc-profit .card-value { color: #fff; }
.mc-profit .card-sub   { color: rgba(255,255,255,0.65); }
.mc-profit .card-icon  { background: rgba(255,255,255,0.2); color: #fff; }
.mc-profit:hover { border-color: transparent; }

.mc-wallet {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  border-color: transparent;
  color: #fff;
}
.mc-wallet .card-label { color: rgba(255,255,255,0.7); }
.mc-wallet .card-value { color: #fff; }
.mc-wallet .card-sub   { color: rgba(255,255,255,0.65); }
.mc-wallet .card-icon  { background: rgba(255,255,255,0.2); color: #fff; }
.mc-wallet:hover { border-color: transparent; }

/* ── Chart Cards ── */
.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.chart-card-header {
  padding: 1.1rem 1.4rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chart-card-header h5 {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.chart-card-header .header-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.chart-card-body { padding: 1.25rem 1.4rem; }

/* ── Data Cards ── */
.data-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.data-card-header {
  padding: 1.1rem 1.4rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}

.data-card-header h5 {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

/* ── List Group ── */
.list-group-flush .list-group-item {
  background: transparent;
  border-color: var(--border);
  color: var(--text-primary);
  padding: 0.85rem 1.4rem;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 0.875rem;
  transition: background 0.15s;
}
.list-group-flush .list-group-item:hover { background: #f9fafb; }

.rank-num {
  width: 22px; height: 22px;
  border-radius: 6px;
  background: #eef2ff;
  color: #4f46e5;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.68rem; font-weight: 700;
  margin-right: 10px;
  flex-shrink: 0;
}

.sold-badge {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
  border-radius: 6px;
  font-size: 0.72rem; font-weight: 600;
  padding: 0.25em 0.6em;
}

/* ── Table ── */
.table { color: var(--text-primary); margin: 0; font-size: 0.85rem; }
.table thead th {
  background: #f9fafb;
  color: var(--text-muted);
  font-size: 0.71rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1.4rem;
}
.table tbody td {
  border-bottom: 1px solid var(--border);
  padding: 0.8rem 1.4rem;
  vertical-align: middle;
  color: var(--text-primary);
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: #f9fafb; }
.table a { color: var(--accent-primary); text-decoration: none; font-weight: 500; }
.table a:hover { color: #3730a3; }

/* ── Status Badges ── */
.badge-status {
  display: inline-block;
  border-radius: 6px;
  font-size: 0.7rem; font-weight: 600;
  padding: 0.28em 0.65em;
  border: 1px solid transparent;
}
.bs-pending   { background: #fffbeb; color: #b45309; border-color: #fcd34d; }
.bs-confirmed { background: #eff6ff; color: #1d4ed8; border-color: #93c5fd; }
.bs-packaging { background: #f5f3ff; color: #6d28d9; border-color: #c4b5fd; }
.bs-shipping  { background: #ecfeff; color: #0e7490; border-color: #67e8f9; }
.bs-delivered { background: #ecfdf5; color: #065f46; border-color: #6ee7b7; }
.bs-cancelled { background: #fef2f2; color: #991b1b; border-color: #fca5a5; }

/* ── View All button ── */
.btn-view-all {
  font-size: 0.75rem; font-weight: 600;
  color: var(--accent-primary);
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  padding: 0.3rem 0.8rem;
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.15s;
}
.btn-view-all:hover {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
}

/* ── Animations ── */
@keyframes pulseDot {
  0%   { box-shadow: 0 0 0 0 rgba(16,185,129,0.4); }
  70%  { box-shadow: 0 0 0 7px rgba(16,185,129,0); }
  100% { box-shadow: 0 0 0 0 rgba(16,185,129,0); }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.metric-card { animation: fadeUp 0.4s ease both; }
.metric-card:nth-child(1) { animation-delay: 0.04s; }
.metric-card:nth-child(2) { animation-delay: 0.08s; }
.metric-card:nth-child(3) { animation-delay: 0.12s; }
.metric-card:nth-child(4) { animation-delay: 0.16s; }
.metric-card:nth-child(5) { animation-delay: 0.20s; }
.metric-card:nth-child(6) { animation-delay: 0.24s; }

.chart-card, .data-card { animation: fadeUp 0.5s ease both; animation-delay: 0.2s; }

/* ── Mobile ── */
@media (max-width: 767.98px) {
  #sidebar {
    display: none;
    position: fixed;
    z-index: 1000;
    width: 260px;
    top: 56px; left: 0; bottom: 0;
    overflow-y: auto;
    box-shadow: 4px 0 20px rgba(0,0,0,0.1);
  }
  #sidebar.show { display: block; }
}

/* ── Bootstrap overrides — ensure our styles win ── */
body { background-color: var(--bg-base) !important; font-family: 'Inter', sans-serif !important; }

.navbar { background-color: #ffffff !important; }

/* Card resets — Bootstrap .card conflicts */
.metric-card, .chart-card, .data-card {
  background-color: #ffffff !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 14px !important;
}
.mc-profit {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%) !important;
  border-color: transparent !important;
}
.mc-wallet {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%) !important;
  border-color: transparent !important;
}

/* Ensure metric card text colors */
.metric-card .card-label { color: #9ca3af !important; }
.metric-card .card-value { color: #111827 !important; }
.mc-profit .card-label, .mc-profit .card-value, .mc-profit .card-sub { color: #fff !important; }
.mc-wallet .card-label, .mc-wallet .card-value, .mc-wallet .card-sub { color: #fff !important; }

/* Sidebar */
#sidebar { background-color: #ffffff !important; border-right: 1px solid #e5e7eb !important; }
#sidebar .nav-link { color: #6b7280 !important; }
#sidebar .nav-link.active { background-color: #eef2ff !important; color: #4f46e5 !important; }
#sidebar .nav-link:hover { background-color: #f3f4f6 !important; color: #111827 !important; }

/* Table */
.table { --bs-table-bg: transparent; --bs-table-hover-bg: #f9fafb; }
.table thead th { background-color: #f9fafb !important; color: #9ca3af !important; border-bottom: 1px solid #e5e7eb !important; }
.table tbody td { color: #111827 !important; border-bottom: 1px solid #e5e7eb !important; }

/* List group */
.list-group-item { background-color: transparent !important; border-color: #e5e7eb !important; color: #111827 !important; }

/* Main content area background */
main, .col-md-9, .col-lg-10 { background-color: var(--bg-base) !important; }
