/**
 * ==============================================
 * STYLES FORMULAIRES (Public & Collecteur)
 * Design moderne et élégant
 * ==============================================
 */

body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 25%, #f093fb 50%, #4facfe 75%, #667eea 100%);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    min-height: 100vh;
    padding: 1rem 0.75rem;
    position: relative;
    /* Prévenir les sauts de layout */
    overflow-x: hidden;
    /* Retirer will-change qui peut causer des problèmes de rendu */
    /* will-change: background-position; */
    /* Forcer le rendu GPU de manière stable */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 50%, rgba(102, 126, 234, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(118, 75, 162, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(79, 172, 254, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.container {
    max-width: 950px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.98);
    /* Désactiver backdrop-filter qui cause des problèmes de rendu */
    /* backdrop-filter: blur(20px); */
    border-radius: 24px;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.12),
        0 8px 24px rgba(0, 0, 0, 0.08),
        0 0 0 1px rgba(255, 255, 255, 0.5) inset;
    overflow: hidden;
    animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    position: relative;
    z-index: 1;
    /* Prévenir les sauts de layout */
    min-height: 100px;
    /* Forcer le rendu GPU de manière stable */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    /* Forcer la visibilité - protection contre les disparitions */
    opacity: 1 !important;
    visibility: visible !important;
    display: block !important;
    /* Empêcher les re-rendus */
    contain: layout style paint;
    /* Isolation pour éviter les problèmes de rendu */
    isolation: isolate;
}

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

.header {
    background: linear-gradient(135deg, #1e293b 0%, #334155 50%, #475569 100%);
    color: white;
    padding: 1.5rem 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
    /* Forcer le rendu GPU de manière stable */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    /* Empêcher les re-rendus */
    contain: layout style paint;
}

.header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: 
        radial-gradient(circle, rgba(102, 126, 234, 0.15) 0%, transparent 70%),
        radial-gradient(circle at 80% 20%, rgba(118, 75, 162, 0.15) 0%, transparent 50%);
    animation: rotate 20s linear infinite;
    /* Forcer le rendu GPU et éviter les re-rendus */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    will-change: transform;
    /* Isoler les modifications */
    contain: layout style paint;
}

.header::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    opacity: 0.6;
}

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

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

.header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.2);
    background: linear-gradient(135deg, #ffffff 0%, #e2e8f0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header p {
    font-size: 0.875rem;
    opacity: 0.9;
    font-weight: 400;
    text-shadow: 0 1px 10px rgba(0, 0, 0, 0.1);
    margin: 0;
}

.header-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    opacity: 0.95;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.2));
    animation: float 3s ease-in-out infinite;
    width: 60px;
    height: 60px;
    min-width: 60px;
    min-height: 60px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    /* Retirer will-change qui peut causer des problèmes */
    /* will-change: transform; */
    /* Forcer le rendu GPU de manière stable */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

@keyframes float {
    0%, 100% { transform: translateY(0px) translateZ(0); }
    50% { transform: translateY(-10px) translateZ(0); }
}

.form-container {
    padding: 0.75rem 1rem;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 1));
    /* Prévenir les sauts de layout */
    min-height: 200px;
    contain: layout style paint;
    /* Forcer le rendu GPU de manière stable */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    /* Empêcher les re-rendus */
    position: relative;
    z-index: 1;
    /* Forcer la visibilité - protection contre les disparitions */
    opacity: 1 !important;
    visibility: visible !important;
    display: block !important;
    /* Isolation pour éviter les problèmes de rendu */
    isolation: isolate;
}

.form-section {
    margin-bottom: 1rem;
    padding: 0.875rem;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(248, 250, 252, 0.9) 100%);
    border-radius: 10px;
    border: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.04),
        0 1px 3px rgba(0, 0, 0, 0.02),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.form-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.form-section:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 8px 24px rgba(0, 0, 0, 0.08),
        0 2px 8px rgba(0, 0, 0, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    border-color: rgba(102, 126, 234, 0.3);
}

.form-section:hover::before {
    opacity: 1;
}

.form-section-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.625rem;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid transparent;
    position: relative;
}

.form-section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 2px;
}

.form-section-note {
    font-size: 0.9rem;
    color: #64748b;
    margin: -0.25rem 0 0.75rem 0;
    font-style: italic;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 0.625rem;
    margin-bottom: 0.625rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    position: relative;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

label {
    margin-bottom: 0.375rem;
    font-weight: 600;
    color: #334155;
    font-size: 0.8125rem;
    letter-spacing: 0.01em;
    transition: color 0.2s ease;
}

.form-group:focus-within label {
    color: #667eea;
}

label .required {
    color: #ef4444;
    font-weight: 700;
    margin-left: 2px;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
select,
textarea {
    padding: 0.5rem 0.75rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.875rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    background: rgba(255, 255, 255, 0.9);
    color: #1e293b;
    font-weight: 400;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

input:hover, select:hover, textarea:hover {
    border-color: #cbd5e1;
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

input:focus, select:focus, textarea:focus {
    border-color: #667eea;
    box-shadow: 
        0 0 0 4px rgba(102, 126, 234, 0.1),
        0 4px 12px rgba(102, 126, 234, 0.15);
    background: rgba(255, 255, 255, 1);
    transform: translateY(-2px);
}

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

.radio-group {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.25rem;
    flex-wrap: wrap;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(226, 232, 240, 0.6);
}

.radio-option:hover {
    background: rgba(248, 250, 252, 0.9);
    border-color: rgba(102, 126, 234, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.radio-option input[type="radio"],
.radio-option input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #667eea;
    transition: transform 0.2s ease;
}

.radio-option input[type="radio"]:hover,
.radio-option input[type="checkbox"]:hover {
    transform: scale(1.1);
}

.radio-option label {
    margin: 0;
    cursor: pointer;
    font-weight: 400;
}

/* ==============================================
   RÉGIME CARDS (Cartes visuelles pour les régimes)
   ============================================== */
.regime-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 0.5rem;
}

.regime-card {
    position: relative;
    cursor: pointer;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: #ffffff;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.regime-card:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.15);
}

.regime-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.regime-card input[type="radio"]:checked + .regime-card-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
}

.regime-card input[type="radio"]:checked + .regime-card-content .regime-icon {
    transform: scale(1.1);
}

.regime-card-content {
    padding: 1.25rem;
    text-align: center;
    transition: all 0.3s ease;
    border-radius: 10px;
}

.regime-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    transition: transform 0.3s ease;
    display: block;
}

.regime-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #1e293b;
    transition: color 0.3s ease;
}

.regime-card input[type="radio"]:checked + .regime-card-content .regime-title {
    color: white;
}

.regime-description {
    font-size: 0.85rem;
    color: #64748b;
    line-height: 1.4;
    transition: color 0.3s ease;
}

.regime-card input[type="radio"]:checked + .regime-card-content .regime-description {
    color: rgba(255, 255, 255, 0.9);
}

@media (max-width: 768px) {
    .regime-cards {
        grid-template-columns: 1fr;
    }
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    width: 100%;
    box-shadow: 
        0 4px 16px rgba(102, 126, 234, 0.4),
        0 2px 8px rgba(102, 126, 234, 0.2);
    font-weight: 700;
    letter-spacing: 0.02em;
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 8px 24px rgba(102, 126, 234, 0.5),
        0 4px 12px rgba(102, 126, 234, 0.3);
    background: linear-gradient(135deg, #5568d3 0%, #6a3d8f 100%);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 
        0 2px 8px rgba(102, 126, 234, 0.3),
        0 1px 4px rgba(102, 126, 234, 0.2);
}

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

.form-footer {
    background: linear-gradient(135deg, rgba(248, 250, 252, 0.9) 0%, rgba(241, 245, 249, 0.9) 100%);
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(226, 232, 240, 0.8);
    text-align: center;
    font-size: 0.8125rem;
    color: #64748b;
    line-height: 1.5;
    position: relative;
}

.form-footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 3px;
    background: linear-gradient(90deg, transparent, #667eea, transparent);
    border-radius: 3px;
}

.info-box {
    background: linear-gradient(135deg, rgba(239, 246, 255, 0.8) 0%, rgba(248, 250, 252, 0.8) 100%);
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-left: 4px solid #667eea;
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    position: relative;
    overflow: hidden;
}

.info-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
}

.info-box h3 {
    color: #1e293b;
    margin-bottom: 0.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
}

.info-box ul {
    margin-left: 1.25rem;
    color: #475569;
    line-height: 1.6;
}

.info-box li {
    margin-bottom: 0.375rem;
}

/* Responsive */
@media (max-width: 768px) {
    body {
        padding: 1rem;
    }

    .header {
        padding: 1.25rem 1.5rem;
    }

    .header h1 {
        font-size: 1.25rem;
    }

    .header-icon {
        font-size: 1.75rem;
    }

    .form-container {
        padding: 1.25rem 1.5rem;
    }
    
    .form-footer {
        padding: 1.25rem 1.5rem;
    }

    .form-section {
        padding: 1.25rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   FORMATION SELECTION - DESIGN MODERNE
   ============================================ */

.formation-choice {
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.95) 0%, 
        rgba(248, 250, 252, 0.95) 100%);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(226, 232, 240, 0.6);
    border-radius: 16px;
    margin-bottom: 1rem;
    padding: 0;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.06),
        0 2px 8px rgba(0, 0, 0, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    position: relative;
}

.formation-choice::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, 
        #667eea 0%, 
        #764ba2 50%, 
        #667eea 100%);
    background-size: 200% 100%;
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.formation-choice:hover {
    border-color: rgba(102, 126, 234, 0.4);
    box-shadow: 
        0 16px 48px rgba(102, 126, 234, 0.15),
        0 4px 16px rgba(102, 126, 234, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    transform: translateY(-4px);
}

/* Header de la card */
.formation-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, 
        rgba(102, 126, 234, 0.05) 0%, 
        rgba(118, 75, 162, 0.05) 100%);
    border-bottom: 1px solid rgba(226, 232, 240, 0.5);
}

.formation-card-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.formation-number {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.formation-label {
    font-weight: 600;
    font-size: 1rem;
    color: #1e293b;
    letter-spacing: 0.01em;
}

/* Badge de priorité */
.formation-priority-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, 
        rgba(102, 126, 234, 0.1) 0%, 
        rgba(118, 75, 162, 0.1) 100%);
    padding: 0.5rem 1rem;
    border-radius: 12px;
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.priority-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #667eea;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.formation-priority-input {
    width: 50px;
    padding: 0.375rem 0.5rem;
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 700;
    text-align: center;
    background: white;
    color: #667eea;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.formation-priority-input:hover {
    border-color: #667eea;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.formation-priority-input:focus {
    border-color: #764ba2;
    box-shadow: 
        0 0 0 4px rgba(102, 126, 234, 0.1),
        0 4px 12px rgba(102, 126, 234, 0.2);
    outline: none;
    transform: scale(1.1);
}

/* Stepper vertical */
.formation-stepper {
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.formation-step {
    display: flex;
    gap: 1.25rem;
    position: relative;
    animation: slideIn 0.5s ease-out backwards;
}

.formation-step:nth-child(1) { animation-delay: 0.1s; }
.formation-step:nth-child(2) { animation-delay: 0.2s; }
.formation-step:nth-child(3) { animation-delay: 0.3s; }
.formation-step:nth-child(4) { animation-delay: 0.4s; }

.formation-step.hidden {
    display: none;
}

.formation-step.progressive-hidden {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    margin: 0;
    padding: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.formation-step.progressive-show {
    opacity: 1;
    max-height: 500px;
    margin: 0;
    padding: 0;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: auto;
    animation: slideInFromRight 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Réduire le padding-top pour Structure/Entité (step 2) et Formation (step 4) */
.formation-step:nth-child(2),
.formation-step:nth-child(4) {
    padding-top: 0;
    margin-top: 0;
}

.formation-step:nth-child(2) .step-content,
.formation-step:nth-child(4) .step-content {
    padding-top: 0;
    margin-top: 0;
}

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

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

/* Indicateur de step */
.step-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    position: relative;
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 2;
}

.step-indicator.active .step-number {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 
        0 4px 16px rgba(102, 126, 234, 0.4),
        0 0 0 4px rgba(102, 126, 234, 0.1);
    transform: scale(1.1);
    animation: stepPulse 2s ease-in-out infinite;
}

@keyframes stepPulse {
    0%, 100% { box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4), 0 0 0 4px rgba(102, 126, 234, 0.1); }
    50% { box-shadow: 0 4px 16px rgba(102, 126, 234, 0.6), 0 0 0 8px rgba(102, 126, 234, 0.15); }
}

.step-line {
    width: 2px;
    flex: 1;
    min-height: 40px;
    background: linear-gradient(180deg, 
        #e2e8f0 0%, 
        #cbd5e1 100%);
    margin-top: 0.5rem;
    border-radius: 2px;
    transition: all 0.4s ease;
}

.step-indicator.active ~ .formation-step .step-line,
.step-indicator.active .step-line {
    background: linear-gradient(180deg, 
        #667eea 0%, 
        #764ba2 100%);
    box-shadow: 0 0 8px rgba(102, 126, 234, 0.3);
}

/* Contenu du step */
.step-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-self: flex-start;
    padding-top: 0;
}

/* Réduire le padding-top pour Structure/Entité et Formation */
.formation-step:nth-child(2) .step-content,
.formation-step:nth-child(4) .step-content {
    padding-top: 0;
    margin-top: 0;
}

/* Correction alignement step 5 (site) */
.formation-site-step {
    display: flex !important;
    gap: 1.25rem;
    align-items: flex-start;
}

.formation-site-step.progressive-show {
    display: flex !important;
}

.formation-site-step .step-content {
    align-self: flex-start;
    margin-top: 0;
    padding-top: 0;
}

.step-label {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 0.25rem;
}

.step-icon {
    font-size: 1.125rem;
    filter: grayscale(0.3);
    transition: all 0.3s ease;
}

.step-indicator.active ~ .formation-step .step-icon,
.step-indicator.active ~ .formation-step .step-label,
.step-indicator.active ~ .formation-step .step-select {
    filter: grayscale(0);
    color: #1e293b;
}

.step-select {
    width: 100%;
    padding: 1rem 1.25rem;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 0.9375rem;
    background: white;
    color: #1e293b;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    appearance: none;
    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='%23667eea' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 3rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.step-select:hover:not(:disabled) {
    border-color: #94a3b8;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.step-select:focus {
    border-color: #667eea;
    box-shadow: 
        0 0 0 4px rgba(102, 126, 234, 0.1),
        0 4px 12px rgba(102, 126, 234, 0.15);
    outline: none;
    transform: translateY(-1px);
}

.step-select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #f8fafc;
    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='%23cbd5e1' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
}

.step-select option {
    padding: 0.75rem;
}

/* Bouton ajouter formation */
.btn-add-formation {
    margin-top: 0.375rem;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9375rem;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 4px 16px rgba(102, 126, 234, 0.3),
        0 2px 8px rgba(102, 126, 234, 0.2);
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-add-formation::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.3), 
        transparent);
    transition: left 0.5s ease;
}

.btn-add-formation:hover::before {
    left: 100%;
}

.btn-add-formation:hover {
    transform: translateY(-3px);
    box-shadow: 
        0 8px 24px rgba(102, 126, 234, 0.4),
        0 4px 12px rgba(102, 126, 234, 0.3);
    background: linear-gradient(135deg, #5568d3 0%, #6a3d8f 100%);
}

.btn-add-formation:active {
    transform: translateY(-1px);
    box-shadow: 
        0 2px 8px rgba(102, 126, 234, 0.3),
        0 1px 4px rgba(102, 126, 234, 0.2);
}

/* Bouton supprimer formation */
.btn-remove-formation {
    width: 36px;
    height: 36px;
    padding: 0;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.125rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
    flex-shrink: 0;
}

.btn-remove-formation:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.4);
}

.btn-remove-formation:active {
    transform: scale(0.95) rotate(90deg);
}

/* Responsive pour la formation */
@media (max-width: 768px) {
    body {
        padding: 1rem;
    }
    .header {
        padding: 1rem 1rem;
    }
    .header h1 {
        font-size: 1.125rem;
    }
    .header-icon {
        font-size: 1.5rem;
    }
    .form-container {
        padding: 1rem 1rem;
    }
    .form-section {
        padding: 1.25rem;
    }
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .formation-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        padding: 1rem;
    }
    
    .formation-priority-badge {
        width: 100%;
        justify-content: space-between;
    }
    
    .formation-stepper {
        padding: 1rem;
        gap: 1.25rem;
    }
    
    .formation-step {
        gap: 1rem;
    }
    
    .step-number {
        width: 36px;
        height: 36px;
        font-size: 0.8rem;
    }
    
    .step-label {
        font-size: 0.8125rem;
    }
    
    .step-select {
        padding: 0.875rem 1rem;
        font-size: 0.875rem;
    }
}

/* ===================================================================
   AUTOCOMPLETE FORMATION — nouveau système simplifié
   =================================================================== */

.fm-search-block {
    padding: 1rem 1.25rem 0.75rem;
}

/* Chips de pré-sélection par niveau */
.fm-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-bottom: 0.75rem;
}

.fm-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.3rem 0.7rem;
    border: 1.5px solid #e2e8f0;
    border-radius: 999px;
    background: white;
    color: #6b7280;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    line-height: 1.2;
}

.fm-chip:hover {
    border-color: #93c5fd;
    color: #3b82f6;
    background: #eff6ff;
}

.fm-chip.fm-chip-active {
    border-color: #3b82f6;
    background: #3b82f6;
    color: white;
}

.fm-chip.fm-chip-active:hover {
    background: #2563eb;
    border-color: #2563eb;
    color: white;
}

.fm-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #374151;
    font-size: 0.875rem;
}

.fm-autocomplete {
    /* inline : pas de position relative, le dropdown s'insère dans le flux */
}

.fm-input-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: 2px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: white;
    transition: border-color 0.2s, box-shadow 0.2s, border-radius 0.1s;
    cursor: text;
}

.fm-input-row:focus-within {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Quand la liste est ouverte, arrondir seulement le haut */
.fm-input-row.fm-input-open {
    border-radius: 0.5rem 0.5rem 0 0;
    border-bottom-color: transparent;
    box-shadow: none;
}

.fm-search-icon {
    font-size: 1rem;
    color: #94a3b8;
    flex-shrink: 0;
}

.fm-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 0.9rem;
    color: #1f2937;
    background: transparent;
    min-width: 0;
}

.fm-input::placeholder {
    color: #94a3b8;
}

.fm-clear-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #9ca3af;
    font-size: 0.8rem;
    padding: 0.2rem 0.3rem;
    border-radius: 50%;
    line-height: 1;
    transition: color 0.15s, background 0.15s;
}

.fm-clear-btn:hover {
    color: #ef4444;
    background: #fee2e2;
}

.fm-dropdown {
    /* Inline — s'insère dans le flux, scroll naturel */
    background: white;
    border: 2px solid #3b82f6;
    border-top: none;
    border-radius: 0 0 0.5rem 0.5rem;
    max-height: 420px;
    overflow-y: auto;
    /* scroll smooth sur iOS */
    -webkit-overflow-scrolling: touch;
}

.fm-group-header {
    padding: 0.4rem 0.875rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #6b7280;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 1;
}

.fm-group-header:first-child {
    border-top: none;
}

.fm-item {
    padding: 0.55rem 0.875rem 0.55rem 1.375rem;
    font-size: 0.875rem;
    color: #374151;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: background 0.1s, border-color 0.1s;
    line-height: 1.4;
}

.fm-item:hover,
.fm-item.fm-active {
    background: #eff6ff;
    border-left-color: #3b82f6;
    color: #1d4ed8;
}

.fm-no-results {
    padding: 1rem;
    text-align: center;
    color: #9ca3af;
    font-size: 0.85rem;
    font-style: italic;
}

.fm-selected {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    background: linear-gradient(135deg, #eff6ff, #f0fdf4);
    border: 2px solid #bfdbfe;
    border-radius: 0.5rem;
}

.fm-selected-check {
    font-size: 1.1rem;
    color: #22c55e;
    flex-shrink: 0;
}

.fm-selected-text {
    flex: 1;
    font-size: 0.875rem;
    font-weight: 600;
    color: #1e40af;
    line-height: 1.3;
}

.fm-change-btn {
    background: none;
    border: 1px solid #93c5fd;
    border-radius: 0.375rem;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    cursor: pointer;
    color: #3b82f6;
    white-space: nowrap;
    transition: all 0.15s;
    flex-shrink: 0;
}

.fm-change-btn:hover {
    background: #dbeafe;
    border-color: #60a5fa;
}

.fm-extra-steps {
    padding-top: 0;
}
