/* ============================================================
   Trackier Admin CSS – Blue/Dark Navy Theme
   ============================================================ */

:root {
  --sidebar-w:        240px;
  --sidebar-bg:       #0f172a;
  --sidebar-text:     rgba(255,255,255,.65);
  --sidebar-active:   #2563eb;
  --topbar-h:         56px;
  --topbar-bg:        #ffffff;
  --primary:          #2563eb;
  --primary-dark:     #1d4ed8;
  --success:          #16a34a;
  --warning:          #d97706;
  --danger:           #dc2626;
  --body-bg:          #f1f5f9;
  --card-bg:          #ffffff;
  --border:           #e2e8f0;
  --text:             #0f172a;
  --text-muted:       #64748b;
  --font:             'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  font-family: var(--font);
  font-size: 14px;
  background: var(--body-bg);
  color: var(--text);
}

/* ── Sidebar ──────────────────────────────────────────────── */
#wrapper { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 1000;
  transition: width .25s ease, transform .25s ease;
  overflow: hidden;
}
.sidebar.collapsed { width: 64px; }
.sidebar.collapsed .nav-text,
.sidebar.collapsed .nav-section,
.sidebar.collapsed .user-details,
.sidebar.collapsed .sidebar-brand span { display: none; }
.sidebar.collapsed .sidebar-brand { justify-content: center; }
.sidebar.collapsed .user-info { justify-content: center; }
.sidebar.collapsed .nav-link { justify-content: center; padding: .6rem; }

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  color: #fff;
  text-decoration: none;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -.3px;
}
.sidebar-brand i { font-size: 1.4rem; color: var(--primary); flex-shrink: 0; }

.sidebar-menu {
  flex: 1;
  overflow-y: auto;
  padding: .5rem 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.1) transparent;
}

.nav-section {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .1em;
  color: rgba(255,255,255,.3);
  padding: 1rem 1rem .25rem;
  text-transform: uppercase;
  white-space: nowrap;
}

.sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .55rem 1rem;
  margin: 1px .5rem;
  border-radius: 7px;
  color: var(--sidebar-text);
  font-size: .83rem;
  font-weight: 500;
  transition: all .15s;
  white-space: nowrap;
  text-decoration: none;
}
.sidebar .nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar .nav-link.active { background: var(--sidebar-active); color: #fff; }
.sidebar .nav-icon { font-size: 1rem; flex-shrink: 0; width: 18px; text-align: center; }

.sidebar-footer {
  padding: .75rem;
  border-top: 1px solid rgba(255,255,255,.08);
}
.user-info {
  display: flex;
  align-items: center;
  gap: .65rem;
  min-width: 0;
}
.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: .75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.user-name  { font-size: .8rem; font-weight: 600; color: #fff; }
.user-role  { font-size: .7rem; color: var(--sidebar-text); }

/* ── Main Content ─────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  transition: margin-left .25s ease;
  min-width: 0;
}
.sidebar.collapsed ~ .main-content { margin-left: 64px; }

.top-navbar {
  height: var(--topbar-h);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  gap: 1rem;
}

.breadcrumb { font-size: .8rem; margin-bottom: 0; }
.breadcrumb-item.active { color: var(--text-muted); }

.page-title { font-size: 1.2rem; font-weight: 700; color: var(--text); }

/* ── Cards ────────────────────────────────────────────────── */
.card {
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.card-header {
  background: transparent;
  border-bottom: 1px solid var(--border);
  padding: .85rem 1.1rem;
  font-weight: 600;
  font-size: .9rem;
}

/* ── Stat Cards ───────────────────────────────────────────── */
.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.1rem;
  transition: box-shadow .2s;
}
.stat-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.08); }
.stat-card .stat-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}
.stat-card .stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text);
}
.stat-card .stat-label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: .25rem;
}
.stat-card .stat-change {
  font-size: .75rem;
  font-weight: 500;
}

/* ── Tables ───────────────────────────────────────────────── */
.table { font-size: .84rem; }
.table th {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.table td { vertical-align: middle; }
.table > :not(:first-child) { border-top: none; }
.table-hover tbody tr:hover { background: #f8fafc; }

.table-card { border-radius: 10px; overflow: hidden; border: 1px solid var(--border); }
.table-card .table { margin-bottom: 0; }
.table-card .table-header {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: .85rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  flex-wrap: wrap;
}
.table-footer {
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  padding: .6rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem;
}

/* ── Badges ───────────────────────────────────────────────── */
.badge { font-size: .7rem; font-weight: 600; }
.status-active   { --bs-badge-color:#16a34a; background:rgba(22,163,74,.12); color:#16a34a; }
.status-inactive { --bs-badge-color:#64748b; background:rgba(100,116,139,.12); color:#64748b; }
.status-paused   { --bs-badge-color:#d97706; background:rgba(217,119,6,.12); color:#d97706; }
.status-pending  { --bs-badge-color:#2563eb; background:rgba(37,99,235,.12); color:#2563eb; }

/* ── Forms ────────────────────────────────────────────────── */
.form-label { font-size: .83rem; font-weight: 600; color: var(--text); }
.form-control, .form-select {
  font-size: .84rem;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.input-group-text { font-size: .84rem; background: #f8fafc; border-color: var(--border); }

/* ── Buttons ──────────────────────────────────────────────── */
.btn { font-size: .84rem; font-weight: 500; border-radius: 7px; }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-xs { padding: .2rem .55rem; font-size: .72rem; border-radius: 5px; }

/* ── Color utilities ──────────────────────────────────────── */
.bg-primary-subtle  { background: rgba(37,99,235,.1)  !important; }
.bg-success-subtle  { background: rgba(22,163,74,.1)   !important; }
.bg-warning-subtle  { background: rgba(217,119,6,.1)   !important; }
.bg-danger-subtle   { background: rgba(220,38,38,.1)   !important; }
.bg-info-subtle     { background: rgba(6,182,212,.1)   !important; }
.text-primary  { color: var(--primary)  !important; }
.text-success  { color: var(--success)  !important; }
.text-warning  { color: var(--warning)  !important; }
.text-danger   { color: var(--danger)   !important; }

/* ── Filter bar ───────────────────────────────────────────── */
.filter-bar {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .85rem 1rem;
  margin-bottom: 1rem;
}
.filter-bar .row { row-gap: .5rem; }

/* ── Modals ───────────────────────────────────────────────── */
.modal-content { border-radius: 12px; border: none; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.modal-header { border-bottom: 1px solid var(--border); }
.modal-footer { border-top: 1px solid var(--border); }

/* ── Empty state ──────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
}
.empty-state .empty-icon {
  font-size: 3rem;
  color: #cbd5e1;
  margin-bottom: .75rem;
}
.empty-state h6 { color: var(--text-muted); font-weight: 600; }

/* ── Login page ───────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
  overflow: hidden;
}
.login-header {
  background: var(--primary);
  padding: 2rem;
  text-align: center;
  color: #fff;
}
.login-logo { font-size: 2rem; font-weight: 800; letter-spacing: -1px; }
.login-body { padding: 2rem; }

/* ── Chart containers ─────────────────────────────────────── */
.chart-container { position: relative; }
.chart-container canvas { max-height: 280px; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-content { margin-left: 0 !important; }
}

/* ── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ── Misc ─────────────────────────────────────────────────── */
.text-truncate-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
code { font-size: .8rem; background: #f1f5f9; padding: .15rem .4rem; border-radius: 4px; }
.cursor-pointer { cursor: pointer; }

/* ── Page body (opened by navbar, closed by footer) ──────── */
.page-body {
  padding: 0;
  min-height: calc(100vh - var(--topbar-h));
}
.page-body > .container-fluid {
  padding: 1.25rem 1.25rem;
}
/* Make top-navbar sticky within main-content */
.top-navbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  box-shadow: 0 1px 0 var(--border);
}
/* Ensure dropdowns in top-navbar always appear above content */
.top-navbar .dropdown-menu {
  z-index: 1031;
}
.top-navbar .dropdown-menu { z-index: 1031 !important; }
