/* ==========================================================================
   Espace Pro Annuaire97 - pro-styles.css (Version Dynamique)
   ========================================================================== */

/* 1. Configuration Globale & Variables
   -------------------------------------------------------------------------- */
:root {
    --primary-color: #005a87;
    --primary-color-dark: #004a70;
    --primary-color-rgb: 0, 90, 135; 
    --secondary-color: #5a6268;
    --success-color: #28a745;
    --success-color-dark: #218838;
    --danger-color: #dc3545;
    --danger-color-dark: #c82333;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    
    --light-gray: #f4f7f6; 
    --white: #ffffff;
    --text-dark: #212529;
    --text-light: #6c757d;
    --border-color: #e0e0e0;

    --font-sans: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    
    --border-radius-sm: 0.25rem;
    --border-radius-md: 0.5rem;
    --border-radius-lg: 0.8rem;
    
    --shadow-soft: 0 2px 8px rgba(0,0,0,.06);
    --shadow-medium: 0 4px 12px rgba(0,0,0,.1);
    --shadow-large: 0 10px 30px rgba(0,0,0,.1);
}

/* 2. NOUVEAU: Animations
   -------------------------------------------------------------------------- */

/* Animation de fond (pour Login/Register) */
@keyframes gradientAnimation {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Animation d'apparition (pour Dashboard/Formulaires) */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 3. Styles de Base (Body, Typo)
   -------------------------------------------------------------------------- */
body {
    font-family: var(--font-sans);
    /* Fond gris clair par DÉFAUT pour les pages internes */
    background-color: var(--light-gray);
    color: var(--text-dark);
    margin: 0;
    padding: 20px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* NOUVEAU: Classe spéciale pour le fond animé (Login/Register) */
body.pro-access-page {
    background: linear-gradient(-45deg, #005a87, #00a896, #23a6d5, #f0c808);
    background-size: 400% 400%;
    animation: gradientAnimation 18s ease infinite;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 15px;
}

img {
    max-width: 100%;
    height: auto;
}

/* 4. Conteneurs (Login, Register, Dashboard)
   -------------------------------------------------------------------------- */

/* Conteneur pour Login & Inscription */
.login-page-wrapper, 
.register-page-wrapper {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 80vh;
    padding-top: 5vh;
}

.login-container, 
.register-container {
    background: var(--white);
    padding: 2.5rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-large); /* Ombre plus forte sur fond animé */
    max-width: 650px;
    width: 100%;
    text-align: center;
    border-top: 4px solid var(--primary-color);
    
    /* NOUVEAU: Animation d'apparition */
    animation: fadeInUp 0.6s ease-out;
}

.login-container header, 
.register-container header { 
    margin-bottom: 25px; 
}
.login-container header img, 
.register-container header img {
    max-width: 150px;
    margin-bottom: 1rem;
}
.login-container h1, 
.register-container h1 { 
    color: var(--text-dark);
    margin-bottom: 5px; 
    font-weight: 700;
}
.login-container p, 
.register-container p { 
    color: var(--text-light); 
    margin-bottom: 20px; 
    font-size: 1.1em;
}

/* Section de formulaire (pour dashboard, edit_profile.php) */
.form-section {
    background: var(--white);
    padding: 2.5rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-medium);
    margin-bottom: 2rem;

    /* NOUVEAU: Animation d'apparition */
    animation: fadeInUp 0.6s ease-out;
    animation-fill-mode: both; /* Garde l'état final */
}

/* NOUVEAU: Appliquer l'animation avec un décalage */
.dashboard-header {
    animation: fadeInUp 0.5s ease-out;
}
.form-section:nth-of-type(1) { animation-delay: 0.1s; }
.form-section:nth-of-type(2) { animation-delay: 0.2s; }
.form-section:nth-of-type(3) { animation-delay: 0.3s; }
/* ... (vous pouvez continuer si vous en avez plus) */


/* 5. Formulaires (Champs, Labels, Boutons)
   -------------------------------------------------------------------------- */
.form-group { 
    margin-bottom: 1.25rem; 
    text-align: left; 
}
.form-group label { 
    display: block; 
    margin-bottom: 0.5rem; 
    font-weight: 500;
    font-size: 0.9em;
    color: var(--text-light);
}
.form-group input, 
.form-group select, 
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    box-sizing: border-box;
    font-size: 1rem;
    font-family: var(--font-sans);
    background-color: #fdfdfd;
    box-shadow: var(--shadow-soft);
    transition: all 0.3s ease;
}
.form-group input:focus, 
.form-group select:focus, 
.form-group textarea:focus {
    border-color: var(--primary-color);
    background-color: var(--white);
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(var(--primary-color-rgb), 0.25);
}
.form-group textarea {
    min-height: 120px;
}

/* Boutons d'action */
.action-button {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 8px; 
    padding: 12px 24px; 
    border-radius: var(--border-radius-md);
    font-weight: 600; 
    text-decoration: none; 
    border: none; 
    cursor: pointer;
    transition: all 0.3s ease; 
    color: var(--white) !important;
    width: 100%;
    margin-top: 10px;
    font-size: 1rem;
    box-shadow: 0 2px 5px rgba(0,0,0,.1);
}
.action-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,.15);
    filter: brightness(1.05);
}
.action-button.primary { background: linear-gradient(45deg, var(--primary-color), #007abf); }
.action-button.success { background: linear-gradient(45deg, var(--success-color), #34c759); }
.action-button.danger { background: linear-gradient(45deg, var(--danger-color), #e74c3c); }
.action-button.secondary { background: linear-gradient(45deg, var(--secondary-color), #868e96); }
.action-button.warning { background: linear-gradient(45deg, var(--warning-color), #ffd700); color: var(--text-dark) !important; }

.action-button.small { 
    padding: 5px 10px; 
    font-size: 0.85em; 
    width: auto; 
}


/* 6. Composants Spécifiques (Messages, Dashboard, Edit Profile)
   -------------------------------------------------------------------------- */

/* Messages d'alerte */
.message { 
    padding: 1rem; 
    margin-bottom: 1.5rem; 
    border-radius: var(--border-radius-md); 
    border: 1px solid transparent;
    font-weight: 500;
    border-left-width: 4px;
    /* NOUVEAU: Animation d'apparition */
    animation: fadeInUp 0.5s ease-out;
}
.message.error { color: #721c24; background-color: #f8d7da; border-color: #d9534f; }
.message.success { color: #155724; background-color: #d4edda; border-color: #28a745; }
.message.info { color: #0c5460; background-color: #d1ecf1; border-color: #17a2b8; }

/* Liens (mot de passe oublié, etc.) */
.extra-links { margin-top: 20px; font-size: 0.9em; text-align: center; }
.extra-links a { color: var(--primary-color); text-decoration: none; margin: 0 10px; }
.extra-links a:hover { text-decoration: underline; }

/* En-tête du Dashboard (ex: edit_profile.php) */
.dashboard-header {
    display: flex;
    flex-wrap: wrap; 
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    gap: 1rem;
}
.dashboard-header h1 {
    color: var(--text-dark);
    font-size: 1.8em;
    margin: 0;
}
.back-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}
.back-link:hover {
    color: var(--primary-color-dark);
    text-decoration: underline;
}

/* Grille de Communes (edit_profile.php) */
.communes-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); 
    gap: 10px; 
    max-height: 350px; 
    overflow-y: auto; 
    border: 1px solid var(--border-color); 
    padding: 15px; 
    border-radius: var(--border-radius-md); 
    background: var(--light-gray);
}
.checkbox-item { 
    display: flex; 
    align-items: center; 
    gap: 8px; 
    margin-bottom: 5px; 
    background: var(--white);
    padding: 8px 10px;
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-soft);
    transition: all 0.2s ease;
}
.checkbox-item:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-medium);
}
.checkbox-item input[type="checkbox"], 
.checkbox-item input[type="radio"] { 
    width: auto; 
    flex-shrink: 0; 
}
.checkbox-item label { 
    margin-bottom: 0; 
    font-weight: 400; 
    font-size: 0.9em; 
    color: var(--text-dark);
}

/* Carte Leaflet (edit_profile.php) */
#map { 
    height: 300px; 
    margin: 15px 0;
    border-radius: var(--border-radius-md); 
    border: 1px solid var(--border-color); 
    z-index: 1;
    box-shadow: var(--shadow-soft);
}

/* Aperçu du Logo (edit_profile.php) */
.logo-preview {
    background: var(--light-gray);
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100px;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}
.logo-preview:hover {
    border-color: var(--primary-color);
    background-color: var(--white);
}
.logo-preview img { 
    max-height: 100px; 
    margin-bottom: 10px; 
    border: 1px solid var(--border-color); 
    padding: 5px; 
    background: var(--white); 
    border-radius: var(--border-radius-sm);
}
.delete-logo-label { 
    display: inline-flex; 
    align-items: center;
    gap: 5px;
    margin-top: 10px;
    font-size: 0.9em; 
    color: var(--text-light); 
}

/* Bannière Promo (register.php) */
.promo-banner h2 {
    border-bottom: none !important;
    font-size: 1.6em !important;
    margin-bottom: 0.5em !important;
    color: var(--primary-color) !important;
}
.promo-banner ul {
    list-style-type: none !important;
    padding-left: 0 !important;
    text-align: left;
}
.promo-banner ul li {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 1.1em;
}
.promo-banner ul li i {
    color: var(--success-color); 
    margin-right: 10px;
    font-size: 1.2em;
}


/* 7. Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
    body { padding: 10px; }
    .container { padding: 0 5px; }

    .login-page-wrapper, 
    .register-page-wrapper {
        padding: 20px 10px;
    }
    
    .login-container, 
    .register-container,
    .form-section {
        padding: 1.5rem;
        box-shadow: var(--shadow-soft); /* Garder une ombre légère */
        border-radius: var(--border-radius-md);
    }
    
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    .dashboard-header h1 {
        font-size: 1.5em;
    }
}

@media (max-width: 480px) {
    .communes-grid {
        grid-template-columns: 1fr;
    }
    .promo-banner h2 {
        font-size: 1.4em !important;
    }
}

/* Fin du fichier pro-styles.css */