/* ============================================================
   admin-auth.css
   Admin sign-in shell — floating card on a soft background.

   Sibling of the user dashboard's auth-v2.css: same card, same
   type scale, same field sizing, so the two products read as one
   family. The differences are deliberate — a red ADMIN PORTAL
   badge, no social sign-in, no sign-up route.

   Self-contained: admin-login.html loads THIS FILE ONLY (not
   main.css / login.css), so there is no cascade fight with the
   old full-bleed split layout.
   ============================================================ */

:root {
    --av-navy:        #1D4E63;
    --av-navy-deep:   #143c4e;
    --av-ink:         #10303f;
    --av-red:         #e13732;
    --av-red-deep:    #c22c28;
    --av-text:        #4a5b66;
    --av-muted:       #8496a2;
    --av-line:        #e4eaef;
    --av-line-strong: #d3dde5;
    --av-field:       #fbfcfd;
    --av-radius:      28px;
    --av-radius-sm:   10px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--av-text);
    background: #eaf0f7;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ===== BACKGROUND · soft corner blobs ===== */
.av-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
    background:
        radial-gradient(60% 50% at 12% 0%,   #dfe9f7 0%, rgba(223,233,247,0) 70%),
        radial-gradient(55% 45% at 92% 100%, #dbe8f6 0%, rgba(219,232,246,0) 70%),
        #eef3f9;
}

.av-blob {
    position: absolute;
    display: block;
    filter: blur(6px);
}

.av-blob--tl {
    top: -170px;
    left: -150px;
    width: 460px;
    height: 430px;
    background: linear-gradient(150deg, #c3d9f2 0%, #dde9f8 100%);
    border-radius: 52% 48% 60% 40% / 55% 45% 55% 45%;
    opacity: .75;
}

.av-blob--br {
    right: -160px;
    bottom: -190px;
    width: 480px;
    height: 440px;
    background: linear-gradient(320deg, #bcd5f0 0%, #dbe9f8 100%);
    border-radius: 46% 54% 40% 60% / 48% 52% 48% 52%;
    opacity: .7;
}

/* ===== STAGE · centres the card ===== */
.av-stage {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 28px;
}

/* ===== CARD ===== */
.av-card {
    position: relative;
    /* Narrower than the user dashboard's 1060px: the admin form has no social
       sign-in or divider, so the card is ~100px shorter and 1060 read squat. */
    width: min(960px, 100%);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 26px;
    padding: 26px;
    border-radius: var(--av-radius);
    overflow: hidden;
    /* Gradient bleeds to the card edge; the form panel floats inset on top.
       Stops are weighted to the LEFT half — anything past ~60% across is
       hidden behind the form panel and does no visual work. */
    background:
        radial-gradient(58% 55% at 4% 0%,    #bcd7f2 0%, rgba(188,215,242,0) 62%),
        radial-gradient(55% 52% at 2% 100%,  #c3dbf3 0%, rgba(195,219,243,0) 60%),
        radial-gradient(62% 58% at 44% 50%,  #ffffff 0%, rgba(255,255,255,0) 68%),
        radial-gradient(80% 74% at 100% 6%,  #9dc2e8 0%, rgba(157,194,232,0) 55%),
        radial-gradient(76% 66% at 92% 100%, #9abfe6 0%, rgba(154,191,230,0) 58%),
        #e9f2fb;
    box-shadow:
        0 44px 88px -34px rgba(13, 42, 58, .34),
        0 4px 14px rgba(13, 42, 58, .05);
}

/* ===== LEFT · brand ===== */
.av-visual {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 34px 26px 34px 34px;
    min-width: 0;
}

/* align-self is required: the column stretches items by default, which makes
   the <img> box full-width and object-fit then centres the artwork inside it */
.av-visual__logo {
    height: 50px;
    width: auto;
    align-self: flex-start;
    flex-shrink: 0;
    object-fit: contain;
    display: block;
}

/* Sits directly under the logo, top-aligned — the space below is
   deliberate breathing room, not something to centre into. */
.av-visual__copy {
    margin: 0;
    padding: 30px 0 0;
}

/* Tells an admin at a glance which door they are standing at */
.av-admin-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 13px 6px 10px;
    margin-bottom: 16px;
    border-radius: 30px;
    background: rgba(225, 55, 50, .1);
    border: 1px solid rgba(225, 55, 50, .22);
    color: #bd2d29;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    white-space: nowrap;
}

.av-admin-pill svg {
    flex-shrink: 0;
}

.av-visual h1 {
    font-family: 'Sora', 'Inter', sans-serif;
    font-size: clamp(1.7rem, 2.4vw, 2.3rem);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -.022em;
    color: var(--av-ink);
    margin-bottom: 15px;
    max-width: 15ch;
}

.av-visual__sub {
    font-size: .92rem;
    line-height: 1.62;
    color: #56707f;
    max-width: 36ch;
}

/* ===== RIGHT · form panel ===== */
.av-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: #fff;
    border-radius: 20px;
    padding: 36px 38px 22px;
    min-width: 0;
    box-shadow:
        0 18px 40px -26px rgba(13, 42, 58, .3),
        0 1px 2px rgba(13, 42, 58, .04);
}

.av-panel__inner {
    width: 100%;
    max-width: 380px;
    margin: 0 auto;
}

.av-head {
    margin-bottom: 22px;
}

.av-head h2 {
    font-family: 'Sora', 'Inter', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -.02em;
    color: var(--av-ink);
    margin-bottom: 5px;
}

.av-head p {
    font-size: .82rem;
    color: var(--av-muted);
}

/* ===== ERROR ===== */
/* admin-login.js toggles this with style.display = 'block' */
.error-message {
    padding: 11px 14px;
    margin-bottom: 16px;
    background: #fef3f3;
    border: 1px solid #fbd5d5;
    border-radius: var(--av-radius-sm);
    color: var(--av-red);
    font-size: .8rem;
    line-height: 1.45;
}

/* ===== FIELDS ===== */
.form-group {
    margin-bottom: 14px;
}

.form-label {
    display: block;
    font-size: .76rem;
    font-weight: 600;
    color: #23414f;
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    border: 1.5px solid var(--av-line);
    border-radius: var(--av-radius-sm);
    background: var(--av-field);
    font-family: inherit;
    font-size: .875rem;
    color: var(--av-ink);
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.form-input::placeholder {
    color: #a9b6c0;
}

.form-input:hover:not(:focus) {
    border-color: var(--av-line-strong);
}

.form-input:focus {
    outline: none;
    background: #fff;
    border-color: var(--av-navy);
    box-shadow: 0 0 0 3.5px rgba(29, 78, 99, .11);
}

/* admin-login.js adds .error on failed inline validation */
.form-input.error,
.form-input.error:hover {
    border-color: #f0a3a1;
    background: #fffafa;
}

.form-input.error:focus {
    border-color: var(--av-red);
    box-shadow: 0 0 0 3.5px rgba(225, 55, 50, .12);
}

/* Password field + eye toggle */
.input-wrapper {
    position: relative;
}

.input-wrapper .form-input {
    padding-right: 44px;
}

.password-toggle {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: none;
    color: #9aa8b2;
    cursor: pointer;
    transition: color .18s ease, background .18s ease;
}

.password-toggle:hover {
    color: var(--av-navy);
    background: #eef3f6;
}

/* The script swaps this <svg>'s innerHTML, so sizing lives on the element */
.password-toggle svg {
    width: 18px;
    height: 18px;
}

/* ===== OPTIONS ROW ===== */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin: 4px 0 18px;
}

.custom-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: .76rem;
    line-height: 1.5;
    color: var(--av-text);
    user-select: none;
}

.custom-checkbox input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.checkbox-checkmark {
    width: 17px;
    height: 17px;
    flex-shrink: 0;
    border: 1.5px solid #b6c2cb;
    border-radius: 5px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .16s ease, border-color .16s ease;
}

.custom-checkbox input[type="checkbox"]:checked + .checkbox-checkmark {
    background: var(--av-navy);
    border-color: var(--av-navy);
}

.custom-checkbox input[type="checkbox"]:checked + .checkbox-checkmark::after {
    content: '';
    width: 4px;
    height: 8px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-top: -2px;
}

/* Keyboard focus ring — the native input is visually hidden */
.custom-checkbox input[type="checkbox"]:focus-visible + .checkbox-checkmark {
    box-shadow: 0 0 0 3.5px rgba(29, 78, 99, .16);
}

/* ===== SIGN-IN BUTTON ===== */
.login-button {
    position: relative;
    width: 100%;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    border-radius: var(--av-radius-sm);
    background: linear-gradient(180deg, #23596f 0%, var(--av-navy) 55%, #17455a 100%);
    color: #fff;
    font-family: inherit;
    font-size: .9rem;
    font-weight: 600;
    letter-spacing: .01em;
    cursor: pointer;
    box-shadow: 0 8px 20px -8px rgba(29, 78, 99, .55);
    transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
}

.login-button:hover:not(:disabled) {
    transform: translateY(-1px);
    filter: brightness(1.07);
    box-shadow: 0 12px 26px -8px rgba(29, 78, 99, .6);
}

.login-button:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 5px 14px -8px rgba(29, 78, 99, .55);
}

.login-button:disabled {
    opacity: .7;
    cursor: not-allowed;
    box-shadow: none;
}

/* admin-login.js toggles .loading during the Firebase round-trip */
.login-button.loading .button-text {
    visibility: hidden;
}

.login-button.loading::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255, 255, 255, .35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: av-spin .7s linear infinite;
}

@keyframes av-spin {
    to { transform: rotate(360deg); }
}

/* admin-login.js sets form.style.animation = 'shake 0.5s' on a failed login.
   No `shake` keyframes existed anywhere in the project, so that line has
   always been a silent no-op — defining it here makes it work. */
@keyframes shake {
    10%, 90% { transform: translateX(-2px); }
    20%, 80% { transform: translateX(4px); }
    30%, 50%, 70% { transform: translateX(-6px); }
    40%, 60% { transform: translateX(6px); }
}

/* ===== FOOTER ===== */
.login-footer {
    text-align: center;
    margin-top: 18px;
    font-size: .82rem;
    color: var(--av-muted);
}

.login-footer .link {
    color: var(--av-red);
    font-weight: 700;
    text-decoration: none;
    transition: color .18s ease;
}

.login-footer .link:hover {
    color: var(--av-red-deep);
    text-decoration: underline;
}

.powered-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin-top: 22px;
    padding-top: 16px;
    border-top: 1px solid #f0f3f6;
    font-size: .7rem;
    color: #a6b2bb;
    letter-spacing: .03em;
}

.powered-badge a {
    color: var(--av-red);
    font-weight: 700;
    font-size: .72rem;
    text-decoration: none;
}

.powered-badge a:hover {
    text-decoration: underline;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Short desktop viewports — tighten so the card still fits */
@media (min-width: 981px) and (max-height: 780px) {
    .av-stage        { padding: 24px; }
    .av-visual__copy { padding-top: 22px; }
    .av-panel        { padding: 26px 34px 18px; }
    .av-head         { margin-bottom: 16px; }
    .form-group      { margin-bottom: 11px; }
    .powered-badge   { margin-top: 16px; padding-top: 12px; }
}

@media (min-width: 981px) and (max-height: 660px) {
    .form-input   { height: 40px; }
    .login-button { height: 42px; }
    .av-visual h1 { font-size: 1.55rem; }
}

/* ── Tablet & below: stack into one column ── */
@media (max-width: 980px) {
    .av-stage {
        padding: 24px 18px;
        align-items: flex-start;
    }

    .av-card {
        grid-template-columns: 1fr;
        gap: 18px;
        padding: 20px;
        max-width: 560px;
    }

    /* Brand block becomes a compact banner above the form */
    .av-visual {
        padding: 12px 12px 0;
        flex-direction: row;
        align-items: center;
        gap: 16px;
    }

    .av-visual__logo {
        height: 40px;
        flex-shrink: 0;
    }

    .av-visual__copy {
        margin: 0;
        padding: 0;
        min-width: 0;
    }

    .av-admin-pill {
        margin-bottom: 8px;
        padding: 5px 11px 5px 8px;
        font-size: .62rem;
    }

    .av-visual h1 {
        font-size: 1.12rem;
        line-height: 1.3;
        margin-bottom: 0;
        max-width: none;
    }

    .av-visual__sub {
        display: none;
    }

    .av-panel {
        padding: 26px 26px 18px;
    }
}

/* ── Phone ── */
@media (max-width: 560px) {
    .av-stage {
        padding: 14px 12px 22px;
    }

    .av-card {
        gap: 14px;
        padding: 14px;
        border-radius: 22px;
        box-shadow: 0 24px 50px -28px rgba(13, 42, 58, .38);
    }

    .av-visual {
        padding: 8px 6px 0;
        gap: 12px;
    }

    .av-visual__logo { height: 34px; }
    .av-visual h1    { font-size: 1rem; }
    .av-admin-pill   { font-size: .58rem; letter-spacing: .04em; }

    .av-panel {
        padding: 22px 18px 16px;
        border-radius: 16px;
    }

    .av-head h2 { font-size: 1.28rem; }

    .form-input { height: 42px; }

    .form-options {
        flex-wrap: wrap;
        gap: 8px;
    }
}

/* Very small phones — drop the pill so the header stays one tidy row */
@media (max-width: 380px) {
    .av-admin-pill { display: none; }
    .av-visual h1  { font-size: .95rem; }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
    .login-button,
    .form-input,
    .password-toggle {
        transition: none;
    }

    .login-button:hover:not(:disabled) {
        transform: none;
    }
}
