/* =====================================================
   MDC-BUKTAM - UI Theme
   Nuansa Madrasah · MTs Negeri 2 Lampung Selatan
   ===================================================== */
:root {
  --kemenag-green: #006633;
  --kemenag-green-dark: #004d26;
  --kemenag-green-mid: #0a7a3e;
  --kemenag-green-light: #e6f4ea;
  --kemenag-green-soft: #f3faf5;
  --kemenag-navy: #1a365d;
  --accent-gold: #c9a227;
  --accent-gold-soft: #faf6e9;
  --text-dark: #1a2e1a;
  --text-muted: #5a6b5a;
  --bg-body: #f0f7f2;
  --radius: 1.15rem;
  --shadow: 0 10px 40px rgba(0, 77, 38, 0.1);
  --shadow-lg: 0 25px 60px rgba(0, 0, 0, 0.18);
}

* { box-sizing: border-box; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, 'Twemoji Country Flags', sans-serif;
  color: var(--text-dark);
  background-color: var(--bg-body);
}

/* ---- Pattern background (motif geometris lembut) ---- */
.bg-madrasah {
  background-color: #004d26;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(201, 162, 39, 0.12) 0%, transparent 45%),
    radial-gradient(circle at 80% 10%, rgba(255,255,255,0.06) 0%, transparent 40%),
    radial-gradient(circle at 70% 80%, rgba(0, 102, 51, 0.5) 0%, transparent 50%),
    linear-gradient(160deg, #1a365d 0%, #004d26 45%, #006633 100%);
  min-height: 100vh;
}

.bg-soft-pattern {
  background-color: var(--bg-body);
  background-image:
    url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23006633' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

/* ---- Buttons ---- */
.btn-kemenag {
  background: linear-gradient(135deg, #0a7a3e, #006633);
  border: none;
  color: #fff;
  font-weight: 600;
  border-radius: 0.75rem;
  padding: 0.7rem 1.35rem;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(0, 102, 51, 0.3);
}
.btn-kemenag:hover {
  background: linear-gradient(135deg, #006633, #004d26);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 102, 51, 0.4);
}
.btn-kemenag-outline {
  border: 2px solid var(--kemenag-green);
  color: var(--kemenag-green);
  background: #fff;
  font-weight: 600;
  border-radius: 0.75rem;
}
.btn-kemenag-outline:hover {
  background: var(--kemenag-green);
  color: #fff;
}

/* ---- Cards ---- */
.card-app {
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  background: #fff;
}

.brand-header {
  background: linear-gradient(145deg, #004d26 0%, #006633 60%, #0a7a3e 100%);
  color: #fff;
  text-align: center;
  padding: 1.75rem 1.25rem 1.4rem;
  position: relative;
  overflow: hidden;
}
.brand-header::before {
  content: '';
  position: absolute;
  top: -40%;
  right: -20%;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(201,162,39,0.2) 0%, transparent 70%);
  border-radius: 50%;
}
.brand-header::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: -15%;
  width: 160px;
  height: 160px;
  background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
  border-radius: 50%;
}

.brand-logo {
  width: 92px;
  height: 92px;
  object-fit: contain;
  background: #fff;
  border-radius: 50%;
  padding: 6px;
  border: 3px solid var(--accent-gold);
  margin-bottom: 0.65rem;
  box-shadow: 0 6px 20px rgba(0,0,0,0.2);
  position: relative;
  z-index: 1;
}

.badge-gold {
  background: linear-gradient(135deg, #d4af37, #c9a227);
  color: #1a202c;
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.4px;
  padding: 0.4rem 0.85rem;
  border-radius: 2rem;
  box-shadow: 0 2px 8px rgba(201,162,39,0.35);
}

/* ---- Form ---- */
.form-control, .form-select {
  border-radius: 0.7rem;
  border: 1.5px solid #c8e0c8;
  padding: 0.65rem 0.95rem;
  background: #fafffe;
}
.form-control:focus, .form-select:focus {
  border-color: var(--kemenag-green);
  box-shadow: 0 0 0 0.22rem rgba(0, 102, 51, 0.15);
  background: #fff;
}
.form-label {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-dark);
}

.section-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--kemenag-green);
  text-transform: uppercase;
  letter-spacing: 0.7px;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--kemenag-green-light);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.section-title::before {
  content: '';
  width: 8px;
  height: 8px;
  background: var(--accent-gold);
  border-radius: 50%;
}

/* Jenis tamu */
.jenis-card {
  border: 2px solid #c8e0c8;
  border-radius: 1rem;
  cursor: pointer;
  transition: all 0.25s ease;
  text-align: center;
  padding: 1.5rem 0.75rem;
  background: #fff;
  position: relative;
  overflow: hidden;
}
.jenis-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: transparent;
  transition: background 0.25s;
}
.jenis-card:hover {
  border-color: var(--kemenag-green);
  background: var(--kemenag-green-soft);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,102,51,0.12);
}
.jenis-card.active {
  border-color: var(--kemenag-green);
  background: var(--kemenag-green-light);
  box-shadow: 0 0 0 4px rgba(0, 102, 51, 0.12);
}
.jenis-card.active::after {
  background: linear-gradient(90deg, var(--accent-gold), var(--kemenag-green));
}
.jenis-card .icon-wrap {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--kemenag-green-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.6rem;
}
.jenis-card i { font-size: 1.6rem; color: var(--kemenag-green); }

/* Camera & signature */
#signatureCanvas {
  border: 2px dashed #a8d5a8;
  border-radius: 0.75rem;
  width: 100%;
  height: 180px;
  touch-action: none;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='40'%3E%3Ctext x='50%25' y='50%25' dominant-baseline='middle' text-anchor='middle' fill='%23c8e0c8' font-size='12' font-family='sans-serif'%3ETanda tangan di sini%3C/text%3E%3C/svg%3E") center no-repeat;
}
#videoPreview, #canvasSelfie, #previewSelfie {
  width: 100%;
  max-width: 300px;
  border-radius: 1rem;
  border: 3px solid var(--kemenag-green-light);
  box-shadow: 0 4px 16px rgba(0,102,51,0.1);
}

/* Avatar / ilustrasi empty */
.illus-wrap {
  width: 120px;
  height: 120px;
  margin: 0 auto 1rem;
  background: linear-gradient(145deg, var(--kemenag-green-light), var(--accent-gold-soft));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(0,102,51,0.12);
}
.illus-wrap i {
  font-size: 3rem;
  color: var(--kemenag-green);
}

/* Admin */
.sidebar-kemenag {
  min-height: 100vh;
  background: linear-gradient(180deg, #004d26 0%, #006633 55%, #0a7a3e 100%);
}
.sidebar-kemenag .nav-link {
  color: rgba(255,255,255,0.88);
  border-radius: 0.6rem;
  margin-bottom: 0.2rem;
  padding: 0.65rem 0.95rem;
  font-size: 0.9rem;
  transition: all 0.15s;
}
.sidebar-kemenag .nav-link:hover,
.sidebar-kemenag .nav-link.active {
  background: rgba(255,255,255,0.15);
  color: #fff;
}
.stat-card {
  border: none;
  border-radius: 1rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.05);
  transition: transform 0.15s, box-shadow 0.15s;
  background: #fff;
}
.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,102,51,0.1);
}
.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Decorative stars / accent */
.accent-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--accent-gold);
  border-radius: 50%;
  margin: 0 0.25rem;
  vertical-align: middle;
}

@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
}

/* =====================================================
   Mobile-first / Responsive (HP)
   ===================================================== */
html {
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
}

/* Tombol lebih mudah disentuh di HP */
.btn-kemenag,
.btn-kemenag-outline,
.btn-lg {
  min-height: 48px;
  font-size: 1rem;
}

.jenis-card {
  min-height: 120px;
  padding: 1.25rem 0.5rem;
}

/* Form di HP: full width nyaman */
@media (max-width: 576px) {
  .container {
    padding-left: 0.85rem;
    padding-right: 0.85rem;
  }
  .card-app {
    border-radius: 1rem;
  }
  .brand-header {
    padding: 1.35rem 1rem 1.15rem;
  }
  .brand-logo {
    width: 76px;
    height: 76px;
  }
  .form-control,
  .form-select {
    font-size: 16px; /* cegah zoom otomatis di iOS */
    min-height: 46px;
  }
  #signatureCanvas {
    height: 160px;
  }
  .header-guest {
    padding: 1rem 0 !important;
  }
  .section-title {
    font-size: 0.72rem;
  }
}

/* Viewport aman untuk notch HP */
@supports (padding: max(0px)) {
  body {
    padding-left: max(0px, env(safe-area-inset-left));
    padding-right: max(0px, env(safe-area-inset-right));
  }
}

/* Input group di mobile */
@media (max-width: 576px) {
  .input-group .form-control {
    font-size: 16px;
  }
}


/* =====================================================
   Homepage compact on mobile
   ===================================================== */
@media (max-width: 576px) {
  body.bg-madrasah {
    align-items: flex-start !important;
    padding-top: 0.75rem !important;
    padding-bottom: 0.75rem !important;
  }
  .home-card .brand-header {
    padding: 1rem 0.85rem 0.9rem !important;
  }
  .home-card .brand-logo {
    width: 58px !important;
    height: 58px !important;
    margin-bottom: 0.35rem !important;
    border-width: 2px !important;
  }
  .home-card .brand-header h5 {
    font-size: 0.95rem !important;
    margin-bottom: 0.15rem !important;
  }
  .home-card .brand-header .small {
    font-size: 0.7rem !important;
  }
  .home-card .badge-gold {
    font-size: 0.65rem !important;
    padding: 0.25rem 0.55rem !important;
  }
  .home-card .card-body {
    padding: 1rem 0.9rem 1.1rem !important;
  }
  .home-card .illus-wrap {
    width: 64px !important;
    height: 64px !important;
    margin-bottom: 0.5rem !important;
  }
  .home-card .illus-wrap i {
    font-size: 1.6rem !important;
  }
  .home-card .step-box {
    padding: 0.45rem 0.25rem !important;
  }
  .home-card .step-num {
    width: 26px !important;
    height: 26px !important;
    font-size: 0.75rem !important;
  }
  .home-card .btn-lg {
    min-height: 44px !important;
    font-size: 0.95rem !important;
    padding: 0.55rem 1rem !important;
  }
  .home-footer-note {
    font-size: 0.72rem !important;
    margin-top: 0.75rem !important;
  }
}

/* Premium micro-animations (form, login, dll) */
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.anim-in {
  animation: fadeSlideIn 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.anim-delay-1 { animation-delay: 0.08s; }
.anim-delay-2 { animation-delay: 0.16s; }
.anim-delay-3 { animation-delay: 0.24s; }
.anim-delay-4 { animation-delay: 0.32s; }

.jenis-card {
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.jenis-card:active {
  transform: scale(0.97);
}

.btn-kemenag {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.btn-kemenag:active {
  transform: scale(0.98);
}

/* Header guest soft entrance */
.header-guest {
  animation: fadeSlideIn 0.45s ease both;
}
