/* ============================================================
   SETORAN BACAAN & HAFALAN AL-QUR'AN — CSS
   Modern Islamic Design System
   ============================================================ */

/* ── FONTS & RESET ───────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Color Palette */
  --clr-primary:       #1a6b4a;
  --clr-primary-dark:  #0d3b2e;
  --clr-primary-light: #2a8a62;
  --clr-accent:        #d4af37;
  --clr-accent-light:  #f0d060;
  --clr-accent-pale:   #fdf8e8;

  --clr-surface:       #ffffff;
  --clr-surface-2:     #f8faf9;
  --clr-border:        #d6e8df;
  --clr-border-focus:  #1a6b4a;

  --clr-text:          #1a2e25;
  --clr-text-muted:    #5a7a6a;
  --clr-text-light:    #8aaaa0;

  --clr-shubuh:        #ff9d3d;
  --clr-maghrib:       #7b60d4;

  --clr-success:       #16a34a;
  --clr-error:         #dc2626;
  --clr-warning:       #d97706;

  /* Typography */
  --font-sans:   'Inter', system-ui, sans-serif;
  --font-arabic: 'Amiri', serif;

  /* Spacing */
  --space-xs:   0.25rem;
  --space-sm:   0.5rem;
  --space-md:   1rem;
  --space-lg:   1.5rem;
  --space-xl:   2rem;
  --space-2xl:  3rem;

  /* Radius */
  --radius-sm:  6px;
  --radius-md:  12px;
  --radius-lg:  20px;
  --radius-xl:  28px;

  /* Shadow */
  --shadow-card: 0 2px 16px rgba(13, 59, 46, 0.10), 0 1px 4px rgba(13, 59, 46, 0.06);
  --shadow-hover: 0 8px 32px rgba(13, 59, 46, 0.15), 0 2px 8px rgba(13, 59, 46, 0.10);
  --shadow-btn:  0 4px 16px rgba(26, 107, 74, 0.4);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  color: var(--clr-text);
  background-color: #edf5f0;
  background-image:
    radial-gradient(ellipse 80% 60% at 10% 0%, rgba(26,107,74,0.08) 0%, transparent 60%),
    radial-gradient(ellipse 60% 80% at 90% 100%, rgba(26,107,74,0.06) 0%, transparent 60%);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* ── BACKGROUND ORNAMENTS ────────────────────────────────── */
.bg-ornament {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.045;
}

.bg-ornament--1 {
  width: 600px;
  height: 600px;
  top: -200px;
  right: -200px;
  background: radial-gradient(circle, var(--clr-primary) 0%, transparent 70%);
  animation: floatOrn 18s ease-in-out infinite;
}

.bg-ornament--2 {
  width: 500px;
  height: 500px;
  bottom: -150px;
  left: -150px;
  background: radial-gradient(circle, var(--clr-accent) 0%, transparent 70%);
  animation: floatOrn 22s ease-in-out infinite reverse;
}

@keyframes floatOrn {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%       { transform: translate(20px, -30px) scale(1.05); }
  66%       { transform: translate(-10px, 15px) scale(0.98); }
}

/* ── CONTAINER ───────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 0 var(--space-md);
  position: relative;
  z-index: 1;
}

/* ── HEADER ──────────────────────────────────────────────── */
.site-header {
  background: linear-gradient(135deg, var(--clr-primary-dark) 0%, var(--clr-primary) 50%, #1a5c3e 100%);
  color: #fff;
  padding: var(--space-xl) 0 0;
  position: relative;
  overflow: hidden;
}

.site-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(
      45deg,
      transparent 0px,
      transparent 40px,
      rgba(255,255,255,0.015) 40px,
      rgba(255,255,255,0.015) 80px
    );
  pointer-events: none;
}

/* Golden star pattern overlay */
.site-header::after {
  content: '✦ ✧ ✦ ✧ ✦ ✧ ✦ ✧ ✦ ✧ ✦';
  position: absolute;
  bottom: 36px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 10px;
  color: rgba(212,175,55,0.3);
  letter-spacing: 8px;
  pointer-events: none;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  padding-bottom: var(--space-lg);
}

.header-icon {
  flex-shrink: 0;
  filter: drop-shadow(0 4px 12px rgba(212,175,55,0.3));
}

.header-text {
  flex: 1;
}

.header-arabic {
  font-family: var(--font-arabic);
  font-size: 1.2rem;
  color: var(--clr-accent-light);
  margin-bottom: var(--space-xs);
  text-shadow: 0 1px 4px rgba(0,0,0,0.3);
  direction: rtl;
}

.header-title {
  font-size: clamp(1.3rem, 4vw, 1.75rem);
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.header-subtitle {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.65);
  margin-top: 2px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.header-divider {
  position: relative;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-divider::before,
.header-divider::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(212,175,55,0.5), rgba(212,175,55,0.5), transparent);
}

.divider-ornament {
  position: relative;
  z-index: 1;
  color: var(--clr-accent);
  font-size: 1rem;
  background: var(--clr-primary);
  padding: 0 var(--space-md);
  line-height: 40px;
}

/* ── MAIN CONTENT ────────────────────────────────────────── */
.main-content {
  padding: var(--space-xl) var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

/* ── FORM CARD ───────────────────────────────────────────── */
.form-card {
  background: var(--clr-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--clr-border);
  overflow: hidden;
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}

.form-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.form-card__header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  background: linear-gradient(135deg, var(--clr-surface-2) 0%, rgba(212,175,55,0.04) 100%);
  border-bottom: 1px solid var(--clr-border);
  position: relative;
}

.form-card__header::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, var(--clr-primary), var(--clr-accent));
  border-radius: 0 2px 2px 0;
}

.form-card__icon {
  font-size: 1.35rem;
  line-height: 1;
}

.form-card__title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--clr-primary-dark);
  flex: 1;
}

.form-card__badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 20px;
  background: rgba(26,107,74,0.12);
  color: var(--clr-primary);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.form-card__badge--gold {
  background: rgba(212,175,55,0.15);
  color: #9a7a1a;
}

.form-card__body {
  padding: var(--space-lg);
}

/* ── FORM ELEMENTS ───────────────────────────────────────── */
.form-group {
  margin-bottom: var(--space-md);
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--clr-text);
  margin-bottom: var(--space-sm);
}

.required {
  color: var(--clr-error);
  margin-left: 2px;
}

.label-time {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.label-time--shubuh {
  color: var(--clr-shubuh);
}

.label-time--maghrib {
  color: var(--clr-maghrib);
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  color: var(--clr-text);
  background: var(--clr-surface-2);
  border: 1.5px solid var(--clr-border);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
  -webkit-appearance: none;
  appearance: none;
}

.form-input::placeholder {
  color: var(--clr-text-light);
  font-size: 0.875rem;
}

.form-input:focus {
  border-color: var(--clr-border-focus);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(26,107,74,0.12);
}

.form-input:focus-visible {
  outline: none;
}

input[type="date"].form-input {
  cursor: pointer;
}

.form-textarea {
  resize: vertical;
  min-height: 110px;
  line-height: 1.6;
}

.form-select {
  cursor: pointer;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%231a6b4a' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
}

.form-select option[value=""] {
  color: var(--clr-text-light);
}

.form-hint {
  font-size: 0.78rem;
  color: var(--clr-text-muted);
  margin-top: 6px;
  padding-left: 2px;
}

.input-with-unit {
  position: relative;
}

/* ── TWO COLUMN GRID ─────────────────────────────────────── */
.two-col-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

@media (max-width: 500px) {
  .two-col-grid {
    grid-template-columns: 1fr;
  }
}

/* ── SUBMIT BUTTON ───────────────────────────────────────── */
.submit-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) 0 var(--space-xl);
}

.btn-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 16px 40px;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--clr-primary-light) 0%, var(--clr-primary) 50%, var(--clr-primary-dark) 100%);
  border: none;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: var(--shadow-btn);
  transition:
    transform var(--transition-fast),
    box-shadow var(--transition-fast),
    filter var(--transition-fast);
  position: relative;
  overflow: hidden;
  min-width: 240px;
  letter-spacing: 0.02em;
}

.btn-submit::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, transparent 60%);
  border-radius: inherit;
  pointer-events: none;
}

.btn-submit::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s ease;
}

.btn-submit:hover::after {
  left: 100%;
}

.btn-submit:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(26,107,74,0.5);
  filter: brightness(1.08);
}

.btn-submit:active {
  transform: translateY(0);
  box-shadow: var(--shadow-btn);
}

.btn-submit:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
  filter: none;
}

.btn-submit__icon {
  display: flex;
  align-items: center;
}

.submit-note {
  font-size: 0.78rem;
  color: var(--clr-text-muted);
  text-align: center;
}

/* ── TOAST NOTIFICATION ──────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  left: 24px;
  max-width: 420px;
  margin: 0 auto;
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15), 0 2px 8px rgba(0,0,0,0.10);
  border-left: 4px solid var(--clr-success);
  z-index: 9999;

  /* hidden by default */
  opacity: 0;
  transform: translateY(30px) scale(0.95);
  pointer-events: none;
  transition: opacity var(--transition-slow), transform var(--transition-slow);
}

.toast.toast--visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.toast.toast--error {
  border-left-color: var(--clr-error);
}

.toast.toast--warning {
  border-left-color: var(--clr-warning);
}

.toast__icon {
  font-size: 1.5rem;
  flex-shrink: 0;
  line-height: 1;
}

.toast__body {
  flex: 1;
}

.toast__title {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--clr-text);
  margin-bottom: 2px;
}

.toast__message {
  font-size: 0.83rem;
  color: var(--clr-text-muted);
  line-height: 1.4;
}

.toast__close {
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--clr-text-light);
  cursor: pointer;
  padding: 0 4px;
  flex-shrink: 0;
  line-height: 1;
  transition: color var(--transition-fast);
}

.toast__close:hover {
  color: var(--clr-text);
}

/* ── LOADING OVERLAY ─────────────────────────────────────── */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13, 59, 46, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
}

.loading-overlay.loading--visible {
  opacity: 1;
  pointer-events: auto;
}

.loading-spinner {
  background: #fff;
  border-radius: var(--radius-xl);
  padding: 40px 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-lg);
  box-shadow: 0 16px 48px rgba(0,0,0,0.2);
}

.spinner-ring {
  width: 52px;
  height: 52px;
  border: 4px solid rgba(26,107,74,0.15);
  border-top-color: var(--clr-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner-text {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--clr-primary-dark);
}

.dots {
  display: inline-block;
  animation: dotsAnim 1.4s steps(4, end) infinite;
}

@keyframes dotsAnim {
  0%   { width: 0;   overflow: hidden; }
  25%  { width: 0.35em; }
  50%  { width: 0.7em; }
  75%  { width: 1.05em; }
  100% { width: 0; }
}

/* ── FOOTER ──────────────────────────────────────────────── */
.site-footer {
  background: var(--clr-primary-dark);
  color: rgba(255,255,255,0.7);
  padding: var(--space-xl) 0 var(--space-lg);
  text-align: center;
  position: relative;
}

.site-footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--clr-accent), transparent);
}

.footer-text {
  font-family: var(--font-arabic);
  font-size: 1.2rem;
  color: var(--clr-accent-light);
  margin-bottom: var(--space-sm);
  direction: rtl;
  text-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

.footer-sub {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.5);
  line-height: 1.5;
  max-width: 460px;
  margin: 0 auto var(--space-md);
  font-style: italic;
}

.footer-copy {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.35);
}

/* ── FIELD VALIDATION STATES ─────────────────────────────── */
.form-input.is-invalid {
  border-color: var(--clr-error);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

.form-input.is-valid {
  border-color: var(--clr-success);
}

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .header-inner {
    flex-direction: column;
    text-align: center;
  }

  .header-arabic {
    text-align: center;
  }

  .btn-submit {
    width: 100%;
    min-width: unset;
  }

  .toast {
    bottom: 16px;
    right: 16px;
    left: 16px;
  }
}

@media (max-width: 400px) {
  .form-card__body {
    padding: var(--space-md);
  }

  .form-card__header {
    padding: var(--space-sm) var(--space-md);
  }
}

/* ── SCROLLBAR ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(26,107,74,0.3);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(26,107,74,0.5);
}

/* ── ANIMATIONS ──────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* Entrance animation for cards */
.form-card {
  animation: cardEnter 0.45s ease backwards;
}

#card-identitas  { animation-delay: 0.05s; }
#card-membaca    { animation-delay: 0.12s; }
#card-menghafal  { animation-delay: 0.19s; }
#card-setoran    { animation-delay: 0.26s; }

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