/* ============================================================
   Danantara Redemption — Brand Stylesheet
   Font: Poppins | Warna: maroon #5C0000/#A52A2A, aksen #D11927
   ============================================================ */
:root {
  --maroon-dark:   #5C0000;
  --maroon:        #800000;
  --maroon-light:  #A52A2A;
  --red:           #D11927;
  --bg:            #F4F7F5;
  --ink:           #333333;
  --muted:         #6b7280;
  --border:        #e5e7eb;
  --white:         #ffffff;
  --green:         #198754;
  --radius:        14px;
  --shadow:        0 4px 18px rgba(92,0,0,.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Poppins', sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container { width: min(1080px, 92%); margin-inline: auto; }
/* Kontainer lebih lebar untuk panel admin (layar fullHD) */
.container-wide { width: min(1440px, 96%); }
.main { flex: 1; padding-block: 28px; }

/* ---------- Header ---------- */
.site-header {
  background: var(--white);
  box-shadow: 0 1px 0 var(--border);
  position: sticky; top: 0; z-index: 50;
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding-block: 12px; flex-wrap: wrap;
}
.brand-logo { height: 42px; width: auto; display: block; }
.main-nav { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.main-nav a {
  color: var(--maroon-dark); text-decoration: none; font-weight: 500; font-size: .95rem;
}
.main-nav a:hover { color: var(--red); }
.nav-user { color: var(--muted); font-size: .9rem; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--maroon-dark);
  color: rgba(255,255,255,.75);
  padding-block: 28px;
  text-align: center;
  margin-top: auto;
}
.footer-logo { height: 34px; width: auto; opacity: .9; margin-bottom: 8px; }
.site-footer p { font-size: .85rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border-radius: 10px; border: 1px solid transparent;
  font-family: inherit; font-size: .95rem; font-weight: 600; cursor: pointer;
  text-decoration: none; transition: filter .15s, transform .05s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--maroon-dark); color: #fff; }
.btn-red     { background: var(--red); color: #fff; }
.btn-outline { background: transparent; border-color: var(--maroon-dark); color: var(--maroon-dark); }
.btn-outline:hover { background: var(--maroon-dark); color: #fff; }
.btn-light   { background: #fff; color: var(--maroon-dark); }
.btn-block   { width: 100%; }
.btn-sm      { padding: 8px 14px; font-size: .85rem; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Cards ---------- */
.card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px;
}
.card + .card { margin-top: 20px; }
.card-title { color: var(--maroon-dark); font-weight: 700; margin-bottom: 12px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; }
.stat-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.stat-value { font-size: 1.8rem; font-weight: 800; color: var(--maroon-dark); }
.stat-label { color: var(--muted); font-size: .85rem; }

/* ---------- Admin dashboard cards ---------- */
.admin-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px; }
.admin-card {
  display: flex; align-items: center; gap: 16px;
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); text-decoration: none;
  transition: transform .12s ease, box-shadow .12s ease;
}
.admin-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(92,0,0,.12); }
.admin-card-icon {
  flex: none; width: 52px; height: 52px; border-radius: 14px;
  display: inline-flex; align-items: center; justify-content: center;
}
.admin-card-icon svg { width: 26px; height: 26px; }
.admin-card-title { display: block; font-weight: 700; color: var(--maroon-dark); font-size: 1.02rem; }
.admin-card-desc { display: block; color: var(--muted); font-size: .8rem; margin-top: 2px; line-height: 1.4; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; color: var(--maroon-dark); font-size: .9rem; }
.form-control {
  width: 100%; padding: 12px 14px; border: 1px solid var(--border);
  border-radius: 10px; font-family: inherit; font-size: .95rem; background: #fff; color: var(--ink);
}
.form-control:focus { outline: 2px solid var(--maroon-light); outline-offset: 1px; }
.form-control-sm { padding: 8px 14px; font-size: .85rem; border-radius: 8px; }
.form-control.is-invalid { border-color: var(--red); background: #fff5f5; }
.form-control.is-invalid:focus { outline-color: var(--red); }
.form-hint { font-size: .8rem; color: var(--muted); margin-top: 4px; }
.form-error { color: var(--red); font-size: .85rem; margin-top: 4px; }

/* ---------- Select lokasi dengan pencarian di dalam dropdown ---------- */
.combobox { position: relative; }
.combobox-toggle {
  width: 100%; padding: 8px 14px; border: 1px solid var(--border);
  border-radius: 8px; font-family: inherit; font-size: .85rem; background: #fff;
  color: var(--ink); cursor: pointer; display: flex; align-items: center;
  justify-content: space-between; gap: 8px; text-align: left;
}
.combobox-toggle:focus { outline: 2px solid var(--maroon-light); outline-offset: 1px; }
.combobox-toggle .combobox-placeholder { color: var(--muted); }
.combobox-caret { color: var(--muted); font-size: .8rem; flex-shrink: 0; }
.combobox-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 60;
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.14); padding: 6px;
}
.combobox-search {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border);
  border-radius: 8px; font-family: inherit; font-size: .9rem; margin-bottom: 6px;
}
.combobox-search:focus { outline: 2px solid var(--maroon-light); outline-offset: 1px; }
.combobox-list { list-style: none; margin: 0; padding: 0; max-height: 250px; overflow-y: auto; }
.combobox-list li { padding: 9px 12px; border-radius: 8px; cursor: pointer; font-size: .9rem; }
.combobox-list li:hover { background: var(--maroon-light); color: #fff; }
.combobox-list .combobox-empty { color: var(--muted); cursor: default; }
.combobox-list .combobox-empty:hover { background: transparent; color: var(--muted); }

/* ---------- Preview foto bukti ---------- */
.foto-preview { margin-top: 8px; }
.foto-preview img {
  max-width: 100%; max-height: 240px; display: block;
  border: 1px solid var(--border); border-radius: 10px; object-fit: cover;
}

/* ---------- Thumbnail bukti (admin, dibuka Fancybox) ---------- */
.proof-thumb-link { display: inline-block; line-height: 0; }
.proof-thumb {
  width: 52px; height: 52px; object-fit: cover; border-radius: 8px;
  border: 1px solid var(--border); cursor: zoom-in; transition: opacity .15s;
}
.proof-thumb:hover { opacity: .8; }

/* ---------- Alerts ---------- */
.alert { padding: 14px 18px; border-radius: 10px; margin-bottom: 18px; font-size: .92rem; font-weight: 500; }
.alert-error   { background: #fde8e8; color: var(--maroon); border: 1px solid #f5c2c2; }
.alert-success { background: #e6f4ea; color: #0f5132; border: 1px solid #bfe3cc; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); }
.table th { color: var(--maroon-dark); font-weight: 600; background: #faf6f6; white-space: nowrap; }
.table tr:hover td { background: #fdfafa; }

/* ---------- Badge ---------- */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: .75rem; font-weight: 600;
}
.badge-red    { background: #fde8e8; color: var(--maroon); }
.badge-green  { background: #e6f4ea; color: #0f5132; }
.badge-gray   { background: #eef0f2; color: var(--muted); }

/* ---------- Hero (landing) ---------- */
.hero {
  background: linear-gradient(135deg, var(--maroon-dark) 0%, var(--maroon-light) 55%, var(--red) 100%);
  color: #fff; padding: 64px 0; text-align: center; border-radius: 0 0 24px 24px;
}
.hero h1 { font-size: 2.2rem; font-weight: 800; margin-bottom: 8px; }
.hero p { font-size: 1.05rem; opacity: .92; margin-bottom: 24px; }
.auth-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.hero .btn-light { box-shadow: 0 6px 20px rgba(0,0,0,.18); }

.info-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; margin-top: 26px; }
.info-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.info-card h3 { color: var(--maroon-dark); font-size: 1rem; margin-bottom: 6px; }
.info-card p { font-size: .88rem; color: var(--muted); }

/* ---------- Auth panel ---------- */
.auth-wrap { max-width: 460px; margin: 24px auto; }
.auth-logo { height: 46px; width: auto; display: block; margin: 0 auto 18px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .85rem; margin: 18px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.btn-google {
  background: #fff; border: 1px solid var(--border); color: var(--ink);
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.btn-google img { height: 20px; width: 20px; }

/* ---------- QR / Dashboard ---------- */
.qr-box {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; display: inline-block; box-shadow: var(--shadow);
}
.qr-box img { width: 220px; height: 220px; display: block; }
.qr-token { font-size: .75rem; color: var(--muted); word-break: break-all; margin-top: 10px; }

/* ---------- Scanner ---------- */
.scanner-wrap { position: relative; border-radius: var(--radius); overflow: hidden; background: #000; }
#scanner-video { width: 100%; display: block; }
#scanner-canvas { display: none; }
.scan-overlay {
  position: absolute; inset: 0; pointer-events: none;
  border: 3px solid var(--red); border-radius: 12px; margin: 12%;
}

/* ---------- Misc ---------- */
.text-muted { color: var(--muted); }
.text-center { text-align: center; }
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 16px; } .mt-4 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 16px; }
.flex { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

/* ---------- Input group (file input + tombol MENYATU) ---------- */
.input-group { display: flex; align-items: stretch; }
.input-group > .form-control {
  flex: 1 1 auto; width: auto; min-width: 0;
  border-top-right-radius: 0; border-bottom-right-radius: 0;
}
.input-group > .btn {
  flex: 0 0 auto; white-space: nowrap;
  border-top-left-radius: 0; border-bottom-left-radius: 0;
  margin-left: -1px;
}
.btn svg { width: 15px; height: 15px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.kupon-preview { font-size: 2rem; font-weight: 800; color: var(--red); }

/* ---------- Catat Redemption (desktop / laptop) ---------- */
.redemption-grid { grid-template-columns: minmax(360px, 1fr) minmax(440px, 1fr); align-items: start; }
/* Kartu yang menjadi item grid tidak kena margin-atas antar-saudara (agar sejajar) */
.grid-2 > .card + .card { margin-top: 0; }
.nik-status { border-radius: 8px; padding: 8px 12px; margin-bottom: 14px; font-size: .85rem; font-weight: 500; }
.nik-check  { background: #fff8e6; color: #9a6a00; border: 1px solid #f0dfa8; }
.nik-ok     { background: #e6f4ea; color: #0f5132; border: 1px solid #bfe3cc; }
.nik-new    { background: #fff0e6; color: #b15a00; border: 1px solid #f5cfae; }
.nik-err    { background: #fde8e8; color: var(--maroon); border: 1px solid #f5c2c2; }
#form-errors .alert { margin-bottom: 12px; }

/* ---------- Modal Catat Redemption ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0, 0, 0, .5);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 28px 20px; overflow-y: auto;
}
.modal-overlay[hidden] { display: none; }
.modal {
  background: var(--white); border-radius: var(--radius);
  box-shadow: 0 20px 50px rgba(0, 0, 0, .3);
  width: 100%; max-width: 1080px;
  max-height: calc(100vh - 56px);
  display: flex; flex-direction: column;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 1.2rem; font-weight: 700; color: var(--maroon-dark); margin: 0; }
.modal-close {
  border: none; background: transparent; font-size: 1.6rem; line-height: 1;
  color: var(--muted); cursor: pointer; padding: 2px 8px; border-radius: 6px;
}
.modal-close:hover { color: var(--maroon); background: #f3f3f3; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-overlay-top { z-index: 1010; }
.modal-sm { max-width: 440px; }

@media (max-width: 640px) {
  .header-inner { flex-direction: column; align-items: flex-start; }
  .hero h1 { font-size: 1.7rem; }
  .stat-value { font-size: 1.4rem; }
  /* Beri ruang di tepi untuk kartu login/daftar di layar kecil */
  .auth-wrap { padding-inline: 16px; }
}
