/**
 * CAMP PRÉQUALIFICATION - MODAL STYLES
 * Styles pour le formulaire de préqualification avant accès au checkout Stripe
 */

/* === MODAL BASE === */
.prequalification-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
}

.prequalification-overlay {
    width: 100%;
    max-width: 600px;
    margin: auto;
}

.prequalification-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
    animation: modalSlideIn 0.3s ease-out;
    max-height: 90vh;
    overflow-y: auto;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* === HEADER === */
.prequalification-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 24px 16px 24px;
    border-bottom: 1px solid #eee;
}

.prequalification-header h2 {
    margin: 0;
    color: #333;
    font-size: 24px;
    font-weight: 600;
}

.prequalification-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.prequalification-close:hover {
    background: #f5f5f5;
    color: #333;
}

.autosave-indicator {
    position: absolute;
    top: 50%;
    right: 50px;
    transform: translateY(-50%);
    font-size: 12px;
    color: #28a745;
    background: #d4edda;
    padding: 4px 8px;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 10;
}

/* === NOTICES ET INTRO === */
.prequalification-notice {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 12px 16px;
    margin: 16px 24px;
    font-size: 14px;
}

.prequalification-notice a {
    color: #856404;
    text-decoration: underline;
}

.prequalification-intro {
    padding: 16px 24px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
}

.prequalification-intro p {
    margin: 0 0 12px 0;
    line-height: 1.5;
    color: #555;
}

.prequalification-intro p:last-child {
    margin-bottom: 0;
    font-weight: 500;
}

/* === PROGRESS BAR === */
.progress-container {
    padding: 16px 24px 24px 24px;
    border-bottom: 1px solid #eee;
}

.progress-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    margin-bottom: 12px;
}

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

.step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e9ecef;
    color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 8px;
    transition: all 0.3s ease;
}

.progress-step.active .step-number {
    background: #9062f0;
    color: white;
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(144, 98, 240, 0.3);
}

.progress-step.completed .step-number {
    background: #28a745;
    color: white;
}

.progress-step.completed .step-number::after {
    content: '✓';
    font-size: 16px;
    font-weight: bold;
}

.step-label {
    font-size: 12px;
    color: #6c757d;
    text-align: center;
    font-weight: 500;
    transition: color 0.3s ease;
}

.progress-step.active .step-label {
    color: #9062f0;
    font-weight: 600;
}

.progress-step.completed .step-label {
    color: #28a745;
}

.progress-line {
    position: absolute;
    top: 16px;
    left: 16px;
    right: 16px;
    height: 2px;
    background: #e9ecef;
    border-radius: 1px;
    z-index: 1;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #9062f0, #7c4ddf);
    border-radius: 1px;
    width: 0%;
    transition: width 0.4s ease;
}

/* === FORMULAIRE === */
.prequalification-form {
    padding: 24px;
}

.form-section {
    margin-bottom: 32px;
}

.form-section:last-of-type {
    margin-bottom: 16px;
}

.form-section h3 {
    margin: 0 0 16px 0;
    color: #333;
    font-size: 18px;
    font-weight: 600;
    border-bottom: 2px solid #9062f0;
    padding-bottom: 8px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
    position: relative;
    background: white;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #9062f0;
    box-shadow: 0 0 0 3px rgba(144, 98, 240, 0.1);
    transform: scale(1.02);
    background: #fefffe;
}

/* Animation pour les champs valides */
.form-group input:valid:not(:placeholder-shown),
.form-group textarea:valid:not(:placeholder-shown) {
    border-color: #28a745;
    background: linear-gradient(90deg, white 95%, #f8fff8 100%);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2328a745' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M13.5 3.5L6 11 2.5 7.5'/%3e%3c/svg%3e");
    background-size: 12px 12px;
    background-position: right 12px center;
    background-repeat: no-repeat;
}

.form-group select:valid {
    border-color: #28a745;
    background: linear-gradient(90deg, white 95%, #f8fff8 100%);
}

/* Animation pour les champs avec erreur */
.field-invalid {
    border-color: #dc3545 !important;
    background: linear-gradient(90deg, white 95%, #fff8f8 100%) !important;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}

/* Feedback visuel pour les selects remplis - Checkmark */
.form-group select:not([value=""]):valid {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2328a745' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M13.5 3.5L6 11 2.5 7.5'/%3e%3c/svg%3e");
    background-size: 12px 12px;
    background-position: right 12px center;
    background-repeat: no-repeat;
}

/* Animation pour les labels flottants */
.form-group {
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #333;
    font-size: 14px;
    transition: all 0.3s ease;
}

.form-group input:focus ~ label,
.form-group select:focus ~ label,
.form-group textarea:focus ~ label {
    color: #9062f0;
    transform: scale(0.95);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.5;
}

.form-note {
    margin: 12px 0 0 0;
    font-size: 13px;
    color: #666;
    font-style: italic;
}

/* === INFOS ET WARNINGS === */
.form-info {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 16px;
    margin: 16px 0;
}

.form-info p {
    margin: 0 0 8px 0;
    font-size: 14px;
    line-height: 1.4;
}

.form-info p:last-child {
    margin-bottom: 0;
}

.level-warning {
    background: #ffebee;
    border: 1px solid #ffcdd2;
    border-left: 4px solid #f44336;
    border-radius: 8px;
    padding: 16px;
    margin: 16px 0;
    animation: warningSlideIn 0.3s ease-out;
}

.level-warning p {
    margin: 0;
    color: #c62828;
    font-size: 14px;
    line-height: 1.4;
}

.level-warning a {
    color: #c62828;
    text-decoration: underline;
}

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

/* === VALIDATION === */
.field-invalid {
    border-color: #f44336 !important;
    box-shadow: 0 0 0 3px rgba(244, 67, 54, 0.1) !important;
}

.field-error {
    color: #f44336;
    font-size: 12px;
    margin-top: 4px;
    display: block;
}

.form-error {
    margin: 16px 0;
}

/* === BOUTONS D'ACTION === */
.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding-top: 24px;
    border-top: 1px solid #eee;
}

.btn-secondary,
.btn-primary {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    display: inline-block;
    text-align: center;
    min-width: 120px;
    position: relative;
    overflow: hidden;
}

.btn-secondary {
    background: #f8f9fa;
    color: #6c757d;
    border: 1px solid #dee2e6;
}

.btn-secondary:hover {
    background: #e9ecef;
    color: #495057;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-primary {
    background: linear-gradient(135deg, #9062f0, #7c4ddf);
    color: white;
    box-shadow: 0 2px 8px rgba(144, 98, 240, 0.2);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #7c4ddf, #6a3dd9);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(144, 98, 240, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(144, 98, 240, 0.3);
}

.btn-primary:disabled {
    background: #ccc;
    color: #666;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.7;
}

/* Animation de chargement pour les boutons */
.btn-primary.loading {
    pointer-events: none;
    color: transparent;
}

.btn-primary.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid white;
    border-top-color: transparent;
    border-radius: 50%;
    animation: button-spin 1s linear infinite;
}

@keyframes button-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Effet de ripple pour les boutons */
.btn-primary::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
    z-index: 0;
}

.btn-primary:active::before {
    width: 300px;
    height: 300px;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .prequalification-modal {
        padding: 10px;
        align-items: flex-start;
    }
    
    .prequalification-content {
        border-radius: 8px;
        max-height: 95vh;
    }
    
    .prequalification-header {
        padding: 16px 16px 12px 16px;
    }
    
    .prequalification-header h2 {
        font-size: 20px;
    }
    
    .prequalification-notice,
    .prequalification-form {
        padding: 16px;
    }
    
    .prequalification-intro {
        padding: 12px 16px;
    }
    
    .form-section {
        margin-bottom: 24px;
    }
    
    .form-actions {
        flex-direction: column-reverse;
        gap: 8px;
    }
    
    .btn-secondary,
    .btn-primary {
        width: 100%;
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .prequalification-modal {
        padding: 5px;
    }
    
    .prequalification-content {
        border-radius: 4px;
        max-height: 98vh;
    }
    
    .prequalification-header,
    .prequalification-notice,
    .prequalification-intro,
    .prequalification-form {
        padding: 12px;
    }
    
    .form-section h3 {
        font-size: 16px;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 10px 12px;
        font-size: 16px; /* Évite le zoom sur iOS */
    }
}

/* === ANIMATIONS DE CHARGEMENT === */
.btn-primary.loading {
    position: relative;
    color: transparent;
}

.btn-primary.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid white;
    border-top-color: transparent;
    border-radius: 50%;
    animation: buttonSpin 1s linear infinite;
}

@keyframes buttonSpin {
    to {
        transform: rotate(360deg);
    }
}

/* === ACCESSIBILITÉ === */
@media (prefers-reduced-motion: reduce) {
    .prequalification-content {
        animation: none;
    }
    
    .level-warning {
        animation: none;
    }
    
    .btn-primary.loading::after {
        animation: none;
    }
}

/* === PRINT STYLES === */
@media print {
    .prequalification-modal {
        display: none;
    }
}