/* ===== Auth pages (login / register) enhancement ===== */

.auth-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    gap: 0;
    max-width: 1000px;
    margin: 48px auto;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

/* ----- Brand side panel ----- */
.auth-brand {
    position: relative;
    padding: 48px 44px;
    color: #fff;
    background:
        radial-gradient(120% 120% at 0% 0%, color-mix(in srgb, var(--brand-cyan) 70%, transparent) 0%, transparent 55%),
        linear-gradient(155deg, var(--primary) 0%, var(--primary-hover) 48%, #7a0f28 100%);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.auth-brand::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(60% 60% at 85% 15%, rgba(255, 255, 255, 0.16) 0%, transparent 60%),
        radial-gradient(50% 50% at 20% 90%, rgba(37, 244, 238, 0.18) 0%, transparent 60%);
    pointer-events: none;
}

.auth-brand > * { position: relative; z-index: 1; }

.auth-brand__logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: var(--tracking-tight);
}

.auth-brand__logo img {
    width: 30px;
    height: 30px;
    filter: brightness(0) invert(1);
}

.auth-brand__headline {
    font-family: var(--font-serif);
    font-size: clamp(1.6rem, 2.4vw, 2.1rem);
    line-height: 1.18;
    margin: 28px 0 12px;
    letter-spacing: var(--tracking-tight);
}

.auth-brand__sub {
    color: rgba(255, 255, 255, 0.86);
    font-size: 0.98rem;
    line-height: 1.55;
    margin: 0 0 28px;
    max-width: 38ch;
}

.auth-features {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-features li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 0.92rem;
    line-height: 1.45;
    color: rgba(255, 255, 255, 0.95);
}

.auth-features__icon {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
}

.auth-features b { font-weight: 600; }
.auth-features span { display: block; color: rgba(255, 255, 255, 0.78); font-size: 0.84rem; margin-top: 2px; }

.auth-brand__foot {
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ----- Form side ----- */
.auth-pane {
    padding: 44px 44px 40px;
    display: flex;
    flex-direction: column;
}

.auth-pane h1 {
    text-align: left;
    font-family: var(--font-serif);
    font-size: 1.7rem;
    margin: 0 0 6px;
    letter-spacing: var(--tracking-tight);
}

.auth-pane__lead {
    color: var(--muted-foreground);
    font-size: 0.92rem;
    margin: 0 0 24px;
}

.auth-pane .form { gap: 16px; }
.auth-pane .hint { text-align: left; }

/* ----- Password field & strength ----- */
.field-pw { position: relative; }

.field-pw input { padding-right: 46px; }

.pw-toggle {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: 0;
    background: transparent;
    color: var(--muted-foreground);
    cursor: pointer;
    border-radius: var(--radius-xs);
    transition: color 0.15s var(--ease), background 0.15s var(--ease);
}

.pw-toggle:hover { color: var(--foreground); background: var(--muted); }
.pw-toggle:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

.pw-strength {
    margin-top: 4px;
    display: none;
}
.pw-strength.is-active { display: block; }

.pw-strength__bar {
    height: 6px;
    border-radius: var(--radius-pill);
    background: var(--muted);
    overflow: hidden;
}

.pw-strength__fill {
    height: 100%;
    width: 0;
    border-radius: var(--radius-pill);
    transition: width 0.25s var(--ease), background 0.25s var(--ease);
}

.pw-strength__label {
    margin-top: 6px;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--muted-foreground);
}

.pw-strength[data-score="1"] .pw-strength__fill { width: 25%; background: var(--destructive); }
.pw-strength[data-score="2"] .pw-strength__fill { width: 50%; background: var(--warning); }
.pw-strength[data-score="3"] .pw-strength__fill { width: 75%; background: var(--brand-cyan); }
.pw-strength[data-score="4"] .pw-strength__fill { width: 100%; background: var(--success); }

/* ----- Inline field validation ----- */
.field-msg {
    font-size: 0.78rem;
    margin-top: 2px;
    min-height: 1em;
    color: var(--muted-foreground);
}
.field-msg.is-error { color: var(--destructive); }
.field-msg.is-ok { color: var(--success); }

.form input.is-invalid {
    border-color: var(--destructive);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--destructive) 20%, transparent);
}
.form input.is-valid {
    border-color: var(--success);
}

/* ----- Loading button state ----- */
.btn[data-loading="true"] {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}
.btn[data-loading="true"]::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-top-color: #fff;
    animation: auth-spin 0.6s linear infinite;
}

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

/* ----- Responsive ----- */
@media (max-width: 820px) {
    .auth-shell {
        grid-template-columns: 1fr;
        max-width: 460px;
        margin: 32px auto;
    }
    .auth-brand {
        padding: 36px 32px;
    }
    .auth-brand__headline { margin-top: 18px; }
    .auth-pane { padding: 32px 30px; }
}

/* ----- Mobile: form-first, compact brand header ----- */
@media (max-width: 560px) {
    .auth-shell {
        display: flex;
        flex-direction: column;
        max-width: none;
        width: auto;
        /* break out of main.container horizontal padding for edge-to-edge */
        margin: -8px -18px 0;
        border: 0;
        border-radius: 0;
        box-shadow: none;
        background: var(--background);
        min-height: calc(100dvh - 8px);
    }

    /* Compact gradient header: only logo + headline */
    .auth-brand {
        order: 1;
        padding: calc(env(safe-area-inset-top, 0px) + 26px) 22px 24px;
        border-radius: 0 0 20px 20px;
        justify-content: flex-start;
    }
    .auth-brand > div { width: 100%; }
    .auth-brand__logo { font-size: 1rem; }
    .auth-brand__logo img { width: 26px; height: 26px; }
    .auth-brand__headline {
        margin: 16px 0 6px;
        font-size: 1.5rem;
    }
    .auth-brand__sub {
        margin: 0;
        font-size: 0.9rem;
        max-width: none;
    }
    /* Trim heavy marketing on small screens */
    .auth-features,
    .auth-brand__foot {
        display: none;
    }

    /* Form gets priority + breathing room */
    .auth-pane {
        order: 2;
        padding: 26px 22px calc(env(safe-area-inset-bottom, 0px) + 32px);
        flex: 1 1 auto;
    }
    .auth-pane h1 {
        font-size: 1.5rem;
        margin-bottom: 4px;
    }
    .auth-pane__lead {
        margin-bottom: 20px;
        font-size: 0.9rem;
    }
    .auth-pane .form { gap: 18px; }

    /* Larger, full-width primary action for thumbs */
    .auth-pane .form .btn {
        width: 100%;
        min-height: 52px;
        font-size: 1.02rem;
        margin-top: 8px;
    }

    /* Clear tap spacing for helper links */
    .auth-pane .hint {
        font-size: 0.9rem;
        margin: 10px 0 0;
    }
    .auth-pane .hint a { padding: 2px 0; }

    /* Bigger password toggle target */
    .pw-toggle { width: 40px; height: 40px; }
}

@media (max-width: 380px) {
    .auth-brand { padding: calc(env(safe-area-inset-top, 0px) + 22px) 18px 20px; }
    .auth-brand__headline { font-size: 1.35rem; }
    .auth-pane { padding: 22px 18px calc(env(safe-area-inset-bottom, 0px) + 28px); }
}

@media (prefers-reduced-motion: reduce) {
    .btn[data-loading="true"]::after { animation: none; }
    .pw-strength__fill { transition: none; }
}
