@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --brand: #4f46e5;
  --brand-dark: #4338ca;
  --brand-light: #eef2ff;
  --ink: #1e293b;
  --muted: #64748b;
  --bg: #f5f6fb;
  --border: #e6e8f0;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(16,24,40,.06);
  --shadow-md: 0 4px 16px rgba(16,24,40,.08);
}

* { box-sizing: border-box; }

body {
  background: var(--bg);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--ink);
  font-size: 0.925rem;
}

h1,h2,h3,h4,h5,h6 { font-weight: 700; letter-spacing: -0.01em; }

a { text-decoration: none; }

/* ---------- Layout ---------- */
#wrapper { min-height: 100vh; }

#sidebar {
  width: 264px;
  min-height: 100vh;
  background: #14152b;
  background: linear-gradient(180deg, #171833 0%, #10112a 100%);
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  overflow-y: auto;
}
#sidebar .brand {
  padding: 1.35rem 1.25rem;
  display: flex;
  align-items: center;
  gap: .6rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
#sidebar .brand .logo-badge {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), #7c3aed);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.1rem;
  flex-shrink: 0;
}
#sidebar .brand-text { color: #fff; font-weight: 800; font-size: 1.05rem; line-height: 1.1; }
#sidebar .brand-text small { display:block; color: rgba(255,255,255,.5); font-weight: 500; font-size: .7rem; }

#sidebar .nav { padding: .9rem .8rem; }
#sidebar .nav-link {
  color: rgba(255,255,255,.72);
  border-radius: 10px;
  padding: .62rem .85rem;
  margin-bottom: .2rem;
  font-weight: 500;
  font-size: .89rem;
  display: flex; align-items: center; gap: .7rem;
  transition: background .15s ease, color .15s ease;
}
#sidebar .nav-link i { font-size: 1.05rem; width: 20px; text-align: center; }
#sidebar .nav-link:hover { background: rgba(255,255,255,.07); color: #fff; }
#sidebar .nav-link.active { background: var(--brand); color: #fff; box-shadow: var(--shadow-sm); }
#sidebar .sidebar-divider { border-color: rgba(255,255,255,.1); margin: 0 1.1rem; }

/* Topbar */
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: .7rem 1.25rem;
  position: sticky;
  top: 0;
  z-index: 1020;
}
.avatar-circle {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--brand-light); color: var(--brand);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .9rem;
}

main.content-area { padding: 1.5rem; max-width: 1400px; }

/* ---------- Cards ---------- */
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-header {
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  border-top-left-radius: var(--radius) !important;
  border-top-right-radius: var(--radius) !important;
}

.card-stat { border: none; border-radius: 16px; box-shadow: var(--shadow-md); overflow: hidden; position: relative; }
.card-stat .stat-icon {
  position: absolute; right: .9rem; top: .9rem;
  width: 42px; height: 42px; border-radius: 12px;
  background: rgba(255,255,255,.18);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
}
.card-stat .stat-label { font-size: .78rem; opacity: .9; font-weight: 500; }
.card-stat .stat-value { font-size: 1.55rem; font-weight: 800; margin-top: .15rem; }

/* ---------- Buttons ---------- */
.btn { border-radius: 10px; font-weight: 600; font-size: .875rem; }
.btn-primary { background: var(--brand); border-color: var(--brand); }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }

.accordion-button:not(.collapsed) { background: var(--brand-light); color: var(--brand-dark); box-shadow: none; }
.accordion-button:focus { box-shadow: 0 0 0 .2rem rgba(79,70,229,.15); border-color: var(--brand); }
.accordion-button::after { flex-shrink: 0; }
.btn-sm { border-radius: 8px; }

/* ---------- Forms ---------- */
.form-control, .form-select {
  border-radius: 10px;
  border-color: var(--border);
  padding: .55rem .8rem;
  font-size: .9rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 .2rem rgba(79,70,229,.15);
}
.form-label { font-weight: 600; font-size: .85rem; color: var(--ink); margin-bottom: .35rem; }

/* ---------- Tables ---------- */
.table thead th {
  white-space: nowrap;
  font-size: .76rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  background: #fafbfe;
  border-bottom-width: 1px;
}
.table td { vertical-align: middle; font-size: .875rem; }
.table-hover tbody tr:hover { background: #fafbff; }

.badge { font-weight: 600; font-size: .72rem; padding: .4em .65em; border-radius: 7px; }

/* ---------- Auth pages (login/register/otp) ---------- */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top left, #6d5bf6 0%, #4338ca 45%, #1e1b4b 100%);
  padding: 1.25rem;
}
.auth-card {
  width: 100%;
  max-width: 460px;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(15,15,40,.35);
  padding: 2.1rem 2rem;
}
.auth-card.auth-card-wide { max-width: 620px; }
.auth-logo {
  width: 52px; height: 52px; border-radius: 14px;
  background: linear-gradient(135deg, var(--brand), #7c3aed);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.4rem; margin: 0 auto .9rem;
}

/* ---------- Split-panel login (kiri branding, kanan form) ---------- */
.auth-split {
  width: 100%;
  max-width: 900px;
  min-height: 560px;
  background: #fff;
  border-radius: 22px;
  box-shadow: 0 25px 70px rgba(15,15,40,.4);
  display: flex;
  overflow: hidden;
}
.auth-split-left {
  flex: 0 0 42%;
  background: linear-gradient(160deg, var(--brand) 0%, #6d28d9 55%, #312e81 100%);
  color: #fff;
  padding: 2.75rem 2.25rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.auth-split-left .auth-logo { margin: 0 0 1.1rem; background: rgba(255,255,255,.16); }
.auth-split-left h1 { font-size: 1.65rem; font-weight: 800; margin-bottom: .85rem; }
.auth-split-left p.lead-desc { color: rgba(255,255,255,.85); font-size: .92rem; line-height: 1.55; margin-bottom: 1.75rem; }
.auth-feature-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .85rem; }
.auth-feature-list li { display: flex; align-items: flex-start; gap: .65rem; font-size: .87rem; color: rgba(255,255,255,.92); }
.auth-feature-list .feature-icon {
  width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0;
  background: rgba(255,255,255,.14);
  display: flex; align-items: center; justify-content: center; font-size: .95rem;
}
.auth-split-right { flex: 1; padding: 2.75rem 2.5rem; display: flex; flex-direction: column; justify-content: center; }
.auth-split-right h2 { font-size: 1.35rem; font-weight: 800; margin-bottom: .3rem; }
.auth-split-right .subtitle { color: var(--muted); font-size: .88rem; margin-bottom: 1.5rem; }
.auth-input-icon { position: relative; }
.auth-input-icon .form-control { padding-left: 2.6rem; }
.auth-input-icon .input-icon-glyph {
  position: absolute; left: .9rem; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: 1rem; pointer-events: none;
}
.auth-demo-box {
  background: var(--brand-light);
  border: 1px solid #d9d6fb;
  border-radius: 12px;
  padding: .85rem 1rem;
  font-size: .8rem;
  color: var(--ink);
}
.auth-demo-box strong { color: var(--brand-dark); }
@media (max-width: 767.98px) {
  .auth-split { flex-direction: column; max-width: 460px; min-height: 0; }
  .auth-split-left { padding: 2rem 1.75rem 1.5rem; }
  .auth-split-right { padding: 2rem 1.75rem; }
}

/* ---------- Mobile responsive table -> card list ---------- */
@media (max-width: 767.98px) {
  .table-cards thead { display: none; }
  .table-cards, .table-cards tbody, .table-cards tr, .table-cards td { display: block; width: 100%; }
  .table-cards tr {
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: .75rem;
    padding: .75rem .9rem;
    background: #fff;
  }
  .table-cards td {
    border: none;
    padding: .3rem 0;
    display: flex;
    justify-content: space-between;
    gap: .75rem;
    text-align: right;
  }
  .table-cards td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--muted);
    font-size: .74rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    text-align: left;
  }
  .table-cards td.td-actions { justify-content: flex-end; padding-top: .5rem; }
  .table-cards td.td-actions::before { content: none; }
  main.content-area { padding: 1rem; }
}

/* Flash toast */
.alert { border-radius: 12px; border: none; box-shadow: var(--shadow-sm); }

/* Misc */
.text-brand { color: var(--brand) !important; }
.bg-brand { background: var(--brand) !important; }
.rounded-xl { border-radius: var(--radius) !important; }

/* ---------- Loading Overlay (global, muncul saat submit/navigasi/fetch) ---------- */
#pageLoadingOverlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(1.5px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity .15s ease;
}
#pageLoadingOverlay.active { opacity: 1; visibility: visible; }
#pageLoadingOverlay .loading-box {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(16,24,40,.18);
  padding: 1.4rem 1.8rem;
  display: flex;
  align-items: center;
  gap: .85rem;
  font-weight: 600;
  color: var(--ink);
  font-size: .9rem;
}
#pageLoadingOverlay .loading-spinner {
  width: 26px; height: 26px;
  border: 3px solid var(--brand-light);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: page-spin .7s linear infinite;
  flex-shrink: 0;
}
@keyframes page-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  #pageLoadingOverlay .loading-spinner { animation-duration: 1.4s; }
}

/* ---------- Portal Pelacakan Publik (lacak/index.php) ---------- */
.track-card { width: 100%; max-width: 560px; background: #fff; border-radius: 20px; box-shadow: 0 20px 60px rgba(15,15,40,.35); padding: 1.75rem; }
.track-input {
  text-align: center; font-weight: 700; font-size: 1.3rem; letter-spacing: .35em;
  text-transform: uppercase; border-radius: 12px;
}

.status-stepper { display: flex; justify-content: space-between; margin: 1.5rem 0 1.75rem; position: relative; }
.status-stepper::before {
  content: ''; position: absolute; top: 17px; left: 6%; right: 6%; height: 3px; background: var(--border); z-index: 0;
}
.status-stepper .step { position: relative; z-index: 1; flex: 1; text-align: center; }
.status-stepper .step .dot {
  width: 36px; height: 36px; border-radius: 50%; background: #fff; border: 3px solid var(--border);
  display: flex; align-items: center; justify-content: center; margin: 0 auto .5rem; color: var(--muted); font-size: 1rem;
  transition: all .2s ease;
}
.status-stepper .step.done .dot { background: var(--brand); border-color: var(--brand); color: #fff; }
.status-stepper .step.current .dot { background: #fff; border-color: var(--brand); color: var(--brand); box-shadow: 0 0 0 4px var(--brand-light); }
.status-stepper .step .label { font-size: .72rem; font-weight: 600; color: var(--muted); }
.status-stepper .step.done .label, .status-stepper .step.current .label { color: var(--ink); }
@media (max-width: 480px) {
  .status-stepper .step .label { font-size: .62rem; }
  .status-stepper .step .dot { width: 30px; height: 30px; }
}
