/* ==========================================
   SAT Forge Authentication and Account UI
========================================== */

.auth-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    color: var(--text-color);
    background:
        radial-gradient(circle at 12% 8%, rgba(37, 99, 235, 0.12), transparent 28rem),
        var(--page-background);
}

.auth-site-header {
    width: min(1120px, 92%);
    margin: 0 auto;
    min-height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.auth-brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    color: inherit;
    text-decoration: none;
    font-weight: 800;
    font-size: 1.25rem;
}

.auth-brand img {
    width: 40px;
    height: 40px;
}

.auth-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.auth-back-link,
.auth-nav-link {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 15px;
    border: 1px solid var(--border-color);
    border-radius: 11px;
    color: var(--text-color);
    background: var(--card-background);
    text-decoration: none;
    font-weight: 700;
    transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.auth-back-link:hover,
.auth-nav-link:hover {
    border-color: #2563eb;
    transform: translateY(-1px);
}

.auth-nav-link.is-authenticated {
    color: #ffffff;
    border-color: #2563eb;
    background: #2563eb;
}

.auth-shell {
    width: min(1040px, 92%);
    flex: 1;
    margin: 26px auto 64px;
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(360px, 1fr);
    align-items: center;
    gap: clamp(30px, 7vw, 80px);
}

.auth-intro {
    padding: 24px 0;
}

.auth-eyebrow {
    margin-bottom: 12px;
    color: #2563eb;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.auth-intro h1,
.account-hero h1 {
    margin: 0 0 16px;
    color: var(--text-color);
    font-size: clamp(2.25rem, 5vw, 3.65rem);
    line-height: 1.06;
    letter-spacing: -0.04em;
}

.auth-intro > p:not(.auth-eyebrow) {
    max-width: 560px;
    color: var(--muted-text);
    font-size: 1.06rem;
    line-height: 1.75;
}

.auth-benefits {
    margin: 28px 0 0;
    padding: 0;
    display: grid;
    gap: 13px;
    list-style: none;
}

.auth-benefits li {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    color: var(--text-color);
}

.auth-benefits li::before {
    content: "✓";
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    color: #1d4ed8;
    background: #dbeafe;
    font-size: 0.8rem;
    font-weight: 900;
}

.auth-card {
    padding: clamp(24px, 4vw, 38px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    background: var(--card-background);
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.11);
}

.auth-card h2 {
    margin: 0 0 8px;
    color: var(--text-color);
    font-size: 1.7rem;
    line-height: 1.2;
}

.auth-card-subtitle {
    margin: 0 0 24px;
    color: var(--muted-text);
}

.auth-form {
    display: grid;
    gap: 17px;
}

.auth-field {
    display: grid;
    gap: 7px;
    color: var(--text-color);
    font-weight: 700;
}

.auth-field input,
.auth-field select {
    width: 100%;
    min-height: 48px;
    padding: 11px 13px;
    border: 1px solid var(--border-color);
    border-radius: 11px;
    color: var(--text-color);
    background: var(--page-background);
    font: inherit;
    font-weight: 500;
}

.auth-field input:focus,
.auth-field select:focus {
    outline: 3px solid rgba(37, 99, 235, 0.22);
    border-color: #2563eb;
}

.password-input-wrap {
    position: relative;
}

.password-input-wrap input {
    padding-right: 72px;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    min-height: 34px;
    padding: 5px 10px;
    border: 0;
    border-radius: 8px;
    color: #2563eb;
    background: transparent;
    cursor: pointer;
    font-weight: 800;
}

.password-toggle:hover {
    background: rgba(37, 99, 235, 0.1);
}

.auth-form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.auth-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: var(--muted-text);
    font-size: 0.9rem;
    font-weight: 500;
}

.auth-check input {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: #2563eb;
}

.auth-link {
    color: #2563eb;
    font-weight: 750;
    text-decoration: none;
}

.auth-link:hover {
    text-decoration: underline;
}

.auth-submit {
    min-height: 50px;
    padding: 12px 20px;
    border: 0;
    border-radius: 12px;
    color: #ffffff;
    background: #2563eb;
    cursor: pointer;
    font: inherit;
    font-weight: 800;
    transition: background 0.2s ease, transform 0.2s ease;
}

.auth-submit:hover:not(:disabled) {
    background: #1d4ed8;
    transform: translateY(-1px);
}

.auth-submit:disabled,
.auth-form input:disabled,
.auth-form button:disabled {
    cursor: not-allowed;
    opacity: 0.65;
}

.auth-message {
    margin: 0 0 18px;
    padding: 12px 14px;
    border: 1px solid transparent;
    border-radius: 11px;
    font-size: 0.92rem;
    line-height: 1.55;
}

.auth-message-info {
    color: #1e40af;
    border-color: #bfdbfe;
    background: #eff6ff;
}

.auth-message-success {
    color: #166534;
    border-color: #bbf7d0;
    background: #f0fdf4;
}

.auth-message-warning {
    color: #92400e;
    border-color: #fde68a;
    background: #fffbeb;
}

.auth-message-error {
    color: #991b1b;
    border-color: #fecaca;
    background: #fef2f2;
}

.auth-card-footer {
    margin: 22px 0 0;
    color: var(--muted-text);
    text-align: center;
    font-size: 0.94rem;
}

.auth-privacy-note {
    margin: 18px 0 0;
    color: var(--muted-text);
    font-size: 0.8rem;
    line-height: 1.55;
    text-align: center;
}

/* Account */
.account-page {
    min-height: 100vh;
    color: var(--text-color);
    background: var(--page-background);
}

.account-main {
    width: min(1120px, 92%);
    margin: 30px auto 72px;
}

.account-loading {
    min-height: 240px;
    display: grid;
    place-items: center;
    color: var(--muted-text);
    font-weight: 700;
}

.account-hero {
    margin-bottom: 26px;
    padding: clamp(25px, 4vw, 42px);
    border: 1px solid #bfdbfe;
    border-radius: 24px;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.13), rgba(14, 165, 233, 0.05));
}

.account-hero h1 {
    margin-bottom: 10px;
    font-size: clamp(2rem, 5vw, 3.2rem);
}

.account-hero p {
    color: var(--muted-text);
}

.account-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
    gap: 22px;
}

.account-card {
    padding: 24px;
    border: 1px solid var(--border-color);
    border-radius: 18px;
    background: var(--card-background);
}

.account-card h2 {
    margin: 0 0 6px;
    font-size: 1.25rem;
}

.account-card-description {
    margin: 0 0 20px;
    color: var(--muted-text);
    font-size: 0.93rem;
}

.account-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.account-stat {
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: var(--page-background);
}

.account-stat span,
.account-stat strong {
    display: block;
}

.account-stat span {
    margin-bottom: 5px;
    color: var(--muted-text);
    font-size: 0.8rem;
    font-weight: 700;
}

.account-stat strong {
    overflow-wrap: anywhere;
    font-size: 1rem;
}

.plan-badge {
    display: inline-flex;
    margin-bottom: 10px;
    padding: 6px 11px;
    border-radius: 999px;
    color: #1e40af;
    background: #dbeafe;
    font-size: 0.82rem;
    font-weight: 850;
}

.account-side-stack {
    display: grid;
    align-content: start;
    gap: 22px;
}

.secondary-button,
.danger-outline-button {
    width: 100%;
    min-height: 46px;
    padding: 10px 16px;
    border-radius: 11px;
    cursor: pointer;
    font: inherit;
    font-weight: 800;
}

.secondary-button {
    color: #ffffff;
    border: 1px solid #2563eb;
    background: #2563eb;
}

.danger-outline-button {
    color: #b91c1c;
    border: 1px solid #ef4444;
    background: transparent;
}

.danger-outline-button:hover {
    color: #ffffff;
    background: #dc2626;
}

html[data-theme="dark"] .auth-page {
    background:
        radial-gradient(circle at 12% 8%, rgba(59, 130, 246, 0.16), transparent 28rem),
        var(--page-background);
}

html[data-theme="dark"] .auth-card {
    box-shadow: none;
}

html[data-theme="dark"] .auth-benefits li::before,
html[data-theme="dark"] .plan-badge {
    color: #bfdbfe;
    background: #1e3a8a;
}

html[data-theme="dark"] .auth-message-info {
    color: #bfdbfe;
    border-color: #1e40af;
    background: #172554;
}

html[data-theme="dark"] .auth-message-success {
    color: #bbf7d0;
    border-color: #166534;
    background: #052e16;
}

html[data-theme="dark"] .auth-message-warning {
    color: #fde68a;
    border-color: #92400e;
    background: #451a03;
}

html[data-theme="dark"] .auth-message-error {
    color: #fecaca;
    border-color: #991b1b;
    background: #450a0a;
}

@media (max-width: 820px) {
    .auth-shell,
    .account-grid {
        grid-template-columns: 1fr;
    }

    .auth-shell {
        margin-top: 4px;
        gap: 22px;
    }

    .auth-intro {
        padding-bottom: 0;
    }

    .auth-benefits {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    .auth-site-header {
        width: 100%;
        min-height: 68px;
        padding: 10px 15px;
    }

    .auth-brand span {
        display: none;
    }

    .auth-back-link {
        padding-inline: 11px;
        font-size: 0.86rem;
    }

    .auth-shell,
    .account-main {
        width: min(100% - 28px, 1120px);
    }

    .auth-intro h1 {
        font-size: 2.25rem;
    }

    .auth-benefits,
    .account-stats {
        grid-template-columns: 1fr;
    }

    .auth-card {
        padding: 22px 18px;
        border-radius: 18px;
    }

    .account-hero,
    .account-card {
        padding: 20px;
    }
}

/* Legal pages */
.legal-main {
    width: min(860px, 92%);
    margin: 28px auto 72px;
}

.legal-card {
    padding: clamp(24px, 5vw, 48px);
    border: 1px solid var(--border-color);
    border-radius: 22px;
    background: var(--card-background);
}

.legal-card h1 {
    margin: 0 0 8px;
    font-size: clamp(2rem, 5vw, 3rem);
    letter-spacing: -0.035em;
}

.legal-updated {
    margin-bottom: 30px;
    color: var(--muted-text);
}

.legal-card section + section {
    margin-top: 28px;
}

.legal-card h2 {
    margin-bottom: 9px;
    font-size: 1.2rem;
}

.legal-card p,
.legal-card li {
    color: var(--muted-text);
    line-height: 1.75;
}

.legal-card ul {
    margin: 10px 0 0 22px;
}
