/* ========================================================
   PROPAM YANDUAN PREISIS PRO - Custom Stylesheet
   Tema: Navy (#0B192C) + Gold (#D4AF37)
   ======================================================== */

:root {
  --propam-navy: #0B192C;
  --propam-dark: #030A14;
  --propam-accent: #1E3E62;
  --propam-gold: #D4AF37;
  --propam-goldlight: #F3E5AB;
  --propam-card: #162942;
  --page-bg: #050a14;
  --sidebar-w: 260px;
}

* { -webkit-tap-highlight-color: transparent; }

html, body {
  color: #e2e8f0;
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Body: dark background, fills entire viewport on all devices */
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: #030a14;
  background-attachment: fixed;
}

/* ===== Scrollbar ===== */
.mobile-scroll::-webkit-scrollbar { width: 4px; height: 4px; }
.mobile-scroll::-webkit-scrollbar-track { background: rgba(11,25,44,.1); }
.mobile-scroll::-webkit-scrollbar-thumb { background: rgba(212,175,55,.4); border-radius: 4px; }
.mobile-scroll { scrollbar-width: thin; scrollbar-color: rgba(212,175,55,.3) transparent; }

/* ===== App Shell — fluid full-screen on ALL devices (no frame) ===== */
.app-shell {
  /* Fill entire viewport on mobile */
  width: 100%;
  height: 100vh;
  height: 100dvh;
  background: #030a14;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* On tablet (≥640px) & desktop (≥1024px): center with max-width */
@media (min-width: 640px) {
  body {
    display: flex;
    align-items: center;
    justify-content: center;
    background:
      radial-gradient(circle at 20% 30%, rgba(212,175,55,.05) 0%, transparent 50%),
      radial-gradient(circle at 80% 70%, rgba(30,62,98,.18) 0%, transparent 50%),
      #050a14;
  }
  .app-shell {
    width: 100%;
    max-width: 480px;
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
  }
}

@media (min-width: 1024px) {
  .app-shell {
    max-width: 520px;
  }
}

/* Camera notch removed entirely (real devices have their own) */
.camera-notch { display: none !important; }

/* ===== Bottom Navigation — FIXED at viewport bottom (APK-friendly) ===== */
/* position:fixed ensures nav always visible even in WebView/APK scenarios
   where 100dvh flex layout may behave inconsistently. */
.bottom-nav {
  position: fixed !important;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: #0B192C;
  border-top: 1px solid #1e293b;
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -4px 12px rgba(0,0,0,.3);
  /* Removed from flex flow — app-body fills entire shell height */
}

/* On tablet/desktop: constrain width to match app-shell and center horizontally */
@media (min-width: 640px) {
  .bottom-nav {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    border-left: 1px solid #1e293b;
    border-right: 1px solid #1e293b;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }
}
@media (min-width: 1024px) {
  .bottom-nav { max-width: 520px; }
}

/* App body: extra padding-bottom so content scrolls clear of fixed nav.
   Nav height ≈ 56px (py-1.5 + pill 28px + label 14px) + 12px breathing room */
#app-body {
  padding-bottom: calc(72px + env(safe-area-inset-bottom)) !important;
}

/* ===== Ripple ===== */
.ripple { position: relative; overflow: hidden; transform: translateZ(0); transition: transform .1s ease; cursor: pointer; }
.ripple:active { transform: scale(.97); }

/* ===== Animations ===== */
@keyframes bounce-in {
  0% { transform: translateY(40px); opacity: 0; }
  60% { transform: translateY(-4px); opacity: 1; }
  100% { transform: translateY(0); opacity: 1; }
}
.animate-bounce-in { animation: bounce-in .35s cubic-bezier(.34,1.56,.64,1) both; }

@keyframes fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.animate-fade-in { animation: fade-in .25s ease-out both; }

/* ===== Snackbar ===== */
.snackbar {
  position: fixed; bottom: 90px; left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #1e293b; color: #fde68a;
  padding: 12px 20px; border-radius: 12px;
  border: 1px solid rgba(212,175,55,.4);
  box-shadow: 0 10px 25px rgba(0,0,0,.5);
  font-size: 13px; z-index: 100;
  opacity: 0; pointer-events: none;
  transition: all .3s ease;
  max-width: 90vw;
}
@media (min-width: 640px) {
  .snackbar { bottom: 24px; }
}
.snackbar.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1; pointer-events: auto;
}
.snackbar.error { color: #fca5a5; border-color: rgba(239,68,68,.4); }
.snackbar.success { color: #86efac; border-color: rgba(34,197,94,.4); }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(2,6,12,.8);
  backdrop-filter: blur(4px);
  z-index: 50;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  animation: fade-in .2s ease-out;
}
.modal-overlay[hidden] { display: none; }
.modal-card {
  background: #0f172a; border: 1px solid #334155;
  border-radius: 16px; padding: 20px;
  width: 100%; max-width: 28rem;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,.6);
  max-height: 90vh; overflow-y: auto;
}
@media (max-width: 640px) {
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal-card { border-radius: 24px 24px 0 0; max-width: 100%; }
}

/* ===== Form inputs ===== */
.propam-input, .propam-select, .propam-textarea {
  width: 100%;
  background: #030a14;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  color: #fff;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}
.propam-input:focus, .propam-select:focus, .propam-textarea:focus {
  border-color: #D4AF37;
  box-shadow: 0 0 0 3px rgba(212,175,55,.15);
}
.propam-select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23D4AF37' stroke-width='2'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
.propam-textarea { resize: vertical; min-height: 80px; }
.propam-label {
  display: block; font-size: 12px; font-weight: 600;
  color: #cbd5e1; margin-bottom: 6px;
}

/* ===== Officer Layout (sidebar) ===== */
.officer-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}
.officer-sidebar {
  background: #0B192C;
  border-right: 1px solid #1e293b;
  position: sticky; top: 0;
  height: 100vh;
  display: flex; flex-direction: column;
  padding: 20px 0;
  overflow-y: auto;
}
.officer-main {
  padding: 24px 32px;
  max-width: 100%;
  overflow-x: hidden;
}
@media (max-width: 768px) {
  .officer-layout { grid-template-columns: 1fr; }
  .officer-sidebar {
    position: fixed; top: 0; left: 0;
    width: var(--sidebar-w); z-index: 50;
    transform: translateX(-100%);
    transition: transform .25s ease;
  }
  .officer-sidebar.open { transform: translateX(0); }
  .officer-main { padding: 16px; }
  .sidebar-toggle { display: block !important; }
}
.sidebar-toggle { display: none; }

.sidebar-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px;
  color: #cbd5e1;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: all .15s;
}
.sidebar-link:hover { background: rgba(212,175,55,.05); color: #fde68a; }
.sidebar-link.active {
  background: rgba(212,175,55,.1);
  color: #D4AF37;
  border-left-color: #D4AF37;
  font-weight: 600;
}

/* ===== Stats Card ===== */
.stat-card {
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: 12px;
  padding: 16px;
  transition: border-color .15s;
}
.stat-card:hover { border-color: rgba(212,175,55,.3); }
.stat-card-label { font-size: 11px; color: #94a3b8; text-transform: uppercase; letter-spacing: .05em; }
.stat-card-value { font-size: 24px; font-weight: 800; margin-top: 4px; }

/* ===== Table ===== */
.officer-table-wrap {
  max-height: 600px; overflow: auto;
  border: 1px solid #1e293b; border-radius: 12px;
}
.officer-table-wrap thead th {
  position: sticky; top: 0;
  background: #0B192C; z-index: 1;
}

/* ===== Timeline ===== */
.timeline { position: relative; padding-left: 24px; }
.timeline::before {
  content: ''; position: absolute;
  left: 8px; top: 8px; bottom: 8px;
  width: 2px; background: #1e293b;
}
.timeline-step { position: relative; padding-bottom: 16px; }
.timeline-step:last-child { padding-bottom: 0; }
.timeline-dot {
  position: absolute; left: -22px; top: 2px;
  width: 16px; height: 16px;
  border-radius: 50%; border: 2px solid #0f172a;
  display: flex; align-items: center; justify-content: center;
  font-size: 8px; font-weight: bold;
}
@keyframes pulse-dot { 0%,100% { opacity: 1; } 50% { opacity: .5; } }
.pulse-dot { animation: pulse-dot 1.5s ease-in-out infinite; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px;
  font-size: 13px; font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer; transition: all .15s;
  text-decoration: none;
  font-family: inherit;
}
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary { background: #D4AF37; color: #0B192C; }
.btn-primary:hover:not(:disabled) { background: #E5C25A; }
.btn-secondary { background: #1e293b; color: #cbd5e1; border-color: #334155; }
.btn-secondary:hover:not(:disabled) { background: #334155; color: #fff; }
.btn-danger { background: #991b1b; color: #fee2e2; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }
.btn-success { background: #16a34a; color: #f0fdf4; }
.btn-success:hover:not(:disabled) { background: #15803d; }
.btn-outline { background: transparent; color: #D4AF37; border-color: rgba(212,175,55,.4); }
.btn-outline:hover:not(:disabled) { background: rgba(212,175,55,.1); }

/* ===== Pagination ===== */
.pagination {
  display: flex; gap: 4px; flex-wrap: wrap;
  justify-content: center;
}
.pagination a, .pagination span {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 32px; height: 32px; padding: 0 8px;
  border: 1px solid #334155; border-radius: 6px;
  font-size: 12px; color: #cbd5e1; text-decoration: none;
}
.pagination a:hover { background: #1e293b; }
.pagination .current { background: #D4AF37; color: #0B192C; border-color: #D4AF37; font-weight: 700; }

/* ===== Print ===== */
@media print {
  body * { visibility: hidden; }
  #printable-ticket, #printable-ticket * { visibility: visible; }
  #printable-ticket {
    position: absolute; left: 0; top: 0;
    width: 100%; color: #000; background: #fff;
    padding: 32px; font-family: Georgia, serif;
  }
}

/* ===== Login page ===== */
.login-bg {
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 30%, rgba(212,175,55,.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(30,62,98,.4) 0%, transparent 50%),
    #050a14;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}

/* ===== Badges ===== */
.badge {
  display: inline-block;
  padding: 2px 8px; border-radius: 999px;
  font-size: 10px; font-weight: 700;
  border: 1px solid;
}
.badge-success { background: rgba(34,197,94,.15); color: #86efac; border-color: rgba(34,197,94,.4); }
.badge-warning { background: rgba(245,158,11,.15); color: #fcd34d; border-color: rgba(245,158,11,.4); }
.badge-danger  { background: rgba(239,68,68,.15); color: #fca5a5; border-color: rgba(239,68,68,.4); }
.badge-info    { background: rgba(59,130,246,.15); color: #93c5fd; border-color: rgba(59,130,246,.4); }
.badge-purple  { background: rgba(168,85,247,.15); color: #d8b4fe; border-color: rgba(168,85,247,.4); }
.badge-muted   { background: rgba(100,116,139,.15); color: #cbd5e1; border-color: rgba(100,116,139,.4); }

/* ===== Toast variant ===== */
.toast-error { color: #fca5a5; border-color: rgba(239,68,68,.5) !important; }
