/* Variables CSS */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary-color: #f8fafc;
    --accent-color: #10b981;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --border-color: #e2e8f0;
    --border-focus: #3b82f6;
    --success-color: #059669;
    --warning-color: #d97706;
    --error-color: #dc2626;
    --background: #ffffff;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    min-height: 100vh;
}

/* Container principal */
.form-container {
    max-width: 800px;
    margin: 0 auto;
    background: var(--background);
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-xl);
    overflow: hidden;
    animation: slideInUp 0.6s ease-out;
}

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

/* Header */
.form-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 2rem;
    text-align: center;
    position: relative;
}

.form-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="white" opacity="0.1"/><circle cx="75" cy="75" r="1" fill="white" opacity="0.1"/><circle cx="50" cy="10" r="0.5" fill="white" opacity="0.1"/><circle cx="10" cy="60" r="0.5" fill="white" opacity="0.1"/><circle cx="90" cy="40" r="0.5" fill="white" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    pointer-events: none;
}

.header-content {
    position: relative;
    z-index: 1;
}

.form-header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.form-header h1 i {
    font-size: 1.75rem;
    opacity: 0.9;
}

.subtitle {
    font-size: 1.1rem;
    font-weight: 400;
    margin-bottom: 1.5rem;
    opacity: 0.9;
    line-height: 1.5;
}

.duration-info {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.15);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-lg);
    font-size: 0.95rem;
    margin-bottom: 1rem;
    backdrop-filter: blur(10px);
}

.instruction {
    font-size: 0.95rem;
    font-style: italic;
    opacity: 0.8;
}

/* Barre de progression */
.progress-container {
    margin-top: 2rem;
    position: relative;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-color) 0%, #34d399 100%);
    border-radius: 4px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    width: 10%;
}

.progress-text {
    text-align: center;
    margin-top: 0.75rem;
    font-size: 0.9rem;
    font-weight: 500;
    opacity: 0.9;
}

/* Formulaire */
.audit-form {
    padding: 0;
}

.form-section {
    display: none;
    padding: 2.5rem;
    animation: fadeIn 0.4s ease-out;
}

.form-section.active {
    display: block;
}

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

/* En-têtes de section */
.section-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
    position: relative;
}

.section-header::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 2px;
    background: var(--primary-color);
}

.section-number {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
}

.section-header h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
    font-weight: 600;
}

/* Groupes de questions */
.question-group {
    margin-bottom: 2rem;
}

.question-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    font-size: 1rem;
}

/* Champs de texte */
input[type="text"],
input[type="email"],
input[type="tel"],
textarea {
    width: 100%;
    padding: 0.875rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.2s ease;
    background: var(--background);
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
textarea:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    transform: translateY(-1px);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

.inline-input {
    margin-left: 0.5rem;
    width: auto;
    min-width: 200px;
    display: inline-block;
    vertical-align: middle;
}

/* Options radio */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.radio-option {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--secondary-color);
    position: relative;
}

.radio-option:hover {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.radio-option input[type="radio"] {
    display: none;
}

.radio-custom {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    margin-right: 0.75rem;
    position: relative;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.radio-option input[type="radio"]:checked + .radio-custom {
    border-color: var(--primary-color);
    background: var(--primary-color);
}

.radio-option input[type="radio"]:checked + .radio-custom::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
}

.radio-option input[type="radio"]:checked ~ * {
    color: var(--primary-color);
    font-weight: 500;
}

/* Options checkbox */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.checkbox-option {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--secondary-color);
    position: relative;
}

.checkbox-option:hover {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.checkbox-option input[type="checkbox"] {
    display: none;
}

.checkbox-custom {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-right: 0.75rem;
    position: relative;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.checkbox-option input[type="checkbox"]:checked + .checkbox-custom {
    border-color: var(--primary-color);
    background: var(--primary-color);
}

.checkbox-option input[type="checkbox"]:checked + .checkbox-custom::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 14px;
    font-weight: bold;
}

.checkbox-option input[type="checkbox"]:checked ~ * {
    color: var(--primary-color);
    font-weight: 500;
}

/* Grille de contact */
.contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

/* Navigation */
.form-navigation {
    padding: 2rem;
    background: var(--secondary-color);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.nav-btn {
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 120px;
    justify-content: center;
}

.prev-btn {
    background: var(--secondary-color);
    color: var(--text-secondary);
    border: 2px solid var(--border-color);
}

.prev-btn:hover {
    background: var(--background);
    color: var(--text-primary);
    border-color: var(--text-secondary);
    transform: translateY(-1px);
}

.next-btn,
.submit-btn {
    background: var(--primary-color);
    color: white;
    border: 2px solid var(--primary-color);
}

.next-btn:hover,
.submit-btn:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.submit-btn {
    background: var(--success-color);
    border-color: var(--success-color);
}

.submit-btn:hover {
    background: #047857;
    border-color: #047857;
}

/* Message de succès */
.success-message {
    padding: 3rem 2rem;
    text-align: center;
    background: var(--background);
}

.success-content {
    max-width: 400px;
    margin: 0 auto;
}

.success-content i {
    font-size: 4rem;
    color: var(--success-color);
    margin-bottom: 1rem;
    display: block;
    animation: successBounce 0.6s ease-out;
}

@keyframes successBounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

.success-content h3 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.success-content p {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Champs requis */
input:required,
textarea:required {
    border-left: 4px solid var(--warning-color);
}

input:required:valid,
textarea:required:valid {
    border-left: 4px solid var(--success-color);
}

/* États d'erreur */
.error {
    border-color: var(--error-color) !important;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1) !important;
}

.error-message {
    color: var(--error-color);
    font-size: 0.875rem;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .form-container {
        margin: 0;
        border-radius: 0;
        min-height: 100vh;
    }
    
    .form-header {
        padding: 1.5rem;
    }
    
    .form-header h1 {
        font-size: 1.5rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .form-section {
        padding: 1.5rem;
    }
    
    .section-header {
        margin-bottom: 1.5rem;
        padding-bottom: 1rem;
    }
    
    .section-header h2 {
        font-size: 1.25rem;
    }
    
    .question-group {
        margin-bottom: 1.5rem;
    }
    
    .form-navigation {
        padding: 1.5rem;
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav-btn {
        width: 100%;
        min-width: auto;
    }
    
    .contact-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .radio-group,
    .checkbox-group {
        gap: 0.5rem;
    }
    
    .radio-option,
    .checkbox-option {
        padding: 0.625rem;
    }
    
    .inline-input {
        margin-left: 0;
        margin-top: 0.5rem;
        width: 100%;
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .form-header h1 {
        font-size: 1.25rem;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .section-number {
        font-size: 1.5rem;
    }
    
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    textarea {
        padding: 0.75rem;
        font-size: 0.95rem;
    }
    
    .nav-btn {
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
    }
}

/* Animations d'état */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

/* Accessibilité */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus visible pour l'accessibilité */
.radio-option:focus-within,
.checkbox-option:focus-within {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Amélioration du contraste pour l'accessibilité */
@media (prefers-contrast: high) {
    :root {
        --border-color: #000000;
        --text-secondary: #000000;
        --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.2);
        --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
        --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
    }
}