/**
 * Next League AI - EB-1A Candidate Intake MVP
 * Design System CSS
 *
 * This file contains all CSS variables and base component styles
 * as defined in the UI Design Specification.
 */

/* ==========================================================================
   CSS VARIABLES
   ========================================================================== */

:root {
    /* Colors - Primary */
    --color-primary: #1e3a5f;
    --color-secondary: #2563eb;
    --color-accent: #3b82f6;

    /* Colors - Text */
    --color-text: #1f2937;
    --color-text-secondary: #64748b;
    --color-text-light: #94a3b8;

    /* Colors - Background */
    --color-bg: #f8fafc;
    --color-bg-white: #ffffff;
    --color-border: #e2e8f0;
    --color-border-light: #f1f5f9;

    /* Colors - Semantic */
    --color-success: #059669;
    --color-success-light: #34d399;
    --color-warning: #d97706;
    --color-warning-light: #fbbf24;
    --color-error: #dc2626;
    --color-gold: #b8860b;

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    /* Spacing Scale */
    --space-1: 0.25rem;   /* 4px */
    --space-2: 0.5rem;    /* 8px */
    --space-3: 0.75rem;   /* 12px */
    --space-4: 1rem;      /* 16px */
    --space-5: 1.25rem;   /* 20px */
    --space-6: 1.5rem;    /* 24px */
    --space-8: 2rem;      /* 32px */
    --space-10: 2.5rem;   /* 40px */
    --space-12: 3rem;     /* 48px */
    --space-16: 4rem;     /* 64px */
    --space-20: 5rem;     /* 80px */
    --space-24: 6rem;     /* 96px */

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --shadow-button: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-button-hover: 0 4px 12px rgba(37, 99, 235, 0.25);
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.04);

    /* Container Widths */
    --container-max: 1200px;
    --form-max: 680px;
    --content-max: 720px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-default: 0.2s ease;
    --transition-slow: 0.3s ease;
}

/* ==========================================================================
   RESET & BASE STYLES
   ========================================================================== */

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family);
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.6;
    color: var(--color-text);
    background: var(--color-bg);
}

/* ==========================================================================
   TYPOGRAPHY
   ========================================================================== */

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
    color: var(--color-text);
}

.text-hero {
    font-size: 3rem;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.025em;
}

.text-title {
    font-size: 2.25rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.text-section {
    font-size: 1.75rem;
    font-weight: 600;
    line-height: 1.3;
}

.text-subsection {
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.4;
}

.text-body-lg {
    font-size: 1.125rem;
    font-weight: 400;
    line-height: 1.7;
}

.text-body {
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.6;
}

.text-sm {
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.5;
}

.text-caption {
    font-size: 0.75rem;
    font-weight: 400;
    line-height: 1.4;
    color: var(--color-text-secondary);
}

.text-label {
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.4;
    letter-spacing: 0.01em;
}

a {
    color: var(--color-secondary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-accent);
}

/* ==========================================================================
   LAYOUT
   ========================================================================== */

.container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--space-6);
}

.container-narrow {
    max-width: var(--form-max);
}

.section {
    padding: var(--space-20) 0;
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    font-family: inherit;
    font-weight: 600;
    text-decoration: none;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-default);
}

.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.4);
}

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

/* Primary Button */
.btn-primary {
    padding: 14px 28px;
    font-size: 1rem;
    color: var(--color-bg-white);
    background: var(--color-primary);
    box-shadow: var(--shadow-button);
}

.btn-primary:hover:not(:disabled) {
    background: var(--color-secondary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-button-hover);
}

/* Secondary Button */
.btn-secondary {
    padding: 14px 28px;
    font-size: 1rem;
    color: var(--color-primary);
    background: var(--color-bg-white);
    border: 2px solid var(--color-primary);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--color-bg);
    border-color: var(--color-secondary);
    color: var(--color-secondary);
}

/* Ghost Button */
.btn-ghost {
    padding: 12px 20px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    background: transparent;
}

.btn-ghost:hover:not(:disabled) {
    color: var(--color-text);
    background: var(--color-border-light);
}

/* CTA Button (Large) */
.btn-cta {
    padding: 18px 40px;
    font-size: 1.125rem;
    color: var(--color-bg-white);
    background: var(--color-secondary);
    border-radius: 10px;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.btn-cta:hover:not(:disabled) {
    background: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

/* Button Sizes */
.btn-sm {
    padding: 10px 18px;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 1.125rem;
}

/* ==========================================================================
   FORM ELEMENTS
   ========================================================================== */

.form-group {
    margin-bottom: var(--space-6);
}

.form-label {
    display: block;
    margin-bottom: var(--space-2);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text);
}

.form-label .required {
    color: var(--color-error);
    margin-left: 2px;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 14px 16px;
    font-size: 1rem;
    font-family: inherit;
    color: var(--color-text);
    background: var(--color-bg-white);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: all var(--transition-default);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--color-text-light);
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
    border-color: #cbd5e1;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--color-secondary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-input.error,
.form-select.error,
.form-textarea.error {
    border-color: var(--color-error);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.form-select {
    padding-right: 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 12px;
    appearance: none;
    cursor: pointer;
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
}

.form-helper {
    margin-top: 6px;
    font-size: 0.75rem;
    color: var(--color-text-secondary);
}

.form-error-text {
    margin-top: 6px;
    font-size: 0.75rem;
    color: var(--color-error);
}

/* Checkbox and Radio */
.form-checkbox-group {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    cursor: pointer;
}

.form-checkbox {
    width: 20px;
    height: 20px;
    accent-color: var(--color-secondary);
    cursor: pointer;
    flex-shrink: 0;
    margin-top: 2px;
}

/* ==========================================================================
   CARDS
   ========================================================================== */

.card {
    background: var(--color-bg-white);
    border-radius: var(--radius-lg);
    padding: var(--space-8);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--color-border-light);
}

.card-sm {
    padding: var(--space-6);
}

/* Criteria Card */
.criteria-card {
    background: var(--color-bg-white);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    border: 1px solid var(--color-border);
    transition: all var(--transition-default);
}

.criteria-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.criteria-card.strong {
    border-left: 4px solid var(--color-success);
}

.criteria-card.moderate {
    border-left: 4px solid var(--color-warning);
}

.criteria-card.weak {
    border-left: 4px solid var(--color-border);
}

/* Stat Card */
.stat-card {
    text-align: center;
    padding: var(--space-6);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: var(--space-1);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    font-weight: 500;
}

/* ==========================================================================
   PROGRESS INDICATOR
   ========================================================================== */

.progress-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 600px;
    margin: 0 auto var(--space-12);
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    flex: 1;
}

.progress-step-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 600;
    background: var(--color-bg-white);
    border: 2px solid var(--color-border);
    color: var(--color-text-secondary);
    transition: all var(--transition-slow);
    z-index: 1;
}

.progress-step.active .progress-step-circle {
    background: var(--color-secondary);
    border-color: var(--color-secondary);
    color: var(--color-bg-white);
}

.progress-step.completed .progress-step-circle {
    background: var(--color-success);
    border-color: var(--color-success);
    color: var(--color-bg-white);
}

.progress-step-label {
    margin-top: var(--space-2);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    text-align: center;
    max-width: 80px;
}

.progress-step.active .progress-step-label,
.progress-step.completed .progress-step-label {
    color: var(--color-text);
}

/* Connector line */
.progress-step::after {
    content: '';
    position: absolute;
    top: 20px;
    left: calc(50% + 24px);
    width: calc(100% - 48px);
    height: 2px;
    background: var(--color-border);
}

.progress-step:last-child::after {
    display: none;
}

.progress-step.completed::after {
    background: var(--color-success);
}

/* ==========================================================================
   STRENGTH INDICATOR
   ========================================================================== */

.strength-bar-container {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.strength-bar {
    flex: 1;
    height: 8px;
    background: var(--color-border);
    border-radius: 4px;
    overflow: hidden;
}

.strength-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.strength-bar-fill.strong {
    background: linear-gradient(90deg, var(--color-success), var(--color-success-light));
}

.strength-bar-fill.moderate {
    background: linear-gradient(90deg, var(--color-warning), var(--color-warning-light));
}

.strength-bar-fill.weak {
    background: var(--color-text-light);
}

.strength-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    min-width: 80px;
    text-align: right;
}

.strength-label.strong { color: var(--color-success); }
.strength-label.moderate { color: var(--color-warning); }
.strength-label.weak { color: var(--color-text-light); }

/* ==========================================================================
   NAVIGATION
   ========================================================================== */

.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 72px;
    background: var(--color-bg-white);
    border-bottom: 1px solid var(--color-border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-12);
    z-index: 1000;
    transition: box-shadow var(--transition-default);
}

.navbar.scrolled {
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-primary);
    text-decoration: none;
}

.navbar-transparent {
    background: transparent;
    border-bottom: none;
}

.navbar-transparent .logo {
    color: var(--color-bg-white);
}

/* ==========================================================================
   HERO SECTION
   ========================================================================== */

.hero {
    min-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 120px var(--space-6) var(--space-24);
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    color: var(--color-bg-white);
    text-align: center;
}

.hero-content {
    max-width: var(--content-max);
}

.hero h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: var(--space-6);
    line-height: 1.1;
    color: inherit;
}

.hero p {
    font-size: 1.25rem;
    opacity: 0.9;
    margin-bottom: var(--space-10);
    line-height: 1.7;
}

.hero-trust {
    margin-top: var(--space-4);
    font-size: 0.875rem;
    opacity: 0.8;
}

/* ==========================================================================
   FORM CONTAINER (Questionnaire)
   ========================================================================== */

.questionnaire-page {
    min-height: 100vh;
    padding: 96px var(--space-6) var(--space-12);
    background: var(--color-bg);
}

.form-container {
    max-width: var(--form-max);
    margin: 0 auto;
    background: var(--color-bg-white);
    border-radius: var(--radius-xl);
    padding: var(--space-12);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

.step-title {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: var(--space-2);
}

.step-description {
    font-size: 1rem;
    color: var(--color-text-secondary);
    margin-bottom: var(--space-8);
}

.form-actions {
    display: flex;
    justify-content: space-between;
    margin-top: var(--space-10);
    padding-top: var(--space-6);
    border-top: 1px solid var(--color-border-light);
}

/* ==========================================================================
   RESULTS PAGE
   ========================================================================== */

.results-header {
    text-align: center;
    padding: var(--space-20) var(--space-6) var(--space-16);
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    color: var(--color-bg-white);
}

.results-score {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: 4px solid var(--color-bg-white);
    margin-bottom: var(--space-6);
}

.results-score-number {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
}

.results-score-label {
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: var(--space-1);
}

.criteria-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-6);
    max-width: 1000px;
    margin: 0 auto;
    padding: var(--space-16) var(--space-6);
}

/* ==========================================================================
   UTILITIES
   ========================================================================== */

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }

.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

.hidden { display: none; }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ==========================================================================
   ANIMATIONS
   ========================================================================== */

.fade-in {
    animation: fadeIn 0.3s ease forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fillBar {
    from { width: 0; }
    to { width: var(--fill-width, 100%); }
}

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

/* Mobile (max-width: 480px) */
@media (max-width: 480px) {
    .container { padding: 0 var(--space-4); }

    .text-hero { font-size: 2rem; }
    .text-title { font-size: 1.5rem; }
    .text-section { font-size: 1.25rem; }

    .hero { padding: 100px var(--space-4) var(--space-16); }
    .hero h1 { font-size: 2rem; }
    .hero p { font-size: 1rem; }

    .form-container { padding: var(--space-6); }
    .step-title { font-size: 1.5rem; }

    .progress-step-label { display: none; }
    .progress-step-circle { width: 32px; height: 32px; font-size: 0.75rem; }

    .criteria-grid { grid-template-columns: 1fr; }

    .navbar { padding: 0 var(--space-4); }

    .btn-cta { padding: 16px 32px; font-size: 1rem; }

    .form-actions { flex-direction: column-reverse; gap: var(--space-3); }
    .form-actions .btn { width: 100%; }
}

/* Tablet (481px - 768px) */
@media (min-width: 481px) and (max-width: 768px) {
    .container { padding: 0 var(--space-6); }

    .text-hero { font-size: 2.5rem; }
    .hero h1 { font-size: 2.5rem; }

    .criteria-grid { grid-template-columns: 1fr; }
}

/* Desktop (769px+) */
@media (min-width: 769px) {
    .container { padding: 0 var(--space-8); }
}

/* Large Desktop (1025px+) */
@media (min-width: 1025px) {
    .container { padding: 0 var(--space-12); }
}

/* ==========================================================================
   FOCUS STYLES (Accessibility)
   ========================================================================== */

*:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.4);
}

/* Skip link for keyboard navigation */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--color-primary);
    color: var(--color-bg-white);
    padding: 8px 16px;
    z-index: 9999;
    transition: top 0.2s ease;
}

.skip-link:focus {
    top: 0;
}
