/* ============================================================
   Billboard Management System — Shared Design System
   Version 1.0 | shared.css
   Import this file into every module page
   ============================================================ */

html { scroll-behavior: smooth; }
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --font-sans: 'DM Sans', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --color-background-primary:   #ffffff;
  --color-background-secondary: #f5f5f3;
  --color-background-tertiary:  #eeede9;
  --color-background-info:      #E6F1FB;
  --color-background-success:   #E1F5EE;
  --color-background-danger:    #FCEBEB;
  --color-background-warning:   #FAEEDA;

  --color-text-primary:   #1a1a1a;
  --color-text-secondary: #6b6b6b;
  --color-text-tertiary:  #9a9a9a;
  --color-text-info:      #185FA5;
  --color-text-success:   #0F6E56;
  --color-text-danger:    #A32D2D;
  --color-text-warning:   #633806;

  --color-border-tertiary:  rgba(0,0,0,0.12);
  --color-border-secondary: rgba(0,0,0,0.22);
  --color-border-primary:   rgba(0,0,0,0.35);
  --color-border-info:      rgba(24,95,165,0.4);
  --color-border-success:   rgba(15,110,86,0.4);
  --color-border-danger:    rgba(163,45,45,0.4);
  --color-border-warning:   rgba(99,56,6,0.4);

  --border-radius-sm: 4px;
  --border-radius-md: 8px;
  --border-radius-lg: 12px;
  --border-radius-xl: 16px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-background-primary:   #1e1e1e;
    --color-background-secondary: #2a2a2a;
    --color-background-tertiary:  #111111;
    --color-background-info:      #0c2a45;
    --color-background-success:   #063424;
    --color-background-danger:    #3b1212;
    --color-background-warning:   #3a2000;

    --color-text-primary:   #e8e8e8;
    --color-text-secondary: #9a9a9a;
    --color-text-tertiary:  #666666;
    --color-text-info:      #85B7EB;
    --color-text-success:   #5DCAA5;
    --color-text-danger:    #F09595;
    --color-text-warning:   #FAC775;

    --color-border-tertiary:  rgba(255,255,255,0.10);
    --color-border-secondary: rgba(255,255,255,0.20);
    --color-border-primary:   rgba(255,255,255,0.32);
    --color-border-info:      rgba(133,183,235,0.35);
    --color-border-success:   rgba(93,202,165,0.35);
    --color-border-danger:    rgba(240,149,149,0.35);
    --color-border-warning:   rgba(250,199,117,0.35);
  }
}

body {
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--color-text-primary);
  background: var(--color-background-tertiary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ─────────────────────────────────────────────── */
.portal-shell {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  background: var(--color-background-primary);
  border-right: 0.5px solid var(--color-border-tertiary);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.main-content {
  padding: 1.5rem;
  overflow: hidden;
}

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--color-background-primary);
  border: 0.5px solid var(--color-border-tertiary);
  border-radius: var(--border-radius-lg);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}
.card:last-child { margin-bottom: 0; }
.card-title {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.two-col {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(0,1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}
.four-col {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 8px;
  margin-bottom: 1.25rem;
}

/* ── Stat cards ──────────────────────────────────────────── */
.stat-card {
  background: var(--color-background-primary);
  border: 0.5px solid var(--color-border-tertiary);
  border-radius: var(--border-radius-md);
  padding: 10px 12px;
}
.stat-number { font-size: 20px; font-weight: 500; margin-bottom: 2px; }
.stat-label  { font-size: 11px; color: var(--color-text-secondary); }

/* ── Nav ────────────────────────────────────────────────── */
.nav-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--color-text-secondary);
  letter-spacing: 0.06em;
  padding: 8px 1rem 3px;
  text-transform: uppercase;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 1rem;
  cursor: pointer;
  font-size: 12px;
  color: var(--color-text-secondary);
  border-left: 2px solid transparent;
  text-decoration: none;
  transition: all 0.12s;
}
.nav-item:hover { color: var(--color-text-primary); background: var(--color-background-secondary); }
.nav-item.active { border-left-color: currentColor; background: var(--color-background-secondary); font-weight: 500; }
.nav-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.nav-badge {
  font-size: 10px; padding: 1px 6px; border-radius: 10px;
  background: #E24B4A; color: #fff; margin-left: auto;
}

/* ── Badges ─────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 500;
}
.badge-purple { background: #EEEDFE; color: #3C3489; }
.badge-blue   { background: #E6F1FB; color: #0C447C; }
.badge-teal   { background: #E1F5EE; color: #085041; }
.badge-amber  { background: #FAEEDA; color: #633806; }
.badge-red    { background: #FCEBEB; color: #791F1F; }
.badge-coral  { background: #FAECE7; color: #712B13; }
.badge-green  { background: #EAF3DE; color: #27500A; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  font-size: 12px; padding: 5px 12px; cursor: pointer;
  border-radius: var(--border-radius-md);
  border: 0.5px solid var(--color-border-secondary);
  background: transparent; color: var(--color-text-primary);
  transition: background 0.12s, transform 0.1s;
  text-decoration: none; display: inline-block;
}
.btn:hover   { background: var(--color-background-secondary); }
.btn:active  { transform: scale(0.98); }
.btn-sm      { font-size: 11px; padding: 4px 10px; }
.btn-primary { background: #26215C; color: #fff; border-color: #26215C; }
.btn-primary:hover { background: #3C3489; }
.btn-danger  { color: #A32D2D; border-color: #A32D2D; }
.btn-danger:hover { background: #FCEBEB; }

/* ── Form fields ─────────────────────────────────────────── */
.field { margin-bottom: 8px; }
.field label { display: block; font-size: 11px; color: var(--color-text-secondary); margin-bottom: 3px; }
.field input, .field select, .field textarea {
  width: 100%; font-size: 12px; padding: 6px 10px;
  border: 0.5px solid var(--color-border-secondary);
  border-radius: var(--border-radius-md);
  background: var(--color-background-primary);
  color: var(--color-text-primary);
  outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus {
  box-shadow: 0 0 0 2px var(--color-border-info);
}
.field textarea { resize: vertical; min-height: 70px; }
.fg2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fg3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.fg4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 8px; }

/* ── Table ───────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 12px; }
.data-table th {
  text-align: left; padding: 7px 10px; font-size: 11px; font-weight: 500;
  color: var(--color-text-secondary); border-bottom: 0.5px solid var(--color-border-tertiary);
}
.data-table td { padding: 7px 10px; border-bottom: 0.5px solid var(--color-border-tertiary); vertical-align: middle; }
.data-table tr:last-child td { border: none; }
.data-table tr:hover td { background: var(--color-background-secondary); }

/* ── Toggle ─────────────────────────────────────────────── */
.toggle { position: relative; width: 30px; height: 17px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.tsl { position: absolute; inset: 0; border-radius: 9px; background: var(--color-border-secondary); cursor: pointer; transition: 0.2s; }
.tsl:before { content: ""; position: absolute; width: 11px; height: 11px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: 0.2s; }
input:checked + .tsl { background: #534AB7; }
input:checked + .tsl:before { transform: translateX(13px); }

/* ── Row dividers ────────────────────────────────────────── */
.divider-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 0; border-bottom: 0.5px solid var(--color-border-tertiary);
  font-size: 12px; gap: 8px;
}
.divider-row:last-child { border: none; }

/* ── Alerts ─────────────────────────────────────────────── */
.alert { border-radius: var(--border-radius-md); padding: 8px 12px; font-size: 12px; margin-bottom: 1rem; }
.alert-warning { background: #FAEEDA; color: #633806; }
.alert-success { background: #E1F5EE; color: #085041; }
.alert-danger  { background: #FCEBEB; color: #791F1F; }
.alert-info    { background: #E6F1FB; color: #0C447C; }

/* ── Page header ─────────────────────────────────────────── */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.25rem;
}
.page-title { font-size: 16px; font-weight: 500; }

/* ── Utility ─────────────────────────────────────────────── */
.text-muted    { color: var(--color-text-secondary); }
.text-sm       { font-size: 11px; }
.font-medium   { font-weight: 500; }
.text-success  { color: #0F6E56; }
.text-danger   { color: #E24B4A; }
.text-warning  { color: #854F0B; }
.text-info     { color: #185FA5; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.gap-1 { gap: 6px; }
.gap-2 { gap: 12px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; }


/* ── Print styles ── */
@media print {
  .sidebar, .topbar, .btn, button { display: none !important; }
  body { background: #fff !important; }
  .card { border: 1px solid #ccc !important; box-shadow: none !important; }
  table { font-size: 10px !important; }
  section { display: block !important; }
}

/* ── Accessibility ── */
:focus-visible {
  outline: 2px solid #534AB7;
  outline-offset: 2px;
  border-radius: 4px;
}


/* ── Skeleton loader ── */
.skeleton {
  background: linear-gradient(90deg, var(--color-background-secondary) 25%, var(--color-background-tertiary) 50%, var(--color-background-secondary) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: 4px;
}
@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}


/* ── Scrollbar styling ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--color-background-secondary); }
::-webkit-scrollbar-thumb { background: var(--color-border-secondary); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--color-border-primary); }
