/* Variables CSS */
:root {
    --primary: #7c3aed;
    --primary-light: #a78bfa;
    --primary-dark: #5b21b6;
    --secondary: #06b6d4;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Reset et base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 50%, #ddd6fe 100%);
    min-height: 100vh;
    color: var(--gray-800);
    line-height: 1.6;
    padding-bottom: 4rem;
}

/* Progress bar */
.progress-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: var(--gray-200);
    z-index: 1000;
    display: flex;
    align-items: center;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 0 3px 3px 0;
}

.progress-text {
    position: fixed;
    top: 12px;
    right: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary);
    background: white;
    padding: 4px 12px;
    border-radius: 20px;
    box-shadow: var(--shadow-md);
    z-index: 1001;
}

/* Container */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: var(--radius-lg);
    padding: 3rem 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-xl);
    text-align: center;
    color: white;
}

.header-content {
    max-width: 600px;
    margin: 0 auto;
}

.header-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.9;
}

.header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Intro card */
.intro-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-lg);
    text-align: center;
    border-left: 4px solid var(--success);
}

.intro-icon {
    font-size: 2.5rem;
    color: var(--success);
    margin-bottom: 1rem;
}

.intro-card h2 {
    font-size: 1.5rem;
    color: var(--gray-800);
    margin-bottom: 0.75rem;
}

.intro-card p {
    color: var(--gray-600);
    max-width: 600px;
    margin: 0 auto 1.5rem;
}

.intro-features {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.feature {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--gray-600);
    font-size: 0.9rem;
}

.feature i {
    color: var(--primary);
    font-size: 1.1rem;
}

/* Section cards */
.section-card {
    background: white;
    border-radius: var(--radius-lg);
    margin-bottom: 1rem;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}

.section-card:hover {
    box-shadow: var(--shadow-lg);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    cursor: pointer;
    background: linear-gradient(135deg, var(--gray-50), white);
    border-bottom: 1px solid var(--gray-100);
    transition: background 0.2s ease;
}

.section-header:hover {
    background: var(--gray-50);
}

.section-header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.section-number {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
}

.section-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--gray-800);
}

.section-header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.section-status {
    font-size: 0.8rem;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 500;
}

.section-status.complete {
    background: #dcfce7;
    color: #166534;
}

.section-status.partial {
    background: #fef3c7;
    color: #92400e;
}

.toggle-icon {
    color: var(--gray-400);
    transition: transform 0.3s ease;
    font-size: 1.25rem;
}

.section-card.open .toggle-icon {
    transform: rotate(180deg);
}

/* Section content */
.section-content {
    padding: 1.5rem;
    max-height: 5000px;
    overflow: hidden;
    transition: max-height 0.4s ease, padding 0.4s ease, opacity 0.3s ease;
    opacity: 1;
}

.section-content.collapsed {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
}

/* Question groups */
.question-group {
    margin-bottom: 1.75rem;
}

.question-group:last-child {
    margin-bottom: 0;
}

.question-label {
    display: block;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

.required {
    color: var(--danger);
}

/* Options grid */
.options-grid {
    display: grid;
    gap: 0.75rem;
}

.options-grid.cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.options-grid.cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.options-grid.cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

.options-grid.cols-5 {
    grid-template-columns: repeat(5, 1fr);
}

/* Options list (vertical) */
.options-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Option cards */
.option-card {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 0.75rem;
    background: var(--gray-50);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    min-height: 60px;
}

.option-card.full {
    text-align: left;
    justify-content: flex-start;
    padding: 1rem 1.25rem;
}

.option-card input[type="radio"],
.option-card input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.option-content {
    font-size: 0.9rem;
    color: var(--gray-700);
    font-weight: 500;
    line-height: 1.4;
}

.option-card:hover {
    border-color: var(--primary-light);
    background: white;
}

.option-card:has(input:checked) {
    border-color: var(--primary);
    background: linear-gradient(135deg, #f5f3ff, #ede9fe);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.option-card:has(input:checked) .option-content {
    color: var(--primary-dark);
}

/* Checkbox specific style */
.option-card.checkbox:has(input:checked)::before {
    content: '\f26b';
    font-family: 'bootstrap-icons';
    position: absolute;
    top: 6px;
    right: 6px;
    font-size: 0.8rem;
    color: var(--primary);
}

/* Correct answer highlight (for knowledge questions) */
.option-card.correct:has(input:checked) {
    border-color: var(--success);
    background: linear-gradient(135deg, #dcfce7, #bbf7d0);
}

.option-card.correct:has(input:checked) .option-content {
    color: #166534;
}

/* Conditional questions */
.conditional-questions {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 2px dashed var(--gray-200);
    animation: fadeIn 0.3s ease;
}

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

/* Other input */
.other-input {
    width: 100%;
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.other-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.other-input.hidden {
    display: none;
}

/* Text input (for required text fields like age) */
.text-input {
    width: 100%;
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.text-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.text-input::placeholder {
    color: var(--gray-400);
}

/* Short text input (for numeric fields) */
.text-input.short {
    max-width: 150px;
}

/* Submit section */
.submit-section {
    text-align: center;
    margin-top: 2rem;
    padding: 2rem;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.submit-btn {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    padding: 1rem 3rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-width: 250px;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(124, 58, 237, 0.3);
}

.submit-btn:active {
    transform: translateY(0);
}

.submit-btn:disabled {
    background: var(--gray-400);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-loader {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.submit-note {
    margin-top: 1rem;
    color: var(--gray-500);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.submit-note i {
    color: var(--success);
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    max-width: 450px;
    width: 100%;
    text-align: center;
    animation: modalIn 0.3s ease;
    box-shadow: var(--shadow-xl);
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
}

.modal-content.success .modal-icon {
    color: var(--success);
}

.modal-content.error .modal-icon {
    color: var(--danger);
}

.modal-content.warning .modal-icon {
    color: var(--warning);
}

.modal-content h2 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--gray-800);
}

.modal-content p {
    color: var(--gray-600);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.modal-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.modal-btn:hover {
    background: var(--primary-dark);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--gray-800);
    color: white;
    padding: 1rem 2rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 3000;
    font-weight: 500;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 1rem 0.75rem;
    }
    
    .header {
        padding: 2rem 1.5rem;
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
    
    .subtitle {
        font-size: 0.95rem;
    }
    
    .intro-features {
        gap: 1rem;
    }
    
    .section-header {
        padding: 1rem 1.25rem;
    }
    
    .section-header h3 {
        font-size: 1rem;
    }
    
    .section-content {
        padding: 1.25rem;
    }
    
    .options-grid.cols-5,
    .options-grid.cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .options-grid.cols-3 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .option-card {
        padding: 0.875rem 0.5rem;
        min-height: 50px;
    }
    
    .option-content {
        font-size: 0.85rem;
    }
    
    .submit-btn {
        width: 100%;
        padding: 1rem 1.5rem;
    }
    
    .progress-text {
        top: 10px;
        right: 12px;
        font-size: 0.75rem;
        padding: 3px 10px;
    }
}

@media (max-width: 480px) {
    .options-grid.cols-3,
    .options-grid.cols-2 {
        grid-template-columns: 1fr;
    }
    
    .intro-card {
        padding: 1.5rem;
    }
    
    .feature {
        font-size: 0.8rem;
    }
}

/* Animations d'entree pour les sections */
.section-card {
    animation: slideIn 0.4s ease;
    animation-fill-mode: both;
}

.section-card:nth-child(1) { animation-delay: 0.05s; }
.section-card:nth-child(2) { animation-delay: 0.1s; }
.section-card:nth-child(3) { animation-delay: 0.15s; }
.section-card:nth-child(4) { animation-delay: 0.2s; }
.section-card:nth-child(5) { animation-delay: 0.25s; }
.section-card:nth-child(6) { animation-delay: 0.3s; }
.section-card:nth-child(7) { animation-delay: 0.35s; }
.section-card:nth-child(8) { animation-delay: 0.4s; }
.section-card:nth-child(9) { animation-delay: 0.45s; }
.section-card:nth-child(10) { animation-delay: 0.5s; }
.section-card:nth-child(11) { animation-delay: 0.55s; }
.section-card:nth-child(12) { animation-delay: 0.6s; }

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

/* Focus states for accessibility */
.option-card:focus-within {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.submit-btn:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .progress-container,
    .submit-section,
    .modal {
        display: none;
    }
    
    .section-content.collapsed {
        max-height: none;
        padding: 1.5rem;
        opacity: 1;
    }
    
    body {
        background: white;
    }
}
