/* EGOUSH - Smart Forms CSS */

/* Formulaires intelligents */
.smart-form {
    position: relative;
}

/* Champs avec erreurs */
.form-control.is-invalid,
.form-select.is-invalid {
    border-color: #dc3545;
    padding-right: calc(1.5em + 0.75rem);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath d='m5.8 3.6.7.7-1.4 1.4 1.4 1.4-.7.7-1.4-1.4-1.4 1.4-.7-.7L4.7 6 3.3 4.6l.7-.7L5.4 5.3z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.form-control.is-invalid:focus,
.form-select.is-invalid:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.25);
}

/* Messages d'erreur */
.invalid-feedback {
    display: block !important;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #dc3545;
}

/* Champs téléphone */
.phone-prefix {
    background-color: #e9ecef;
    border-color: #ced4da;
    color: #495057;
    font-weight: 600;
    min-width: 70px;
    text-align: center;
}

/* Indicateur force mot de passe */
.password-strength {
    margin-top: 0.5rem;
}

.password-strength .progress {
    height: 5px;
    border-radius: 3px;
    overflow: hidden;
}

.password-strength .progress-bar {
    transition: width 0.3s ease, background-color 0.3s ease;
}

.strength-text {
    font-size: 0.8rem;
    margin-top: 0.25rem;
    font-weight: 500;
}

/* Animation des labels avec icônes */
.form-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
}

.form-label i {
    color: #059669;
    width: 16px;
}

/* Focus et transitions */
.form-control,
.form-select {
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus,
.form-select:focus {
    border-color: #059669;
    box-shadow: 0 0 0 0.25rem rgba(5, 150, 105, 0.25);
}

/* Boutons améliorés */
.btn {
    font-weight: 500;
    transition: all 0.15s ease-in-out;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.btn:active {
    transform: translateY(0);
}

/* Toggles mot de passe */
.btn-outline-secondary {
    border-color: #ced4da;
}

.btn-outline-secondary:hover {
    background-color: #e9ecef;
    border-color: #ced4da;
    color: #495057;
}

/* Mise en page responsive */
@media (max-width: 768px) {
    .phone-prefix {
        min-width: 60px;
        font-size: 0.9rem;
    }
    
    .form-label {
        font-size: 0.9rem;
    }
}

/* Messages d'erreur du formulaire */
.form-error-message {
    border: none;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    font-weight: 500;
}

/* Animation d'apparition */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-error-message,
.invalid-feedback {
    animation: slideIn 0.3s ease-out;
}

/* Validation en temps réel - styles de succès */
.form-control.is-valid,
.form-select.is-valid {
    border-color: #28a745;
    padding-right: calc(1.5em + 0.75rem);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%2328a745' d='m2.3 6.73.94-.94 2.94-2.94c.39-.39 1.02-.39 1.41 0l.07.08c.35.35.35.92 0 1.27L3.7 8.16 1.27 5.73c-.39-.39-.39-1.02 0-1.41l.07-.08c.35-.35.92-.35 1.27 0l-.01.01z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.form-control.is-valid:focus,
.form-select.is-valid:focus {
    border-color: #28a745;
    box-shadow: 0 0 0 0.25rem rgba(40, 167, 69, 0.25);
}

/* Styles spéciaux pour les cartes de formulaires */
.card .card-body {
    padding: 2rem;
}

.card .card-header {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: white;
    padding: 1rem 2rem;
    border-bottom: none;
}

.card .card-header h5 {
    margin: 0;
    font-weight: 600;
}

/* États de chargement */
.btn.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Améliorations pour les alertes */
.alert {
    border: none;
    border-radius: 10px;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
}

.alert-info {
    background-color: rgba(13, 110, 253, 0.1);
    color: #0c63e4;
    border-left: 4px solid #0d6efd;
}

.alert-success {
    background-color: rgba(25, 135, 84, 0.1);
    color: #0a58ca;
    border-left: 4px solid #198754;
}

.alert-danger {
    background-color: rgba(220, 53, 69, 0.1);
    color: #b02a37;
    border-left: 4px solid #dc3545;
}

.alert-warning {
    background-color: rgba(255, 193, 7, 0.1);
    color: #997404;
    border-left: 4px solid #ffc107;
}

/* Input groups avec icônes */
.input-group-text {
    background-color: #f8f9fa;
    border-color: #ced4da;
    font-weight: 600;
}

/* Sections de formulaires */
.form-section {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.form-section h5 {
    color: #059669;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

/* Responsive design avancé */
@media (max-width: 576px) {
    .card .card-body {
        padding: 1.5rem;
    }
    
    .card .card-header {
        padding: 0.75rem 1.5rem;
    }
    
    .btn {
        padding: 0.75rem 1.5rem;
    }
    
    .form-label {
        margin-bottom: 0.25rem;
    }
}

/* Thème sombre (pour future implémentation) */
@media (prefers-color-scheme: dark) {
    .form-control,
    .form-select {
        background-color: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .form-label {
        color: #e2e8f0;
    }
    
    .phone-prefix,
    .input-group-text {
        background-color: #4a5568;
        border-color: #4a5568;
        color: #e2e8f0;
    }
}