/* ═══════════════════════════════════════════
   BALAJI CREATION — Admin Dashboard CSS
   Slate & Gold Theme
═══════════════════════════════════════════ */

:root {
  --bg:         #1C2333;
  --bg-dark:    #141924;
  --bg-card:    #252D40;
  --bg-hover:   #2C3650;
  --gold:       #D4AF6A;
  --gold-light: #E8CC8F;
  --gold-dark:  #9B8040;
  --text:       #EEE8DA;
  --text-muted: #A8B2C4;
  --text-dim:   #6A7490;
  --border:     rgba(212,175,106,0.15);
  --border-mid: rgba(212,175,106,0.3);
  --green:      #6fcf97;
  --red:        #e05c5c;
  --blue:       #5dade2;
  --orange:     #f0a500;
  --purple:     #bb8fce;
  --radius:     8px;
  --radius-lg:  14px;
  --radius-xl:  20px;
  --font-display: 'Cormorant Garamond', serif;
  --font-body:    'Jost', sans-serif;
  --sidebar-w:  260px;
  --topbar-h:   64px;
  --transition: 0.3s cubic-bezier(0.4,0,0.2,1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--font-body); background: var(--bg-dark); color: var(--text); overflow-x: hidden; line-height: 1.6; }
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
input, select, textarea { font-family: inherit; }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--gold-dark); border-radius: 3px; }

/* ── LAYOUT ── */
.admin-layout { display: flex; min-height: 100vh; }
.admin-main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-height: 100vh; transition: margin-left var(--transition); }
.admin-content { flex: 1; padding: 28px 32px 60px; }

/* ═══════════════════════════════════════════
   SIDEBAR
═══════════════════════════════════════════ */
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar-w);
  background: var(--bg-card); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; z-index: 200; overflow-y: auto;
  transition: transform var(--transition);
}
.sidebar-logo {
  padding: 24px 24px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.logo-mark {
  width: 38px; height: 38px; border-radius: var(--radius);
  background: linear-gradient(135deg, var(--gold-dark), var(--gold));
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; color: var(--bg-dark); flex-shrink: 0;
  font-family: var(--font-display);
}
.logo-info { min-width: 0; }
.logo-brand { font-size: 13px; font-weight: 600; letter-spacing: 2px; color: var(--gold); text-transform: uppercase; }
.logo-sub { font-size: 10px; color: var(--text-dim); letter-spacing: 1px; }

.sidebar-section { padding: 20px 16px 8px; }
.sidebar-section-label { font-size: 10px; letter-spacing: 3px; color: var(--text-dim); text-transform: uppercase; padding: 0 8px; margin-bottom: 6px; }

.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: var(--radius-lg);
  font-size: 13px; color: var(--text-muted); cursor: pointer; transition: var(--transition);
  position: relative; white-space: nowrap;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.active { background: rgba(212,175,106,0.12); color: var(--gold); border: 1px solid rgba(212,175,106,0.2); }
.nav-icon { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.7; }
.nav-item.active .nav-icon { opacity: 1; }
.nav-badge {
  margin-left: auto; font-size: 10px; min-width: 20px; height: 20px; border-radius: 10px;
  background: var(--gold); color: var(--bg-dark); font-weight: 700;
  display: flex; align-items: center; justify-content: center; padding: 0 5px;
}
.nav-badge.red { background: var(--red); color: #fff; }

.sidebar-footer { margin-top: auto; padding: 16px; border-top: 1px solid var(--border); }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--radius-lg); background: var(--bg); }
.sidebar-user-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--gold-dark); color: var(--bg-dark); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex-shrink: 0; font-family: var(--font-display); }
.sidebar-user-name { font-size: 13px; font-weight: 500; color: var(--text); }
.sidebar-user-role { font-size: 10px; color: var(--gold); letter-spacing: 1px; }
.sidebar-signout { margin-left: auto; font-size: 12px; color: var(--text-dim); cursor: pointer; transition: color var(--transition); }
.sidebar-signout:hover { color: var(--red); }

/* Sidebar overlay (mobile) */
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 199; }

/* ═══════════════════════════════════════════
   TOPBAR
═══════════════════════════════════════════ */
.topbar {
  height: var(--topbar-h); background: var(--bg-card); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px; position: sticky; top: 0; z-index: 100;
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-hamburger { display: none; flex-direction: column; gap: 4px; padding: 8px; border-radius: var(--radius); }
.topbar-hamburger span { display: block; width: 18px; height: 1.5px; background: var(--text-muted); transition: var(--transition); }
.topbar-page-title { font-size: 16px; font-weight: 500; color: var(--text); }
.topbar-breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-dim); }
.topbar-breadcrumb a { transition: color var(--transition); }
.topbar-breadcrumb a:hover { color: var(--gold); }
.topbar-breadcrumb-sep { font-size: 10px; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.topbar-btn {
  width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); transition: var(--transition); position: relative; background: none; border: none;
}
.topbar-btn:hover { background: var(--bg-hover); color: var(--gold); }
.topbar-notif-dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); border: 2px solid var(--bg-card); }
.topbar-store-btn {
  display: flex; align-items: center; gap: 7px; padding: 8px 16px; border-radius: var(--radius);
  border: 1px solid var(--border); color: var(--text-muted); font-size: 12px; letter-spacing: 1px;
  transition: var(--transition);
}
.topbar-store-btn:hover { border-color: var(--gold); color: var(--gold); }

/* ═══════════════════════════════════════════
   PAGE HEADER
═══════════════════════════════════════════ */
.page-header { margin-bottom: 28px; display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.page-header-left { }
.page-tag { font-size: 10px; letter-spacing: 3px; color: var(--gold); text-transform: uppercase; margin-bottom: 6px; }
.page-title { font-family: var(--font-display); font-size: 38px; font-weight: 300; color: var(--text); line-height: 1; }
.page-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 6px; }
.page-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ═══════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════ */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 22px; border-radius: 2px; font-size: 12px; font-weight: 600; letter-spacing: 1.5px; text-transform: uppercase; transition: var(--transition); cursor: pointer; border: none; font-family: var(--font-body); }
.btn-gold { background: var(--gold); color: var(--bg-dark); }
.btn-gold:hover { background: var(--gold-light); }
.btn-ghost { background: none; border: 1px solid var(--border-mid); color: var(--text-muted); }
.btn-ghost:hover { border-color: var(--gold); color: var(--gold); }
.btn-danger { background: none; border: 1px solid rgba(224,92,92,0.4); color: var(--red); }
.btn-danger:hover { background: rgba(224,92,92,0.08); }
.btn-sm { padding: 7px 14px; font-size: 11px; }
.btn-icon { width: 36px; height: 36px; padding: 0; justify-content: center; border-radius: var(--radius); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ═══════════════════════════════════════════
   STAT CARDS
═══════════════════════════════════════════ */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 28px; }
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-xl);
  padding: 24px; transition: var(--transition); position: relative; overflow: hidden;
}
.stat-card:hover { border-color: var(--border-mid); transform: translateY(-2px); }
.stat-card-accent { position: absolute; top: 0; left: 0; right: 0; height: 3px; }
.stat-card-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; }
.stat-card-icon { width: 42px; height: 42px; border-radius: var(--radius-lg); display: flex; align-items: center; justify-content: center; font-size: 18px; }
.stat-card-trend { display: flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 500; padding: 4px 8px; border-radius: 20px; }
.trend-up { color: var(--green); background: rgba(111,207,151,0.1); }
.trend-down { color: var(--red); background: rgba(224,92,92,0.1); }
.trend-flat { color: var(--text-dim); background: rgba(106,116,144,0.1); }
.stat-card-value { font-family: var(--font-display); font-size: 36px; font-weight: 300; color: var(--text); line-height: 1; margin-bottom: 6px; }
.stat-card-label { font-size: 12px; color: var(--text-dim); letter-spacing: 1px; }
.stat-card-sub { font-size: 11px; color: var(--text-dim); margin-top: 8px; }

/* ═══════════════════════════════════════════
   TABLES
═══════════════════════════════════════════ */
.table-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-xl); overflow: hidden; }
.table-card-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--border); flex-wrap: wrap; gap: 12px; }
.table-card-title { font-size: 14px; font-weight: 500; color: var(--text); letter-spacing: 0.5px; }
.table-card-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 12px 16px; text-align: left; font-size: 10px; letter-spacing: 2px; color: var(--text-dim); text-transform: uppercase; font-weight: 500; border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table td { padding: 14px 16px; font-size: 13px; color: var(--text-muted); border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background var(--transition); }
.data-table tbody tr:hover { background: var(--bg-hover); }
.data-table tbody tr.selected { background: rgba(212,175,106,0.05); }
.table-wrap { overflow-x: auto; }

/* ═══════════════════════════════════════════
   SEARCH & FILTERS
═══════════════════════════════════════════ */
.search-bar {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 0 14px; min-width: 240px; transition: border-color var(--transition);
}
.search-bar:focus-within { border-color: var(--gold); }
.search-input { flex: 1; padding: 9px 0; background: none; border: none; color: var(--text); font-size: 13px; outline: none; }
.search-input::placeholder { color: var(--text-dim); }
.filter-select {
  padding: 9px 32px 9px 12px; border-radius: var(--radius);
  background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'%3E%3Cpath fill='%23A8B2C4' d='M6 8L1 3h10z'/%3E%3C/svg%3E") no-repeat right 10px center;
  border: 1px solid var(--border); color: var(--text-muted); font-size: 12px;
  outline: none; cursor: pointer; transition: border-color var(--transition); appearance: none;
}
.filter-select:focus { border-color: var(--gold); }
.filter-select option { background: var(--bg-card); }

/* ═══════════════════════════════════════════
   FORM ELEMENTS
═══════════════════════════════════════════ */
.form-group { display: flex; flex-direction: column; gap: 8px; }
.form-label { font-size: 11px; letter-spacing: 2px; color: var(--text-dim); text-transform: uppercase; font-weight: 500; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 12px 14px; background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); font-family: var(--font-body); font-size: 14px;
  outline: none; transition: border-color var(--transition);
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--gold); }
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-dim); }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'%3E%3Cpath fill='%23A8B2C4' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; background-color: var(--bg); }
.form-select option { background: var(--bg-card); }
.form-textarea { resize: vertical; min-height: 100px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid.thirds { grid-template-columns: 1fr 1fr 1fr; }
.form-grid.full { grid-template-columns: 1fr; }
.form-hint { font-size: 11px; color: var(--text-dim); }
.form-error-msg { font-size: 12px; color: var(--red); margin-top: 4px; display: none; }
.form-error-msg.visible { display: block; }

/* ═══════════════════════════════════════════
   STATUS BADGES
═══════════════════════════════════════════ */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 500; letter-spacing: 0.5px; }
.badge-dot { width: 5px; height: 5px; border-radius: 50%; }
.badge-pending   { background: rgba(212,175,106,0.12); color: var(--gold); }
.badge-pending .badge-dot   { background: var(--gold); }
.badge-confirmed { background: rgba(93,173,226,0.12); color: var(--blue); }
.badge-confirmed .badge-dot { background: var(--blue); }
.badge-packed    { background: rgba(187,143,206,0.12); color: var(--purple); }
.badge-packed .badge-dot    { background: var(--purple); }
.badge-shipped   { background: rgba(240,165,0,0.12); color: var(--orange); }
.badge-shipped .badge-dot   { background: var(--orange); }
.badge-delivered { background: rgba(111,207,151,0.12); color: var(--green); }
.badge-delivered .badge-dot { background: var(--green); }
.badge-cancelled { background: rgba(224,92,92,0.12); color: var(--red); }
.badge-cancelled .badge-dot { background: var(--red); }
.badge-low       { background: rgba(240,165,0,0.12); color: var(--orange); }
.badge-out       { background: rgba(224,92,92,0.12); color: var(--red); }
.badge-active    { background: rgba(111,207,151,0.12); color: var(--green); }
.badge-inactive  { background: rgba(106,116,144,0.12); color: var(--text-dim); }

/* ═══════════════════════════════════════════
   MODAL
═══════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.75); z-index: 500;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  opacity: 0; pointer-events: none; transition: opacity var(--transition);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-xl);
  width: 100%; max-width: 580px; max-height: 90vh; overflow-y: auto;
  transform: scale(0.95) translateY(20px); transition: transform var(--transition);
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }
.modal-lg { max-width: 800px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 24px 28px; border-bottom: 1px solid var(--border); }
.modal-title { font-family: var(--font-display); font-size: 26px; font-weight: 300; color: var(--text); }
.modal-close { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--text-muted); cursor: pointer; transition: var(--transition); font-size: 16px; }
.modal-close:hover { background: var(--bg-hover); color: var(--red); }
.modal-body { padding: 28px; display: flex; flex-direction: column; gap: 20px; }
.modal-footer { padding: 20px 28px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 12px; }

/* ═══════════════════════════════════════════
   TOAST
═══════════════════════════════════════════ */
.toast {
  position: fixed; bottom: 28px; right: 28px;
  background: var(--bg-card); border: 1px solid var(--border-mid);
  color: var(--text); font-size: 13px; padding: 12px 20px;
  border-radius: var(--radius); z-index: 2000; opacity: 0;
  transform: translateY(12px); transition: all 0.3s ease; pointer-events: none;
  display: flex; align-items: center; gap: 10px; max-width: 360px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { border-color: rgba(111,207,151,0.4); }
.toast.error { border-color: rgba(224,92,92,0.4); }

/* ═══════════════════════════════════════════
   CHART AREA
═══════════════════════════════════════════ */
.chart-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 24px; }
.chart-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.chart-title { font-size: 14px; font-weight: 500; color: var(--text); }
.chart-legend { display: flex; gap: 16px; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-muted); }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; }
.mini-chart { display: flex; align-items: flex-end; gap: 6px; height: 80px; }
.mini-bar { flex: 1; border-radius: 3px 3px 0 0; min-width: 8px; transition: opacity var(--transition); cursor: pointer; position: relative; }
.mini-bar:hover { opacity: 0.8; }
.mini-bar-tooltip { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); background: var(--bg-dark); border: 1px solid var(--border); padding: 4px 8px; border-radius: 4px; font-size: 11px; color: var(--text); white-space: nowrap; margin-bottom: 4px; opacity: 0; pointer-events: none; transition: opacity 0.2s; }
.mini-bar:hover .mini-bar-tooltip { opacity: 1; }

/* Sparkline */
.sparkline-wrap { height: 48px; position: relative; }
.sparkline-svg { width: 100%; height: 100%; }

/* ═══════════════════════════════════════════
   MISC COMPONENTS
═══════════════════════════════════════════ */
.divider { height: 1px; background: var(--border); }
.tag { display: inline-block; font-size: 10px; padding: 3px 8px; border-radius: 4px; letter-spacing: 1px; }
.avatar { border-radius: 50%; background: var(--gold-dark); color: var(--bg-dark); display: flex; align-items: center; justify-content: center; font-weight: 700; font-family: var(--font-display); flex-shrink: 0; }
.checkbox-wrap { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.checkbox-wrap input[type="checkbox"] { display: none; }
.checkbox-box { width: 16px; height: 16px; border-radius: 4px; border: 1.5px solid var(--border-mid); background: var(--bg); display: flex; align-items: center; justify-content: center; transition: var(--transition); flex-shrink: 0; }
.checkbox-wrap input:checked ~ .checkbox-box { background: var(--gold); border-color: var(--gold); }
.checkbox-wrap input:checked ~ .checkbox-box::after { content: '✓'; font-size: 10px; color: var(--bg-dark); font-weight: 700; }
.toggle { width: 40px; height: 22px; border-radius: 11px; background: var(--bg); border: 1px solid var(--border); position: relative; cursor: pointer; transition: var(--transition); }
.toggle.on { background: var(--gold); border-color: var(--gold); }
.toggle::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--text-dim); transition: var(--transition); }
.toggle.on::after { left: 20px; background: var(--bg-dark); }
.empty-row td { text-align: center; padding: 48px 16px; color: var(--text-dim); font-size: 14px; }

/* ═══════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════ */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid.thirds { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.visible { display: block; }
  .admin-main { margin-left: 0; }
  .topbar-hamburger { display: flex; }
  .admin-content { padding: 20px 16px 40px; }
}
@media (max-width: 600px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat-card-value { font-size: 28px; }
  .form-grid { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; }
  .table-card-header { flex-direction: column; align-items: flex-start; }
}
