/* =====================================================================
   Portal Pintas — Tema Hijau Zamrud (#1c554a) + tombol 3D
   Font: Roboto | Lembut, elegan, ringan, mobile-first (Android-friendly)
   - Kategori & submenu: tombol hijau blok penuh bergaya 3D
   - Header beranimasi (aurora / gelembung)
   - Efek tekan & ripple pada tombol
   ===================================================================== */
:root {
  --bg:        #eef3f0;
  --card:      #ffffff;
  --text:      #24342e;
  --muted:     #65796f;
  --primary:   #1c554a;
  --primary-d: #143f37;
  --accent:    #e2ece6;
  --border:    #d8e3dd;
  --danger:    #b97f73;
  --danger-d:  #a76b60;
  --radius:    18px;
  --shadow:    0 6px 18px rgba(20, 50, 40, 0.07);
  --grad-primary: linear-gradient(135deg, #1c554a 0%, #2f7d6b 100%);
  --grad-primary-d: linear-gradient(135deg, #143f37 0%, #256454 100%);
  --grad-header: linear-gradient(135deg, #123f36 0%, #1c554a 45%, #2f7d6b 100%);
  --font: 'Roboto', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100vh; }

/* ==================== HEADER ==================== */
.site-header {
  position: relative;
  overflow: hidden;
  color: #ffffff;
  background: var(--grad-header);
  border-radius: 0 0 24px 24px;
  padding: 22px 16px 20px;
  box-shadow: var(--shadow);
}

.hdr-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.hdr-logo {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-weight: 900;
  font-size: 1.3rem;
  letter-spacing: 1px;
  box-shadow: 0 4px 14px rgba(10, 35, 28, 0.22);
  overflow: hidden;
  flex-shrink: 0;
}

.hdr-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: 0.6px;
  text-shadow: 0 1px 6px rgba(5, 25, 20, 0.35);
}

/* Lapisan animasi */
.hdr-anim {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.anim-aurora::before,
.anim-aurora::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(26px);
  opacity: 0.5;
}
.anim-aurora::before {
  width: 70vmin;
  height: 70vmin;
  left: -14%;
  top: -80%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.55), transparent 62%);
  animation: driftA 16s ease-in-out infinite alternate;
}
.anim-aurora::after {
  width: 85vmin;
  height: 85vmin;
  right: -20%;
  bottom: -140%;
  background: radial-gradient(circle at 70% 70%, rgba(180,235,210,0.45), transparent 60%);
  animation: driftB 21s ease-in-out infinite alternate;
}
@keyframes driftA {
  from { transform: translate3d(0,0,0) scale(1); }
  to   { transform: translate3d(26%, 36%, 0) scale(1.16); }
}
@keyframes driftB {
  from { transform: translate3d(0,0,0) scale(1.1); }
  to   { transform: translate3d(-22%, -32%, 0) scale(0.94); }
}

.anim-bubbles .bub {
  position: absolute;
  bottom: -30px;
  border-radius: 50%;
  background: rgba(210, 245, 230, 0.28);
  animation: bubUp linear infinite;
}
@keyframes bubUp {
  from { transform: translateY(0); opacity: 0; }
  12%  { opacity: 0.6; }
  to   { transform: translateY(-260px); opacity: 0; }
}

/* ==================== BAR ADMIN ==================== */
.admin-bar {
  display: flex;
  gap: 8px;
  padding: 12px 16px 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.admin-bar::-webkit-scrollbar { display: none; }

.bar-btn {
  background: #ffffff;
  border: 1px solid #cfe0d7;
  border-bottom-width: 3px;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  flex: 0 0 auto;
  box-shadow: 0 2px 6px rgba(20, 50, 40, 0.08);
}
.bar-btn:active { background: var(--accent); transform: translateY(1px); }

/* ==================== PEMBERITAHUAN ADMIN ==================== */
.admin-alert {
  margin: 12px 16px 0;
  padding: 12px 16px;
  background: #fffdf5;
  border: 1px solid #e8dfb8;
  border-left: 4px solid #c9a227;
  border-radius: 12px;
  color: #6b5a1c;
  font-size: 0.84rem;
  line-height: 1.6;
}
.admin-alert code {
  background: rgba(0, 0, 0, 0.06);
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 0.82rem;
  word-break: break-all;
}
.admin-alert small { opacity: 0.85; }
.admin-alert.danger {
  background: #fbf0ee;
  border-color: #efdcd7;
  border-left-color: #c0563f;
  color: #8e4436;
}

/* ==================== GRID (kolom tunggal) ==================== */
.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  padding: 14px 16px 10px;
}

/* ==================== KATEGORI: TOMBOL 3D HIJAU ==================== */
.cat-card {
  display: flex;
  flex-direction: column;
}

/* Tombol kategori (blok hijau penuh + efek timbul 3D) */
.dd-toggle {
  width: 100%;
  background: var(--primary);
  color: #ffffff;
  border: 1px solid var(--primary-d);
  border-radius: 14px;
  padding: 14px 16px;
  min-height: 54px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  box-shadow:
    0 5px 0 0 #123f36,
    0 9px 16px rgba(18, 63, 54, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    inset 0 -2px 0 rgba(0, 0, 0, 0.16);
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.2s ease;
}
.dd-toggle:active {
  transform: translateY(4px);
  box-shadow:
    0 1px 0 0 #123f36,
    0 3px 8px rgba(18, 63, 54, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.cat-card.open .dd-toggle { background: #17483e; }

.dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  flex-shrink: 0;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.12);
}

.dd-label {
  flex: 1;
  min-width: 0;
  font-size: 1rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.22);
}

.chev {
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.95rem;
  transition: transform 0.28s ease;
  flex-shrink: 0;
}
.cat-card.open .chev { transform: rotate(180deg) translateY(-1px); }

.dd-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.34s ease;
}
.cat-card.open .dd-body { max-height: 2600px; }

/* Panel putih tempat daftar submenu */
.dd-inner {
  margin-top: 10px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-left: 5px solid var(--accent);
  border-radius: 14px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  box-shadow: 0 6px 16px rgba(20, 50, 40, 0.08);
}
.cat-card.open .dd-inner > * { animation: fadeUp 0.24s ease both; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Alat admin di dalam panel ---------- */
.card-tools { display: flex; flex-wrap: wrap; gap: 6px; }

.mini-pill {
  background: var(--accent);
  border: 1px solid #cfe0d7;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--primary);
  cursor: pointer;
}
.mini-pill:active { background: #d2e3da; }
.mini-pill.danger { background: #f7ecea; border-color: #ecd6d1; color: #9c5f53; }
.mini-pill.danger:active { background: #f0ded9; }

/* ==================== SUBMENU: TOMBOL 3D HIJAU ==================== */
.link-row { display: flex; align-items: center; gap: 8px; }

.link-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background-image: linear-gradient(180deg, #56ab94 0%, #3a927c 45%, #2f7d6b 100%);
  background-color: #2f7d6b;
  color: #ffffff;
  border: 1px solid #2b7361;
  border-radius: 13px;
  text-align: left;
  min-height: 46px;
  padding: 12px 15px;
  font-size: 0.93rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  cursor: pointer;
  text-decoration: none;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.22);
  box-shadow:
    0 4px 0 0 #256454,
    0 7px 12px rgba(20, 60, 50, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.15s ease;
  font-family: inherit;
}
.link-btn:active,
.link-btn:hover {
  background-image: linear-gradient(180deg, #67bda4 0%, #42a189 45%, #358f79 100%);
  transform: translateY(3px);
  box-shadow:
    0 1px 0 0 #256454,
    0 3px 7px rgba(20, 60, 50, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.32);
}

.lk-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lk-go {
  flex-shrink: 0;
  font-size: 1.25rem;
  line-height: 1;
  opacity: 0.82;
}

/* URL belum diisi: tetap tombol hijau 3D, tanda panah diredupkan */
.link-btn.missing {
  background-image: linear-gradient(180deg, #6bb09d 0%, #4d9784 45%, #418b78 100%);
}
.link-btn.missing .lk-go { opacity: 0.55; }

.row-tools { display: flex; gap: 4px; flex-shrink: 0; }

.icon-tiny {
  background: #eef4f0;
  border: 1px solid var(--border);
  border-bottom-width: 3px;
  border-radius: 9px;
  width: 32px;
  height: 32px;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}
.icon-tiny:active { background: #dce9e2; color: var(--primary); transform: translateY(1px); }

/* ---------- Form tambah inline ---------- */
.add-form {
  display: none;
  flex-direction: column;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}
.add-form.open { display: flex; animation: slideDown 0.22s ease; }

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.flex-gap { display: flex; gap: 8px; }

/* ==================== FIELD ==================== */
.field { display: flex; flex-direction: column; gap: 5px; }

.field label {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
}

.field input, .field select, .field textarea {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  width: 100%;
}
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(28, 85, 74, 0.14);
}

.hint { font-size: 0.72rem; color: var(--muted); }

.logo-preview {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  background: var(--accent);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-weight: 900;
  font-size: 1.05rem;
  overflow: hidden;
}
.logo-preview img { width: 100%; height: 100%; object-fit: cover; }

/* ==================== OVERLAY & MODAL ==================== */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 40, 33, 0.36);
  backdrop-filter: blur(2px);
  z-index: 40;
  display: none;
}
.overlay.open { display: block; }

.modal {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(92vw, 420px);
  max-height: min(86vh, 620px);
  overflow-y: auto;
  background: var(--card);
  border-radius: 20px;
  box-shadow: 0 18px 40px rgba(15, 40, 33, 0.24);
  z-index: 50;
  display: none;
  flex-direction: column;
  animation: pop 0.2s ease;
}
.modal.open { display: flex; }

@keyframes pop {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.93); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.modal-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  position: sticky;
  top: 0;
  background: var(--card);
}
.modal-head span { font-weight: 700; font-size: 1rem; }

.modal-close {
  background: transparent;
  border: none;
  font-size: 1.45rem;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
}
.modal-close:active { color: var(--text); }

.modal > form, .modal > .confirm-text {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.modal-actions.pad { padding: 0 18px 16px; }

.confirm-text { margin: 0; color: var(--text); font-size: 0.95rem; }

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

/* ==================== TOMBOL ==================== */
button { font-family: inherit; font-size: 0.95rem; touch-action: manipulation; }

.link-btn, .dd-toggle, .bar-btn, .btn-primary, .btn-save, .btn-cancel,
.btn-danger, .btn-add-sub, .mini-pill, .icon-mini, .icon-tiny, .swatch {
  position: relative;
  overflow: hidden;
}

/* Ripple */
.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(28, 85, 74, 0.22);
  transform: scale(0);
  animation: rippleAnim 0.55s ease-out forwards;
  pointer-events: none;
}
.dd-toggle .ripple, .link-btn .ripple,
.btn-primary .ripple, .btn-save .ripple, .btn-danger .ripple {
  background: rgba(255, 255, 255, 0.45);
}
@keyframes rippleAnim {
  to { transform: scale(2.6); opacity: 0; }
}

/* Tombol utama: hijau #1c554a dengan gradasi pemanis */
.btn-primary, .btn-save {
  background-image: var(--grad-primary);
  background-color: var(--primary);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 11px 16px;
  font-weight: 700;
  cursor: pointer;
  flex: 1;
  box-shadow: 0 3px 0 #123f36, 0 6px 12px rgba(28, 85, 74, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.btn-primary:active, .btn-save:active {
  background-image: var(--grad-primary-d);
  transform: translateY(2px);
  box-shadow: 0 1px 0 #123f36, 0 3px 6px rgba(20, 63, 55, 0.3);
}

.btn-block { width: 100%; flex: none; margin-top: 6px; }

.btn-cancel {
  background: #eef4f0;
  color: var(--text);
  border: 1px solid #cfe0d7;
  border-radius: 12px;
  padding: 11px 16px;
  font-weight: 700;
  cursor: pointer;
  flex: 1;
}
.btn-cancel:active { background: #dfeae4; transform: translateY(1px); }

.btn-danger {
  background-image: linear-gradient(135deg, #b97f73 0%, #c98d80 100%);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 11px 16px;
  font-weight: 700;
  cursor: pointer;
  flex: 1;
  box-shadow: 0 3px 0 #96605433, 0 6px 12px rgba(185, 127, 115, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.btn-danger:active {
  background-image: linear-gradient(135deg, #a76b60 0%, #b97f73 100%);
  transform: translateY(2px);
  box-shadow: 0 1px 0 #96605433, 0 3px 6px rgba(150, 96, 84, 0.3);
}

.btn-add-sub {
  background: var(--accent);
  color: var(--primary);
  border: 1px dashed #b9d2c6;
  border-radius: 12px;
  padding: 10px;
  width: 100%;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
}
.btn-add-sub:active { background: #d2e3da; transform: translateY(1px); }

.icon-mini {
  background: var(--accent);
  border: 1px solid #cfe0d7;
  border-bottom-width: 3px;
  border-radius: 9px;
  width: 32px;
  height: 32px;
  font-size: 0.92rem;
  cursor: pointer;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}
.icon-mini:active { background: #d2e3da; transform: translateY(1px); }

/* ==================== PALET WARNA ==================== */
.palette { display: flex; flex-wrap: wrap; gap: 9px; }

.swatch {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  flex-shrink: 0;
}
.swatch.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(28, 85, 74, 0.18);
}

/* ==================== FOOTER ==================== */
.site-footer {
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  padding: 16px 18px calc(18px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border);
  margin-top: 6px;
  line-height: 1.6;
}

/* ==================== TOAST ==================== */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 14px) + 10px);
  transform: translateX(-50%) translateY(6px);
  background: rgba(18, 48, 40, 0.92);
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 0.85rem;
  z-index: 60;
  display: none;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
  max-width: 90vw;
  text-align: center;
}
.toast.show { display: block; opacity: 1; transform: translateX(-50%) translateY(0); }

/* ==================== STATUS KOSONG ==================== */
.empty-state {
  text-align: center;
  padding: 12px 8px;
  color: var(--muted);
  font-size: 0.85rem;
}

/* ==================== HALAMAN LOGIN ==================== */
.login-view { background: linear-gradient(160deg, #eff6f2 0%, #dcebe4 100%); }

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.login-card {
  width: min(92vw, 380px);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 30px 26px 26px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-icon { font-size: 2rem; text-align: center; }

.login-title {
  margin: 0;
  text-align: center;
  font-size: 1.25rem;
  font-weight: 900;
  color: var(--primary);
}

.login-sub {
  margin: -8px 0 4px;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.alert-error {
  background: #fbf0ee;
  color: #9c5f53;
  border: 1px solid #efdcd7;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 0.85rem;
  text-align: center;
}

/* ==================== AKSESIBILITAS ==================== */
@media (prefers-reduced-motion: reduce) {
  .anim-aurora::before, .anim-aurora::after,
  .anim-bubbles .bub, .ripple, .dd-inner > * { animation: none !important; }
  .dd-body, .chev { transition: none !important; }
}
