/* ============================================================
   SIPATEN - Public Page CSS - Premium Redesign v2
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Merriweather:wght@700&display=swap');

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

:root {
  /* Color Palette */
  --bg-from:      #0d1b3e;
  --bg-mid:       #1a3a6e;
  --bg-to:        #0c4a8a;
  --accent:       #3b82f6;
  --accent-glow:  rgba(59,130,246,.35);
  --success:      #22c55e;
  --success-bg:   rgba(34,197,94,.1);
  --success-border: rgba(34,197,94,.35);
  --danger:       #ef4444;
  --danger-bg:    rgba(239,68,68,.1);
  --danger-border: rgba(239,68,68,.35);
  --white:        #ffffff;
  --card-bg:      rgba(255,255,255,0.97);
  --input-border: #d1d5db;
  --input-focus:  #3b82f6;
  --text-dark:    #0f172a;
  --text-mid:     #374151;
  --text-light:   #6b7280;
  --text-xs:      #9ca3af;
  --font:         'Plus Jakarta Sans', sans-serif;
  --radius-sm:    8px;
  --radius:       14px;
  --radius-lg:    22px;
  --radius-xl:    28px;
  --shadow-card:  0 20px 60px rgba(0,0,0,.25), 0 8px 24px rgba(0,0,0,.15);
  --shadow-input: 0 1px 3px rgba(0,0,0,.06);
  --transition:   .22s cubic-bezier(.4,0,.2,1);
}

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  color: var(--text-dark);
  line-height: 1.6;
  min-height: 100vh;
  background: var(--bg-from);
  overflow-x: hidden;
}

/* ════════════════════════════════════════
   BACKGROUND SCENE
════════════════════════════════════════ */
.public-bg {
  min-height: 100vh;
  background-color: #fdfaf4; /* Off-white / light beige */
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 16px;
  position: relative;
  overflow: hidden;
}

/* Remove old decorative blobs and overlays as they don't fit the new clean aesthetic */
.public-bg::before,
.public-bg::after,
.grid-overlay {
  display: none;
}

/* ════════════════════════════════════════
   FORM CARD & PREMIUM HEADER
════════════════════════════════════════ */
.form-card {
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.08);
  width: 100%;
  max-width: 580px; /* Slightly wider for the new header layout */
  overflow: hidden;
  position: relative;
  z-index: 2;
  animation: slideUp .55s ease both;
  border: 1px solid #e5e7eb;
}

/* ── PREMIUM HEADER (Dark Green) ── */
.card-header-premium {
  background-color: #1a3c34; /* Dark elegant green */
  position: relative;
  border-bottom: 4px dashed #b18b45; /* Golden dashed line at the bottom */
}

.header-content {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 24px 24px;
}

.header-icon-wrap {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 1.5px dashed #b18b45;
  padding: 4px; /* Space between dashed border and inner content */
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}

/* Subtle glow behind the logo */
.header-icon-wrap::before {
  content: '';
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(177,139,69,0.4) 0%, transparent 70%);
  z-index: 0;
}

.school-logo-img,
.header-icon-placeholder {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: contain;
  position: relative;
  z-index: 1;
  background-color: #ffffff;
}

.header-icon-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #1a3c34;
}

.header-text-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sub-title {
  color: #c9a25b; /* Golden color */
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.main-title {
  font-family: 'Merriweather', serif; /* Elegant serif font */
  color: #ffffff;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.2;
}

.school-info {
  color: #e2e8f0;
  font-size: 0.85rem;
  font-weight: 400;
}
/* Note: Legacy header styles removed */

.form-body {
  padding: 20px 24px 24px;
}

/* ── SECTION HEADERS ── */
.section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.section-head .section-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
  flex-shrink: 0;
}
.section-head.green .section-icon  { background: rgba(34,197,94,.12);  }
.section-head.blue  .section-icon  { background: rgba(59,130,246,.12);  }
.section-head.purple .section-icon { background: rgba(139,92,246,.12); }

.section-head .section-label {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-light);
}

/* ── DIVIDER ── */
.form-sep {
  border: none;
  border-top: 1px solid #f0f0f0;
  margin: 16px 0;
}

/* ── STATUS TOGGLE ── */
.status-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 0;
}

.status-card {
  position: relative;
  border: 2px solid #e5e7eb;
  border-radius: var(--radius);
  padding: 14px 10px 10px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: #fafafa;
  overflow: hidden;
  user-select: none;
}
.status-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

/* Shimmer effect on hover */
.status-card::after {
  content: '';
  position: absolute;
  top: -50%; left: -60%;
  width: 40%; height: 200%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.6), transparent);
  transform: skewX(-20deg);
  transition: left .6s ease;
  pointer-events: none;
}
.status-card:hover::after { left: 140%; }

.status-card:hover {
  border-color: #d1d5db;
  background: #f5f7ff;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,.08);
}

/* Check indicator */
.status-card .check-dot {
  position: absolute;
  top: 10px; right: 10px;
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid #d1d5db;
  background: white;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}
.status-card .check-dot::after {
  content: '✓';
  font-size: .55rem;
  color: transparent;
  font-weight: 900;
}

.status-card .s-emoji {
  font-size: 2rem;
  display: block;
  margin-bottom: 6px;
  filter: grayscale(.3);
  transition: var(--transition);
}
.status-card .s-label {
  font-size: .8rem;
  font-weight: 700;
  color: var(--text-mid);
  line-height: 1.3;
  transition: var(--transition);
}
.status-card .s-sub {
  font-size: .68rem;
  color: var(--text-xs);
  margin-top: 2px;
}

/* ACTIVE STATE - HADIR */
.status-card.hadir.active {
  border-color: var(--success);
  background: linear-gradient(135deg, rgba(34,197,94,.06) 0%, rgba(34,197,94,.02) 100%);
  box-shadow: 0 0 0 3px rgba(34,197,94,.15), 0 6px 20px rgba(34,197,94,.1);
  transform: translateY(-2px);
}
.status-card.hadir.active .s-label  { color: #16a34a; }
.status-card.hadir.active .s-emoji  { filter: none; }
.status-card.hadir.active .check-dot {
  border-color: var(--success);
  background: var(--success);
}
.status-card.hadir.active .check-dot::after { color: white; }

/* ACTIVE STATE - TIDAK */
.status-card.tidak.active {
  border-color: var(--danger);
  background: linear-gradient(135deg, rgba(239,68,68,.06) 0%, rgba(239,68,68,.02) 100%);
  box-shadow: 0 0 0 3px rgba(239,68,68,.15), 0 6px 20px rgba(239,68,68,.1);
  transform: translateY(-2px);
}
.status-card.tidak.active .s-label  { color: #dc2626; }
.status-card.tidak.active .s-emoji  { filter: none; }
.status-card.tidak.active .check-dot {
  border-color: var(--danger);
  background: var(--danger);
}
.status-card.tidak.active .check-dot::after { color: white; }

/* ── TIDAK HADIR FIELDS ── */
#tidak-hadir-fields {
  background: linear-gradient(135deg, #fff5f5 0%, #fff8f8 100%);
  border: 1.5px solid rgba(239,68,68,.2);
  border-radius: var(--radius);
  padding: 18px 16px;
  margin-top: 16px;
  display: none;
  animation: expandDown .3s ease;
}
#tidak-hadir-fields.show { display: block; }

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

.tidak-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(239,68,68,.15);
}
.tidak-head span {
  font-size: .7rem;
  font-weight: 700;
  color: #dc2626;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ── FORM CONTROLS ── */
.form-group {
  margin-bottom: 12px;
}
.form-group:last-child { margin-bottom: 0; }

.form-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: .75rem;
  font-weight: 700;
  color: var(--text-mid);
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-bottom: 4px;
}
.form-label .req {
  color: var(--danger);
  font-size: .8rem;
  line-height: 1;
}

.form-control {
  width: 100%;
  padding: 8px 12px;
  font-family: var(--font);
  font-size: .85rem;
  color: var(--text-dark);
  background: var(--white);
  border: 1.5px solid var(--input-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-input);
  transition: var(--transition);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}
.form-control:hover  { border-color: #9ca3af; }
.form-control:focus  {
  border-color: var(--input-focus);
  box-shadow: 0 0 0 3px rgba(59,130,246,.15), var(--shadow-input);
}
.form-control::placeholder { color: #c4c9d4; font-size: .88rem; }

/* Custom select arrow */
select.form-control {
  cursor: pointer;
  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='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 38px;
}

textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

/* Two-column grid for fields */
.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ── INPUT WITH ICON ── */
.input-wrap {
  position: relative;
}
.input-wrap .input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-xs);
  font-size: .9rem;
  pointer-events: none;
}
.input-wrap .form-control.has-icon {
  padding-left: 36px;
}
textarea.form-control.has-icon { padding-left: 14px; }

/* ── SUBMIT BUTTON ── */
.btn-submit {
  position: relative;
  width: 100%;
  padding: 12px 20px;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 50%, #4f46e5 100%);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: .95rem;
  font-weight: 700;
  letter-spacing: .3px;
  cursor: pointer;
  transition: all var(--transition);
  overflow: hidden;
  box-shadow: 0 4px 18px rgba(37,99,235,.45), 0 2px 6px rgba(37,99,235,.3);
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-submit::before {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.12), transparent);
  transition: left .6s ease;
}
.btn-submit:hover::before { left: 100%; }
.btn-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(37,99,235,.55), 0 4px 12px rgba(37,99,235,.3);
}
.btn-submit:active {
  transform: translateY(0);
  box-shadow: 0 3px 12px rgba(37,99,235,.4);
}
.btn-submit:disabled {
  opacity: .65;
  cursor: not-allowed;
  transform: none;
}
.btn-submit .btn-icon { font-size: 1.1rem; }
.btn-submit .spinner {
  width: 18px; height: 18px;
  border: 2.5px solid rgba(255,255,255,.35);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform:rotate(360deg); } }

/* ── CARD FOOTER INFO ── */
.card-footer-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 28px 20px;
  font-size: .72rem;
  color: #94a3b8;
  border-top: 1px solid #f1f5f9;
}
.card-footer-note span { color: var(--success); font-weight: 700; }

/* ── ADMIN LINK ── */
.admin-link-footer {
  margin-top: 22px;
  z-index: 2;
  animation: fadeIn .6s .3s ease both;
  text-align: center;
}
@keyframes fadeIn { from {opacity:0;} to {opacity:1;} }
.admin-link-footer a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: rgba(26, 60, 52, 0.7);
  font-size: .75rem;
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 99px;
  border: 1px solid rgba(26, 60, 52, 0.2);
  transition: var(--transition);
  backdrop-filter: blur(6px);
}
.admin-link-footer a:hover {
  color: #1a3c34;
  border-color: rgba(26, 60, 52, 0.4);
  background: rgba(26, 60, 52, 0.05);
}

/* ════════════════════════════════════════
   MOBILE RESPONSIVE (≤ 480px)
════════════════════════════════════════ */
@media (max-width: 480px) {
  .public-bg {
    padding: 28px 12px 40px;
  }

  .logo-ring {
    width: 84px;
    height: 84px;
  }
  .logo-ring img {
    width: 70px;
    height: 70px;
  }
  .logo-placeholder-icon { font-size: 2rem; }

  .school-name { font-size: 1.25rem; }

  .form-body { padding: 22px 18px 26px; }

  .status-grid { gap: 10px; }
  .status-card { padding: 16px 8px 12px; }
  .status-card .s-emoji { font-size: 1.7rem; }
  .status-card .s-label { font-size: .75rem; }

  .form-control { font-size: .875rem; }

  .form-row-2 { grid-template-columns: 1fr; gap: 0; }

  .btn-submit { padding: 14px; font-size: .9rem; }
}

/* ════════════════════════════════════════
   TABLET (481px – 768px)
════════════════════════════════════════ */
@media (min-width: 481px) and (max-width: 768px) {
  .public-bg { padding: 32px 20px 44px; }
  .form-body { padding: 26px 24px 30px; }
}

/* ════════════════════════════════════════
   SAFE AREA (notch phones)
════════════════════════════════════════ */
@supports (padding: env(safe-area-inset-bottom)) {
  .public-bg {
    padding-bottom: calc(48px + env(safe-area-inset-bottom));
  }
}
