/* ============================================
   VENISOR - MULTI-STEP FORM CSS
   Version: 2.5.1 - Correction Complète
   ============================================ */

/* Section principale du formulaire */
.multi-step-form {
    min-height: calc(100vh - 80px);
    background: linear-gradient(135deg, #f9fafb 0%, #e5e7eb 100%);
    margin-top: 80px; /* Compensation pour le header fixe */
    padding: 48px 0 60px; /* Padding réduit car margin-top compense déjà */
}

/* Container */
.multi-step-form .container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ============================================
   BARRE DE PROGRESSION HORIZONTALE
   ============================================ */
.progress-container {
    background: white;
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.progress-steps {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    max-width: 700px;
    margin: 0 auto;
}

/* Ligne de connexion entre les étapes */
.progress-steps::before {
    content: '';
    position: absolute;
    top: 30px;
    left: 12%;
    right: 12%;
    height: 3px;
    background: #e5e7eb;
    z-index: 0;
}

/* Progress line active */
.progress-steps::after {
    content: '';
    position: absolute;
    top: 30px;
    left: 12%;
    height: 3px;
    background: linear-gradient(90deg, #059669, #10b981);
    z-index: 1;
    transition: width 0.4s ease;
}

.progress-steps[data-step="1"]::after { width: 0%; }
.progress-steps[data-step="2"]::after { width: 28%; }
.progress-steps[data-step="3"]::after { width: 56%; }
.progress-steps[data-step="4"]::after { width: 84%; }

/* Chaque étape */
.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 2;
    flex: 1;
}

/* Cercle de l'étape */
.step-circle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #e5e7eb;
    border: 4px solid #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #9ca3af;
    transition: all 0.3s ease;
    margin-bottom: 12px;
}

.progress-step.active .step-circle,
.progress-step.completed .step-circle {
    background: linear-gradient(135deg, #059669, #10b981);
    border-color: #10b981;
    color: white;
    box-shadow: 0 4px 15px rgba(5, 150, 105, 0.3);
    transform: scale(1.05);
}

.progress-step.completed .step-circle {
    background: #10b981;
}

/* Label de l'étape */
.step-label {
    font-size: 14px;
    font-weight: 600;
    color: #6b7280;
    text-align: center;
    transition: all 0.3s ease;
}

.progress-step.active .step-label {
    color: #059669;
    font-weight: 700;
}

.progress-step.completed .step-label {
    color: #10b981;
}

/* ============================================
   CARTE DU FORMULAIRE
   ============================================ */
.form-card {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.form-card h2 {
    font-size: 28px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.form-card h2 i {
    color: #059669;
    font-size: 32px;
}

.form-card p {
    color: #6b7280;
    font-size: 16px;
    margin-bottom: 30px;
}

/* ============================================
   GROUPES DE FORMULAIRE
   ============================================ */
.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: #374151;
    margin-bottom: 10px;
    font-size: 15px;
}

.form-group label i {
    color: #059669;
    margin-right: 8px;
}

/* Inputs */
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 16px;
    font-family: 'Inter', sans-serif;
    transition: all 0.3s ease;
    background: #f9fafb;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #059669;
    background: white;
    box-shadow: 0 0 0 4px rgba(5, 150, 105, 0.1);
}

.form-group input::placeholder {
    color: #9ca3af;
}

/* Date input avec masque fixe */
#birthDate {
    font-family: 'Courier New', monospace;
    letter-spacing: 2px;
    font-size: 18px;
    font-weight: 500;
}

#birthDate::placeholder {
    letter-spacing: 2px;
    color: #9ca3af;
    font-weight: 400;
}

/* Select dropdown */
.form-group select {
    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='%23059669' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 18px center;
    padding-right: 45px;
}

/* ============================================
   SLIDERS (Range Inputs)
   ============================================ */
.slider-container {
    margin: 25px 0;
}

.slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.slider-label {
    font-weight: 600;
    color: #374151;
    font-size: 15px;
}

.slider-value {
    font-size: 24px;
    font-weight: 700;
    color: #059669;
}

/* Range slider styling */
input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: #e5e7eb;
    outline: none;
    -webkit-appearance: none;
    margin: 15px 0;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #059669, #10b981);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.4);
    transition: all 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.6);
}

input[type="range"]::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #059669, #10b981);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.4);
}

.slider-limits {
    display: flex;
    justify-content: space-between;
    color: #6b7280;
    font-size: 13px;
    margin-top: 8px;
}

/* ============================================
   BOUTONS DE DURÉE
   ============================================ */
.duration-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 12px;
    margin: 20px 0;
}

.duration-btn {
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 10px;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    font-size: 14px;
}

.duration-btn:hover {
    border-color: #059669;
    background: #ecfdf5;
    color: #059669;
    transform: translateY(-2px);
}

.duration-btn.active {
    background: linear-gradient(135deg, #059669, #10b981);
    border-color: #059669;
    color: white;
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
}

/* ============================================
   CHAMP OPTIONNEL
   ============================================ */
.optional-field {
    position: relative;
}

.optional-badge {
    position: absolute;
    top: -8px;
    right: 10px;
    background: #fbbf24;
    color: white;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

/* ============================================
   BOUTONS DE NAVIGATION
   ============================================ */
.form-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 40px;
    gap: 15px;
}

.btn-back,
.btn-next,
.btn-continue {
    padding: 14px 28px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 15px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 200px; /* Limite la largeur */
}

.btn-back {
    background: #f3f4f6;
    color: #374151;
    border: 2px solid #e5e7eb;
}

.btn-back:hover {
    background: #e5e7eb;
    transform: translateX(-4px);
}

.btn-next,
.btn-continue {
    background: linear-gradient(135deg, #059669, #10b981);
    color: white;
    box-shadow: 0 4px 15px rgba(5, 150, 105, 0.3);
    justify-content: center;
}

.btn-next:hover,
.btn-continue:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(5, 150, 105, 0.4);
}

.btn-next:active,
.btn-continue:active {
    transform: translateY(0);
}

/* ============================================
   GRID LAYOUT (2 colonnes)
   ============================================ */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-row-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

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

/* ============================================
   RÉSUMÉ FINAL (Étape 4)
   ============================================ */
.summary-card {
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    border: 2px solid #10b981;
    border-radius: 16px;
    padding: 30px;
    margin: 30px 0;
}

.summary-card h3 {
    color: #059669;
    font-size: 22px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid rgba(5, 150, 105, 0.2);
}

.summary-item:last-child {
    border-bottom: none;
}

.summary-label {
    font-weight: 600;
    color: #374151;
}

.summary-value {
    font-weight: 700;
    color: #059669;
}

.summary-highlight {
    background: white;
    padding: 20px;
    border-radius: 12px;
    margin-top: 20px;
    text-align: center;
}

.summary-highlight .amount {
    font-size: 36px;
    font-weight: 800;
    color: #059669;
    margin: 10px 0;
}

/* ============================================
   CHECKBOX & RADIO
   ============================================ */
.checkbox-group,
.radio-group {
    margin: 20px 0;
}

.checkbox-item,
.radio-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.checkbox-item:hover,
.radio-item:hover {
    border-color: #059669;
    background: #f0fdf4;
}

.checkbox-item input,
.radio-item input {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    cursor: pointer;
}

.checkbox-item label,
.radio-item label {
    cursor: pointer;
    margin: 0;
    flex: 1;
}

/* ============================================
   RESPONSIVE MOBILE
   ============================================ */
@media (max-width: 768px) {
    .multi-step-form {
        padding: 20px 0 40px;
        margin-top: 80px;
    }

    .multi-step-form .container {
        padding: 0 15px;
        max-width: 100%;
    }

    .progress-container {
        padding: 20px 15px;
        margin-bottom: 20px;
    }

    .progress-steps {
        max-width: 100%;
    }

    .step-circle {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }

    .step-label {
        font-size: 11px;
    }

    .progress-steps::before {
        left: 15%;
        right: 15%;
    }

    .form-card {
        padding: 25px 20px;
    }

    .form-card h2 {
        font-size: 22px;
    }

    .form-row,
    .form-row-3 {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .duration-buttons {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .form-navigation {
        flex-direction: column-reverse;
        gap: 1rem;
    }

    .btn-back,
    .btn-next {
        width: 100%;
        justify-content: center;
        padding: 1rem;
    }

    .slider-value {
        font-size: 20px;
    }

    /* Sidebar en bas sur mobile */
    .form-layout {
        grid-template-columns: 1fr !important;
    }

    .form-sidebar {
        order: 2;
        margin-top: 2rem;
    }
}

/* Corrections Android spécifiques (max-width: 640px) */
@media (max-width: 640px) {
    .multi-step-form {
        padding: 15px 0 30px;
        margin-top: 80px;
        min-height: auto;
    }

    .multi-step-form .container {
        padding: 0 10px;
    }

    .progress-container {
        padding: 15px 10px;
        margin-bottom: 15px;
        border-radius: 12px;
    }

    .progress-steps {
        flex-wrap: nowrap;
        justify-content: space-between;
        gap: 0;
    }

    .progress-step {
        flex: 1;
        min-width: 0;
    }

    .step-circle {
        width: 45px;
        height: 45px;
        font-size: 16px;
        margin-bottom: 8px;
    }

    .step-label {
        font-size: 10px;
        text-align: center;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }

    .progress-steps::before {
        left: 16%;
        right: 16%;
        top: 22px;
    }

    .progress-steps::after {
        left: 16%;
        top: 22px;
    }

    /* Form card */
    .form-card {
        padding: 20px 15px;
        margin-bottom: 15px;
        border-radius: 12px;
    }

    .form-card h2 {
        font-size: 1.25rem;
        line-height: 1.3;
        margin-bottom: 0.75rem;
    }

    .form-card p {
        font-size: 0.9rem;
        line-height: 1.5;
    }

    /* Form groups */
    .form-group {
        margin-bottom: 1.25rem;
    }

    .form-group label {
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px !important; /* Empêche zoom iOS/Android */
        padding: 0.875rem;
        border-radius: 8px;
    }

    /* Form rows */
    .form-row,
    .form-row-3 {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    /* Sliders */
    .slider-container {
        margin: 1.5rem 0;
    }

    .slider-value {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }

    input[type="range"] {
        height: 8px;
    }

    /* Boutons durée */
    .duration-buttons {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .duration-btn {
        padding: 0.75rem 0.5rem;
        font-size: 0.9rem;
    }

    /* Navigation */
    .form-navigation {
        flex-direction: column-reverse;
        gap: 0.75rem;
        margin-top: 2rem;
    }

    .form-actions {
        flex-direction: column-reverse;
        gap: 0.75rem;
    }

    .btn-back,
    .btn-next,
    .btn-continue {
        width: 100%;
        max-width: 100%;
        padding: 1rem;
        font-size: 1rem;
        justify-content: center;
    }

    /* Layout formulaire */
    .form-layout {
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
    }

    .form-main {
        order: 1;
        width: 100%;
    }

    .form-sidebar {
        order: 2;
        width: 100%;
        margin-top: 1rem;
    }

    /* Sidebar cards */
    .sidebar-card {
        padding: 1.25rem;
        margin-bottom: 1rem;
        border-radius: 12px;
    }

    .sidebar-card h3 {
        font-size: 1rem;
        margin-bottom: 0.75rem;
    }

    /* Summary items */
    .summary-item {
        padding: 0.75rem 0;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .summary-label,
    .summary-value {
        font-size: 0.9rem;
    }

    /* Calculation display */
    .calculation-display {
        padding: 1.25rem;
        border-radius: 12px;
    }

    .calculation-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        padding: 0.75rem 0;
    }
}

@media (max-width: 480px) {
    .multi-step-form {
        padding: 10px 0 25px;
    }

    .multi-step-form .container {
        padding: 0 8px;
    }

    .progress-container {
        padding: 12px 8px;
    }

    .progress-steps::before {
        left: 18%;
        right: 18%;
        top: 20px;
    }

    .progress-steps::after {
        left: 18%;
        top: 20px;
    }

    .step-circle {
        width: 40px;
        height: 40px;
        font-size: 14px;
        margin-bottom: 6px;
    }

    .step-label {
        font-size: 9px;
    }

    .form-card {
        padding: 15px 12px;
    }

    .form-card h2 {
        font-size: 1.15rem;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 0.75rem;
        font-size: 16px !important;
    }

    .duration-buttons {
        grid-template-columns: 1fr;
        gap: 0.6rem;
    }

    .duration-btn {
        padding: 0.875rem;
    }

    .btn-back,
    .btn-next {
        padding: 0.875rem;
        font-size: 0.95rem;
    }
}

/* Corrections spécifiques Android - Fix overflow et balance */
@media (max-width: 640px) {
    /* Fix overflow horizontal */
    .multi-step-form,
    .multi-step-form *,
    .form-card,
    .progress-container {
        max-width: 100%;
        overflow-x: hidden;
        box-sizing: border-box;
    }

    /* Fix images et contenus qui débordent */
    img {
        max-width: 100%;
        height: auto;
    }

    /* Empêcher le "balancement" */
    html,
    body {
        overflow-x: hidden;
        max-width: 100vw;
        position: relative;
    }

    /* Stabiliser les transitions */
    * {
        transition: none !important;
    }

    /* Fix pour les inputs qui causent du zoom */
    input,
    select,
    textarea {
        font-size: 16px !important;
        max-width: 100%;
    }

    /* Fix pour les longs textes */
    .step-label,
    .summary-label,
    .sidebar-card p {
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }
}

/* Support tactile Android */
@media (hover: none) and (pointer: coarse) {
    /* Zones tactiles optimales */
    button,
    .btn,
    .duration-btn,
    input[type="submit"] {
        min-height: 44px;
        min-width: 44px;
    }

    /* Feedback tactile */
    button:active,
    .btn:active,
    .duration-btn:active {
        opacity: 0.85;
        transform: scale(0.98);
    }

    /* Augmenter les zones de clic */
    input[type="radio"],
    input[type="checkbox"] {
        width: 24px;
        height: 24px;
    }

    /* Désactiver hover sur tactile */
    *:hover {
        transform: none !important;
    }
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

.form-card.next {
    animation: slideInRight 0.4s ease;
}

.form-card.prev {
    animation: slideInLeft 0.4s ease;
}

/* ============================================
   MESSAGES DE VALIDATION
   ============================================ */
.error-message {
    color: #ef4444;
    font-size: 13px;
    margin-top: 6px;
    display: none;
}

.form-group.error input,
.form-group.error select {
    border-color: #ef4444;
    background: #fef2f2;
}

.form-group.error .error-message {
    display: block;
}

.success-message {
    color: #10b981;
    font-size: 13px;
    margin-top: 6px;
}
