/* ==========================================================================
   CSS VARIABLES & BRANDING
   ========================================================================== */
:root {
    /* Color Palette */
    --primary: #1E3A5F;       /* Deep Steel Blue */
    --accent: #F5A623;        /* Warm Amber */
    --accent-hover: #E0951C;  /* Darker Amber for hover */
    --bg-light: #F7F9FA;      /* Soft Pearl */
    --text-dark: #2D3748;     /* Dark Charcoal */
    --text-muted: #718096;    /* Gray for secondary text */
    --white: #FFFFFF;
    --border-color: #E2E8F0;
    
    /* Typography */
    --font-heading: 'Montserrat', sans-serif;
    --font-body: 'Inter', sans-serif;
}

/* ==========================================================================
   BASE STYLES & RESET
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

h1, h2, h3, h4 {
    font-family: var(--font-heading);
    color: var(--primary);
    margin-bottom: 1rem;
    line-height: 1.2;
}

.container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ==========================================================================
   HEADER & LOGO
   ========================================================================== */
.main-header {
    background-color: var(--white);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    height: 40px;
    width: auto;
}

.powered-by {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.powered-by strong {
    color: var(--primary);
}

/* ==========================================================================
   VIEW MANAGEMENT (SPA LOGIC)
   ========================================================================== */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 40px 20px;
}

.view {
    display: none;
    animation: fadeIn 0.4s ease-in-out;
}

.view.active {
    display: block;
}

.hidden {
    display: none !important;
}

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

/* ==========================================================================
   BUTTONS
   ========================================================================== */
button, .btn-primary, .btn-secondary {
    cursor: pointer;
    font-family: var(--font-heading);
    font-size: 1rem;
    padding: 12px 24px;
    border-radius: 6px;
    border: none;
    transition: all 0.2s ease;
    text-align: center;
    text-decoration: none;
    display: inline-block;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background-color: var(--accent);
    color: var(--white);
    font-weight: 700;
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--accent-hover);
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
    font-weight: 600;
}

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

/* ==========================================================================
   VIEW 1: LANDING
   ========================================================================== */
.hero {
    text-align: center;
    background: var(--white);
    padding: 50px 30px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* ==========================================================================
   VIEW 2: ASSESSMENT QUIZ
   ========================================================================== */
.progress-container {
    margin-bottom: 30px;
}

.progress-bar {
    height: 8px;
    background-color: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-bar::after {
    content: '';
    display: block;
    height: 100%;
    width: var(--progress, 0%);
    background-color: var(--primary);
    transition: width 0.3s ease;
}

#progress-text {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

.question-box h2 {
    font-size: 1.5rem;
    margin-bottom: 25px;
}

.options-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
}

.option-btn {
    background-color: var(--white);
    border: 2px solid var(--border-color);
    padding: 16px 20px;
    border-radius: 8px;
    text-align: left;
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--text-dark);
    font-weight: 500;
}

.option-btn:hover {
    border-color: var(--primary);
    background-color: #F0F4F8;
}

.option-btn.selected {
    border-color: var(--primary);
    background-color: var(--primary);
    color: var(--white);
}

.quiz-controls {
    display: flex;
    justify-content: space-between;
}

/* ==========================================================================
   VIEW 3: LEAD CAPTURE
   ========================================================================== */
.lead-box {
    background: var(--white);
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    text-align: center;
}

.form-group {
    text-align: left;
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--primary);
}

.form-group input, .form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-family: var(--font-body);
    font-size: 1rem;
}

.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.1);
}

#btn-submit-lead {
    width: 100%;
    margin-top: 10px;
}

.privacy-note {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 15px;
}

/* ==========================================================================
   VIEW 4: RESULTS (On-Screen Layout)
   ========================================================================== */
.print-header {
    text-align: center;
    margin-bottom: 30px;
}

.print-logo {
    height: 80px;
    width: auto;
    margin: 0 auto 15px auto;
    display: block;
}

.score-container {
    text-align: center;
    margin-bottom: 40px;
}

.score-circle {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    border: 8px solid var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 2.5rem;
    font-weight: 800;
    font-family: var(--font-heading);
    color: var(--primary);
    background: var(--white);
}

#score-summary {
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}

.feedback-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 40px;
}

.feedback-card {
    background: var(--white);
    padding: 25px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    border-left: 5px solid var(--primary);
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    margin-bottom: 20px;
    text-align: left;
}

.feedback-card h3 {
    margin-bottom: 10px;
    font-size: 1.2rem;
    color: var(--primary);
}

.results-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
}

.print-only {
    display: none;
}

/* ==========================================================================
   PRINT MEDIA QUERY (For flawless PDF generation)
   ========================================================================== */
@media print {
    /* 1. Turn off flexbox so pages can break naturally */
    body, main {
        display: block !important;
        height: auto !important;
        min-height: auto !important;
        background-color: white;
        color: black;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    .no-print {
        display: none !important;
    }
    
    /* 2. Show the formal report header */
    .print-only {
        display: block !important;
        text-align: center;
        margin-bottom: 30px;
        padding-bottom: 20px;
        border-bottom: 2px solid #EEE;
    }
    
    .print-logo {
        height: 60px;
        margin: 0 auto 15px auto;
        display: block;
    }

    /* 3. Force colors to print (bypasses browser ink-saving settings) */
    .score-circle {
        border-color: var(--primary) !important;
        color: var(--primary) !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        margin-top: 20px;
    }

    /* 4. Fix the grid and prevent cards from splitting across pages */
    .feedback-grid {
        display: block !important; 
    }

    .feedback-card {
        border: 1px solid #CCC;
        border-left: 5px solid var(--primary);
        box-shadow: none;
        page-break-inside: avoid; /* Old browsers */
        break-inside: avoid;      /* Modern browsers */
        margin-bottom: 20px;
        padding: 20px;
        display: block;
    }
}

/* ==========================================================================
   MOBILE RESPONSIVENESS
   ========================================================================== */
@media (max-width: 600px) {
    .hero h1 { font-size: 2rem; }
    
    .results-actions { 
        flex-direction: column; 
        margin-bottom: 40px; /* This adds the breathing room under the button */
    }
    
    .btn-primary, .btn-secondary { width: 100%; }
}