/**
 * FV Core Login Page Styles
 *
 * Owner design pilot (2026-10-08): the auth pages follow the product design
 * language (frontend/DESIGN.md in the Symmetric Strength plugin): ink on
 * white, one rose accent, DM Sans, one quiet shadow step, no gradients. Colors
 * come from the theme tokens (--ss-*, themes/symmetric-strength/assets/css/
 * tokens.css) with the same values as fallbacks. Light only: the product has
 * no dark theme, so these pages carry no prefers-color-scheme overrides.
 *
 * @package FV_App_Core
 */

/* Login Container */
.fv-login-container {
    max-width: 480px;
    margin: 48px auto;
    padding: 40px;
    background: var(--ss-surface, #ffffff);
    border: 1px solid var(--ss-border, #e2e8f0);
    border-radius: var(--ss-radius-card, 1rem);
    box-shadow: var(--ss-shadow-card, 0 1px 2px rgb(15 23 42 / 4%), 0 8px 24px rgb(15 23 42 / 4%));
    color: var(--ss-body, #334155);
    font-family: var(--ss-font-body, 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
    text-align: left;
}

/* Header */
.fv-login-header {
    margin-bottom: 28px;
}

.fv-login-title {
    font-size: clamp(1.75rem, 2.6vw, 2.25rem);
    font-weight: 700;
    line-height: 1.1;
    color: var(--ss-ink, #020617);
    margin: 0 0 10px 0;
    letter-spacing: -0.02em;
}

.fv-login-subtitle {
    font-size: 1rem;
    line-height: 1.6;
    color: #475569;
    margin: 0;
}

/* ========================================
   Split layout: form + brand panel (sign-in and sign-up)
   ======================================== */

.fv-auth-panel-mark,
.fv-auth-panel-body {
    display: none;
}

.fv-auth-panel-compact {
    margin: 24px 0 0;
    padding-top: 20px;
    border-top: 1px solid var(--ss-border, #e2e8f0);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.6;
    color: var(--ss-body, #334155);
}

@media (min-width: 1024px) {
    /* Break out of the theme's 46.25rem content shell, the same way the
       theme widens .alignwide blocks (content.css). */
    .fv-login-container.fv-auth-split {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 26rem);
        width: min(calc(100vw - 3rem), 68rem);
        max-width: none;
        margin: 0 0 56px 50%;
        padding: 0;
        overflow: hidden;
        transform: translateX(-50%);
    }

    .fv-auth-split .fv-auth-main {
        padding: 56px 72px 48px;
    }

    /* Top-aligned, not centered: the form column grows once the social
       buttons load, and a centered panel would shift with it (CLS). */
    .fv-auth-panel {
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        gap: 40px;
        padding: 64px 48px 56px;
        background: #0f172a; /* coach-band: the proposed auth-panel exception */
        color: #ffffff;
    }

    .fv-auth-panel-mark {
        display: block;
        width: 56px;
        height: 56px;
        overflow: visible;
        color: #ffffff;
    }

    .fv-auth-panel-mark-collar {
        fill: var(--ss-primary, #e11d48);
    }

    .fv-auth-panel-body {
        display: block;
    }

    .fv-auth-panel-headline {
        margin: 12px 0 0;
        font-size: clamp(1.625rem, 2.2vw, 2rem);
        font-weight: 700;
        line-height: 1.15;
        letter-spacing: -0.02em;
        color: #ffffff;
    }

    .fv-auth-panel-label {
        margin: 0;
        font-size: 12px;
        font-weight: 600;
        letter-spacing: 0.05em;
        text-transform: uppercase;
        color: #cbd5e1;
    }

    /* Sample result: the classes of ExampleResultMini (score line in Bebas,
       one classification dot, one coach line) on a white card. */
    .fv-auth-example {
        margin-top: 24px;
        padding: 16px;
        background: var(--ss-surface, #ffffff);
        border: 1px solid var(--ss-border, #e2e8f0);
        border-radius: var(--ss-radius-control, 0.75rem);
        color: var(--ss-body, #334155);
    }

    .fv-auth-example-head {
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        gap: 12px;
    }

    .fv-auth-example-label {
        margin: 0;
        font-size: 12px;
        font-weight: 600;
        letter-spacing: 0.05em;
        text-transform: uppercase;
        color: var(--ss-body, #334155);
    }

    .fv-auth-example-note {
        margin: 0;
        font-size: 12px;
        font-weight: 500;
        color: var(--ss-muted, #64748b);
    }

    .fv-auth-example-score {
        display: flex;
        flex-wrap: wrap;
        align-items: flex-end;
        gap: 4px 12px;
        margin-top: 12px;
    }

    .fv-auth-example-number {
        font-family: var(--ss-font-display, 'Bebas Neue', Impact, sans-serif);
        font-size: 48px;
        font-weight: 400;
        line-height: 0.82;
        font-variant-numeric: tabular-nums;
        color: var(--ss-ink, #020617);
    }

    .fv-auth-example-tier {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        padding-bottom: 2px;
        font-size: 14px;
        font-weight: 600;
        color: var(--ss-body, #334155);
    }

    .fv-auth-example-dot {
        width: 6px;
        height: 6px;
        border-radius: 999px;
        background: #009688; /* Intermediate, tokens/colors.ts */
    }

    .fv-auth-example-coach {
        margin: 12px 0 0;
        padding-top: 12px;
        border-top: 1px solid var(--ss-border, #e2e8f0);
        font-size: 14px;
        line-height: 1.6;
        color: #475569;
    }

    .fv-auth-example-coach strong {
        font-weight: 600;
        color: var(--ss-heading, #0f172a);
    }

    .fv-auth-panel-list {
        margin: 28px 0 0;
        padding: 0;
        list-style: none;
    }

    .fv-auth-panel-list li {
        display: flex;
        gap: 12px;
        margin: 0 0 16px;
        font-size: 15px;
        line-height: 1.6;
        color: #f1f5f9;
    }

    .fv-auth-panel-list li:last-child {
        margin-bottom: 0;
    }

    /* Proof line: real counts only, same place as in the in-app dialog. */
    .fv-auth-panel-proof {
        margin: 24px 0 0;
        padding-top: 20px;
        border-top: 1px solid #334155;
        font-size: 14px;
        font-weight: 500;
        line-height: 1.6;
        color: #cbd5e1;
    }

    .fv-auth-panel-check {
        flex: 0 0 16px;
        margin-top: 4px;
        color: #cbd5e1;
    }

    .fv-auth-panel-compact {
        display: none;
    }
}

/* Social Buttons Container */
.fv-login-buttons {
    margin: 20px 0;
}

/* Style Nextend buttons */
.fv-login-container .nsl-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.fv-login-container .nsl-container-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.fv-login-container .nsl-button {
    width: 100% !important;
    min-height: 48px !important;
    border: 1px solid var(--ss-border-strong, #cbd5e1) !important;
    border-radius: var(--ss-radius-control, 0.75rem) !important;
    box-shadow: none !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    transition: border-color 0.15s ease, background-color 0.15s ease !important;
}

.fv-login-container .nsl-button:hover {
    border-color: #94a3b8 !important;
    background-color: var(--ss-page, #f8fafc) !important;
}

/* Separator */
.fv-login-container .nsl-separator {
    margin: 20px 0;
    color: var(--ss-muted, #64748b);
    font-size: 14px;
}

/* Error Message */
.fv-login-error {
    padding: 16px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #b91c1c;
    font-size: 14px;
}

/* Social Proof Section */
.fv-login-social-proof {
    margin: 32px 0 0 0;
    padding: 24px;
    background: #f9fafb;
    border-radius: 12px;
    text-align: center;
}

.fv-testimonial {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid #e5e7eb;
}

.fv-testimonial-stars {
    color: #fbbf24;
    font-size: 18px;
    margin-bottom: 12px;
    letter-spacing: 2px;
}

.fv-testimonial-text {
    font-size: 15px;
    line-height: 1.6;
    color: #374151;
    font-style: italic;
    margin: 0 0 8px 0;
}

.fv-testimonial-author {
    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
    margin: 0;
}

.fv-stats {
    display: flex;
    justify-content: space-around;
    gap: 24px;
}

.fv-stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.fv-stat strong {
    font-size: 24px;
    font-weight: 700;
    color: #dc2626;
    line-height: 1;
}

.fv-stat span {
    font-size: 12px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Footer */
.fv-login-footer {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--ss-border, #e2e8f0);
}

.fv-login-terms {
    font-size: 13px;
    color: var(--ss-muted, #64748b);
    line-height: 1.6;
    margin: 0;
}

.fv-login-terms a {
    color: var(--ss-primary, #e11d48);
    text-decoration: none;
}

.fv-login-terms a:hover {
    color: var(--ss-primary-hover, #be123c);
    text-decoration: underline;
}

/* Logged In State */
.fv-login-logged-in {
    text-align: center;
}

.fv-login-logged-in .fv-login-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--ss-heading, #0f172a);
    margin: 0 0 8px 0;
}

.fv-login-logged-in .fv-login-header p {
    color: var(--ss-muted, #64748b);
    margin: 0;
}

.fv-login-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 24px;
}

/* Buttons */
.fv-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 12px 24px;
    border-radius: var(--ss-radius-control, 0.75rem);
    font-size: 16px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.fv-btn-primary {
    background: var(--ss-primary, #e11d48);
    color: #ffffff;
    border: none;
}

.fv-btn-primary:hover {
    background: var(--ss-primary-hover, #be123c);
    color: #ffffff;
}

.fv-btn-secondary {
    background: var(--ss-surface-muted, #f1f5f9);
    color: var(--ss-heading, #0f172a);
    border: none;
}

.fv-btn-secondary:hover {
    background: var(--ss-border, #e2e8f0);
    color: var(--ss-ink, #020617);
}

/* Style Variations */
.fv-login-style-minimal {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 20px;
}

.fv-login-style-minimal .fv-login-footer {
    border-top: none;
}

.fv-login-style-fullwidth {
    max-width: none;
    margin: 0;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-radius: 0;
}

/* Page Background */
body.fv-login-page {
    background: var(--ss-page, #f8fafc);
    min-height: 100vh;
}

/* Responsive */
@media (max-width: 480px) {
    .fv-login-container {
        margin: 16px 0 24px;
        padding: 28px 20px;
    }

    .fv-login-subtitle {
        font-size: 15px;
    }
}

/* ========================================
   Email/Password Login Form
   ======================================== */

/* Login Form */
.fv-login-form {
    margin-bottom: 20px;
}

.fv-form-group {
    margin-bottom: 18px;
}

.fv-form-label {
    display: block;
    font-weight: 500;
    margin-bottom: 6px;
    color: #374151;
    text-align: left;
}

.fv-form-input {
    width: 100%;
    min-height: 48px;
    padding: 12px 16px;
    border: 1px solid var(--ss-border-strong, #cbd5e1);
    border-radius: var(--ss-radius-control, 0.75rem);
    background: var(--ss-surface, #ffffff);
    color: var(--ss-ink, #020617);
    font-size: 16px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    box-sizing: border-box;
}

.fv-form-input:focus {
    outline: none;
    border-color: var(--ss-primary, #e11d48);
    box-shadow: 0 0 0 3px var(--ss-focus-ring, #fda4af);
}

.fv-password-wrapper {
    position: relative;
}

.fv-password-wrapper .fv-form-input {
    padding-right: 56px;
}

.fv-password-toggle {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--ss-muted, #64748b);
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.fv-password-toggle:hover {
    color: var(--ss-heading, #0f172a);
}

.fv-form-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.fv-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--ss-body, #334155);
    min-height: 44px;
}

/* Outranks .fv-form-group label (display: block), which pushed the box and
   its text off the centre line of the "Forgot password?" link. */
.fv-form-group .fv-checkbox-label {
    display: flex;
    margin-bottom: 0;
    font-weight: 500;
}

.fv-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    margin: 0;
    accent-color: var(--ss-primary, #e11d48);
}

.fv-forgot-password {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    color: var(--ss-primary, #e11d48);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}

.fv-forgot-password:hover {
    color: var(--ss-primary-hover, #be123c);
    text-decoration: underline;
}

.fv-forgot-link {
    color: #DC2626;
    text-decoration: none;
    font-size: 14px;
}

.fv-forgot-link:hover {
    text-decoration: underline;
}

.fv-submit-btn {
    width: 100%;
    padding: 14px 24px;
    background: #DC2626;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.fv-submit-btn:hover {
    background: #b91c1c;
}

.fv-submit-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

/* Login Error - Updated styles */
.fv-login-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    padding: 12px 16px;
    border-radius: var(--ss-radius-control, 0.75rem);
    margin-bottom: 16px;
    font-size: 14px;
    text-align: left;
}

/* ========================================
   Login Divider
   ======================================== */

.fv-login-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 24px 0 20px;
    color: var(--ss-muted, #64748b);
    font-size: 14px;
}

.fv-login-divider::before,
.fv-login-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--ss-border, #e2e8f0);
}

.fv-login-divider span {
    padding: 0 16px;
}

/* ========================================
   Account Link
   ======================================== */

.fv-account-link {
    text-align: center;
    margin-top: 24px;
    font-size: 14px;
    color: #6b7280;
}

.fv-account-link a {
    color: #DC2626;
    font-weight: 500;
    text-decoration: none;
}

.fv-account-link a:hover {
    text-decoration: underline;
}

/* ========================================
   Signup Page Specific
   ======================================== */

.fv-signup-container .fv-login-buttons {
    margin-top: 20px;
}

.fv-signup-form label {
    display: block;
    margin-bottom: 6px;
    color: var(--ss-heading, #0f172a);
    font-weight: 600;
    text-align: left;
}

.fv-signup-form .fv-form-input[type="password"] {
    padding-right: 64px;
}

.fv-signup-password-toggle {
    font-size: 13px;
    font-weight: 600;
    width: auto;
    min-width: 56px;
    padding: 0 8px;
}

.fv-signup-status {
    margin: 0 0 16px;
    padding: 12px 16px;
    border-radius: var(--ss-radius-control, 0.75rem);
    font-size: 14px;
    text-align: left;
}

.fv-signup-status.is-error {
    border: 1px solid #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

.fv-signup-status.is-success {
    border: 1px solid #a7f3d0;
    background: #ecfdf5;
    color: #065f46;
}

.fv-password-requirements li::before {
    content: '';
    width: 12px;
    height: 12px;
    border: 2px solid var(--ss-border-strong, #cbd5e1);
    border-radius: 50%;
    box-sizing: border-box;
}

.fv-password-requirements li.is-met {
    color: #047857;
}

.fv-password-requirements li.is-met::before {
    border-color: #10b981;
    background: #10b981;
    box-shadow: inset 0 0 0 2px #fff;
}

.fv-signup-title {
    font-size: 28px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 8px;
}

/* ========================================
   Password Reset Flow Styles
   ======================================== */

/* Success Message */
.fv-login-success-message {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: var(--ss-radius-control, 0.75rem);
    margin-bottom: 24px;
    text-align: left;
}

.fv-login-success-message .fv-message-icon {
    flex-shrink: 0;
    margin-top: 2px;
}

.fv-login-success-message p {
    margin: 0;
    color: #065f46;
    font-size: 14px;
    line-height: 1.5;
}

/* Error Message - Enhanced */
.fv-login-error-message {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 16px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--ss-radius-control, 0.75rem);
    margin-bottom: 24px;
    text-align: left;
}

.fv-login-error-message p {
    margin: 0;
    color: #b91c1c;
    font-size: 14px;
    line-height: 1.5;
}

/* Back Link */
.fv-back-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--ss-muted, #64748b);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: color 0.15s ease;
}

.fv-back-link:hover {
    color: var(--ss-primary, #e11d48);
}

/* Forgot Password Container */
.fv-forgot-container .fv-login-footer {
    text-align: center;
}

/* Reset Password Container */
.fv-reset-container .fv-login-footer {
    text-align: center;
}

/* Password Strength Indicator */
.fv-password-strength {
    display: none;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.fv-strength-bar {
    flex: 1;
    height: 4px;
    background: var(--ss-border, #e2e8f0);
    border-radius: 2px;
    overflow: hidden;
}

.fv-strength-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s ease, background-color 0.3s ease;
}

.fv-strength-weak {
    background: #ef4444;
}

.fv-strength-medium {
    background: #f59e0b;
}

.fv-strength-strong {
    background: #10b981;
}

.fv-strength-text {
    font-size: 12px;
    font-weight: 500;
    min-width: 60px;
    text-align: right;
}

.fv-text-weak {
    color: #ef4444;
}

.fv-text-medium {
    color: #f59e0b;
}

.fv-text-strong {
    color: #10b981;
}

/* Password Match Indicator */
.fv-password-match {
    font-size: 13px;
    margin-top: 6px;
    min-height: 20px;
}

.fv-match-success {
    color: #10b981;
}

.fv-match-error {
    color: #ef4444;
}

/* Password Requirements Checklist */
.fv-password-requirements {
    margin: 20px 0;
    padding: 16px;
    background: var(--ss-page, #f8fafc);
    border: 1px solid var(--ss-border, #e2e8f0);
    border-radius: var(--ss-radius-control, 0.75rem);
    text-align: left;
}

.fv-password-requirements .fv-requirements-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--ss-heading, #0f172a);
    margin: 0 0 10px 0;
}

.fv-password-requirements .fv-requirements-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.fv-password-requirements .fv-requirements-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--ss-muted, #64748b);
    padding: 4px 0;
    margin: 0;
    transition: color 0.2s;
}

/* Requirement Icon */
.fv-req-icon {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
}

/* Pending state - empty circle */
.fv-req-pending .fv-req-icon {
    border: 2px solid var(--ss-border-strong, #cbd5e1);
    background: transparent;
}

/* Met state - filled green with checkmark */
.fv-req-met .fv-req-icon {
    border: none;
    background: #10b981;
}

.fv-req-met .fv-req-icon::after {
    content: '';
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-top: -2px;
}

.fv-req-met {
    color: #10b981;
}

/* Button with Icon */
.fv-btn svg {
    flex-shrink: 0;
}

.fv-btn-block {
    width: 100%;
}

/* Form Group Label */
.fv-form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--ss-heading, #0f172a);
    text-align: left;
}

/* Login Switch Link */
.fv-login-switch {
    font-size: 14px;
    color: var(--ss-muted, #64748b);
    margin: 0;
}

.fv-login-switch a {
    color: var(--ss-primary, #e11d48);
    text-decoration: none;
    font-weight: 600;
}

.fv-login-switch a:hover {
    color: var(--ss-primary-hover, #be123c);
    text-decoration: underline;
}

/* Keep every visible text-link action large enough for touch and motor access.
   Links inside the terms sentence are inline text (WCAG 2.5.8 inline
   exception); a 44px box there doubled the paragraph's line gap. */
.fv-login-switch a,
.fv-back-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
}

.fv-login-container a:focus-visible,
.fv-login-container button:focus-visible {
    outline: 2px solid #f43f5e;
    outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
    .fv-login-container *,
    .fv-login-container *::before,
    .fv-login-container *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }

    .fv-login-container .nsl-button:hover,
    .fv-back-link:hover svg {
        transform: none !important;
    }
}
