/* Import de la police Inter si elle n'est pas déjà chargée */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

body {
    font-family: 'Inter', sans-serif;
    background-color: #f4f6f9;
}

/* --- CARTE "Dashboard-like" --- */
.dashboard-card {
    border: none;
    border-radius: 15px;
    /* Harmonisé avec index.css */
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    background: #fff;
    margin-top: 2rem;
    margin-bottom: 2rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden;
}

/* Animation au survol (optionnel, mais présent sur l'index) */
.dashboard-card:hover {
    /* On évite le translateY trop prononcé sur le formulaire pour ne pas gêner la saisie, 
       mais on garde l'ombre renforcée */
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
}

.card-body {
    padding: 40px;
}

/* --- HEADER DU FORMULAIRE --- */
.form-header {
    text-align: left;
    margin-bottom: 30px;
}

.form-header h3 {
    font-weight: 700;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    /* Gradient propre au nouveau thème */
    background: linear-gradient(90deg, #1c5980 0%, #008c9e 100%);
    -webkit-background-clip: text;
    -moz-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: #1c5980;
    /* Fallback */
}

.form-header h3 i {
    color: #008c9e;
    margin-right: 15px;
    /* L'icone garde sa couleur */
    -webkit-text-fill-color: initial;
}

.form-header .subtitle {
    color: #8898aa;
    margin-bottom: 0;
    font-size: 1rem;
    margin-top: 5px;
}

/* --- CHAMPS --- */
.form-group label {
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.form-control {
    height: 50px;
    border-radius: 10px;
    border: 1px solid #e0e0e0;
    padding: 0 20px;
    background: #fdfdfd;
}

textarea.form-control {
    height: auto;
    padding-top: 15px;
    padding-bottom: 15px;
}

.form-control:focus {
    border-color: #1c5980;
    box-shadow: 0 0 0 3px rgba(28, 89, 128, 0.1);
    /* Harmonisé avec login.css */
    background: #fff;
}

.form-control.is-invalid {
    border: 2px solid #dc3545 !important;
}

.form-control.is-invalid:focus {
    border: 2px solid #dc3545 !important;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.25) !important;
}

/* Forcer la bordure rouge sur le Select2 s'il suit un champ invalide, ou s'il a la classe. */
.is-invalid ~ .select2-container .select2-selection,
.is-invalid + .select2-container .select2-selection {
    border: 2px solid #dc3545 !important;
}

div.alert.project-section-box.invalid-section {
    border: 3px solid #dc3545 !important;
    background-color: rgba(220, 53, 69, 0.1) !important;
}

/* --- CUSTOM FILE INPUT --- */
.custom-file {
    height: 50px;
    position: relative;
    margin-bottom: 1rem;
}

.custom-file-input {
    height: 50px;
    opacity: 0;
    position: relative;
    z-index: 2;
    cursor: pointer;
    width: 100%;
}

.custom-file-label {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    z-index: 1;
    height: 50px;
    padding: 0.375rem 0.75rem;
    line-height: 2.5;
    color: #8898aa;
    background-color: #fdfdfd;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding-left: 20px;
    font-weight: 400;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
}

.custom-file-label::after {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 1.5rem;
    color: #555;
    content: var(--browse-text, "Parcourir");
    background-color: #e9ecef;
    border-left: 1px solid #e0e0e0;
    border-radius: 0 10px 10px 0;
    /* Arrondi cohérent */
    font-weight: 600;
}

.custom-file-input:focus~.custom-file-label {
    border-color: #1c5980;
    box-shadow: 0 0 0 3px rgba(28, 89, 128, 0.1);
}

/* --- FOOTER & BOUTONS --- */
.card-footer {
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    padding: 20px 40px;
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    align-items: center;
}

/* BOUTON PRINCIPAL (Harmonisé .btn-custom) */
.btn-custom {
    background: linear-gradient(90deg, #1c5980 0%, #008c9e 100%);
    border: none;
    border-radius: 10px;
    /* Sur login c'est 10px, index 50px... On garde 10px pour les formulaires c'est mieux */
    padding: 0 25px;
    height: 45px;
    font-weight: 600;
    color: white;
    transition: opacity 0.2s;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-custom:hover {
    color: white;
    opacity: 0.9;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* BOUTON SECONDAIRE (Harmonisé .btn-custom-outline) */
.btn-custom-outline {
    border-radius: 10px;
    border: 2px solid #e0e0e0;
    color: #6c757d;
    font-weight: 600;
    padding: 0 20px;
    height: 45px;
    background: transparent;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.btn-custom-outline:hover {
    background-color: #f4f6f9;
    border-color: #1c5980;
    color: #1c5980;
    text-decoration: none;
}

/* --- LOADER OVERLAY --- */
/* Le conteneur doit être relatif pour que l'overlay se positionne par rapport à lui */
.loading-container {
    position: relative;
    min-height: 200px; /* Hauteur min pour voir le spinner */
}

/* Le masque blanc qui cache le formulaire */
.form-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95); /* Blanc quasi opaque */
    z-index: 50;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 0.25rem;
    transition: opacity 0.5s ease-out, visibility 0.5s;
}

/* La classe pour cacher l'overlay une fois fini */
.form-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none; /* Permet de cliquer à travers une fois caché */
}

/* Le spinner (roue qui tourne) */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db; /* Bleu primaire */
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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