/* ═══════════════════════════════════════════════════════════
   Immigration CMS — Main Stylesheet
   ═══════════════════════════════════════════════════════════ */

:root {
  --sidebar-width: 250px;
  --sidebar-bg: #1a2236;
  --sidebar-active: #2563eb;
  --primary: #2563eb;
  --topbar-h: 56px;
  --border: #e5e7eb;
  --radius: 10px;
}

* { box-sizing: border-box; }
body { background: #f3f4f8; font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; margin: 0; }

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex; flex-direction: column;
  z-index: 1040; overflow-y: auto;
  transition: transform .25s ease;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 20px 16px;
  color: #fff; font-size: 1.1rem; font-weight: 700;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand i { font-size: 1.5rem; color: #60a5fa; }
.sidebar-nav { flex: 1; padding: 12px 0; }
.nav-label {
  color: rgba(255,255,255,.35); font-size: .65rem; font-weight: 700;
  letter-spacing: .1em; padding: 16px 20px 6px; text-transform: uppercase;
}
/* Collapsible nav label */
.nav-label-toggle {
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; user-select: none;
  padding-right: 16px;
}
.nav-label-toggle:hover { color: rgba(255,255,255,.6); }
.nav-toggle-icon {
  font-size: .6rem; opacity: .6;
  transition: transform .2s ease;
}
.nav-label-toggle.expanded .nav-toggle-icon { transform: rotate(-180deg); }

/* Collapsible submenu */
.nav-submenu {
  max-height: 0; overflow: hidden;
  transition: max-height .25s ease;
}
.nav-submenu.open { max-height: 300px; }

/* Sub-items indented */
.nav-sub-item { padding-left: 42px !important; font-size: .85rem !important; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 20px; color: rgba(255,255,255,.7);
  text-decoration: none; border-radius: 0; font-size: .9rem;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: var(--sidebar-active); color: #fff; }
.nav-item i { width: 18px; text-align: center; font-size: 1rem; }
.sidebar-footer { padding: 16px; border-top: 1px solid rgba(255,255,255,.08); }
.user-info { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--sidebar-active); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .95rem; flex-shrink: 0;
}
.user-avatar-sm {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .75rem; flex-shrink: 0;
}
.user-name { color: #fff; font-size: .85rem; font-weight: 600; }
.user-role { color: rgba(255,255,255,.5); font-size: .75rem; }

/* ── Main Wrapper ────────────────────────────────────────── */
.main-wrapper {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex; flex-direction: column;
  transition: margin-left .25s ease;
}
.topbar {
  height: var(--topbar-h); background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; position: sticky; top: 0; z-index: 100;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.topbar-right { display: flex; align-items: center; }
.sidebar-toggle { border: none; background: none; color: #6b7280; padding: 4px 8px; }
.sidebar-toggle:hover { color: var(--primary); }
.page-content { padding: 24px; flex: 1; }

/* Sidebar collapsed state */
.sidebar.collapsed { transform: translateX(-100%); }
.main-wrapper.expanded { margin-left: 0; }

/* ── Page Header ─────────────────────────────────────────── */
.page-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 20px; gap: 16px; flex-wrap: wrap;
}
.page-header h4 { margin-bottom: 4px; font-weight: 700; color: #111827; }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 1px 4px rgba(0,0,0,.05); background: #fff;
}
.card-header {
  background: #fff; border-bottom: 1px solid var(--border);
  padding: 14px 20px; border-radius: var(--radius) var(--radius) 0 0;
  font-weight: 600;
}
.card-footer { background: #fafafa; border-top: 1px solid var(--border); padding: 12px 20px; }

/* ── Stat Cards ──────────────────────────────────────────── */
.stat-card {
  border-radius: var(--radius); padding: 20px;
  position: relative; overflow: hidden; min-height: 120px;
}
.stat-card .stat-icon {
  position: absolute; top: 16px; right: 16px;
  font-size: 3rem; opacity: .15;
}
.stat-card .stat-value { font-size: 2.2rem; font-weight: 700; line-height: 1; }
.stat-card .stat-label { font-size: .85rem; opacity: .85; margin-top: 4px; }
.stat-card .stat-link { font-size: .8rem; opacity: .75; text-decoration: none; color: inherit; }
.stat-card .stat-link:hover { opacity: 1; }

/* ── Info Rows ───────────────────────────────────────────── */
.info-row { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid #f3f4f8; font-size: .875rem; }
.info-row:last-child { border-bottom: none; }
.info-label { color: #6b7280; flex-shrink: 0; min-width: 140px; }
.info-value { font-weight: 500; color: #111827; text-align: right; }

/* ── Info Cards (case view) ──────────────────────────────── */
.info-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; }
.info-card-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: #6b7280; font-weight: 600; }
.info-card-value { font-size: 1.1rem; font-weight: 600; margin-top: 4px; color: #111827; }

/* ── Tables ──────────────────────────────────────────────── */
.table thead th { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: #6b7280; font-weight: 600; border-top: none; }
.table tbody td { vertical-align: middle; font-size: .875rem; }
.btn-xs { padding: 2px 7px; font-size: .78rem; }

/* ── Upload Drop Zone ────────────────────────────────────── */
.upload-dropzone {
  border: 2px dashed #d1d5db; border-radius: var(--radius);
  padding: 40px 20px; text-align: center; cursor: pointer;
  transition: border-color .2s, background .2s;
}
.upload-dropzone:hover, .upload-dropzone.drag-over {
  border-color: var(--primary); background: #eff6ff;
}

/* ── Notes ───────────────────────────────────────────────── */
.note-bubble { background: #f9fafb; border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; font-size: .875rem; }
.smaller { font-size: .75rem; }

/* ── Auth Page ───────────────────────────────────────────── */
.auth-body { background: linear-gradient(135deg, #1a2236 0%, #2563eb 100%); min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.auth-container { width: 100%; max-width: 420px; padding: 20px; }
.auth-card { background: #fff; border-radius: 16px; padding: 40px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.auth-brand { text-align: center; margin-bottom: 32px; }
.auth-brand i { font-size: 3rem; color: var(--primary); }
.auth-brand h1 { font-size: 1.5rem; font-weight: 800; margin: 8px 0 4px; color: #111827; }
.auth-brand p { color: #6b7280; font-size: .9rem; margin: 0; }

/* ── Portal Nav ──────────────────────────────────────────── */
.portal-nav { background: var(--sidebar-bg); }

/* ── Utilities ───────────────────────────────────────────── */
.border-dashed { border: 2px dashed #dee2e6 !important; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.show { transform: none; }
  .main-wrapper { margin-left: 0; }
  .page-header { flex-direction: column; }
  .stat-card .stat-value { font-size: 1.8rem; }
}

/* ── Utilities ───────────────────────────────────────────── */
.badge { font-weight: 500; }
.form-label { font-weight: 500; font-size: .875rem; color: #374151; }
.form-control, .form-select { font-size: .875rem; border-color: #d1d5db; }
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: #1d4ed8; border-color: #1d4ed8; }

/* Toast */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 9999; }
