/* ==========================================================================
   Arts School Manager — Auth (Login + Password + 2FA) Professional Theme
   --------------------------------------------------------------------------
   Drop-in stylesheet. Loads AFTER /assets/css/app.css and overrides only the
   auth pages via the .auth-shell wrapper that the layout already adds.
   No PHP, no markup, no core CSS changes required.
   ========================================================================== */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:wght@600;700;800&display=swap");

/* --------------------------------------------------------------------------
   1. Theme tokens (scoped to .auth-shell so we never bleed into the portal)
   -------------------------------------------------------------------------- */
.auth-shell {
    --auth-ink:           #0b1424;
    --auth-ink-soft:      #334155;
    --auth-muted:         #64748b;
    --auth-line:          rgba(15, 23, 42, 0.08);
    --auth-line-strong:   rgba(15, 23, 42, 0.14);
    --auth-surface:       #ffffff;
    --auth-surface-soft:  #f8fafc;

    --auth-brand:         #0e6b5c;
    --auth-brand-strong:  #0a5146;
    --auth-brand-deep:    #06372f;
    --auth-brand-soft:    rgba(14, 107, 92, 0.10);
    --auth-accent:        #d88b32;
    --auth-accent-soft:   rgba(216, 139, 50, 0.14);

    --auth-danger:        #b42318;
    --auth-success:       #027a48;

    --auth-radius:        20px;
    --auth-radius-sm:     12px;

    --auth-shadow-sm:     0 1px 2px rgba(15, 23, 42, 0.06);
    --auth-shadow-md:     0 6px 18px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --auth-shadow-lg:     0 30px 60px -20px rgba(15, 23, 42, 0.30), 0 18px 36px -18px rgba(14, 107, 92, 0.22);

    font-family: "Inter", "Segoe UI", "Helvetica Neue", system-ui, sans-serif;
    color: var(--auth-ink);
}

/* --------------------------------------------------------------------------
   2. Page shell — split layout: brand panel (left) + form panel (right)
   -------------------------------------------------------------------------- */
body.auth-shell {
    min-height: 100vh;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
    align-items: stretch;
    justify-items: stretch;
    background: #f1f5f9;
    background-image:
        radial-gradient(900px 600px at -10% -10%, rgba(14, 107, 92, 0.10), transparent 60%),
        radial-gradient(800px 600px at 110% 110%, rgba(216, 139, 50, 0.10), transparent 60%),
        linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
}

/* Left brand rail. The existing .auth-branding wraps the school logo,
   so we elevate it into a full-height pane on desktop. */
.auth-shell .auth-branding {
    position: relative;
    grid-column: 1;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-start;
    padding: 3rem 3rem 2.5rem;
    width: 100%;
    min-height: 100vh;
    color: #ffffff;
    background:
        radial-gradient(120% 80% at 10% 0%, rgba(255,255,255,0.12), transparent 55%),
        radial-gradient(80% 60% at 100% 100%, rgba(216, 139, 50, 0.30), transparent 60%),
        linear-gradient(160deg, var(--auth-brand-deep) 0%, var(--auth-brand) 60%, var(--auth-brand-strong) 100%);
    overflow: hidden;
    isolation: isolate;
}

.auth-shell .auth-branding::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(transparent 23px, rgba(255,255,255,0.045) 24px),
        linear-gradient(90deg, transparent 23px, rgba(255,255,255,0.045) 24px);
    background-size: 24px 24px;
    mask-image: radial-gradient(closest-side at 30% 30%, #000 55%, transparent 100%);
    z-index: -1;
    opacity: 0.6;
}

.auth-shell .auth-branding::after {
    content: "";
    position: absolute;
    right: -120px;
    bottom: -120px;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.10), transparent 70%);
    z-index: -1;
}

.auth-shell .auth-logo {
    max-width: 220px;
    max-height: 90px;
    object-fit: contain;
    filter: drop-shadow(0 6px 16px rgba(0,0,0,0.18));
    background: rgba(255,255,255,0.96);
    padding: 0.6rem 1rem;
    border-radius: 14px;
}

/* Synthesized brand copy — appears under the logo without changing markup */
.auth-shell .auth-branding::before { /* keep grid */ }

.auth-shell .auth-branding > *:not(img):not(.auth-brand-copy) { display: none; }

/* Inject brand statement using a flex spacer so the logo stays at top */
.auth-shell .auth-branding {
    gap: 2rem;
}

/* --------------------------------------------------------------------------
   3. Right pane — form area
   -------------------------------------------------------------------------- */
.auth-shell .auth-page {
    grid-column: 2;
    grid-row: 1;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: clamp(2rem, 6vw, 5rem) clamp(1.25rem, 5vw, 4rem);
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-shell .auth-page main,
.auth-shell main.auth-page { width: 100%; }

.auth-shell .auth-card {
    width: 100%;
    max-width: 460px;
    margin: 0 auto;
    padding: 2.25rem 2.25rem 2rem;
    background: var(--auth-surface);
    border: 1px solid var(--auth-line);
    border-radius: var(--auth-radius);
    box-shadow: var(--auth-shadow-lg);
    backdrop-filter: none;
}

.auth-shell .auth-card h1 {
    font-family: "Plus Jakarta Sans", "Inter", sans-serif;
    font-size: 1.85rem;
    line-height: 1.15;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: var(--auth-ink);
    margin: 0 0 0.55rem;
}

.auth-shell .auth-card > p {
    color: var(--auth-muted);
    font-size: 0.95rem;
    line-height: 1.55;
    margin: 0 0 1.5rem;
}

.auth-shell .auth-card > p:last-of-type {
    margin: 1.25rem 0 0;
    font-size: 0.9rem;
    color: var(--auth-ink-soft);
    text-align: center;
}

.auth-shell .auth-card a {
    color: var(--auth-brand);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.15s ease, color 0.15s ease;
}
.auth-shell .auth-card a:hover {
    color: var(--auth-brand-strong);
    border-bottom-color: currentColor;
}

/* --------------------------------------------------------------------------
   4. Form fields
   -------------------------------------------------------------------------- */
.auth-shell .grid-form,
.auth-shell .grid-form.single-column {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.05rem;
    margin-top: 0.5rem;
}

.auth-shell label {
    display: grid;
    gap: 0.4rem;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--auth-ink-soft);
    text-transform: none;
}

.auth-shell input,
.auth-shell select,
.auth-shell textarea {
    width: 100%;
    min-height: 48px;
    padding: 0.85rem 1rem;
    background: var(--auth-surface-soft);
    border: 1px solid var(--auth-line-strong);
    border-radius: var(--auth-radius-sm);
    font: inherit;
    font-size: 0.98rem;
    color: var(--auth-ink);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.6);
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.auth-shell input::placeholder { color: #94a3b8; }

.auth-shell input:hover,
.auth-shell select:hover,
.auth-shell textarea:hover { border-color: rgba(15,23,42,0.22); }

.auth-shell input:focus,
.auth-shell select:focus,
.auth-shell textarea:focus {
    outline: none;
    background: #fff;
    border-color: var(--auth-brand);
    box-shadow: 0 0 0 4px var(--auth-brand-soft);
}

/* --------------------------------------------------------------------------
   5. Buttons
   -------------------------------------------------------------------------- */
.auth-shell .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 50px;
    margin-top: 0.35rem;
    padding: 0.9rem 1.2rem;
    border: 1px solid transparent;
    border-radius: var(--auth-radius-sm);
    background: linear-gradient(180deg, var(--auth-brand) 0%, var(--auth-brand-strong) 100%);
    color: #fff;
    font: inherit;
    font-weight: 700;
    letter-spacing: 0.01em;
    cursor: pointer;
    box-shadow: 0 8px 18px -8px rgba(14, 107, 92, 0.55), inset 0 1px 0 rgba(255,255,255,0.18);
    transition: transform 0.05s ease, box-shadow 0.15s ease, background 0.2s ease;
}
.auth-shell .button:hover {
    background: linear-gradient(180deg, #0f7567 0%, #0a5146 100%);
    box-shadow: 0 12px 22px -10px rgba(14, 107, 92, 0.6), inset 0 1px 0 rgba(255,255,255,0.20);
}
.auth-shell .button:active { transform: translateY(1px); }
.auth-shell .button:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px var(--auth-brand-soft), 0 8px 18px -8px rgba(14, 107, 92, 0.55);
}

.auth-shell .button.secondary {
    background: #fff;
    color: var(--auth-ink);
    border: 1px solid var(--auth-line-strong);
    box-shadow: var(--auth-shadow-sm);
}
.auth-shell .button.secondary:hover { background: var(--auth-surface-soft); }

/* --------------------------------------------------------------------------
   6. Alerts (flash messages)
   -------------------------------------------------------------------------- */
.auth-shell .alert {
    padding: 0.85rem 1rem;
    border-radius: var(--auth-radius-sm);
    border: 1px solid var(--auth-line-strong);
    font-size: 0.92rem;
    font-weight: 500;
    margin: 0 0 1.1rem;
    background: #f8fafc;
    color: var(--auth-ink);
}
.auth-shell .alert.success {
    background: rgba(2, 122, 72, 0.08);
    border-color: rgba(2, 122, 72, 0.28);
    color: var(--auth-success);
}
.auth-shell .alert.error,
.auth-shell .alert.danger {
    background: rgba(180, 35, 24, 0.08);
    border-color: rgba(180, 35, 24, 0.28);
    color: var(--auth-danger);
}
.auth-shell .alert.info {
    background: var(--auth-brand-soft);
    border-color: rgba(14, 107, 92, 0.28);
    color: var(--auth-brand-strong);
}

/* --------------------------------------------------------------------------
   7. Brand panel decorative content (synthesized, no markup change)
   -------------------------------------------------------------------------- */
.auth-shell .auth-branding {
    position: relative;
}

/* The subtle SVG-as-data badge below the logo is purely decorative and
   created via a pseudo wrapper. We can't add nodes; instead we add a
   ::after on the body to overlay a fixed tagline. We use body::before. */

body.auth-shell::before {
    content: "Arts School Manager";
    position: fixed;
    left: clamp(1.5rem, 4vw, 3rem);
    top: clamp(7.5rem, 15vh, 11rem);
    z-index: 5;
    color: rgba(255,255,255,0.95);
    font-family: "Plus Jakarta Sans", "Inter", sans-serif;
    font-size: clamp(1.6rem, 2.4vw, 2.4rem);
    line-height: 1.05;
    font-weight: 800;
    letter-spacing: -0.01em;
    max-width: 24ch;
    pointer-events: none;
    text-shadow: 0 2px 12px rgba(0,0,0,0.18);
}

body.auth-shell::after {
    content: "One secure portal for staff, families, donors, and stakeholders.";
    position: fixed;
    left: clamp(1.5rem, 4vw, 3rem);
    top: calc(clamp(7.5rem, 15vh, 11rem) + 4.5rem);
    z-index: 5;
    color: rgba(255,255,255,0.78);
    font-size: clamp(0.95rem, 1vw, 1.05rem);
    font-weight: 500;
    line-height: 1.55;
    max-width: 36ch;
    pointer-events: none;
    text-shadow: 0 1px 8px rgba(0,0,0,0.18);
}

/* --------------------------------------------------------------------------
   8. Responsive — collapse to a single column on small screens
   -------------------------------------------------------------------------- */
@media (max-width: 960px) {
    body.auth-shell {
        grid-template-columns: 1fr;
        background-image:
            radial-gradient(700px 400px at 0% 0%, rgba(14, 107, 92, 0.12), transparent 60%),
            radial-gradient(700px 400px at 100% 100%, rgba(216, 139, 50, 0.12), transparent 60%),
            linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
    }
    .auth-shell .auth-branding {
        min-height: 220px;
        padding: 2rem 1.5rem 1.5rem;
        align-items: center;
        justify-content: center;
    }
    .auth-shell .auth-page {
        padding: 1.5rem 1.25rem 3rem;
    }
    body.auth-shell::before,
    body.auth-shell::after { display: none; }
}

@media (max-width: 480px) {
    .auth-shell .auth-card {
        padding: 1.75rem 1.25rem 1.5rem;
        border-radius: 16px;
    }
    .auth-shell .auth-card h1 { font-size: 1.55rem; }
}

/* Mobile overflow guard: this stylesheet loads after app.css, so keep auth
   screens inside the visual viewport even with long school names or emails. */
body.auth-shell {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden;
}

.auth-shell .auth-branding,
.auth-shell .auth-page,
.auth-shell .auth-card,
.auth-shell form,
.auth-shell label,
.auth-shell input,
.auth-shell select,
.auth-shell textarea,
.auth-shell .button,
.auth-shell .alert,
.auth-shell .muted-text {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
}

@media (max-width: 960px) {
    body.auth-shell {
        grid-template-columns: minmax(0, 1fr);
    }

    .auth-shell .auth-page {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .auth-shell .auth-page {
        padding-inline: 0.85rem;
    }

    .auth-shell .button {
        width: 100%;
        min-height: 44px;
        white-space: normal;
    }
}

/* Phones and touch WebViews must never use the desktop split rail. Some
   mobile shells report a wide layout viewport, so include pointer/device
   queries in addition to viewport width. */
@media (max-width: 1100px), (max-device-width: 1100px), (hover: none) and (pointer: coarse) {
    body.auth-shell,
    body.auth-shell[class*="theme-"] {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        justify-content: flex-start !important;
        min-height: 100svh;
        grid-template-columns: none !important;
        grid-template-rows: none !important;
        padding: 1rem !important;
        background:
            radial-gradient(700px 420px at 0% 0%, rgba(14, 107, 92, 0.10), transparent 60%),
            radial-gradient(700px 420px at 100% 100%, rgba(216, 139, 50, 0.10), transparent 60%),
            linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%) !important;
    }

    body.auth-shell::before,
    body.auth-shell::after,
    .auth-shell .auth-branding::before,
    .auth-shell .auth-branding::after {
        content: none !important;
        display: none !important;
    }

    .auth-shell .auth-branding {
        position: static !important;
        grid-column: auto !important;
        grid-row: auto !important;
        display: flex !important;
        width: 100% !important;
        min-height: 0 !important;
        max-height: none !important;
        margin: 0 auto 0.85rem !important;
        padding: 0.35rem 0 !important;
        align-items: center !important;
        justify-content: center !important;
        background: transparent !important;
        border: 0 !important;
        box-shadow: none !important;
        overflow: visible !important;
        isolation: auto !important;
    }

    .auth-shell .auth-logo {
        display: block !important;
        width: auto !important;
        max-width: min(220px, 72vw) !important;
        max-height: 84px !important;
        padding: 0.55rem 0.85rem !important;
        border-radius: 14px !important;
        background: rgba(255, 255, 255, 0.96) !important;
        object-fit: contain !important;
        filter: drop-shadow(0 8px 18px rgba(15, 23, 42, 0.12)) !important;
    }

    .auth-shell .auth-page,
    .auth-shell main.auth-page {
        position: static !important;
        grid-column: auto !important;
        grid-row: auto !important;
        display: block !important;
        width: 100% !important;
        max-width: 480px !important;
        margin: 0 auto !important;
        padding: 0 !important;
    }

    .auth-shell .auth-card {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: clamp(1.15rem, 4.5vw, 1.65rem) !important;
        border-radius: 18px !important;
        box-shadow: 0 20px 42px -24px rgba(15, 23, 42, 0.30), 0 8px 18px -14px rgba(14, 107, 92, 0.28) !important;
    }

    .auth-shell .auth-card h1 {
        font-size: clamp(1.8rem, 9vw, 2.35rem) !important;
        line-height: 1.06 !important;
    }

    .auth-shell .auth-card > p {
        font-size: clamp(0.95rem, 4vw, 1rem) !important;
        line-height: 1.45 !important;
        margin-bottom: 1.15rem !important;
    }

    .auth-shell .grid-form,
    .auth-shell .grid-form.single-column {
        gap: 0.9rem !important;
    }

    .auth-shell label {
        font-size: 0.9rem !important;
    }

    .auth-shell input,
    .auth-shell select,
    .auth-shell textarea {
        min-height: 48px !important;
        font-size: 16px !important;
        padding: 0.8rem 0.9rem !important;
    }

    .auth-shell .button {
        min-height: 50px !important;
        border-radius: 14px !important;
        font-size: 1rem !important;
    }
}

@media (max-width: 380px), (max-device-width: 380px) {
    body.auth-shell,
    body.auth-shell[class*="theme-"] {
        padding: 0.75rem !important;
    }

    .auth-shell .auth-card {
        padding: 1rem !important;
        border-radius: 16px !important;
    }

    .auth-shell .auth-card h1 {
        font-size: 1.7rem !important;
    }
}
