/* ====================================================================
   SmartPermit – Custom Stylesheet
   Complements Bootstrap 5.3 with a professional blue/grey theme.
   ==================================================================== */

/* ── Variables ─────────────────────────────────────────────────────── */
:root {
  --sp-blue-dark:   #7A5800;
  --sp-blue:        #B8860B;
  --sp-blue-light:  #D4A017;
  --sp-accent:      #fff;
  --sp-sidebar-w:   260px;
  --sp-topbar-h:    60px;
  --sp-bg:          #f0f4f8;
  --sp-card-shadow: 0 2px 8px rgba(0,0,0,.08);
  --sp-radius:      10px;
  --sp-font:        'Inter', 'Segoe UI', sans-serif;
}

/* ── Base ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: var(--sp-font);
  background: var(--sp-bg);
  color: #1e293b;
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
}

/* ── Sidebar ────────────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--sp-sidebar-w);
  background: linear-gradient(160deg, var(--sp-blue-dark) 0%, var(--sp-blue) 100%);
  color: #fff;
  z-index: 1000;
  overflow-y: auto;
  transition: transform .25s ease;
  box-shadow: 3px 0 15px rgba(0,0,0,.2);
}

/* Brand */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.brand-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: rgba(255,255,255,.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.brand-logo { height: 44px; border-radius: 8px; }
.brand-text { display: flex; flex-direction: column; }
.brand-name { font-size: 1.05rem; font-weight: 700; letter-spacing: .03em; }
.brand-subtitle { font-size: .68rem; opacity: .65; line-height: 1.2; }

/* Period pill */
.sidebar-period {
  margin: 8px 12px;
  background: rgba(255,255,255,.1);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: .72rem;
  text-align: center;
  opacity: .8;
}

/* Nav */
.sidebar-nav {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}

.nav-section-label {
  padding: 10px 20px 4px;
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  opacity: .45;
}

.sidebar-nav .nav-item > a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: rgba(255,255,255,.8);
  text-decoration: none;
  border-radius: 0 30px 30px 0;
  margin-right: 12px;
  font-size: .875rem;
  font-weight: 500;
  transition: all .18s;
}
.sidebar-nav .nav-item > a i { width: 18px; text-align: center; opacity: .75; }
.sidebar-nav .nav-item > a:hover {
  background: rgba(255,255,255,.12);
  color: #fff;
}
.sidebar-nav .nav-item.active > a {
  background: rgba(255,255,255,.18);
  color: #fff;
  font-weight: 600;
  border-left: 3px solid var(--sp-accent);
}
.sidebar-nav .nav-item.active > a i { opacity: 1; }

/* Sidebar footer */
.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,.1);
}
.btn-sidebar-action {
  width: 100%;
  background: rgba(255,255,255,.12);
  color: rgba(255,255,255,.85);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: .8rem;
  cursor: pointer;
  transition: all .18s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn-sidebar-action:hover {
  background: rgba(255,255,255,.2);
  color: #fff;
}

/* ── Main Wrapper ────────────────────────────────────────────────────── */
.main-wrapper {
  margin-left: var(--sp-sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin .25s ease;
}

/* ── Topbar ─────────────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 900;
  height: var(--sp-topbar-h);
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
}

.btn-topbar {
  background: none;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #64748b;
  transition: all .15s;
  flex-shrink: 0;
}
.btn-topbar:hover { background: #f1f5f9; color: var(--sp-blue); }

.topbar-title {
  font-size: 1rem;
  font-weight: 600;
  color: #1e293b;
  margin: 0;
  flex: 1;
}

.topbar-right { display: flex; align-items: center; gap: 8px; }

/* User Avatar button */
.btn-user {
  background: none;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 4px 10px;
  cursor: pointer;
  transition: all .15s;
}
.btn-user:hover { background: #f8fafc; }

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--sp-blue), var(--sp-blue-light));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* Sync indicator */
.sync-indicator { display: flex; align-items: center; font-size: .78rem; }

/* ── Page Content ───────────────────────────────────────────────────── */
.page-content {
  padding: 24px;
  flex: 1;
}

/* ── Cards ─────────────────────────────────────────────────────────── */
.card {
  border: 1px solid #e2e8f0;
  border-radius: var(--sp-radius);
  box-shadow: var(--sp-card-shadow);
  background: #fff;
}
.card-header {
  border-bottom: 1px solid #f1f5f9;
  padding: 12px 16px;
  border-radius: var(--sp-radius) var(--sp-radius) 0 0 !important;
}
.card-footer {
  border-top: 1px solid #f1f5f9;
  padding: 10px 16px;
}
.border-dashed { border: 2px dashed #e2e8f0; }

/* ── Stat Cards ─────────────────────────────────────────────────────── */
.stat-card {
  border-radius: var(--sp-radius);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--sp-card-shadow);
  color: #fff;
  transition: transform .15s;
}
.stat-card:hover { transform: translateY(-2px); }
.stat-card--blue   { background: linear-gradient(135deg, #1a3a6b, #2563eb); }
.stat-card--green  { background: linear-gradient(135deg, #065f46, #059669); }
.stat-card--yellow { background: linear-gradient(135deg, #92400e, #d97706); }
.stat-card--red    { background: linear-gradient(135deg, #7f1d1d, #dc2626); }

.stat-card__icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(255,255,255,.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.stat-card__label { font-size: .78rem; opacity: .85; }
.stat-card__value { font-size: 1.55rem; font-weight: 700; line-height: 1.2; }
.stat-card__value--amount { font-size: 1.2rem; }
/* ── Student View – base (all sizes) ───────────────────────────────── */
.sv-profile-body   { padding: 1.25rem 1rem; }
.sv-sync-footer    { font-size: .78rem; }
.sv-profile-dl     { font-size: .82rem; }
.sv-profile-dl dt  { font-weight: 500; }
.sv-stat-card      { padding: .75rem 1rem; }
.sv-permit-table   { font-size: .82rem; }
.sv-permit-sub     { font-size: .7rem; }

/* ── Student View – tablet (≤991px) ────────────────────────────────── */
@media (max-width: 991.98px) {
  .sv-avatar        { width: 56px; height: 56px; font-size: 1.3rem; }
  .stat-card__value--amount { font-size: 1rem; }
}

/* ── Student View – small mobile (≤575px) ──────────────────────────── */
@media (max-width: 575.98px) {
  /* breadcrumb */
  .sv-breadcrumb       { font-size: .72rem; }
  .sv-bc-name          { max-width: 160px; }
  /* action buttons — keep icon, hide label text */
  .sv-action-btn       { font-size: .75rem; padding: .25rem .55rem; }
  .sv-btn-label        { display: none; }
  /* profile card – tighter padding */
  .sv-profile-body     { padding: .75rem; }
  .sv-avatar           { width: 46px; height: 46px; font-size: 1.1rem; }
  .sv-student-name     { font-size: .9rem; }
  .sv-student-id       { font-size: .72rem; }
  .sv-profile-dl       { font-size: .72rem; }
  .sv-sync-footer      { font-size: .68rem; }
  /* stat cards */
  .sv-stat-card        { padding: .4rem .35rem; }
  .stat-card__value--amount { font-size: .72rem; }
  .stat-card__label    { font-size: .6rem; }
  /* eligibility alert */
  .sv-elig-alert       { font-size: .75rem; padding: .45rem .65rem; }
  .sv-elig-alert i     { font-size: .85rem; }
  /* permit table */
  .sv-permit-table     { font-size: .72rem; }
  .sv-permit-sub       { font-size: .65rem; }

  /* doc review – balance column */
  .doc-balance-amount { font-size: .78rem; }
  /* doc review – top stats cards */
  .doc-stat-value { font-size: 1.1rem !important; }
  .doc-stat-label { font-size: .68rem; }
  /* doc review – page heading */
  .doc-review-title { font-size: 1rem; }
  /* doc review – table rows */
  .table.small td, .table.small th { font-size: .72rem; }
}

/* ── Buttons – Extra small ──────────────────────────────────────────── */
.btn-xs {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  font-size: .72rem;
  border-radius: 6px;
}

/* ── Tables ────────────────────────────────────────────────────────── */
.table > :not(caption) > * > * { vertical-align: middle; padding: 10px 12px; }
.table-hover tbody tr:hover { background: #f8fafc; }
thead { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: #64748b; }

/* ── Avatars ────────────────────────────────────────────────────────── */
.mini-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--sp-blue), var(--sp-blue-light));
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 700;
  flex-shrink: 0;
}
.student-avatar-lg {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--sp-blue), var(--sp-blue-light));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  flex-shrink: 0;
}
.student-avatar-xl {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--sp-blue), var(--sp-blue-light));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 700;
  margin: 0 auto;
  font-style: normal;
}

/* ── Form tweaks ────────────────────────────────────────────────────── */
.form-control:focus, .form-select:focus {
  border-color: var(--sp-blue-light);
  box-shadow: 0 0 0 .2rem rgba(37,99,235,.18);
}

/* ── Alerts ─────────────────────────────────────────────────────────── */
.alert-sm { font-size: .82rem; padding: .4rem .75rem; }

/* ── Sidebar Collapse (mobile) ─────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-wrapper { margin-left: 0; }
  .topbar-title { font-size: .9rem; }
}

/* ── Scrollbar (thin) ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ── Print ──────────────────────────────────────────────────────────── */
@media print {
  .sidebar, .topbar, .btn, .no-print { display: none !important; }
  .main-wrapper { margin-left: 0; }
  .page-content { padding: 0; }
  .card { box-shadow: none; border: 1px solid #ccc; }
}
