/* =====================================================================
   E-TAMU MIN 1 WAKATOBI — Guest Interface
   Tema: Hijau Madrasah + Putih + Aksen Emas Tipis
   Motif: garis ombak (identitas bahari Wakatobi) dipadu lengkung kubah
   ===================================================================== */

:root {
  --hijau-tua: #0f6e4a;
  --hijau: #128a5c;
  --hijau-muda: #e6f5ee;
  --emas: #c9a227;
  --emas-muda: #f3e9c9;
  --putih: #ffffff;
  --abu: #6b7280;
  --abu-muda: #f4f6f5;
  --teks: #1f2a24;
  --bahaya: #dc2626;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 8px;
  --shadow: 0 10px 30px rgba(15, 110, 74, 0.10);
  --shadow-sm: 0 4px 12px rgba(15, 110, 74, 0.08);
  --font-display: 'Poppins', sans-serif;
  --font-body: 'Inter', sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  color: var(--teks);
  background: var(--abu-muda);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 42% 58%;
}

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
}

/* ---------- Panel Branding (kiri) ---------- */
.brand-panel {
  position: relative;
  background: linear-gradient(160deg, var(--hijau-tua) 0%, var(--hijau) 65%, #0b5a3c 100%);
  color: var(--putih);
  padding: 56px 48px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

@media (max-width: 900px) {
  .brand-panel { padding: 36px 24px 64px; }
}

.brand-waves {
  position: absolute;
  inset: auto 0 0 0;
  width: 100%;
  height: 220px;
  opacity: 0.16;
  pointer-events: none;
}

.brand-arch {
  position: absolute;
  top: -60px;
  right: -60px;
  width: 260px;
  height: 260px;
  border: 2px solid rgba(201, 162, 39, 0.35);
  border-radius: 50% 50% 50% 50%;
  opacity: 0.6;
}

.brand-header { position: relative; z-index: 2; }

.brand-logo-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 40px;
}

.brand-logo-badge {
  width: 52px; height: 52px;
  border-radius: 14px;
  background: rgba(255,255,255,0.92);
  border: 1px solid rgba(201,162,39,0.55);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  color: var(--emas-muda);
  padding: 5px;
  flex-shrink: 0;
}
.brand-logo-badge img {
  width: 100%; height: 100%;
  object-fit: contain;
}

.brand-logo-text .eyebrow {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--emas-muda);
  opacity: 0.85;
  margin: 0;
}

.brand-logo-text .school-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  margin: 2px 0 0;
}

.brand-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.2;
  margin: 0 0 16px;
  max-width: 420px;
}

.brand-sub {
  font-size: 15px;
  line-height: 1.7;
  color: rgba(255,255,255,0.85);
  max-width: 380px;
  margin: 0;
}

.brand-footer {
  position: relative;
  z-index: 2;
  display: flex;
  gap: 28px;
  font-size: 13px;
  color: rgba(255,255,255,0.75);
}

.brand-footer .stat b {
  display: block;
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--putih);
}

/* ---------- Panel Form (kanan) ---------- */
.form-panel {
  padding: 48px;
  display: flex;
  justify-content: center;
}

@media (max-width: 900px) {
  .form-panel { padding: 24px 18px 48px; margin-top: -36px; }
}

.form-card {
  width: 100%;
  max-width: 560px;
  background: var(--putih);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 36px;
}

@media (max-width: 520px) {
  .form-card { padding: 22px; border-radius: var(--radius-md); }
}

.form-card h2 {
  font-family: var(--font-display);
  font-size: 22px;
  margin: 0 0 4px;
}

.form-card .form-desc {
  color: var(--abu);
  font-size: 14px;
  margin: 0 0 28px;
}

.field-group { margin-bottom: 20px; }

.field-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--teks);
}

.field-group label .req { color: var(--bahaya); }

.field-group input[type="text"],
.field-group input[type="tel"],
.field-group textarea,
.field-group select {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid #e2e6e4;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font-body);
  background: var(--abu-muda);
  transition: border-color .15s ease, box-shadow .15s ease;
}

.field-group input:focus,
.field-group textarea:focus,
.field-group select:focus {
  outline: none;
  border-color: var(--hijau);
  box-shadow: 0 0 0 3px rgba(15,110,74,0.12);
  background: var(--putih);
}

.field-group textarea { resize: vertical; min-height: 80px; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 520px) { .field-row { grid-template-columns: 1fr; } }

.field-error {
  color: var(--bahaya);
  font-size: 12px;
  margin-top: 5px;
  display: none;
}

.field-group.has-error input,
.field-group.has-error textarea,
.field-group.has-error select {
  border-color: var(--bahaya);
}
.field-group.has-error .field-error { display: block; }

/* ---------- Tanda Tangan Digital ---------- */
.signature-box {
  border: 1.5px dashed #cfd8d3;
  border-radius: var(--radius-md);
  background: var(--abu-muda);
  padding: 10px;
}

.signature-box canvas {
  width: 100%;
  height: 180px;
  background: var(--putih);
  border-radius: var(--radius-sm);
  touch-action: none;
  cursor: crosshair;
}

.signature-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}

.signature-hint { font-size: 12px; color: var(--abu); }

.btn-link {
  background: none;
  border: none;
  color: var(--hijau-tua);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 8px;
}
.btn-link:hover { text-decoration: underline; }

/* ---------- Webcam ---------- */
.webcam-box {
  border: 1.5px dashed #cfd8d3;
  border-radius: var(--radius-md);
  background: var(--abu-muda);
  padding: 14px;
  text-align: center;
}

.webcam-video, .webcam-canvas, .webcam-preview {
  width: 100%;
  max-width: 320px;
  border-radius: var(--radius-sm);
  background: #000;
  margin: 0 auto 12px;
}

.webcam-preview { display: none; }

.btn-camera {
  background: var(--hijau-tua);
  color: var(--putih);
  border: none;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.btn-camera.secondary {
  background: transparent;
  color: var(--hijau-tua);
  border: 1.5px solid var(--hijau-tua);
}

/* ---------- Tombol Submit ---------- */
.btn-submit {
  width: 100%;
  padding: 15px;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(120deg, var(--hijau-tua), var(--hijau));
  color: var(--putih);
  font-size: 15px;
  font-weight: 700;
  font-family: var(--font-display);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform .12s ease, box-shadow .12s ease;
  margin-top: 8px;
}
.btn-submit:hover { transform: translateY(-1px); box-shadow: 0 12px 24px rgba(15,110,74,0.22); }
.btn-submit:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.form-note {
  text-align: center;
  font-size: 12px;
  color: var(--abu);
  margin-top: 14px;
}

.form-note a { color: var(--hijau-tua); }

/* ---------- Modal Sukses ---------- */
.success-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 42, 33, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 20px;
}
.success-overlay.active { display: flex; }

.success-card {
  background: var(--putih);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  text-align: center;
  max-width: 380px;
  width: 100%;
  transform: scale(0.85);
  opacity: 0;
  animation: popIn .35s cubic-bezier(.2,1.4,.4,1) forwards;
}

@keyframes popIn { to { transform: scale(1); opacity: 1; } }

.success-check {
  width: 76px; height: 76px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: var(--hijau-muda);
  display: flex; align-items: center; justify-content: center;
}

.success-check svg { width: 38px; height: 38px; }

.success-card h3 {
  font-family: var(--font-display);
  margin: 0 0 8px;
  font-size: 20px;
}

.success-card p { color: var(--abu); font-size: 14px; margin: 0 0 24px; line-height: 1.6; }

.btn-close-success {
  background: var(--hijau-tua);
  color: var(--putih);
  border: none;
  padding: 12px 28px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
}

/* ---------- Utility ---------- */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  display: inline-block;
  animation: spin .7s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.hidden { display: none !important; }
