/* =========================================================
   Auth pages (login / register / forgot / set password)
   Night-sky gradient · slowly drifting light orbs · twinkling stars · glass card
   All motion is slow and soft; disabled for prefers-reduced-motion.
   ========================================================= */
:root { --navy-1: #0F1626; --navy-2: #22324F; --brand: #1E5BA8; --brand-2: #3B7DD8; --gold: #C9A961; --gold-2: #A88A47; --text: #1C2434; --muted: #6B7484; }
* { box-sizing: border-box; }
body.auth-body {
  margin: 0; min-height: 100vh; display: grid; place-items: center; padding: 40px 24px 64px; overflow-x: hidden;
  font-family: 'Heebo', 'Segoe UI', Arial, sans-serif; color: var(--text);
  background: linear-gradient(160deg, #0B1220 0%, var(--navy-2) 55%, #1A2A48 100%);
}

/* ---------- Animated background ---------- */
.sky { position: fixed; inset: 0; overflow: hidden; z-index: 0; pointer-events: none; }
/* faint flowing lines drifting slowly */
.lattice { position: absolute; inset: -50%; opacity: .08; animation: latticeDrift 140s linear infinite;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='120' viewBox='0 0 160 120'%3E%3Cg fill='none' stroke='%23E6CF94' stroke-width='1'%3E%3Cpath d='M0 30 C40 10 120 50 160 30'/%3E%3Cpath d='M0 85 C50 105 110 65 160 85'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 160px 120px; }
@keyframes latticeDrift { to { transform: translate(160px, 120px); } }
.orb { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .55; will-change: transform; }
.o1 { width: 520px; height: 520px; background: radial-gradient(circle, rgba(201,169,97,.75), transparent 65%); top: -140px; right: -120px; animation: drift1 26s ease-in-out infinite alternate; }
.o2 { width: 600px; height: 600px; background: radial-gradient(circle, rgba(59,125,216,.7), transparent 65%); bottom: -220px; left: -160px; animation: drift2 32s ease-in-out infinite alternate; }
.o3 { width: 360px; height: 360px; background: radial-gradient(circle, rgba(140,110,220,.45), transparent 65%); top: 40%; left: 55%; animation: drift3 38s ease-in-out infinite alternate; }
@keyframes drift1 { to { transform: translate(-120px, 90px) scale(1.12); } }
@keyframes drift2 { to { transform: translate(140px, -80px) scale(1.08); } }
@keyframes drift3 { to { transform: translate(-180px, -120px) scale(.9); } }
.stars {
  position: absolute; inset: -50%;
  background-image:
    radial-gradient(1.5px 1.5px at 20% 30%, rgba(255,255,255,.8), transparent 60%),
    radial-gradient(1px 1px at 70% 20%, rgba(255,255,255,.7), transparent 60%),
    radial-gradient(1.2px 1.2px at 40% 80%, rgba(255,255,255,.6), transparent 60%),
    radial-gradient(1px 1px at 85% 65%, rgba(233,196,106,.8), transparent 60%),
    radial-gradient(1.4px 1.4px at 10% 75%, rgba(255,255,255,.5), transparent 60%),
    radial-gradient(1px 1px at 55% 50%, rgba(255,255,255,.6), transparent 60%);
  background-size: 340px 340px; animation: twinkle 7s ease-in-out infinite alternate, starsMove 120s linear infinite;
}
@keyframes twinkle { from { opacity: .35; } to { opacity: .85; } }
@keyframes starsMove { to { transform: translateY(-340px); } }

/* ---------- Shell: brand panel + form card ---------- */
.auth-shell {
  position: relative; z-index: 1; width: min(1020px, 100%); display: grid; grid-template-columns: 1.05fr 1fr;
  border-radius: 28px; overflow: hidden; background: rgba(255, 255, 255, .04);
  box-shadow: 0 40px 100px rgba(3, 8, 20, .6), 0 0 0 1px rgba(230, 207, 148, .2);
  animation: shellIn 1s cubic-bezier(.22, 1, .36, 1) both;
}
@keyframes shellIn { from { opacity: 0; transform: translateY(30px) scale(.97); filter: blur(6px); } }

.auth-brand {
  position: relative; overflow: hidden; color: #fff; text-align: center; padding: 52px 40px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  background: linear-gradient(165deg, rgba(30, 91, 168, .42) 0%, rgba(15, 22, 38, .6) 100%); backdrop-filter: blur(6px);
  border-left: 1px solid rgba(230, 207, 148, .2);
}
.auth-brand::before { /* one soft light sweep across the panel */
  content: ""; position: absolute; inset: 0; pointer-events: none; transform: translateX(100%);
  background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, .12) 50%, transparent 65%);
  animation: sweep 2.4s ease-out 1s 1 forwards;
}
@keyframes sweep { to { transform: translateX(-100%); } }
.logo-stage { position: relative; width: 150px; aspect-ratio: 1; margin-bottom: 20px; animation: logoStage 1.2s cubic-bezier(.22, 1, .36, 1) .2s both; }
@keyframes logoStage { from { opacity: 0; transform: scale(.7) rotate(-10deg); } }
.logo-ring { /* turning gold ring */
  position: absolute; inset: -10px; border-radius: 50%; opacity: .95; animation: ringSpin 16s linear infinite;
  background: conic-gradient(from 0deg, rgba(233,196,106,0) 0deg, #E9C46A 70deg, rgba(233,196,106,0) 140deg, rgba(233,196,106,0) 220deg, #C9A961 290deg, rgba(233,196,106,0) 360deg);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
}
@keyframes ringSpin { to { transform: rotate(360deg); } }
.logo-halo { position: absolute; inset: -30px; border-radius: 50%; background: radial-gradient(circle, rgba(233,196,106,.32) 0%, transparent 65%); animation: haloPulse 6s ease-in-out infinite; }
@keyframes haloPulse { 0%, 100% { opacity: .55; transform: scale(.95); } 50% { opacity: 1; transform: scale(1.06); } }
.logo-disc { position: absolute; inset: 0; border-radius: 50%; display: grid; place-items: center; font-size: 4rem; color: var(--gold);
  background: linear-gradient(145deg, #22324F, #0F1626); box-shadow: 0 16px 38px rgba(0,0,0,.4), inset 0 0 0 3px rgba(201,169,97,.6); }
.logo-disc i { animation: bookFloat 6s ease-in-out 1.4s infinite; }
@keyframes bookFloat { 50% { transform: translateY(-4px); } }
.brand-kicker { font-size: .9rem; letter-spacing: 1.5px; color: #E9C46A; animation: fadeUp .8s ease .5s both; }
.brand-name { font-weight: 800; font-size: clamp(1.9rem, 3.2vw, 2.6rem); line-height: 1.15; text-shadow: 0 2px 18px rgba(0,0,0,.35); animation: fadeUp .9s cubic-bezier(.22, 1, .36, 1) .62s both; }
.brand-divider { width: 120px; height: 2px; margin: 14px auto 12px; background: linear-gradient(90deg, transparent, var(--gold), transparent); animation: drawLine 1s cubic-bezier(.22, 1, .36, 1) .9s both; }
@keyframes drawLine { from { transform: scaleX(0); opacity: 0; } }
.brand-tagline { font-size: 1.02rem; color: rgba(255,255,255,.84); max-width: 340px; line-height: 1.6; margin: 0; animation: fadeUp .9s ease 1.05s both; }
.brand-features { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 10px; text-align: right; }
.brand-features li { display: flex; align-items: center; gap: 10px; font-size: .95rem; color: rgba(255,255,255,.9); animation: fadeUp .7s ease both; }
.brand-features li:nth-child(1) { animation-delay: 1.2s; } .brand-features li:nth-child(2) { animation-delay: 1.32s; } .brand-features li:nth-child(3) { animation-delay: 1.44s; }
.brand-features i { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; color: #E9C46A; background: rgba(255,255,255,.08); border: 1px solid rgba(230,207,148,.25); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } }

/* ---------- Form card ---------- */
.auth-card {
  position: relative; z-index: 1; padding: 44px 40px 30px; background: rgba(255, 255, 255, .96);
  animation: formIn 1s cubic-bezier(.22, 1, .36, 1) .3s both;
}
@keyframes formIn { from { opacity: 0; transform: translateX(-24px); } }
.auth-logo { display: none; } /* the brand panel shows the logo; on narrow screens the card shows its own */
@keyframes logoIn { from { opacity: 0; transform: scale(.6) rotate(-12deg); } }
@keyframes glow { 50% { box-shadow: 0 12px 30px rgba(0,0,0,.35), 0 0 0 10px rgba(201,169,97,.12), 0 0 38px rgba(233,196,106,.45); } }
.auth-card h1 { text-align: center; font-weight: 800; font-size: 1.85rem; margin: 0; color: var(--navy-1); letter-spacing: .2px; }
.auth-sub { text-align: center; color: var(--muted); margin: 4px 0 22px; }

/* staggered entrance of the content */
.auth-card > * { animation: rise .7s cubic-bezier(.22, 1, .36, 1) both; }
.auth-card > h1 { animation-delay: .5s; } .auth-card > .auth-sub { animation-delay: .58s; }
.auth-form .field, .auth-form .two, .auth-form .row-end, .auth-form .auth-btn { animation: rise .7s cubic-bezier(.22, 1, .36, 1) both; }
.auth-form > :nth-child(2) { animation-delay: .66s; } .auth-form > :nth-child(3) { animation-delay: .74s; }
.auth-form > :nth-child(4) { animation-delay: .82s; } .auth-form > :nth-child(5) { animation-delay: .9s; }
.auth-form > :nth-child(6) { animation-delay: .56s; } .auth-form > :nth-child(7) { animation-delay: .62s; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }

/* ---------- Form ---------- */
.auth-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.auth-form .two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field { display: block; margin: 0; }
.field > span { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; color: #3A4456; }
.field small { color: var(--muted); font-weight: 400; }
.input-wrap { position: relative; display: flex; align-items: center; border-radius: 14px; background: #F4F6FA; border: 1.5px solid #E1E6EE; transition: border-color .25s, box-shadow .25s, background .25s; }
.input-wrap:focus-within { background: #fff; border-color: var(--brand-2); box-shadow: 0 0 0 4px rgba(59,125,216,.14); }
.input-wrap > i { position: absolute; right: 14px; color: #9AA3B2; font-size: 1.05rem; transition: color .25s; }
.input-wrap:focus-within > i { color: var(--gold-2); }
.input-wrap input { flex: 1; width: 100%; border: 0; background: transparent; outline: 0; padding: 13px 44px 13px 14px; font: inherit; font-size: 1rem; color: var(--text); border-radius: 14px; min-width: 0; }
.input-wrap.readonly { opacity: .7; }
.toggle-pw { border: 0; background: none; color: #9AA3B2; padding: 0 14px; height: 100%; cursor: pointer; }
.toggle-pw:hover { color: var(--brand); }
.row-end { text-align: left; margin-top: -4px; }
.row-end a, .auth-links a { color: var(--brand); font-weight: 600; text-decoration: none; }
.row-end a:hover, .auth-links a:hover { color: var(--gold-2); }

.auth-btn {
  position: relative; overflow: hidden; margin-top: 4px; border: 0; border-radius: 14px; padding: 14px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 10px; font: inherit; font-size: 1.08rem; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--brand-2), var(--brand) 60%, #18478A);
  box-shadow: 0 10px 24px rgba(30,91,168,.35); transition: transform .2s, box-shadow .25s;
}
.auth-btn:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(30,91,168,.42); }
.auth-btn:active { transform: translateY(0); }
.auth-btn::after { /* gentle sheen sweeping across on hover */
  content: ""; position: absolute; top: 0; bottom: 0; width: 40%; right: -60%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.28), transparent); transform: skewX(-20deg);
}
.auth-btn:hover::after { animation: sheen 1.1s ease; }
@keyframes sheen { to { right: 130%; } }
.auth-btn i { transition: transform .25s; }
.auth-btn:hover i.bi-arrow-left { transform: translateX(-4px); }
.auth-btn.loading { pointer-events: none; opacity: .85; }
.auth-btn.loading span::after { content: "…"; }

.auth-alert { border-radius: 12px; padding: 10px 14px; margin-bottom: 14px; font-weight: 500; animation: rise .5s both; }
.auth-alert.error { background: #FDECEE; color: #9B1C2C; border: 1px solid #F6C9CF; animation: rise .5s both, shake .45s .1s; }
.auth-alert.ok { background: #E8F6EE; color: #146C43; border: 1px solid #C3E8D2; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.auth-links { text-align: center; margin-top: 20px; padding-top: 16px; border-top: 1px solid #EEF1F6; color: var(--muted); animation-delay: .7s; }

/* ---------- Footer credit ---------- */
.site-footer { position: fixed; bottom: 0; left: 0; right: 0; z-index: 2; padding: 7px 10px; text-align: center; font-size: .76rem;
  color: rgba(255,255,255,.6); background: rgba(10, 16, 30, .45); backdrop-filter: blur(6px); border-top: 1px solid rgba(230,207,148,.15);
  animation: fadeUp .8s ease 1.6s both; }
.site-footer a { color: #E9C46A; font-weight: 600; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.site-footer .sep { margin: 0 6px; opacity: .45; }

/* ---------- Narrow screens: form card only (with its own logo) ---------- */
@media (max-width: 900px) {
  body.auth-body { padding: 64px 16px 56px; }
  .auth-shell { grid-template-columns: 1fr; width: min(460px, 100%); overflow: visible; border-radius: 26px; }
  .auth-brand { display: none; }
  .auth-card { border-radius: 26px; animation: shellIn 1s cubic-bezier(.22, 1, .36, 1) .1s both; }
  .auth-logo { display: grid; width: 82px; height: 82px; margin: -84px auto 14px; border-radius: 50%; place-items: center; font-size: 2.2rem;
    color: var(--gold); background: linear-gradient(145deg, var(--navy-2), var(--navy-1)); border: 3px solid var(--gold);
    box-shadow: 0 12px 30px rgba(0,0,0,.35); animation: logoIn 1s .15s cubic-bezier(.22, 1, .36, 1) both, glow 5s 1.2s ease-in-out infinite; }
}
@media (max-width: 480px) { .auth-card { padding: 34px 20px 22px; } .auth-form .two { grid-template-columns: minmax(0, 1fr); } .site-footer { font-size: .68rem; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* Accessibility: clear keyboard focus */
a:focus-visible, button:focus-visible, input:focus-visible { outline: 3px solid #E9A23B; outline-offset: 2px; }

/* One-time data-entry declaration (confirm.php) */
.confirm-box { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border: 1px solid #DDE3EC; border-radius: 14px; background: #F7F9FC; line-height: 1.7; cursor: pointer; font-size: .97rem; }
.confirm-box input { width: 20px; height: 20px; margin-top: 4px; flex-shrink: 0; accent-color: var(--brand); }
.confirm-note { margin: 10px 2px 16px; font-size: .82rem; color: var(--muted); line-height: 1.6; }
