/* ============================================================
   style.css - Sistem Presensi Fingerspot
   Badan Gizi Nasional - Republik Indonesia
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=DM+Mono:wght@400;500&display=swap');

/* ── Design tokens ─────────────────────────────────────────── */
:root {
  --bg-top:       #7EC8E8;
  --bg-mid:       #5AB3D9;
  --bg-bot:       #3A9AC4;
  --navy:         #0D2158;
  --blue-dark:    #1A4480;
  --blue:         #1E5FAD;
  --blue-light:   #2E80C8;
  --accent:       #D4A847;
  --surface:      rgba(255,255,255,0.22);
  --surface-hov:  rgba(255,255,255,0.32);
  --surface-dark: rgba(13,33,88,0.18);
  --border:       rgba(255,255,255,0.35);
  --border-dark:  rgba(13,33,88,0.18);
  --text:         #0A1E4E;
  --text-light:   #1A4480;
  --muted:        rgba(10,30,78,0.55);
  --white:        #ffffff;
  --radius:       14px;
  --radius-sm:    9px;
  --shadow:       0 4px 24px rgba(13,33,88,0.13);
  --shadow-lg:    0 8px 40px rgba(13,33,88,0.18);
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  /* Light blue gradient matching BGN branding */
  background:
    radial-gradient(ellipse 90% 60% at 15% 0%,   #A8DCEA 0%, transparent 55%),
    radial-gradient(ellipse 70% 70% at 85% 100%,  #3D9FC8 0%, transparent 55%),
    radial-gradient(ellipse 100% 100% at 50% 50%, #5AB3D9 0%, #4AA5CF 100%);
  background-attachment: fixed;
}

/* Subtle diagonal pattern overlay - matches BGN batik motif feel */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 0;
  background-image:
    radial-gradient(circle at 1px 1px, rgba(255,255,255,0.25) 1px, transparent 0);
  background-size: 28px 28px;
  pointer-events: none;
}

/* ── Wrapper ────────────────────────────────────────────────── */
.wrapper {
  position: relative; z-index: 1;
  max-width: 1380px;
  margin: 0 auto;
  padding: 0 22px 48px;
}

/* ── Navbar ─────────────────────────────────────────────────── */
.navbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 0 12px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--border);
  position: relative;
}

/* Logo */
.navbar-brand {
  display: flex; align-items: center; gap: 14px;
  text-decoration: none; color: inherit;
}
.logo-circle {
  width: 58px; height: 58px;
  border-radius: 50%;
  border: 2.5px solid var(--accent);
  overflow: hidden;
  flex-shrink: 0;
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 16px rgba(212,168,71,0.25), 0 0 0 4px rgba(255,255,255,0.3);
}
.logo-circle img { width: 100%; height: 100%; object-fit: contain; }

.brand-text h1 {
  font-size: 1.05rem; font-weight: 800; color: var(--navy);
  letter-spacing: -.2px; line-height: 1.2;
}
.brand-text p {
  font-size: .72rem; color: var(--muted); margin-top: 2px; font-weight: 500;
}

/* Device chip */
.device-chip {
  margin-left: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: .76rem;
  color: var(--text-light);
  font-weight: 600;
  display: flex; align-items: center; gap: 8px;
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
}
.device-chip .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
  flex-shrink: 0;
}
.device-chip .mono { font-family: 'DM Mono', monospace; font-size: .7rem; opacity: .7; }

/* ── Dropdown nav ────────────────────────────────────────────── */
.nav-menu {
  position: relative;
}
.nav-menu-btn {
  display: flex; align-items: center; gap: 8px;
  background: var(--navy);
  color: #fff;
  border: none; border-radius: var(--radius-sm);
  padding: 9px 16px;
  font-size: .82rem; font-weight: 700;
  cursor: pointer; font-family: inherit;
  transition: background .2s;
  box-shadow: var(--shadow);
}
.nav-menu-btn:hover { background: var(--blue-dark); }
.nav-menu-btn .arrow {
  font-size: .65rem;
  transition: transform .2s;
  display: inline-block;
}
.nav-menu.open .nav-menu-btn .arrow { transform: rotate(180deg); }

.nav-dropdown {
  display: none;
  position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--white);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 210px;
  z-index: 999;
  overflow: hidden;
  animation: dropDown .18s ease;
}
@keyframes dropDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.nav-menu.open .nav-dropdown { display: block; }

.nav-dropdown a {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px;
  font-size: .83rem; font-weight: 600;
  color: var(--text); text-decoration: none;
  transition: background .15s;
  border-bottom: 1px solid rgba(13,33,88,0.07);
}
.nav-dropdown a:last-child { border-bottom: none; }
.nav-dropdown a:hover { background: #EBF5FB; color: var(--blue); }
.nav-dropdown a.active-link { background: #DBEAFE; color: var(--blue); }
.nav-dropdown a .nav-icon { font-size: 1rem; width: 22px; text-align: center; }

/* ── Stat cards ─────────────────────────────────────────────── */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  position: relative; overflow: hidden;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--navy), var(--accent));
}
.stat-card .label {
  font-size: .72rem; color: var(--muted); font-weight: 700;
  text-transform: uppercase; letter-spacing: .9px;
}
.stat-card .value {
  font-size: 2rem; font-weight: 800; color: var(--navy); margin: 6px 0 2px; line-height: 1;
}
.stat-card .sub { font-size: .73rem; color: var(--muted); }
.stat-icon {
  position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
  font-size: 2.4rem; opacity: .13;
}

/* ── Controls panel ─────────────────────────────────────────── */
.controls {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 18px;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}

.filter-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.filter-row input,
.filter-row select {
  background: rgba(255,255,255,0.55);
  border: 1.5px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: .82rem; font-family: inherit; outline: none;
  transition: border-color .2s, background .2s;
}
.filter-row input::placeholder { color: var(--muted); }
.filter-row input:focus,
.filter-row select:focus {
  border-color: var(--blue); background: rgba(255,255,255,0.8);
}
.filter-row input[name=search] { flex: 1; min-width: 200px; }

.btn {
  padding: 8px 18px; border-radius: var(--radius-sm); border: none;
  font-size: .82rem; font-weight: 700; cursor: pointer;
  transition: all .15s; font-family: inherit;
}
.btn-primary { background: var(--navy); color: #fff; box-shadow: var(--shadow); }
.btn-primary:hover { background: var(--blue-dark); }
.btn-reset {
  background: rgba(255,255,255,0.45);
  border: 1px solid var(--border-dark);
  color: var(--muted);
}
.btn-reset:hover { background: rgba(255,255,255,0.7); color: var(--text); }

/* ── Table wrap ─────────────────────────────────────────────── */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-lg);
  margin-bottom: 20px;
}
.table-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.15);
}
.table-head h2 { font-size: .92rem; font-weight: 800; color: var(--navy); }
.record-count { font-size: .76rem; color: var(--muted); font-weight: 600; }

table { width: 100%; border-collapse: collapse; }
thead th {
  background: rgba(13,33,88,0.07);
  padding: 11px 14px;
  text-align: left;
  font-size: .73rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .8px;
  color: var(--text-light);
  border-bottom: 1px solid var(--border);
}
tbody tr { transition: background .15s; }
tbody tr:hover { background: rgba(255,255,255,0.4); }
tbody td {
  padding: 11px 14px; font-size: .82rem;
  border-bottom: 1px solid rgba(13,33,88,0.06);
  vertical-align: middle;
  color: var(--text);
}
tbody tr:last-child td { border-bottom: none; }

/* ── Chips ──────────────────────────────────────────────────── */
.pin-chip {
  font-family: 'DM Mono', monospace;
  background: rgba(30,95,173,0.12);
  color: var(--blue-dark);
  padding: 2px 8px; border-radius: 5px; font-size: .78rem;
}
.cloud-chip {
  font-family: 'DM Mono', monospace;
  background: rgba(212,168,71,0.15);
  color: #8a6200;
  padding: 2px 8px; border-radius: 5px; font-size: .75rem;
}

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
  padding: 3px 10px; border-radius: 20px;
  font-size: .72rem; font-weight: 700;
  display: inline-block; white-space: nowrap;
}
.badge-finger { background: rgba(99,102,241,0.15); color: #4338ca; }
.badge-face   { background: rgba(20,184,166,0.15); color: #0f766e; }
.badge-rfid   { background: rgba(245,158,11,0.15); color: #92400e; }
.badge-pw     { background: rgba(100,116,139,0.15); color: #374151; }
.badge-in     { background: rgba(34,197,94,0.15);  color: #166534; }
.badge-out    { background: rgba(239,68,68,0.15);   color: #991b1b; }
.badge-other  { background: rgba(100,116,139,0.12); color: #4b5563; }
.badge-priv   { background: rgba(212,168,71,0.18);  color: #7c5205; }

/* ── Photo thumbnail ─────────────────────────────────────────── */
.photo-thumb {
  width: 40px; height: 40px;
  border-radius: 8px; object-fit: cover;
  border: 2px solid rgba(255,255,255,0.6);
  cursor: pointer;
  transition: transform .2s, box-shadow .2s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.photo-thumb:hover { transform: scale(1.08); box-shadow: 0 4px 16px rgba(13,33,88,0.2); }
.no-photo {
  width: 40px; height: 40px; border-radius: 8px;
  background: rgba(13,33,88,0.08);
  border: 1.5px dashed rgba(13,33,88,0.2);
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; color: var(--muted);
}

/* ── Photo Lightbox ─────────────────────────────────────────── */
.lightbox-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(5,15,40,0.82);
  backdrop-filter: blur(6px);
  align-items: center; justify-content: center;
  animation: fadeIn .2s ease;
}
.lightbox-overlay.show { display: flex; }
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }

.lightbox-box {
  position: relative;
  background: #fff;
  border-radius: 16px;
  padding: 10px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.4);
  max-width: 90vw; max-height: 90vh;
  animation: popIn .22s cubic-bezier(.34,1.56,.64,1);
}
@keyframes popIn {
  from { opacity:0; transform: scale(.88); }
  to   { opacity:1; transform: scale(1); }
}
.lightbox-box img {
  display: block; max-width: 75vw; max-height: 75vh;
  object-fit: contain; border-radius: 10px;
}
.lightbox-info {
  margin-top: 8px; padding: 8px 6px 2px;
  font-size: .8rem; color: var(--text-light);
  font-weight: 600; text-align: center;
}
.lightbox-close {
  position: absolute; top: -14px; right: -14px;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--navy); color: #fff;
  border: none; font-size: 1rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  transition: background .15s;
}
.lightbox-close:hover { background: #c0392b; }

/* ── Pagination ─────────────────────────────────────────────── */
.pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 6px; flex-wrap: wrap;
}
.page-btn {
  min-width: 34px; height: 34px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface); color: var(--text-light);
  font-size: .8rem; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  text-decoration: none; transition: all .15s; font-family: inherit;
  backdrop-filter: blur(6px);
}
.page-btn:hover { background: var(--navy); color: #fff; border-color: var(--navy); }
.page-btn.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.page-btn.disabled { opacity: .35; pointer-events: none; }
.page-ellipsis { color: var(--muted); padding: 0 4px; font-weight: 600; }

/* ── Empty state ─────────────────────────────────────────────── */
.empty { text-align: center; padding: 52px 20px; color: var(--muted); }
.empty .icon { font-size: 3rem; margin-bottom: 14px; }
.empty p { font-size: .9rem; font-weight: 600; }

/* ── Footer ──────────────────────────────────────────────────── */
.footer {
  text-align: center; margin-top: 36px;
  font-size: .73rem; color: var(--muted); font-weight: 600;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 1000px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .device-chip { display: none; }
  .brand-text h1 { font-size: .92rem; }
}
@media (max-width: 560px) {
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card .value { font-size: 1.6rem; }
  table { font-size: .74rem; }
  thead th, tbody td { padding: 9px 10px; }
  .logo-circle { width: 46px; height: 46px; }
}

/* ── Nav role badge & logout ─────────────────────────────────── */
.nav-role-badge {
  background: var(--accent);
  color: #5a3800;
  font-size: .65rem; font-weight: 800;
  padding: 2px 7px; border-radius: 20px;
  letter-spacing: .4px;
}
.nav-user-icon { font-size: .9rem; }
.nav-divider {
  height: 1px;
  background: rgba(13,33,88,0.09);
  margin: 4px 0;
}
.nav-logout { color: #991b1b !important; }
.nav-logout:hover { background: #fee2e2 !important; }

/* ── Admin page ──────────────────────────────────────────────── */
.admin-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 18px; flex-wrap: wrap; gap: 12px;
}
.admin-toolbar h2 { font-size: 1.05rem; font-weight: 800; color: var(--navy); }

/* Modal overlay */
.modal-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 8888;
  background: rgba(5,15,40,0.70);
  backdrop-filter: blur(5px);
  align-items: center; justify-content: center;
  animation: fadeIn .2s ease;
}
.modal-overlay.show { display: flex; }

.modal-box {
  background: #fff;
  border-radius: 18px;
  padding: 32px 30px 28px;
  width: 100%; max-width: 500px;
  box-shadow: 0 24px 80px rgba(0,0,0,.35);
  animation: popIn .22s cubic-bezier(.34,1.56,.64,1);
  position: relative;
}
.modal-box h3 {
  font-size: 1rem; font-weight: 800; color: var(--navy);
  margin-bottom: 20px; padding-bottom: 12px;
  border-bottom: 1px solid rgba(13,33,88,.1);
}
.modal-close {
  position: absolute; top: 16px; right: 16px;
  background: rgba(13,33,88,.08); border: none;
  width: 30px; height: 30px; border-radius: 50%;
  cursor: pointer; font-size: .9rem;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.modal-close:hover { background: rgba(220,38,38,.15); color: #991b1b; }

/* Form inside modal */
.form-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px;
  margin-bottom: 20px;
}
.form-grid .full { grid-column: 1 / -1; }
.form-field label {
  display: block; font-size: .76rem; font-weight: 700;
  color: var(--navy); margin-bottom: 5px;
}
.form-field input,
.form-field select {
  width: 100%;
  background: rgba(13,33,88,.04);
  border: 1.5px solid rgba(13,33,88,.15);
  border-radius: 8px; padding: 8px 11px;
  font-size: .83rem; font-family: inherit;
  color: var(--text); outline: none;
  transition: border-color .2s;
}
.form-field input:focus,
.form-field select:focus { border-color: var(--blue); background: #fff; }
.form-field .hint { font-size: .7rem; color: var(--muted); margin-top: 3px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* Status toggle */
.status-dot {
  width: 10px; height: 10px; border-radius: 50%; display: inline-block;
  margin-right: 5px; vertical-align: middle;
}
.status-dot.on  { background: #22c55e; box-shadow: 0 0 6px #22c55e; }
.status-dot.off { background: #ef4444; }

/* Alert flash */
.flash {
  border-radius: 10px; padding: 10px 16px;
  font-size: .83rem; font-weight: 600; margin-bottom: 16px;
  display: flex; gap: 8px; align-items: flex-start;
}
.flash-ok    { background: rgba(34,197,94,.12);  border: 1px solid rgba(34,197,94,.3);  color: #14532d; }
.flash-err   { background: rgba(220,38,38,.12);  border: 1px solid rgba(220,38,38,.3);  color: #7f1d1d; }