:root {
  --primary-bright: #16a34a;
  --primary-dark: #15803d;
  --primary-pale: #e8f8ef;
  --primary-mid: #c8f0d8;
  --glass-border: rgba(22, 163, 74, 0.18);
  --text-primary: #0f1f16;
  --text-muted: rgba(15, 31, 22, 0.52);
  --cream: #f4fdf7;
  --white: #ffffff;
  --red: #dc2626;
  --red-pale: #fef2f2;
  --red-border: #fecaca;
  --yellow-pale: #fffbeb;
  --yellow-border: #fde68a;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Plus Jakarta Sans", sans-serif;
  min-height: 100vh;
  display: flex;
}

/* ── BACKGROUND ── */
.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 80% 80% at 20% 10%, #c8f0d8 0%, transparent 60%),
    radial-gradient(ellipse 60% 60% at 80% 90%, #d4edbb 0%, transparent 60%),
    linear-gradient(160deg, #e2f8ec 0%, #eef9f3 50%, #f4fbf7 100%);
  overflow: hidden;
}

.bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='none' stroke='rgba(22,163,74,0.08)' stroke-width='0.9'%3E%3Cpolygon points='60,5 115,35 115,85 60,115 5,85 5,35'/%3E%3Cpolygon points='60,20 100,42 100,78 60,100 20,78 20,42'/%3E%3Cline x1='60' y1='5' x2='60' y2='115'/%3E%3Cline x1='5' y1='35' x2='115' y2='85'/%3E%3Cline x1='5' y1='85' x2='115' y2='35'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 120px 120px;
}

.bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-size: 80px 80px;
}

/* soft glow orbs */
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
}

.orb-1 {
  width: 420px;
  height: 420px;
  top: -120px;
  left: -120px;
  background: radial-gradient(circle, rgba(22, 163, 74, 0.13) 0%, transparent 70%);
  animation: floatOrb 10s ease-in-out infinite;
}

.orb-2 {
  width: 340px;
  height: 340px;
  bottom: -80px;
  right: -80px;
  background: radial-gradient(circle, rgba(21, 128, 61, 0.1) 0%, transparent 70%);
  animation: floatOrb 14s ease-in-out infinite reverse;
}

@keyframes floatOrb {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(28px, 28px); }
}

/* ── PAGE LAYOUT ── */
.page {
  position: relative;
  z-index: 1;
  display: flex;
  width: 100%;
  min-height: 100vh;
}

.brand-logo {
  height: 28px;
  margin-bottom: 20px;
}

/* ── LEFT PANEL ── */
.left-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2rem;
}

@media (max-width: 860px) {
  .left-panel { display: none; }
}

/* ── CAROUSEL ── */
.carousel-wrap {
  width: 100%;
  max-width: 460px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--glass-border);
  position: relative;
}

.carousel-track {
  display: flex;
  transition: transform 0.5s cubic-bezier(0.77, 0, 0.18, 1);
}

.carousel-slide {
  min-width: 100%;
}

.carousel-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.carousel-dots {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(22, 163, 74, 0.3);
  cursor: pointer;
  transition: all 0.3s;
}

.dot.active {
  background: var(--primary-bright);
  width: 18px;
  border-radius: 3px;
}

/* ── RIGHT PANEL ── */
.right-panel {
  width: 45%;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2rem;
}

@media (max-width: 860px) {
  .right-panel {
    width: 100%;
    padding: 1.5rem 1rem;
  }
}

/* ── FORM CARD ── */
.form-card {
  width: 100%;
  max-width: 460px;
  background: var(--white);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  box-shadow:
    0 6px 32px rgba(22, 163, 74, 0.08),
    0 2px 8px rgba(0, 0, 0, 0.05);
  animation: fadeUp 0.55s cubic-bezier(0.22, 0.68, 0, 1.2) both;
  overflow: hidden;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Mobile carousel inside card */
.mobile-carousel-wrapper {
  display: none;
  padding: 2rem 1.75rem 0 1.75rem;
}

.mobile-carousel {
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--glass-border);
}

.mobile-carousel img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

@media (max-width: 860px) {
  .mobile-carousel-wrapper { display: block; overflow: hidden; }
}

/* ── FORM HEADER ── */
.form-wrapper { padding: 2rem 1.75rem; }

.form-header { margin-bottom: 1.5rem; }

.form-eyebrow {
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary-bright);
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.form-title {
  font-family: "DM Serif Display", serif;
  font-size: 1.7rem;
  color: var(--text-primary);
  line-height: 1.2;
}

.form-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

/* ── NAV TABS ── */
.form-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1.5rem;
  background: var(--primary-pale);
  border-radius: 9px;
  padding: 3px;
  border: 1px solid var(--glass-border);
}

.tab-link {
  flex: 1;
  text-align: center;
  padding: 0.4rem 0.35rem;
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 6px;
  transition: all 0.2s;
  white-space: nowrap;
  margin: 0 2px;
}

.tab-link:hover {
  background: var(--primary-mid);
  color: var(--primary-dark);
  outline: 1px solid var(--primary-dark);
  box-shadow: 0 1px 5px rgba(22, 163, 74, 0.12);
}

.tab-link.active {
  background: var(--primary-bright);
  color: var(--white);
  box-shadow: 0 1px 5px rgba(22, 163, 74, 0.12);
}

/* ── INPUTS ── */
.input-group { margin-bottom: 0.9rem; }

.input-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  letter-spacing: 0.03em;
}

.input-wrapper { position: relative; }

.input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  display: flex;
  align-items: center;
}

input[type="email"],
input[type="password"],
input[type="text"],
input[type="number"] {
  width: 100%;
  padding: 0.65rem 1rem 0.65rem 2.5rem;
  background: var(--cream);
  border: 1px solid var(--glass-border);
  border-radius: 9px;
  color: var(--text-primary);
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input::placeholder { color: var(--text-muted); }

input:focus {
  border-color: var(--primary-bright);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1);
  background: var(--white);
}

/* Remove number spinners */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; }
input[type="number"] { -moz-appearance: textfield; }

/* ── SELECT & TEXTAREA ── */
select,
textarea {
  width: 100%;
  padding: 0.65rem 1rem;
  background: var(--cream);
  border: 1px solid var(--glass-border);
  border-radius: 9px;
  color: var(--text-primary);
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  appearance: none;
  -webkit-appearance: none;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='rgba(15,31,22,0.45)' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 2.25rem;
  cursor: pointer;
}

select option { color: var(--text-primary); }
select option[value=""] { color: var(--text-muted); }

textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}

select:focus,
textarea:focus {
  border-color: var(--primary-bright);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1);
  background-color: var(--white);
}

/* ── FLOATING BUBBLES ── */
.bubble-container {
  position: fixed;
  right: 20px;
  bottom: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  z-index: 100;
}

.bubble {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--primary-bright);
  color: var(--white);
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(22, 163, 74, 0.35);
  transition: transform 0.2s, box-shadow 0.2s;
  font-size: 1.5rem;
}

.bubble:hover {
  transform: scale(1.1) translateY(-2px);
  box-shadow: 0 8px 22px rgba(22, 163, 74, 0.45);
  color: var(--white);
  text-decoration: none;
}

.bubble-label {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: center;
  margin-bottom: 6px;
}

/* ── FORM NOTE / HELPER TEXT ── */
.form-note {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 0.9rem;
  line-height: 1.4;
}

/* ── SPACER ── */
.field-gap { margin-bottom: 0.9rem; }

/* ── REGISTRASI CARD WIDER ── */
.form-card-wide { max-width: 520px; }

.toggle-pw {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  transition: color 0.2s;
  display: flex;
  align-items: center;
}

.toggle-pw:hover { color: var(--primary-bright); }

/* ── ALERTS ── */
.alert {
  padding: 0.7rem 0.9rem;
  border-radius: 9px;
  font-size: 0.8rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  line-height: 1.4;
}

.alert-danger {
  background: var(--red-pale);
  border: 1px solid var(--red-border);
  color: #991b1b;
}

.alert-success {
  background: var(--primary-pale);
  border: 1px solid var(--primary-mid);
  color: var(--primary-dark);
}

.alert-warning {
  background: var(--yellow-pale);
  border: 1px solid var(--yellow-border);
  color: #92400e;
}

/* ── SUBMIT BUTTON ── */
.turnstile-wrap {
  margin-bottom: 1rem;
  border-radius: 8px;
  overflow: hidden;
}

.btn-submit {
  width: 100%;
  padding: 0.78rem;
  background: linear-gradient(135deg, var(--primary-bright) 0%, var(--primary-dark) 100%);
  color: var(--white);
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  border: none;
  border-radius: 9px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 16px rgba(22, 163, 74, 0.25);
}

.btn-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(22, 163, 74, 0.35);
}

.btn-submit:active { transform: translateY(0); }

.register-row {
  text-align: center;
  margin-top: 1rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.register-row a {
  color: var(--primary-dark);
  font-weight: 600;
  text-decoration: none;
}

.register-row a:hover { text-decoration: underline; }

/* ── DOWNLOAD ROW ── */
.download-row {
  text-align: center;
  background: var(--cream);
  padding: 12px 0;
  border-top: 1px solid var(--primary-mid);
}

.download-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  margin-bottom: 0.5rem;
}

.download-btns {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
}

.download-btn {
  flex: 1;
  max-width: 130px;
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--white);
  border: 1px solid var(--glass-border);
  border-radius: 9px;
  padding: 0.5rem 0.75rem;
  text-decoration: none;
  color: var(--text-primary);
  font-size: 0.75rem;
  font-weight: 500;
  transition: border-color 0.2s, background 0.2s;
}

.download-btn:hover {
  border-color: var(--primary-bright);
  background: var(--primary-mid);
  padding: 6px;
  border-radius: 14px;
}

.bi { font-size: 1.1rem; }
.bi-google-play { color: var(--primary-bright); }

.store-name {
  font-size: 0.6rem;
  color: var(--text-muted);
  line-height: 1.1;
}

.store-big {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* ── PIN INPUTS (Tabungan Santri) ── */
.pin-section { margin-top: 1rem; display: none; }
.pin-section.visible { display: block; }

.pin-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
  letter-spacing: 0.03em;
}

.pin-inputs {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  margin-bottom: 0.9rem;
}

.pin-input {
  width: 42px !important;
  height: 48px;
  padding: 0 !important;
  text-align: center;
  font-size: 1.3rem !important;
  font-weight: 700;
  border-radius: 9px;
  background: var(--cream);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.pin-input:focus {
  border-color: var(--primary-bright);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1);
  background: var(--white);
}

/* ── RFID HINT ── */
.rfid-hint {
  text-align: center;
  padding: 1rem;
  background: var(--primary-pale);
  border: 1px dashed rgba(22, 163, 74, 0.4);
  border-radius: 12px;
  margin-bottom: 1rem;
  font-size: 0.78rem;
  color: var(--primary-dark);
}

.rfid-hint .rfid-icon {
  font-size: 2rem;
  margin-bottom: 0.35rem;
  display: block;
}

/* ── STUDENT INFO ── */
.student-info {
  display: none;
  text-align: center;
  padding: 1rem;
  background: var(--primary-pale);
  border-radius: 12px;
  margin-bottom: 1rem;
}

.student-info.visible { display: block; }

/* ── PRESENCE PAGE ── */
.presence-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  min-height: 100vh;
}

.presence-page {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  min-height: 100vh;
}

.presence-navbar {
  width: 100%;
  max-width: 520px;
  background: linear-gradient(135deg, var(--primary-bright) 0%, var(--primary-dark) 100%);
  color: var(--white);
  padding: 1rem 1.5rem;
  text-align: center;
  border-bottom-left-radius: 20px;
  border-bottom-right-radius: 20px;
  box-shadow: 0 4px 20px rgba(22, 163, 74, 0.25);
}

.presence-navbar img {
  height: 48px;
  margin-bottom: 0.4rem;
}

.presence-navbar .school-name {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
}

.presence-navbar .school-detail {
  font-size: 0.7rem;
  opacity: 0.82;
  margin-top: 0.15rem;
}

.presence-datetime {
  padding: 1.25rem 1rem 0.5rem;
  text-align: center;
}

.date-display {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
}

.time-display {
  font-size: 3rem;
  font-weight: 700;
  color: var(--primary-bright);
  letter-spacing: 3px;
  font-family: "Plus Jakarta Sans", sans-serif;
  line-height: 1;
}

.time-label {
  display: flex;
  justify-content: center;
  gap: 3.2rem;
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.presence-content {
  width: 100%;
  max-width: 520px;
  padding: 1rem;
}

/* ── PRESENCE STATES ── */
.presence-spinner {
  display: none;
  text-align: center;
  padding: 1.25rem;
}

.presence-spinner.active { display: block; }

.spinner {
  border: 3px solid var(--primary-pale);
  border-top-color: var(--primary-bright);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  animation: spin 0.75s linear infinite;
  margin: 0 auto 0.5rem;
}

@keyframes spin { to { transform: rotate(360deg); } }

.spinner-text {
  font-size: 0.8rem;
  color: var(--primary-bright);
  font-weight: 600;
}

.attendance-info {
  display: none;
  background: linear-gradient(135deg, var(--primary-bright) 0%, var(--primary-dark) 100%);
  color: var(--white);
  padding: 1.25rem;
  border-radius: 14px;
  text-align: center;
  margin-bottom: 1rem;
  font-size: 0.88rem;
  box-shadow: 0 4px 16px rgba(22, 163, 74, 0.25);
}

.attendance-info.show {
  display: block;
  animation: fadeUp 0.3s ease;
}

.attendance-time {
  font-weight: 700;
  font-size: 1rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.3);
}

.error-message {
  display: none;
  background: var(--red-pale);
  border: 1px solid var(--red-border);
  color: #991b1b;
  padding: 1rem;
  border-radius: 12px;
  text-align: center;
  margin-bottom: 1rem;
  font-size: 0.85rem;
}

.error-message.show {
  display: block;
  animation: fadeUp 0.3s ease;
}

/* ── PRESENCE FORM CARD ── */
.presence-card {
  background: var(--white);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 4px 20px rgba(22, 163, 74, 0.08);
  margin-bottom: 1rem;
}

/* ── STUDENT AVATAR PLACEHOLDER ── */
[data-letters] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--primary-bright);
  color: var(--white);
  font-weight: 700;
  font-size: 2rem;
  font-family: "Plus Jakarta Sans", sans-serif;
}

[data-letters]::before { content: attr(data-letters); }

.student-photo {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--primary-bright);
}