/* ===================================================================
   SMS — application stylesheet
   Bootstrap 5 base + custom sidebar shell + dashboard theme
   =================================================================== */

:root {
  --sms-primary: #1d4ed8;
  --sms-primary-hover: #1e40af;
  --sms-accent: #0ea5a4;
  --sms-bg: #f4f6fb;
  --sms-card: #ffffff;
  --sms-text: #111827;
  --sms-muted: #6b7280;
  --sms-border: #e5e7eb;
  --sms-success: #16a34a;
  --sms-warning: #d97706;
  --sms-danger: #dc2626;
  --sms-info: #0ea5e9;
  --sms-sidebar-bg: #0f172a;
  --sms-sidebar-link: #cbd5e1;
  --sms-sidebar-link-hover: #ffffff;
  --sms-sidebar-active: #1d4ed8;
}

html[data-theme="dark"] {
  --sms-bg: #0b1220;
  --sms-card: #111827;
  --sms-text: #e5e7eb;
  --sms-muted: #94a3b8;
  --sms-border: #1f2937;
  --sms-sidebar-bg: #050912;
}

html, body { height: 100%; }
body {
  background: var(--sms-bg);
  color: var(--sms-text);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

a { color: var(--sms-primary); text-decoration: none; }
a:hover { color: var(--sms-primary-hover); text-decoration: underline; }

/* ---------- Login ---------- */
.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  background: linear-gradient(135deg, #1e3a8a 0%, #0ea5a4 100%);
}
.auth-card {
  background: #fff;
  border-radius: 14px;
  padding: 2.5rem 2.5rem 2rem;
  max-width: 420px;
  margin: 2rem auto;
  box-shadow: 0 20px 50px rgba(0,0,0,0.2);
}
.auth-brand {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--sms-primary);
  margin-bottom: .25rem;
}
.auth-sub { color: var(--sms-muted); margin-bottom: 1.5rem; }

/* ---------- App shell ---------- */
.app-shell {
  display: flex;
  align-items: stretch;
  min-height: 100vh;
}
.sidebar {
  flex: 0 0 260px;
  width: 260px;
  background: var(--sms-sidebar-bg);
  color: var(--sms-sidebar-link);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  overflow-y: auto;
}
.sidebar .brand {
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
  padding: 0 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; gap:.5rem;
}
.sidebar .nav-section {
  text-transform: uppercase;
  letter-spacing: .04em;
  font-size: .75rem;
  color: #64748b;
  padding: 1rem 1.25rem .35rem;
}
.sidebar a.nav-link {
  display: flex; align-items: center; gap:.75rem;
  color: var(--sms-sidebar-link);
  padding: .55rem 1.25rem;
  border-left: 3px solid transparent;
  font-size: .95rem;
}
.sidebar a.nav-link i { width: 18px; text-align: center; opacity: .9; }
.sidebar a.nav-link:hover {
  color: var(--sms-sidebar-link-hover);
  background: rgba(255,255,255,.04);
  text-decoration: none;
}
.sidebar a.nav-link.active {
  color: #fff;
  background: rgba(29,78,216,.18);
  border-left-color: var(--sms-sidebar-active);
}
.sidebar .sb-footer {
  border-top: 1px solid rgba(255,255,255,.08);
  padding: 1rem 1.25rem;
  font-size: .8rem;
  color: #64748b;
  margin-top: 2rem;
}

.main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.topbar {
  background: var(--sms-card);
  border-bottom: 1px solid var(--sms-border);
  padding: .65rem 1.25rem;
  display: flex; align-items: center; gap: 1rem;
  position: sticky; top: 0; z-index: 50;
}
.topbar .search { flex: 1; max-width: 520px; }
.content { padding: 1.5rem; }

.page-header {
  display: flex; flex-wrap: wrap; align-items: center; gap: .75rem;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
}
.page-sub { color: var(--sms-muted); font-size: .9rem; }

/* ---------- Cards ---------- */
.card {
  background: var(--sms-card);
  border: 1px solid var(--sms-border);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.stat-card {
  display: flex; align-items: center; gap: 1rem;
  padding: 1rem 1.25rem;
}
.stat-card .icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: grid; place-items: center;
  font-size: 1.25rem;
  color: #fff;
}
.stat-card .icon.bg-primary { background: var(--sms-primary); }
.stat-card .icon.bg-success { background: var(--sms-success); }
.stat-card .icon.bg-warning { background: var(--sms-warning); }
.stat-card .icon.bg-danger  { background: var(--sms-danger); }
.stat-card .icon.bg-info    { background: var(--sms-info); }
.stat-card .icon.bg-accent  { background: var(--sms-accent); }
.stat-card .label { color: var(--sms-muted); font-size: .85rem; margin: 0; }
.stat-card .value { font-size: 1.5rem; font-weight: 700; margin: 0; }

/* ---------- Tables ---------- */
.table-card { padding: 0; overflow: hidden; }
.table-card .table { margin: 0; }
.table > :not(caption) > * > * { padding: .65rem .9rem; }
.table thead { background: #f8fafc; }
html[data-theme="dark"] .table thead { background: #0b1220; }

/* ---------- Forms ---------- */
.form-section {
  background: var(--sms-card);
  border: 1px solid var(--sms-border);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
}
.form-section h5 {
  font-size: 1rem;
  margin-bottom: 1rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--sms-border);
  font-weight: 600;
}
.required::after { content: ' *'; color: var(--sms-danger); }

/* ---------- Badges ---------- */
.badge-soft {
  background: rgba(29,78,216,.10);
  color: var(--sms-primary);
  font-weight: 500;
}
.badge-soft-success { background: rgba(22,163,74,.12); color: var(--sms-success); }
.badge-soft-warning { background: rgba(217,119,6,.12); color: var(--sms-warning); }
.badge-soft-danger  { background: rgba(220,38,38,.12); color: var(--sms-danger); }

/* ---------- Mobile ---------- */
.btn-burger { display: none; }

/* Backdrop is only used on mobile; always keep it out of the grid flow. */
.sb-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 1040;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
  display: none;
}

@media (max-width: 992px) {
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 260px; transform: translateX(-100%);
    transition: transform .25s ease;
    z-index: 1050;
  }
  .sidebar.open { transform: translateX(0); }
  .btn-burger { display: inline-flex; }
  .sb-backdrop { display: block; }
  .sb-backdrop.show { opacity: 1; pointer-events: auto; }
}

/* ---------- Print: receipts and reports ---------- */
@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .app-shell { grid-template-columns: 1fr; }
  .content { padding: 0; }
  body { background: #fff; }
  .card { box-shadow: none; border: 0; }
}

/* ---------- Misc ---------- */
.empty-state {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--sms-muted);
}
.empty-state .icon {
  font-size: 2.5rem;
  color: #cbd5e1;
  margin-bottom: .5rem;
}

.tag-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 999px;
  margin-right: .35rem; vertical-align: middle;
}
.tag-dot.green { background: var(--sms-success); }
.tag-dot.red   { background: var(--sms-danger); }
.tag-dot.amber { background: var(--sms-warning); }
