/* =====================================================================
   VERISYS — Personnel Verification System
   Theme: institutional — deep navy + gold accent
   v2.0 — upgraded with dark mode, toasts, skeletons, photo support
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;600&family=Source+Serif+4:wght@600;700&display=swap');

:root {
  --navy-950: #0a1628;
  --navy-900: #0f1f38;
  --navy-800: #152a4a;
  --navy-700: #1d3a63;
  --navy-600: #28507f;
  --gold-500: #c9971f;
  --gold-400: #dcae3f;
  --gold-100: #f7ecd3;
  --slate-50:  #f5f7fa;
  --slate-100: #eceff3;
  --slate-200: #dde2e9;
  --slate-400: #9aa5b4;
  --slate-600: #5b6776;
  --slate-800: #2b3543;
  --ink:       #1c2430;
  --white:     #ffffff;
  --green-600: #1e7a44;
  --green-100: #e3f4ea;
  --red-600:   #b3261e;
  --red-100:   #fbe8e6;
  --amber-600: #9a6700;
  --amber-100: #fdf1d8;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 14px;
  --shadow-card: 0 1px 2px rgba(10,22,40,.06), 0 4px 14px rgba(10,22,40,.07);
  --font-display: 'Source Serif 4', 'Georgia', serif;
  --font-body:    'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono:    'IBM Plex Mono', 'Consolas', monospace;
  /* semantic tokens (override in dark mode) */
  --bg-page:    var(--slate-50);
  --bg-card:    var(--white);
  --bg-sidebar: linear-gradient(180deg, var(--navy-950), var(--navy-900));
  --border:     var(--slate-200);
  --text-main:  var(--ink);
  --text-muted: var(--slate-600);
}

/* ── Dark mode ── */
[data-theme="dark"] {
  --bg-page:   #0d1117;
  --bg-card:   #161b22;
  --border:    #30363d;
  --text-main: #e6edf3;
  --text-muted:#8b949e;
  --slate-50:  #0d1117;
  --slate-100: #161b22;
  --slate-200: #30363d;
  --slate-400: #8b949e;
  --slate-600: #6e7681;
  --slate-800: #c9d1d9;
  --ink:       #e6edf3;
  --white:     #161b22;
  --gold-100:  #2d2209;
  --amber-100: #2d2209;
  --green-100: #0d2618;
  --red-100:   #2d0f0d;
  --shadow-card: 0 1px 2px rgba(0,0,0,.3), 0 4px 14px rgba(0,0,0,.4);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  background: var(--bg-page);
  color: var(--text-main);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background .2s, color .2s;
}
a { color: var(--navy-700); text-decoration: none; }
a:hover { text-decoration: underline; }
h1,h2,h3,h4 { font-family: var(--font-display); color: var(--navy-950); margin: 0 0 .4em; font-weight: 600; }
[data-theme="dark"] h1,[data-theme="dark"] h2,[data-theme="dark"] h3,[data-theme="dark"] h4 { color: var(--text-main); }
.mono { font-family: var(--font-mono); }

/* ── Layout shell ── */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 248px; flex-shrink: 0;
  background: linear-gradient(180deg, var(--navy-950), var(--navy-900));
  color: var(--slate-100); display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0; overflow-y: auto; z-index: 40;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 22px 20px 18px; border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand .crest {
  width: 38px; height: 38px; border-radius: 50%; background: var(--gold-500);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700;
  color: var(--navy-950); font-size: 16px; flex-shrink: 0;
}
.sidebar-brand .label { font-size: 13px; line-height: 1.25; }
.sidebar-brand .label strong { display: block; font-size: 14.5px; color: var(--white); font-weight: 700; letter-spacing: .2px; }
.sidebar-brand .label span  { color: var(--slate-400); font-size: 11.5px; letter-spacing: .5px; text-transform: uppercase; }

.nav-group { padding: 14px 12px 6px; }
.nav-group-title { font-size: 10.5px; letter-spacing: 1px; text-transform: uppercase; color: var(--slate-400); padding: 8px 10px 6px; }
.nav-link {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border-radius: var(--radius-sm); color: var(--slate-100);
  font-size: 13.8px; font-weight: 500; margin-bottom: 2px; transition: .15s;
}
.nav-link:hover { background: rgba(255,255,255,.06); text-decoration: none; }
.nav-link.active { background: var(--gold-500); color: var(--navy-950); font-weight: 600; }
.nav-link .ic { width: 17px; text-align: center; flex-shrink: 0; opacity: .9; }
.sidebar-foot {
  margin-top: auto; padding: 16px 18px;
  border-top: 1px solid rgba(255,255,255,.08);
  font-size: 12px; color: var(--slate-400);
}

.main { margin-left: 248px; flex: 1; min-width: 0; display: flex; flex-direction: column; }
/* moved to topbar.php */
/* moved to topbar.php */
/* moved to topbar.php */
/* moved to topbar.php */
/* moved to topbar.php */
/* moved to topbar.php */
/* moved to topbar.php */
.content { padding: 26px 28px 60px; flex: 1; }

/* ── Cards ── */
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-card); }
.card-pad { padding: 22px 24px; }
.card-head { padding: 18px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-head h3 { font-size: 15.5px; margin: 0; }
.card-head .desc { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }

.grid { display: grid; gap: 18px; }
.grid-4 { grid-template-columns: repeat(4,1fr); }
.grid-3 { grid-template-columns: repeat(3,1fr); }
.grid-2 { grid-template-columns: repeat(2,1fr); }
@media(max-width:1100px) { .grid-4 { grid-template-columns: repeat(2,1fr); } .grid-3 { grid-template-columns: repeat(2,1fr); } }

.stat-card { padding: 18px 20px; border-radius: var(--radius-md); background: var(--bg-card); border: 1px solid var(--border); box-shadow: var(--shadow-card); }
.stat-card .num { font-family: var(--font-display); font-size: 30px; color: var(--navy-950); font-weight: 700; line-height: 1; }
[data-theme="dark"] .stat-card .num { color: var(--text-main); }
.stat-card .lbl { font-size: 12.5px; color: var(--text-muted); margin-top: 6px; }
.stat-card.accent-gold  { border-left: 4px solid var(--gold-500); }
.stat-card.accent-green { border-left: 4px solid var(--green-600); }
.stat-card.accent-red   { border-left: 4px solid var(--red-600); }
.stat-card.accent-navy  { border-left: 4px solid var(--navy-700); }

/* ── Forms ── */
label { display: block; font-size: 12.8px; font-weight: 600; color: var(--slate-800); margin-bottom: 5px; }
.form-row { margin-bottom: 16px; }
input[type=text], input[type=password], input[type=email], input[type=date],
input[type=number], input[type=tel], input[type=file], select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 14px; font-family: var(--font-body);
  color: var(--text-main); background: var(--bg-card); transition: .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--navy-600);
  box-shadow: 0 0 0 3px rgba(40,80,127,.12);
}
.help-text { font-size: 11.8px; color: var(--text-muted); margin-top: 4px; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 16px 18px; margin: 0 0 18px; }
fieldset legend { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--navy-700); padding: 0 6px; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 18px; border-radius: var(--radius-sm); font-size: 13.6px; font-weight: 600;
  border: 1px solid transparent; cursor: pointer; transition: .15s; line-height: 1.2;
  font-family: var(--font-body);
}
.btn-primary { background: var(--navy-800); color: #fff; }
.btn-primary:hover { background: var(--navy-700); }
.btn-gold { background: var(--gold-500); color: var(--navy-950); }
.btn-gold:hover { background: var(--gold-400); }
.btn-outline { background: var(--bg-card); border-color: var(--border); color: var(--slate-800); }
.btn-outline:hover { background: var(--slate-100); }
.btn-success { background: var(--green-600); color: #fff; }
.btn-success:hover { background: #176038; }
.btn-danger { background: var(--red-600); color: #fff; }
.btn-danger:hover { background: #94201a; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ── Tables ── */
table { width: 100%; border-collapse: collapse; font-size: 13.6px; }
thead th {
  text-align: left; font-size: 11.3px; text-transform: uppercase; letter-spacing: .4px;
  color: var(--text-muted); background: var(--slate-100); padding: 10px 14px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
tbody td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--text-main); }
tbody tr:hover { background: var(--slate-50); }
.table-wrap { overflow-x: auto; border-radius: var(--radius-md); }

/* ── Badges ── */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 20px; }
.badge-present { background: var(--green-100); color: var(--green-600); }
.badge-absent  { background: var(--red-100);   color: var(--red-600); }
.badge-pending { background: var(--amber-100); color: var(--amber-600); }
.badge-role-admin   { background: var(--gold-100);  color: var(--amber-600); }
.badge-role-officer { background: var(--slate-100); color: var(--slate-600); }

/* ── Alerts ── */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 13.5px; margin-bottom: 18px; border: 1px solid transparent; }
.alert-success { background: var(--green-100); color: var(--green-600); border-color: #bfe3cc; }
.alert-error   { background: var(--red-100);   color: var(--red-600);   border-color: #f1c5c1; }
.alert-info    { background: #e9f0fb;           color: var(--navy-700);  border-color: #cbdcf3; }
.alert-warn    { background: var(--amber-100);  color: var(--amber-600); border-color: #f0dca6; }

/* ── Login page ── */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 30% 20%, var(--navy-800), var(--navy-950) 65%);
  padding: 20px;
}
.login-card { width: 100%; max-width: 400px; background: var(--bg-card); border-radius: var(--radius-lg); box-shadow: 0 20px 60px rgba(0,0,0,.35); overflow: hidden; }
.login-head { background: var(--navy-950); padding: 30px 30px 22px; text-align: center; }
.login-head .crest {
  width: 56px; height: 56px; border-radius: 50%; background: var(--gold-500);
  margin: 0 auto 12px; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 22px; color: var(--navy-950);
}
.login-head h2 { color: #fff; font-size: 18px; margin: 0 0 3px; }
.login-head p  { color: var(--slate-400); font-size: 12.5px; margin: 0; }
.login-body { padding: 28px 30px 30px; }

/* ── Misc helpers ── */
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8  { gap: 8px; }  .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.mt-0   { margin-top: 0; }    .mt-8  { margin-top: 8px; }   .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-0   { margin-bottom: 0; } .mb-8  { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.text-muted { color: var(--text-muted); }
.text-sm    { font-size: 12.5px; }
.divider    { height: 1px; background: var(--border); margin: 18px 0; }
.empty-state { text-align: center; padding: 50px 20px; color: var(--text-muted); }
.empty-state .ic { font-size: 40px; margin-bottom: 10px; opacity: .4; }
.checkbox-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 10px; }
.checkbox-item { display: flex; align-items: flex-start; gap: 9px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.checkbox-item input { width: auto; margin-top: 2px; }
.checkbox-item .lbl { font-size: 13.2px; font-weight: 600; color: var(--text-main); }
.checkbox-item .grp { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .3px; }

/* ── Toast notifications ── */
#toast-container {
  position: fixed; bottom: 28px; right: 28px; z-index: 9999;
  display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
.toast {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--navy-950); color: #e6edf3;
  padding: 14px 18px; border-radius: var(--radius-md);
  box-shadow: 0 8px 30px rgba(0,0,0,.35);
  font-size: 13.5px; max-width: 340px; pointer-events: all;
  animation: toast-in .3s cubic-bezier(.16,1,.3,1) both;
  border-left: 4px solid var(--gold-500);
}
.toast.toast-success { border-left-color: var(--green-600); }
.toast.toast-error   { border-left-color: var(--red-600); }
.toast.toast-info    { border-left-color: #5b9bd5; }
.toast-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.toast-body { flex: 1; }
.toast-title { font-weight: 700; margin-bottom: 2px; font-size: 13px; }
.toast-msg   { font-size: 12.5px; opacity: .85; line-height: 1.4; }
.toast-close { background: none; border: none; color: #8b949e; cursor: pointer; font-size: 16px; padding: 0; flex-shrink: 0; margin-top: -1px; }
.toast-close:hover { color: #fff; }
.toast.removing { animation: toast-out .25s ease forwards; }
@keyframes toast-in  { from { opacity:0; transform: translateY(20px) scale(.95); } to { opacity:1; transform: none; } }
@keyframes toast-out { to   { opacity:0; transform: translateY(10px) scale(.95); } }

/* ── Notification bell ── */
.notif-bell { position: relative; cursor: pointer; background: none; border: none; padding: 6px; border-radius: var(--radius-sm); color: var(--text-muted); font-size: 18px; transition: .15s; }
.notif-bell:hover { background: var(--slate-100); color: var(--text-main); }
.notif-badge {
  position: absolute; top: 2px; right: 2px;
  background: var(--red-600); color: #fff;
  font-size: 9px; font-weight: 700;
  width: 16px; height: 16px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--bg-card);
}
.notif-dropdown {
  display: none; position: absolute; right: 0; top: calc(100% + 8px);
  width: 320px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); box-shadow: 0 8px 30px rgba(0,0,0,.15);
  z-index: 200; overflow: hidden;
}
.notif-dropdown.open { display: block; animation: toast-in .2s ease; }
.notif-drop-head { padding: 12px 16px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 13px; display: flex; justify-content: space-between; align-items: center; }
.notif-item { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 13px; line-height: 1.4; }
.notif-item:last-child { border-bottom: none; }
.notif-item.unread { background: var(--gold-100); }
[data-theme="dark"] .notif-item.unread { background: rgba(201,151,31,.08); }
.notif-item-time { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.notif-drop-foot { padding: 10px 16px; text-align: center; font-size: 12.5px; border-top: 1px solid var(--border); }
.notif-wrap { position: relative; }

/* ── Dark mode toggle ── */
.dark-toggle {
  background: none; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 5px 10px; cursor: pointer; font-size: 14px; color: var(--text-muted);
  transition: .15s; display: flex; align-items: center; gap: 5px;
}
.dark-toggle:hover { border-color: var(--navy-600); color: var(--text-main); }

/* ── Skeleton loaders ── */
.skeleton {
  background: linear-gradient(90deg, var(--slate-100) 25%, var(--slate-200) 50%, var(--slate-100) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
  display: inline-block;
}
@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-row td { padding: 14px; }
.skeleton-text  { height: 14px; width: 80%; }
.skeleton-text.w-40 { width: 40%; }
.skeleton-text.w-60 { width: 60%; }
.skeleton-badge { height: 22px; width: 70px; border-radius: 20px; }

/* ── Personnel photo ── */
.personnel-photo {
  width: 100px; height: 120px; object-fit: cover;
  border-radius: var(--radius-md); border: 3px solid var(--border);
  box-shadow: var(--shadow-card);
}
.personnel-photo-placeholder {
  width: 100px; height: 120px; border-radius: var(--radius-md);
  background: var(--slate-100); border: 3px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 40px; color: var(--slate-400);
}
.photo-upload-label {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; color: var(--navy-700);
  cursor: pointer; margin-top: 8px; text-decoration: underline;
}
.photo-upload-label:hover { color: var(--gold-500); }

/* ── Verification slip / print ── */
@media print {
  .sidebar, .topbar, .no-print, .btn, nav { display: none !important; }
  .main { margin: 0; }
  .content { padding: 0; }
  .slip-wrap { border: 2px solid #000; page-break-inside: avoid; }
}
.slip-wrap {
  border: 2px solid var(--navy-950); border-radius: var(--radius-md);
  padding: 28px 32px; max-width: 560px;
}
.slip-header { text-align: center; border-bottom: 2px solid var(--navy-950); padding-bottom: 16px; margin-bottom: 16px; }
.slip-header .crest { width: 68px; height: 68px; border-radius: 50%; background: #fff; border: 2px solid var(--navy-200); margin: 0 auto 10px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.slip-header h3 { font-size: 16px; font-weight: 800; margin: 0 0 1px; color: var(--navy-950); letter-spacing: .3px; }
.slip-header p  { font-size: 11px; color: var(--slate-600); margin: 0; }
.slip-body { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 20px; font-size: 13px; }
.slip-field label { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: var(--slate-600); font-weight: 700; display: block; margin-bottom: 2px; }
.slip-field span  { font-weight: 600; color: var(--navy-950); font-family: var(--font-mono); }
.slip-status { margin-top: 16px; text-align: center; padding: 10px; border-radius: var(--radius-sm); font-weight: 700; font-size: 15px; }
.slip-status.present { background: var(--green-100); color: var(--green-600); }
.slip-status.absent  { background: var(--red-100);   color: var(--red-600); }
.slip-ref { margin-top: 12px; text-align: center; font-size: 11px; color: var(--slate-600); font-family: var(--font-mono); }

/* ── SVG Bar Chart ── */
.chart-wrap { padding: 20px 24px 10px; }
.chart-bar-group text { font-family: var(--font-body); }

/* ── Bulk select ── */
.bulk-bar {
  display: none; align-items: center; gap: 12px;
  background: var(--navy-800); color: #fff; padding: 10px 20px;
  border-radius: var(--radius-sm); margin-bottom: 14px; font-size: 13.5px;
}
.bulk-bar.visible { display: flex; }
.bulk-count { font-weight: 700; }

/* ── Rate limit warning ── */
.login-locked { background: #fff3cd; border: 1px solid #ffc107; border-radius: var(--radius-sm); padding: 12px 16px; margin-bottom: 18px; color: #856404; font-size: 13.5px; }

@media(max-width: 880px) {
  .sidebar { transform: translateX(-100%); transition: .2s; }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

/* ── Search hero (from search.php) ── */
.search-hero {
  background: linear-gradient(135deg,var(--navy-950) 0%,var(--navy-800) 100%);
  border-radius: var(--radius-lg); padding: 40px 36px; margin-bottom: 28px;
  display: flex; align-items: center; gap: 40px;
}
.search-hero-text h2 { font-family: var(--font-display); color: #fff; font-size: 22px; margin: 0 0 6px; }
.search-hero-text p  { color: var(--slate-400); font-size: 13.5px; margin: 0 0 22px; }
.search-bar { display: flex; gap: 0; max-width: 560px; width: 100%; }
.search-bar input {
  flex:1; padding:13px 18px; border: 2px solid rgba(255,255,255,.15);
  border-right: none; border-radius: var(--radius-md) 0 0 var(--radius-md);
  background: rgba(255,255,255,.08); color: #fff;
  font-size: 15.5px; font-family: var(--font-mono); letter-spacing: .5px;
  outline: none; transition: .2s;
}
.search-bar input::placeholder { color: var(--slate-400); font-family: var(--font-body); letter-spacing: 0; }
.search-bar input:focus { border-color: var(--gold-500); background: rgba(255,255,255,.12); }
.search-bar button {
  padding: 13px 26px; background: var(--gold-500); color: var(--navy-950);
  border: none; border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-weight: 700; font-size: 14px; cursor: pointer; letter-spacing: .3px; transition: .2s;
  white-space: nowrap;
}
.search-bar button:hover { background: var(--gold-400); }
