/* ==========================================================================
   ClearPath Landing Page — Scan Page Styles
   Uses CSS variables from design-tokens.css; works in both light and dark modes.
   ========================================================================== */

/* Base layout */
.scan-page {
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    /* Account for fixed header */
    padding-top: 80px;
}

.scan-page .container {
    max-width: 880px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ==========================================================================
   Hero
   Condensed (April 2026): the page now has a Scanner Pro section below the
   form, so the hero doesn't need to dominate vertical real estate. Tighter
   top/bottom keeps both the free form and the Pro card visible without
   excessive scrolling on standard laptop displays.
   ========================================================================== */
.scan-hero {
    padding: 48px 0 20px;
    text-align: center;
}

.scan-hero-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(2rem, 4.5vw, 3rem);
    line-height: 1.15;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.scan-hero-subtitle {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(1rem, 1.5vw, 1.125rem);
    line-height: 1.55;
    color: var(--text-secondary);
    max-width: 620px;
    margin: 0 auto;
}

/* ==========================================================================
   Form section
   Condensed (April 2026): bottom padding tightened because the Pro section
   that follows now provides the visual breathing room.
   ========================================================================== */
.scan-form-section {
    padding: 20px 0 32px;
}

/*
   The "card" wraps the form / loading / results / error states.
   Only one is visible at a time (other states have .hidden).
*/
.scan-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: 12px;
    padding: 32px;
    box-shadow: var(--shadow-card);
}

@media (min-width: 640px) {
    .scan-card {
        padding: 40px;
    }
}

/* ==========================================================================
   Scanner Pro upsell section
   Sits below the free scan form on /scan as a permanent (always-visible)
   discoverability path to the paid tier. Distinct from the in-results
   .scan-upgrade-pitch (shown only after a free scan completes) — this one
   pre-sells Pro before the free scan even runs, so developers who already
   want code-level scanning can route directly there.

   Visual treatment: matches the .scan-card surface but with a green left-
   border accent (matches .scan-upgrade-pitch) to read as a separate "track"
   rather than a continuation of the free form.
   ========================================================================== */
.scan-pro-section {
    padding: 0 0 56px;
}

.scan-pro-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-left: 3px solid var(--accent-green);
    border-radius: 12px;
    padding: 28px 32px;
    box-shadow: var(--shadow-card);
}

@media (min-width: 640px) {
    .scan-pro-card {
        padding: 32px 40px;
    }
}

.scan-pro-card-header {
    margin-bottom: 14px;
}

/* Pill-shaped tier badge — matches the dashboard subscription badge styling
   so the brand of "Scanner Pro" reads consistently across surfaces. */
.scan-pro-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 9999px;
    background: rgba(124, 179, 66, 0.12);
    color: var(--status-complete);
    border: 1px solid var(--status-complete);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}

.scan-pro-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(1.25rem, 2.5vw, 1.625rem);
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
    margin: 0;
}

.scan-pro-body {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin: 0 0 14px;
}

.scan-pro-body strong {
    color: var(--text-primary);
}

.scan-pro-list {
    margin: 0 0 22px 18px;
    padding: 0;
}

.scan-pro-list li {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

.scan-pro-actions {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

/* Secondary "already a subscriber" link — same target as the primary CTA,
   but the wording acknowledges existing customers so they don't feel like
   the page is selling them what they already bought. */
.scan-pro-signin {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.875rem;
    color: var(--accent-cyan);
    text-decoration: none;
    transition: color 0.15s ease;
}

.scan-pro-signin:hover {
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* Mobile: stack the actions and tighten internal padding */
@media (max-width: 480px) {
    .scan-pro-card {
        padding: 22px 18px;
    }
    .scan-pro-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
    }
    .scan-pro-signin {
        text-align: center;
    }
}

/* ==========================================================================
   Form
   ========================================================================== */
.scan-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-row label {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-optional {
    color: var(--text-tertiary);
    font-weight: 400;
    font-size: 0.875rem;
}

.form-row input,
.form-row select {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1rem;
    padding: 12px 14px;
    background: var(--bg-elevated, var(--bg-surface));
    border: 1px solid var(--border-default);
    border-radius: 8px;
    color: var(--text-primary);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    /* Reset default appearance for select on some browsers */
    appearance: none;
    -webkit-appearance: none;
}

/* Custom dropdown arrow for select (since we reset appearance) */
.form-row select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%23636E72' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}

.form-row input::placeholder {
    color: var(--text-tertiary);
}

.form-row input:focus,
.form-row select:focus {
    outline: none;
    border-color: var(--border-focus, var(--accent-cyan));
    box-shadow: 0 0 0 3px var(--glow-cyan-strong, rgba(79, 166, 157, 0.15));
}

.form-row input:hover:not(:focus),
.form-row select:hover:not(:focus) {
    border-color: var(--border-hover);
}

.form-hint {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.8125rem;
    color: var(--text-tertiary);
    margin-top: 2px;
}

.form-row input[aria-invalid="true"] {
    border-color: var(--status-error);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

/* ==========================================================================
   Disclosure block — visible, not buried
   ========================================================================== */
.form-disclosure {
    background: var(--bg-inset, var(--bg-elevated));
    border: 1px solid var(--border-subtle, var(--border-default));
    border-radius: 8px;
    padding: 16px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.875rem;
    line-height: 1.55;
    color: var(--text-secondary);
}

.form-disclosure p {
    margin: 0 0 8px;
}

.form-disclosure p:last-child {
    margin-bottom: 0;
}

.form-disclosure-fine {
    font-size: 0.8125rem;
    color: var(--text-tertiary);
}

.form-disclosure a {
    color: var(--accent-cyan);
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* ==========================================================================
   Submit button (override generic .btn for primary action)
   ========================================================================== */
.scan-submit {
    align-self: stretch;
    margin-top: 8px;
}

@media (min-width: 640px) {
    .scan-submit {
        align-self: flex-start;
    }
}

.scan-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ==========================================================================
   State machine — hidden helper used by JS to swap states
   ========================================================================== */
.hidden {
    display: none !important;
}

/* ==========================================================================
   Loading state
   ========================================================================== */
.scan-loading {
    text-align: center;
    padding: 24px 0;
}

.scan-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border-default);
    border-top-color: var(--accent-cyan);
    border-radius: 50%;
    margin: 0 auto 24px;
    animation: scan-spin 0.8s linear infinite;
}

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

.scan-loading-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.scan-loading-detail {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.9375rem;
    color: var(--text-secondary);
}

/* ==========================================================================
   Results state
   ========================================================================== */
.scan-results-header {
    margin-bottom: 24px;
}

.scan-results-header h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.scan-results-summary {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.9375rem;
    color: var(--text-secondary);
    line-height: 1.55;
    margin-bottom: 24px;
}

/* ==========================================================================
   Report card — 6 section rows (one per category from "What we check")
   Each row: status badge + section title + one-line summary.
   Detailed per-finding text lives in the email, not here.
   ========================================================================== */
.scan-sections {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 24px;
}

.scan-section {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 16px;
    align-items: center;
    border: 1px solid var(--border-default);
    border-radius: 8px;
    padding: 14px 16px;
    background: var(--bg-elevated, var(--bg-surface));
}

@media (max-width: 480px) {
    .scan-section {
        grid-template-columns: 1fr;
        gap: 6px;
    }
}

/* Status badge */
.scan-section-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    border-radius: 9999px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border: 1px solid transparent;
    white-space: nowrap;
    text-align: center;
}

/* Status: pass — green checkmark */
.scan-section.status-pass .scan-section-badge {
    background: rgba(124, 179, 66, 0.12);
    color: var(--status-complete);
    border-color: var(--status-complete);
}
.scan-section.status-pass .scan-section-badge::before {
    content: "\2713\00a0"; /* ✓ + non-breaking space */
    font-weight: 700;
}

/* Status: issues — colored by severity */
.scan-section.status-issues.severity-high .scan-section-badge {
    background: rgba(220, 38, 38, 0.12);
    color: var(--status-error);
    border-color: var(--status-error);
}
.scan-section.status-issues.severity-medium .scan-section-badge {
    background: rgba(217, 119, 6, 0.12);
    color: var(--status-warning, var(--status-in-progress));
    border-color: var(--status-warning, var(--status-in-progress));
}
.scan-section.status-issues.severity-low .scan-section-badge,
.scan-section.status-issues:not(.severity-high):not(.severity-medium) .scan-section-badge {
    background: rgba(217, 119, 6, 0.12);
    color: var(--status-warning, var(--status-in-progress));
    border-color: var(--status-warning, var(--status-in-progress));
}

/* Status: info — neutral cyan */
.scan-section.status-info .scan-section-badge {
    background: rgba(79, 166, 157, 0.12);
    color: var(--accent-cyan);
    border-color: var(--accent-cyan);
}

/* Status: pending — gray (section not yet evaluated) */
.scan-section.status-pending .scan-section-badge {
    background: rgba(107, 107, 107, 0.12);
    color: var(--text-tertiary);
    border-color: var(--border-hover);
}

/* Section body */
.scan-section-body {
    min-width: 0; /* allow text truncation if needed */
}

.scan-section-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.scan-section-summary {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

/* Upsell card on the results page. Inset visually with a subtle accent
   so it reads as a "next step" rather than an aggressive interstitial. */
.scan-upgrade-pitch {
    background: var(--bg-inset, var(--bg-elevated));
    border: 1px solid var(--border-default);
    border-left: 3px solid var(--accent-green);
    border-radius: 8px;
    padding: 20px 22px;
    margin: 24px 0;
}

.scan-upgrade-pitch-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.scan-upgrade-pitch-body {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.9375rem;
    line-height: 1.55;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.scan-upgrade-pitch-list {
    margin: 0 0 16px 18px;
    padding: 0;
}

.scan-upgrade-pitch-list li {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Footer link below the report card */
.scan-results-footer {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.875rem;
    color: var(--text-tertiary);
    margin: 0;
}

.scan-again-link {
    color: var(--accent-cyan);
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* ==========================================================================
   Legacy findings list styles — kept for the email template, no longer
   rendered on-page. Safe to remove once the email template stops importing
   the same class names.
   ========================================================================== */
.scan-findings {
    list-style: none;
    padding: 0;
    margin: 0 0 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.scan-finding {
    border: 1px solid var(--border-default);
    border-radius: 8px;
    padding: 16px;
    background: var(--bg-elevated, var(--bg-surface));
}

.scan-finding-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.scan-finding-severity {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.scan-finding-severity.severity-high {
    background: rgba(220, 38, 38, 0.12);
    color: var(--status-error);
    border: 1px solid var(--status-error);
}

.scan-finding-severity.severity-medium {
    background: rgba(217, 119, 6, 0.12);
    color: var(--status-warning, var(--status-in-progress));
    border: 1px solid var(--status-warning, var(--status-in-progress));
}

.scan-finding-severity.severity-low {
    background: rgba(124, 179, 66, 0.12);
    color: var(--status-complete);
    border: 1px solid var(--status-complete);
}

.scan-finding-severity.severity-info {
    background: rgba(79, 166, 157, 0.12);
    color: var(--accent-cyan);
    border: 1px solid var(--accent-cyan);
}

/* Pass — green checkmark style for sections that passed all sub-checks.
   Slightly stronger green than info to read as a clear "all good" signal. */
.scan-finding-severity.severity-pass {
    background: rgba(124, 179, 66, 0.12);
    color: var(--status-complete);
    border: 1px solid var(--status-complete);
}

.scan-finding-severity.severity-pass::before {
    content: "\2713\00a0"; /* ✓ + non-breaking space */
    font-weight: 700;
}

.scan-finding-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
}

.scan-finding-detail {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
}

.scan-results-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
    margin: 24px 0 16px;
}

/* "Copy for AI co-pilot" button — uses the existing .btn-secondary style.
   The inline icon + label structure matches the dashboard copy button so
   both surfaces feel like the same action. */
.scan-copy-ai-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.scan-copy-ai-icon {
    font-size: 1rem;
    line-height: 1;
}

/* Confirmed state — swap to a green tint so the user sees that the click
   landed even before they paste anywhere. */
.scan-copy-ai-btn.is-copied {
    background: var(--status-complete);
    color: var(--bg-primary);
}

.scan-copy-ai-hint {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.8125rem;
    color: var(--text-tertiary);
    line-height: 1.4;
}

/* ==========================================================================
   Error state
   ========================================================================== */
.scan-error {
    text-align: center;
    padding: 16px 0;
}

.scan-error-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--status-error);
    margin-bottom: 8px;
}

.scan-error-message {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.9375rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

/* ==========================================================================
   What we check section
   ========================================================================== */
.scan-info-section {
    padding: 40px 0 72px;
    background: var(--bg-elevated, var(--bg-surface));
    border-top: 1px solid var(--border-default);
}

.scan-info-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 700;
    margin-bottom: 32px;
    text-align: center;
}

.check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.check-item {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: 8px;
    padding: 20px;
}

.check-item h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.check-item p {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.875rem;
    line-height: 1.55;
    color: var(--text-secondary);
    margin: 0;
}

.scan-disclaimer {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--text-secondary);
    background: var(--bg-inset, var(--bg-elevated));
    border-left: 3px solid var(--accent-cyan);
    padding: 16px 20px;
    border-radius: 4px;
    margin: 0;
}

.scan-disclaimer strong {
    color: var(--text-primary);
}
