/* ==========================================================================
   Ganesh Matka — authentication screens (login, sign-up, OTP, PIN)
   Requires ganesh-theme.css for tokens and the royal backdrop.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html, body.gm-auth {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body.gm-auth {
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    color: var(--gm-text);
}

.auth-shell {
    position: relative;
    width: 100%;
    max-width: 480px;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
}

/* ---------- Hero with the logo ---------- */
.auth-hero {
    position: relative;
    flex: 0 0 auto;
    padding: calc(34px + var(--gm-safe-top)) 24px 26px;
    text-align: center;
}

.auth-logo-wrap {
    position: relative;
    width: 128px;
    height: 128px;
    margin: 0 auto;
}

.auth-logo-wrap::before {
    content: "";
    position: absolute;
    inset: -22px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(245, 169, 63, 0.45) 0%, rgba(245, 169, 63, 0) 68%);
    animation: authHalo 3.2s ease-in-out infinite;
}

.auth-logo-wrap img {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 26%;
    box-shadow: 0 0 0 2px rgba(246, 207, 122, 0.9), 0 14px 30px rgba(0, 0, 0, 0.55);
    animation: authFloat 4s ease-in-out infinite;
}

@keyframes authHalo { 50% { transform: scale(1.08); opacity: 0.75; } }
@keyframes authFloat { 50% { transform: translateY(-4px); } }

.auth-tagline {
    margin: 18px 0 0;
    font-family: var(--gm-font-display);
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--gm-gold-300);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.auth-tagline::before,
.auth-tagline::after {
    content: "";
    width: 34px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gm-gold));
}

.auth-tagline::after { transform: scaleX(-1); }

/* ---------- Ivory sheet ---------- */
.auth-sheet {
    position: relative;
    flex: 1 0 auto;
    background:
        radial-gradient(120% 60% at 50% 0%, #FFFFFF 0%, var(--gm-cream) 70%);
    border-radius: 30px 30px 0 0;
    padding: 30px 22px calc(28px + var(--gm-safe-bottom));
    box-shadow: 0 -12px 34px rgba(0, 0, 0, 0.45);
    animation: sheetUp 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.auth-sheet::before {
    content: "";
    position: absolute;
    top: 0;
    left: 24px;
    right: 24px;
    height: 3px;
    border-radius: 0 0 3px 3px;
    background: var(--gm-grad-gold);
}

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

.auth-title {
    margin: 0;
    text-align: center;
    font-family: var(--gm-font-display);
    font-weight: 800;
    font-size: 23px;
    letter-spacing: 1px;
    color: var(--gm-800);
}

.auth-subtitle {
    margin: 6px 0 24px;
    text-align: center;
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--gm-muted);
}

/* ---------- Fields ---------- */
.auth-form { display: flex; flex-direction: column; gap: 14px; }

.auth-field {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 58px;
    padding: 8px 14px 8px 8px;
    background: var(--gm-paper);
    border: 1.5px solid var(--gm-line);
    border-radius: 16px;
    box-shadow: 0 2px 6px rgba(77, 10, 5, 0.06);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.auth-field:focus-within {
    border-color: var(--gm-gold-700);
    box-shadow: 0 0 0 4px rgba(245, 169, 63, 0.2);
}

.auth-field-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gm-grad-crimson);
    color: var(--gm-gold-300);
    font-size: 16px;
    box-shadow: inset 0 0 0 1px rgba(246, 207, 122, 0.35);
}

.auth-field-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.auth-field-label {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: var(--gm-muted);
    line-height: 1.2;
}

.auth-field-row { display: flex; align-items: center; gap: 6px; }

.auth-prefix { font-size: 16px; font-weight: 600; color: var(--gm-800); }

.auth-input {
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    padding: 2px 0 0;
    font-family: var(--gm-font-body);
    font-size: 16px; /* >=16px keeps WebViews from zooming on focus */
    font-weight: 500;
    color: var(--gm-text);
    letter-spacing: 0.5px;
}

.auth-input::placeholder { color: #B5A098; font-weight: 400; letter-spacing: 0; }
.auth-input[readonly] { color: var(--gm-700); }
.auth-input::-webkit-outer-spin-button,
.auth-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.auth-eye {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--gm-muted);
    font-size: 16px;
    cursor: pointer;
    flex-shrink: 0;
}

.auth-row-end { display: flex; justify-content: flex-end; margin-top: -4px; }

.auth-link {
    color: var(--gm-crimson);
    font-size: 13.5px;
    font-weight: 600;
    text-decoration: none;
}

/* ---------- Buttons ---------- */
.auth-btn {
    position: relative;
    width: 100%;
    height: 56px;
    border: 1px solid rgba(246, 207, 122, 0.7);
    border-radius: 18px;
    background: var(--gm-grad-crimson);
    color: var(--gm-gold-100);
    font-family: var(--gm-font-body);
    font-size: 16.5px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    overflow: hidden;
    box-shadow: 0 10px 22px rgba(142, 18, 9, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.18);
    transition: transform 0.08s ease, filter 0.15s ease;
}

.auth-btn::after {
    content: "";
    position: absolute;
    top: 0;
    left: -60%;
    width: 40%;
    height: 100%;
    background: linear-gradient(100deg, transparent, rgba(255, 241, 184, 0.35), transparent);
    animation: authShine 3.6s ease-in-out infinite;
}

@keyframes authShine { 0%, 60% { left: -60%; } 100% { left: 130%; } }

.auth-btn:active { transform: scale(0.98); }
.auth-btn:disabled { filter: saturate(0.6) brightness(0.9); }
.auth-btn i { color: var(--gm-gold-300); }

.auth-btn-gold {
    background: var(--gm-grad-gold);
    color: var(--gm-800);
    border-color: rgba(122, 74, 14, 0.4);
    box-shadow: var(--gm-shadow-gold), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.auth-btn-gold i { color: var(--gm-800); }

/* ---------- Help + switch ---------- */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 8px 0 2px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--gm-muted);
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gm-line), transparent);
}

.auth-help { display: flex; justify-content: center; gap: 16px; }

.auth-help a,
.auth-help .auth-help-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 999px;
    background: var(--gm-paper);
    border: 1px solid var(--gm-line);
    color: var(--gm-800);
    font-size: 13.5px;
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 2px 6px rgba(77, 10, 5, 0.06);
    cursor: pointer;
}

.auth-help .is-call i { color: var(--gm-crimson); }
.auth-help .is-whatsapp i { color: #1DAA55; font-size: 16px; }

.auth-switch {
    margin-top: 10px;
    text-align: center;
    font-size: 14.5px;
    color: var(--gm-muted);
}

.auth-switch a { margin-left: 4px; color: var(--gm-crimson); font-weight: 700; text-decoration: none; }

.auth-note {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(245, 169, 63, 0.12);
    border: 1px solid rgba(184, 118, 26, 0.3);
    color: var(--gm-gold-900);
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.4;
}

.auth-note i { color: var(--gm-gold-700); font-size: 18px; margin-top: 1px; }
.auth-note span { display: block; font-weight: 400; color: var(--gm-muted); font-size: 12.5px; margin-top: 2px; }

.auth-footer {
    margin-top: 22px;
    text-align: center;
    font-size: 11.5px;
    color: #A68E84;
    letter-spacing: 0.3px;
}

.auth-footer i { color: var(--gm-gold-700); margin-right: 4px; }

/* Multi-step register flow */
.auth-stage { display: none; flex-direction: column; gap: 14px; }
.auth-stage.show { display: flex; animation: stageIn 0.3s ease both; }
.mobile-stage { display: flex; flex-direction: column; gap: 14px; }
.mobile-stage.hide { display: none; }
.register-btn, .login-btn { display: none; }
.register-btn.show, .login-btn.show { display: flex; }

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

/* PIN / OTP digit boxes */
.auth-digits { display: flex; justify-content: center; gap: 12px; }

.auth-digits input {
    width: 56px;
    height: 62px;
    border-radius: 16px;
    border: 1.5px solid var(--gm-line);
    background: var(--gm-paper);
    text-align: center;
    font-family: var(--gm-font-body);
    font-size: 24px;
    font-weight: 700;
    color: var(--gm-800);
    outline: 0;
    box-shadow: 0 2px 6px rgba(77, 10, 5, 0.06);
}

.auth-digits input:focus { border-color: var(--gm-gold-700); box-shadow: 0 0 0 4px rgba(245, 169, 63, 0.2); }

/* SweetAlert2 in the brand palette */
.swal2-popup { border-radius: 22px !important; font-family: var(--gm-font-body) !important; }
.swal2-title { font-family: var(--gm-font-display) !important; color: var(--gm-800) !important; }
.swal2-styled.swal2-confirm {
    background: var(--gm-grad-crimson) !important;
    color: var(--gm-gold-100) !important;
    border-radius: 14px !important;
    border: 1px solid rgba(246, 207, 122, 0.6) !important;
    box-shadow: none !important;
}

.auth-alert {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(198, 40, 40, 0.07);
    border: 1px solid rgba(198, 40, 40, 0.3);
    color: var(--gm-danger);
    font-size: 13.5px;
    font-weight: 500;
}

/* Tablets / desktop (admin is used here): float the sheet as a centred card */
@media (min-width: 768px) {
    .auth-shell { justify-content: center; padding: 40px 0; }
    .auth-hero { padding-top: 10px; }
    .auth-sheet { flex: 0 0 auto; border-radius: 28px; padding-bottom: 30px; }
}

/* Short screens: tighter hero so the form stays above the keyboard */
@media (max-height: 700px) {
    .auth-hero { padding-top: calc(20px + var(--gm-safe-top)); padding-bottom: 18px; }
    .auth-logo-wrap { width: 96px; height: 96px; }
    .auth-tagline { margin-top: 12px; }
}
