/* ===== STYLES FORMULAIRES IMPACT DIGITAL ===== */

/* ===== CONTENEUR PRINCIPAL FORMULAIRE ===== */
.form-container {
    position: relative;
}

.form-container::before {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    background: linear-gradient(45deg, transparent, rgba(254, 163, 71, 0.05), transparent);
    border-radius: calc(var(--border-radius-lg) + 10px);
    z-index: -1;
    opacity: 0;
    transition: opacity var(--transition-fast) ease;
}

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

/* ===== LABELS ===== */
.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
    position: relative;
}

.form-label::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    transition: width var(--transition-fast) ease;
}

.form-label:focus-within::after {
    width: 30px;
}

/* ===== INPUTS GÉNÉRAUX ===== */
.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid #E8E9EA;
    border-radius: var(--border-radius-md);
    font-size: 1rem;
    font-family: inherit;
    transition: all var(--transition-fast) ease;
    background: var(--background);
    color: var(--text-primary);
    position: relative;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 
        0 0 0 3px rgba(254, 163, 71, 0.1),
        0 4px 12px rgba(254, 163, 71, 0.15);
    transform: translateY(-1px);
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
    border-color: var(--secondary);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
}

/* ===== PLACEHOLDERS ===== */
.form-input::placeholder,
.form-textarea::placeholder {
    color: #999;
    font-style: italic;
    opacity: 0.8;
    transition: opacity var(--transition-fast) ease;
}

.form-input:focus::placeholder,
.form-textarea:focus::placeholder {
    opacity: 0.5;
    transform: translateX(5px);
}

/* ===== TEXTAREA SPÉCIFIQUE ===== */
.form-textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.6;
}

.form-textarea:focus {
    min-height: 120px;
}

/* ===== SELECT PERSONNALISÉ ===== */
.form-select {
    background-image: url("data:image/svg+xml;charset=UTF-8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6,9 12,15 18,9'></polyline></svg>");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 16px;
    padding-right: 45px;
    appearance: none;
    cursor: pointer;
}

.form-select:focus {
    background-image: url("data:image/svg+xml;charset=UTF-8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23FEA347' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6,9 12,15 18,9'></polyline></svg>");
}

/* ===== INPUT FILE PERSONNALISÉ ===== */
.form-input[type="file"] {
    padding: 12px 16px;
    background: linear-gradient(135deg, var(--surface) 0%, var(--background) 100%);
    border-style: dashed;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.form-input[type="file"]:hover {
    background: linear-gradient(135deg, rgba(254, 163, 71, 0.05) 0%, var(--background) 100%);
}

.form-input[type="file"]::file-selector-button {
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: var(--border-radius-sm);
    margin-right: 12px;
    cursor: pointer;
    font-weight: 500;
    transition: all var(--transition-fast) ease;
}

.form-input[type="file"]::file-selector-button:hover {
    transform: scale(1.02);
    box-shadow: 0 2px 8px rgba(254, 163, 71, 0.3);
}

/* ===== READONLY INPUTS ===== */
.form-input[readonly] {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-color: #d6d8db;
    color: #6c757d;
    cursor: not-allowed;
    font-weight: 500;
}

/* ===== GROUPES DE CHAMPS ===== */
.form-group {
    margin-bottom: 24px;
    position: relative;
}

.form-group.required .form-label::before {
    content: '*';
    color: #e74c3c;
    margin-right: 4px;
    font-weight: bold;
}

/* ===== CHECKBOXES ET RADIOS PERSONNALISÉS ===== */
.checkbox-group,
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 8px;
}

.checkbox-item,
.radio-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    cursor: pointer;
    padding: 16px;
    border: 2px solid #E8E9EA;
    border-radius: var(--border-radius-md);
    transition: all var(--transition-fast) ease;
    background: var(--background);
    position: relative;
    overflow: hidden;
}

.checkbox-item::before,
.radio-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    background: linear-gradient(45deg, rgba(254, 163, 71, 0.1), rgba(128, 0, 128, 0.1));
    transition: width var(--transition-medium) ease;
    z-index: 0;
}

.checkbox-item:hover,
.radio-item:hover {
    border-color: var(--primary);
    transform: translateX(5px);
    box-shadow: var(--shadow-light);
}

.checkbox-item:hover::before,
.radio-item:hover::before {
    width: 100%;
}

.checkbox-item input[type="checkbox"],
.checkbox-item input[type="radio"],
.radio-item input[type="checkbox"],
.radio-item input[type="radio"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
    cursor: pointer;
    z-index: 2;
    position: relative;
    transform: scale(1.1);
}

.checkbox-item span,
.radio-item span {
    font-size: 0.95rem;
    line-height: 1.5;
    z-index: 2;
    position: relative;
}

.checkbox-item input:checked + span,
.radio-item input:checked + span {
    color: var(--primary);
    font-weight: 600;
}

/* ===== BOUTONS FORMULAIRE ===== */
.btn-form {
    position: relative;
    overflow: hidden;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: none;
    box-shadow: 0 4px 15px rgba(254, 163, 71, 0.2);
}

.btn-form::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transition: all var(--transition-medium) ease;
    transform: translate(-50%, -50%);
}

.btn-form:hover::before {
    width: 300px;
    height: 300px;
}

.btn-form:active {
    transform: scale(0.98);
}

/* ===== MESSAGES DE CONFIRMATION ===== */
.confirmation-message {
    text-align: center;
    padding: 50px 30px;
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.05) 0%, rgba(76, 175, 80, 0.1) 100%);
    border-radius: var(--border-radius-lg);
    border: 2px solid rgba(76, 175, 80, 0.2);
    position: relative;
    animation: slideInUp 0.6s ease;
}

.confirmation-message::before {
    content: '';
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 4px;
    background: linear-gradient(45deg, #4CAF50, #8BC34A);
    border-radius: 2px;
}

.success-icon {
    font-size: 4rem;
    color: #4CAF50;
    margin-bottom: 20px;
    display: inline-block;
    animation: bounceIn 0.8s ease;
    filter: drop-shadow(0 4px 8px rgba(76, 175, 80, 0.3));
}

/* ===== MESSAGES D'AIDE ===== */
.form-help {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 6px;
    line-height: 1.4;
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

.form-help::before {
    content: 'ℹ️';
    font-size: 0.9rem;
    margin-top: 1px;
    flex-shrink: 0;
}

/* ===== VALIDATION ÉTATS ===== */
.form-input.valid,
.form-select.valid,
.form-textarea.valid {
    border-color: #4CAF50;
    background-color: rgba(76, 175, 80, 0.02);
}

.form-input.invalid,
.form-select.invalid,
.form-textarea.invalid {
    border-color: #e74c3c;
    background-color: rgba(231, 76, 60, 0.02);
}

.form-input.valid:focus,
.form-select.valid:focus,
.form-textarea.valid:focus {
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

.form-input.invalid:focus,
.form-select.invalid:focus,
.form-textarea.invalid:focus {
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

/* ===== MESSAGES DE VALIDATION ===== */
.validation-message {
    font-size: 0.85rem;
    margin-top: 6px;
    padding: 8px 12px;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    gap: 8px;
}

.validation-message.success {
    color: #155724;
    background-color: rgba(76, 175, 80, 0.1);
    border: 1px solid rgba(76, 175, 80, 0.2);
}

.validation-message.error {
    color: #721c24;
    background-color: rgba(231, 76, 60, 0.1);
    border: 1px solid rgba(231, 76, 60, 0.2);
}

.validation-message::before {
    font-size: 1rem;
}

.validation-message.success::before {
    content: '✅';
}

.validation-message.error::before {
    content: '❌';
}

/* ===== INDICATEUR DE CHARGEMENT ===== */
.form-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.form-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top: 2px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* ===== COMPTEUR DE CARACTÈRES ===== */
.character-counter {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-align: right;
    margin-top: 4px;
    transition: color var(--transition-fast) ease;
}

.character-counter.warning {
    color: #f39c12;
}

.character-counter.danger {
    color: #e74c3c;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .form-container {
        padding: 20px 15px;
    }
    
    .form-input,
    .form-select,
    .form-textarea {
        padding: 14px 16px;
        font-size: 16px; /* Évite le zoom sur iOS */
    }
    
    .checkbox-item,
    .radio-item {
        padding: 14px 12px;
    }
    
    .confirmation-message {
        padding: 40px 20px;
    }
    
    .success-icon {
        font-size: 3rem;
    }
}

@media (max-width: 480px) {
    .d-flex.gap-3 {
        flex-direction: column;
    }
    
    .form-input,
    .form-select,
    .form-textarea {
        padding: 12px 14px;
    }
    
    .checkbox-group,
    .radio-group {
        gap: 12px;
    }
    
    .checkbox-item,
    .radio-item {
        padding: 12px 10px;
    }
}

/* ===== ANIMATIONS ===== */
@keyframes slideInUp {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes spin {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }
    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* ===== AMÉLIORATIONS ACCESSIBILITÉ ===== */
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.checkbox-item:focus-within,
.radio-item:focus-within {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ===== DARK MODE SUPPORT ===== */
[data-theme="dark"] .form-input,
[data-theme="dark"] .form-select,
[data-theme="dark"] .form-textarea {
    border-color: #404040;
    background: var(--surface);
}

[data-theme="dark"] .checkbox-item,
[data-theme="dark"] .radio-item {
    border-color: #404040;
    background: var(--surface);
}

[data-theme="dark"] .confirmation-message {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.1) 0%, rgba(76, 175, 80, 0.15) 100%);
    border-color: rgba(76, 175, 80, 0.3);
}

/* ===== ÉTATS HOVER AMÉLIORÉS ===== */
.form-container:hover .form-label {
    color: var(--primary);
}

.form-group:hover .form-input,
.form-group:hover .form-select,
.form-group:hover .form-textarea {
    border-color: rgba(254, 163, 71, 0.5);
}

/* ===== PRINT STYLES ===== */
@media print {
    .form-container {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .confirmation-message {
        background: white !important;
        color: black !important;
    }
}