/* ==========================================================================
   PRESENSI SURYA MADINA — LAYOUT & KOMPONEN
   ========================================================================== */

/* ---------------------------------------------------------------------- */
/* 1. HALAMAN LOGIN (split-screen, brand panel + form panel)              */
/* ---------------------------------------------------------------------- */
.auth-shell {
  min-height: 100svh;
  display: grid;
  grid-template-columns: 1fr;
}

@media (min-width: 900px) {
  .auth-shell { grid-template-columns: 1.05fr 1fr; }
}

.auth-brand {
  position: relative;
  overflow: hidden;
  background: linear-gradient(155deg, var(--navy-900) 0%, var(--navy-800) 46%, #3a1e8c 78%, var(--orange-600) 130%);
  color: #fff;
  padding: 40px 32px 48px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 280px;
}

@media (min-width: 900px) {
  .auth-brand { padding: 56px 64px; min-height: 100svh; }
}

.auth-brand::before {
  content: "";
  position: absolute;
  inset: -10% -10% auto auto;
  width: 60%;
  aspect-ratio: 1;
  background: url('../img/icon-mark.png') center / contain no-repeat;
  filter: brightness(0) invert(1);
  opacity: 0.08;
  transform: rotate(8deg);
}

.auth-brand::after {
  content: "";
  position: absolute;
  inset: auto -18% -22% auto;
  width: 55%;
  aspect-ratio: 1;
  background: url('../img/icon-mark.png') center / contain no-repeat;
  filter: brightness(0) invert(1);
  opacity: 0.06;
}

.auth-brand__logo { width: min(220px, 55%); position: relative; z-index: 1; }
.auth-brand__logo img { width: 100%; }

.auth-brand__copy { position: relative; z-index: 1; max-width: 420px; }
.auth-brand__eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--orange-400);
  margin-bottom: 14px;
  display: block;
}
.auth-brand__title {
  font-size: clamp(26px, 3.4vw, 38px);
  line-height: 1.15;
  color: #fff;
  margin-bottom: 14px;
}
.auth-brand__desc { color: rgba(255,255,255,0.78); font-size: 15px; line-height: 1.6; }

.auth-brand__foot {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 28px;
  margin-top: 32px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: rgba(255,255,255,0.65);
}
.auth-brand__foot b { display: block; color: #fff; font-size: 20px; font-family: var(--font-display); }

.auth-form-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px 56px;
  background: var(--paper);
}

.auth-form {
  width: 100%;
  max-width: 380px;
}

.auth-form__head { margin-bottom: 28px; }
.auth-form__head h1 { font-size: 24px; margin-bottom: 6px; }
.auth-form__head p { color: var(--ink-500); font-size: 14.5px; }

.btn-sso {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 15px 18px;
  border-radius: var(--r-md);
  border: none;
  background: linear-gradient(135deg, var(--navy-900), var(--navy-700));
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  box-shadow: var(--shadow-md);
  transition: transform .15s ease, box-shadow .15s ease;
}
.btn-sso:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.btn-sso:active { transform: translateY(0); }
.btn-sso svg { width: 20px; height: 20px; flex-shrink: 0; }

.auth-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 26px 0; color: var(--ink-300); font-size: 12.5px;
}
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--ink-100); }

.auth-note {
  margin-top: 22px;
  font-size: 13px;
  color: var(--ink-500);
  line-height: 1.6;
  background: var(--navy-50);
  border: 1px solid var(--navy-100);
  padding: 12px 14px;
  border-radius: var(--r-sm);
}

/* ---------------------------------------------------------------------- */
/* 2. FORM ELEMENTS (dipakai login lokal & form pengajuan)                */
/* ---------------------------------------------------------------------- */
.field { margin-bottom: 16px; }
.field label {
  display: block; font-size: 13px; font-weight: 600; color: var(--ink-700);
  margin-bottom: 6px;
}
.field input, .field select, .field textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--ink-100);
  background: var(--canvas);
  font-family: var(--font-body);
  font-size: 14.5px;
  color: var(--ink-900);
  transition: border-color .15s ease, background .15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--orange-500); background: var(--paper); outline: none;
}
.field textarea { resize: vertical; min-height: 88px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .field-row { grid-template-columns: 1fr; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: var(--r-sm); border: none;
  font-weight: 600; font-size: 14.5px; transition: all .15s ease;
}
.btn-primary { background: var(--orange-600); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--orange-700); }
.btn-outline { background: transparent; border: 1.5px solid var(--ink-100); color: var(--ink-700); }
.btn-outline:hover { border-color: var(--navy-900); color: var(--navy-900); }
.btn-navy { background: var(--navy-900); color: #fff; }
.btn-navy:hover { background: var(--navy-800); }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------------------------------------------------------------------- */
/* 3. APP SHELL (topbar + konten + bottom nav mobile)                     */
/* ---------------------------------------------------------------------- */
.app-shell { min-height: 100svh; display: flex; flex-direction: column; }

.app-topbar {
  height: var(--topbar-height);
  background: var(--paper);
  border-bottom: 1px solid var(--ink-100);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px;
  position: sticky; top: 0; z-index: 30;
}
.app-topbar__brand { display: flex; align-items: center; gap: 10px; }
.app-topbar__brand img { height: 26px; }
.app-topbar__right { display: flex; align-items: center; gap: 14px; }
.app-topbar__clock {
  font-family: var(--font-mono); font-size: 13px; color: var(--ink-500);
  display: none;
}
@media (min-width: 640px) { .app-topbar__clock { display: block; } }

.avatar {
  width: 38px; height: 38px; border-radius: var(--r-full);
  background: var(--navy-100); color: var(--navy-900);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; overflow: hidden; flex-shrink: 0;
  border: 2px solid var(--paper); box-shadow: 0 0 0 1.5px var(--ink-100);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.app-content {
  flex: 1;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: var(--gap-page) var(--gap-page) calc(var(--nav-height) + 28px);
}

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  height: var(--nav-height);
  background: var(--paper);
  border-top: 1px solid var(--ink-100);
  display: flex;
  box-shadow: 0 -6px 20px rgba(1,0,128,0.06);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.bottom-nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; font-size: 11px; color: var(--ink-500); font-weight: 600;
  transition: color .15s ease;
}
.bottom-nav a svg { width: 22px; height: 22px; stroke: currentColor; }
.bottom-nav a.active { color: var(--orange-600); }
.bottom-nav a.active svg { stroke: var(--orange-600); }

@media (min-width: 900px) {
  .app-content { max-width: 880px; padding-bottom: 40px; }
  .bottom-nav { display: none; }
}

/* ---------------------------------------------------------------------- */
/* 4. GREETING & CARDS                                                    */
/* ---------------------------------------------------------------------- */
.greeting { margin-bottom: 18px; }
.greeting__hi { font-size: 20px; color: var(--navy-900); margin-bottom: 2px; }
.greeting__date { font-size: 13.5px; color: var(--ink-500); }
.greeting__role {
  display: inline-block; margin-top: 8px; font-size: 12px; font-weight: 600;
  color: var(--navy-900); background: var(--navy-50); border: 1px solid var(--navy-100);
  padding: 4px 10px; border-radius: var(--r-full);
}

.card {
  background: var(--paper);
  border-radius: var(--r-lg);
  border: 1px solid var(--ink-100);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--gap-page);
}
.card__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card__head h3 { font-size: 15.5px; }
.card__link { font-size: 12.5px; font-weight: 600; color: var(--orange-600); }

/* ---------------------------------------------------------------------- */
/* 5. SIGNATURE ELEMENT — CINCIN KEHADIRAN (shutter presence ring)        */
/* ---------------------------------------------------------------------- */
.presence-card {
  background: radial-gradient(120% 130% at 15% 0%, var(--navy-800) 0%, var(--navy-900) 45%, #1a0f5c 100%);
  border-radius: var(--r-lg);
  padding: 26px 20px 22px;
  color: #fff;
  position: relative;
  overflow: hidden;
  margin-bottom: var(--gap-page);
  box-shadow: var(--shadow-lg);
}
.presence-card::before {
  content: "";
  position: absolute; inset: auto -20% -30% auto;
  width: 65%; aspect-ratio: 1;
  background: url('../img/icon-mark.png') center / contain no-repeat;
  filter: brightness(0) invert(1);
  opacity: 0.07;
}
.presence-card__top {
  display: flex; justify-content: space-between; align-items: flex-start;
  position: relative; z-index: 1; margin-bottom: 6px;
}
.presence-card__label { font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: rgba(255,255,255,0.6); }
.presence-card__jadwal { font-size: 13px; color: rgba(255,255,255,0.85); margin-top: 3px; }

.presence-badge {
  font-size: 11px; font-weight: 700; padding: 5px 11px; border-radius: var(--r-full);
  background: rgba(255,255,255,0.12); color: #fff; white-space: nowrap;
}
.presence-badge.is-belum { background: rgba(255,255,255,0.14); }
.presence-badge.is-bekerja { background: var(--orange-600); }
.presence-badge.is-jeda { background: var(--warning-500); color: #3a2600; }
.presence-badge.is-selesai { background: var(--success-500); }

.ring-wrap { display: flex; justify-content: center; padding: 18px 0 6px; position: relative; z-index: 1; }
.ring-btn {
  position: relative; width: 176px; height: 176px; border-radius: 50%;
  border: none; background: transparent; padding: 0;
  display: flex; align-items: center; justify-content: center;
}
.ring-btn svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.ring-btn .ring-track { stroke: rgba(255,255,255,0.14); }
.ring-btn .ring-progress {
  stroke: var(--orange-500);
  stroke-linecap: round;
  transition: stroke-dashoffset 0.6s ease, stroke 0.3s ease;
}
.ring-btn.is-jeda .ring-progress { stroke: var(--warning-500); }
.ring-btn.is-selesai .ring-progress { stroke: var(--success-500); }

.ring-core {
  position: relative; z-index: 2;
  width: 128px; height: 128px; border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px;
  backdrop-filter: blur(2px);
}
.ring-core svg { width: 30px; height: 30px; stroke: #fff; }
.ring-core span { font-size: 12.5px; font-weight: 700; letter-spacing: .01em; }
.ring-btn:active .ring-core { transform: scale(0.97); }

.presence-times {
  display: flex; justify-content: center; gap: 34px;
  position: relative; z-index: 1; margin-top: 4px;
}
.presence-times div { text-align: center; }
.presence-times .t-label { font-size: 11px; color: rgba(255,255,255,0.55); margin-bottom: 3px; }
.presence-times .t-value { font-family: var(--font-mono); font-size: 18px; font-weight: 700; }

.presence-actions {
  display: flex; gap: 10px; margin-top: 18px; position: relative; z-index: 1;
}
.presence-actions .btn { flex: 1; }
.btn-ghost-light {
  background: rgba(255,255,255,0.1); color: #fff; border: 1px solid rgba(255,255,255,0.22);
}
.btn-ghost-light:hover { background: rgba(255,255,255,0.18); }

.jeda-list { margin-top: 14px; position: relative; z-index: 1; }
.jeda-list .jeda-item {
  display: flex; justify-content: space-between; font-size: 12.5px;
  padding: 7px 0; color: rgba(255,255,255,0.75); border-top: 1px dashed rgba(255,255,255,0.15);
}

/* ---------------------------------------------------------------------- */
/* 6. MENU GRID (Cuti / Izin / Lembur / Riwayat / dst)                    */
/* ---------------------------------------------------------------------- */
.menu-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
  margin-bottom: var(--gap-page);
}
@media (max-width: 380px) { .menu-grid { grid-template-columns: repeat(3, 1fr); } }

.menu-tile {
  background: var(--paper); border: 1px solid var(--ink-100); border-radius: var(--r-md);
  padding: 14px 6px 12px; display: flex; flex-direction: column; align-items: center; gap: 8px;
  text-align: center; transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.menu-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); border-color: var(--orange-100); }
.menu-tile__icon {
  width: 42px; height: 42px; border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  background: var(--orange-50); color: var(--orange-600);
}
.menu-tile__icon svg { width: 21px; height: 21px; }
.menu-tile span { font-size: 11.5px; font-weight: 600; color: var(--ink-700); line-height: 1.3; }
.menu-tile em {
  font-style: normal; font-size: 9.5px; font-weight: 700; color: var(--navy-900);
  background: var(--navy-50); padding: 1px 6px; border-radius: var(--r-full);
}

/* Variasi warna ikon menu */
.menu-tile--navy .menu-tile__icon { background: var(--navy-50); color: var(--navy-900); }
.menu-tile--green .menu-tile__icon { background: var(--success-100); color: var(--success-600); }
.menu-tile--amber .menu-tile__icon { background: var(--warning-100); color: var(--warning-600); }

/* ---------------------------------------------------------------------- */
/* 7. RINGKASAN / STAT MINI                                               */
/* ---------------------------------------------------------------------- */
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: var(--gap-page); }
.stat-box {
  background: var(--paper); border: 1px solid var(--ink-100); border-radius: var(--r-md);
  padding: 14px 12px; text-align: center;
}
.stat-box .v { font-family: var(--font-mono); font-size: 22px; font-weight: 700; color: var(--navy-900); }
.stat-box .l { font-size: 10.5px; color: var(--ink-500); margin-top: 3px; }

/* ---------------------------------------------------------------------- */
/* 8. BADGE STATUS UMUM (riwayat, pengajuan)                              */
/* ---------------------------------------------------------------------- */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: var(--r-full); font-size: 11.5px; font-weight: 700; }
.badge-success { background: var(--success-100); color: var(--success-600); }
.badge-warning { background: var(--warning-100); color: var(--warning-600); }
.badge-danger  { background: var(--danger-100); color: var(--danger-600); }
.badge-neutral { background: var(--ink-100); color: var(--ink-700); }

/* ---------------------------------------------------------------------- */
/* 9. TABEL RIWAYAT (list-card di mobile, table di desktop)               */
/* ---------------------------------------------------------------------- */
.list-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 0; border-top: 1px solid var(--ink-100);
}
.list-row:first-child { border-top: none; }
.list-row__date { font-size: 13px; font-weight: 600; color: var(--ink-900); }
.list-row__sub { font-size: 11.5px; color: var(--ink-500); margin-top: 2px; }
.list-row__meta { text-align: right; font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-700); }

/* ---------------------------------------------------------------------- */
/* 10. MODAL KAMERA PRESENSI                                              */
/* ---------------------------------------------------------------------- */
.camera-overlay {
  position: fixed; inset: 0; z-index: 100; background: rgba(9, 9, 26, 0.92);
  display: none; align-items: center; justify-content: center; padding: 18px;
}
.camera-overlay.is-open { display: flex; }
.camera-box {
  width: 100%; max-width: 420px; background: var(--ink-900); border-radius: var(--r-lg);
  overflow: hidden; position: relative;
}
.camera-box video, .camera-box canvas, .camera-box img.preview {
  width: 100%; aspect-ratio: 3/4; object-fit: cover; background: #000; display: block;
}
.camera-box canvas { display: none; }
.camera-frame {
  position: absolute; inset: 14px; border: 2px solid rgba(255,255,255,0.55); border-radius: var(--r-md);
  pointer-events: none;
}
.camera-head {
  position: absolute; top: 0; left: 0; right: 0; padding: 14px 16px;
  display: flex; justify-content: space-between; align-items: center;
  background: linear-gradient(to bottom, rgba(0,0,0,0.55), transparent);
  color: #fff; z-index: 2;
}
.camera-head button { background: none; border: none; color: #fff; }
.camera-head button svg { width: 22px; height: 22px; }
.camera-status {
  position: absolute; bottom: 96px; left: 0; right: 0; text-align: center;
  color: #fff; font-size: 12.5px; z-index: 2; padding: 0 24px;
}
.camera-controls {
  position: absolute; bottom: 0; left: 0; right: 0; padding: 18px 20px 22px;
  display: flex; align-items: center; justify-content: center; gap: 20px; z-index: 2;
}
.shutter-btn {
  width: 68px; height: 68px; border-radius: 50%; border: 4px solid #fff; background: transparent;
  display: flex; align-items: center; justify-content: center;
}
.shutter-btn::after { content: ""; width: 54px; height: 54px; background: #fff; border-radius: 50%; }
.shutter-btn:active::after { width: 46px; height: 46px; }
.retake-btn, .confirm-btn {
  display: none; padding: 10px 18px; border-radius: var(--r-full); border: none; font-weight: 700; font-size: 13.5px;
}
.retake-btn { background: rgba(255,255,255,0.15); color: #fff; }
.confirm-btn { background: var(--orange-600); color: #fff; }

/* ---------------------------------------------------------------------- */
/* 11. FLASH ALERT                                                        */
/* ---------------------------------------------------------------------- */
.alert {
  padding: 13px 16px; border-radius: var(--r-sm); font-size: 13.5px; margin-bottom: 16px;
  display: flex; align-items: flex-start; gap: 10px;
}
.alert-success { background: var(--success-100); color: var(--success-600); }
.alert-error { background: var(--danger-100); color: var(--danger-600); }
.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }

/* Toast (feedback aksi presensi via JS) */
#toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-height) + 16px); transform: translateX(-50%) translateY(20px);
  background: var(--ink-900); color: #fff; padding: 12px 18px; border-radius: var(--r-full);
  font-size: 13px; font-weight: 600; box-shadow: var(--shadow-lg); z-index: 200;
  opacity: 0; pointer-events: none; transition: opacity .25s ease, transform .25s ease;
  max-width: 88%; text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.error { background: var(--danger-600); }
#toast.success { background: var(--success-600); }

/* ---------------------------------------------------------------------- */
/* 12. EMPTY STATE                                                        */
/* ---------------------------------------------------------------------- */
.empty-state { text-align: center; padding: 30px 10px; color: var(--ink-500); }
.empty-state svg { width: 40px; height: 40px; margin: 0 auto 10px; stroke: var(--ink-300); }
.empty-state p { font-size: 13.5px; }

/* ---------------------------------------------------------------------- */
/* 13. PAGE HEADER (halaman sekunder: cuti/izin/lembur/riwayat)           */
/* ---------------------------------------------------------------------- */
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.page-head__back {
  width: 36px; height: 36px; border-radius: 50%; background: var(--paper); border: 1px solid var(--ink-100);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.page-head__back svg { width: 18px; height: 18px; }
.page-head h1 { font-size: 19px; }
.page-head p { font-size: 12.5px; color: var(--ink-500); margin-top: 2px; }

.info-banner {
  background: var(--orange-50); border: 1px solid var(--orange-100); border-radius: var(--r-md);
  padding: 14px 16px; font-size: 12.5px; color: var(--orange-700); margin-bottom: var(--gap-page);
  display: flex; gap: 10px; align-items: flex-start; line-height: 1.55;
}
.info-banner svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
