/*
 * =====================================================================
 * Date/Heure : 2026-03-03 20:30:00
 * Chemin     : /style.css
 * Rôle       : Feuille de style globale (Cerenix Marketing + ERP App)
 * =====================================================================
 * Index des blocs :
 * - Bloc 1 : Variables & Reset
 * - Bloc 2 : Structure de l'Application (Carte Leaflet)
 * - Bloc 3 : Composants Généraux (Boutons, Formulaires)
 * - Bloc 4 : Popups Agronomiques & Profil de Sol (L'ancien design)
 * - Bloc 5 : Modals & Sidebar (L'ancien design)
 * - Bloc 6 : Pages Publiques & Marketing (Accueil, Login)
 * =====================================================================
 */

/* =========================================================
   BLOC 1 : VARIABLES & RESET
   ========================================================= */
:root {
    /* Couleurs Cerenix (Nouveau) */
    --color-primary: #2e7d32; 
    --color-primary-dark: #1b5e20;
    --color-secondary: #fbc02d; 
    
    /* Couleurs de l'App d'origine (Ancien) */
    --danger: #D32F2F;
    --warning: #F57F17;
    --bg-light: #F4F6F8;
    --text-main: #2C3E50;
    --text-muted: #64748B;
    --border-color: #E2E8F0;
    --surface: #FFFFFF;
    
    /* Ombres et Rayons */
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --font-family: 'Inter', system-ui, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body, html {
    font-family: var(--font-family);
    color: var(--text-main);
    background-color: var(--bg-light);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Empêche le scroll global pour laisser la carte gérer le sien */
}

/* =========================================================
   BLOC 2 : STRUCTURE DE L'APPLICATION (Carte Leaflet)
   ========================================================= */
.navbar {
    background-color: var(--surface);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    height: 60px;
    flex-shrink: 0;
    z-index: 1000;
}

.navbar .logo {
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--color-primary);
    text-transform: uppercase;
    text-decoration: none;
}

.navbar .user-info {
    color: var(--text-muted);
    display: flex;
    align-items: center;
}

.mode-container {
    display: flex;
    gap: 10px;
    padding: 10px 20px;
    background-color: var(--bg-light);
    flex-shrink: 0;
    z-index: 900;
}

#status {
    padding: 8px 20px;
    font-size: 0.9rem;
    background-color: #1f2937;
    color: white;
    flex-shrink: 0;
    transition: background-color 0.3s;
    z-index: 900;
}

/* C'EST ICI QUE LA CARTE PREND TOUT L'ESPACE (LA CORRECTION DU BUG) */
#map {
    flex-grow: 1;
    width: 100%;
    z-index: 1; /* Doit rester sous les menus et modals */
}

/* =========================================================
   BLOC 3 : COMPOSANTS GÉNÉRAUX (Boutons, Formulaires)
   ========================================================= */
.btn, .btn-mode, .btn-logout, .btn-action-pro, .btn-del, .btn-add, .btn-save {
    display: inline-block;
    padding: 10px 20px;
    border-radius: var(--radius);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    font-size: 1rem;
    text-align: center;
}

.btn-primary { background-color: var(--color-primary); color: white; }
.btn-primary:hover { background-color: var(--color-primary-dark); }
.btn-outline { background-color: transparent; border: 2px solid var(--color-primary); color: var(--color-primary); }
.btn-outline:hover { background-color: var(--color-primary); color: white; }

/* Boutons spécifiques App */
.btn-mode { background-color: transparent; border: 2px solid var(--color-primary); color: var(--color-primary); }
.btn-mode.active { background-color: var(--color-primary); color: white; }
.btn-logout { padding: 5px 15px; border: 2px solid var(--color-primary); color: var(--color-primary); margin-left: 15px; }
.btn-logout:hover { background-color: var(--color-primary); color: white; }

.btn-save { background-color: var(--color-primary); color: white; width: 100%; margin-top: 15px; }
.btn-del { background-color: var(--danger); color: white; width: 100%; margin-top: 10px; }
.btn-add { background-color: var(--color-primary); color: white; width: 100%; margin-top: 10px; }

.form-group { margin-bottom: 20px; text-align: left; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 600; color: var(--text-main); font-size: 0.9rem; }
.form-control, input[type="text"], input[type="email"], input[type="password"] {
    width: 100%; padding: 12px; border: 1px solid var(--border-color); border-radius: var(--radius); font-size: 1rem;
}

/* =========================================================
   BLOC 4 : POPUPS AGRONOMIQUES & PROFIL DE SOL (Ancien)
   ========================================================= */
.leaflet-popup-content { width: 380px !important; margin: 15px !important; }

.agri-dashboard { font-family: var(--font-family); }
.agri-header { margin-bottom: 15px; padding-bottom: 10px; border-bottom: 1px solid var(--border-color); }
.agri-title-row { display: flex; justify-content: space-between; align-items: center; }
.agri-title { margin: 0; font-size: 1.2rem; color: var(--color-primary-dark); }
.agri-subtitle { font-size: 0.9rem; color: var(--text-muted); margin-top: 5px; }

.data-group { margin-bottom: 15px; }
.data-group-title { font-size: 0.85rem; text-transform: uppercase; font-weight: 700; color: var(--text-muted); margin-bottom: 8px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.val-row { display: flex; justify-content: space-between; font-size: 0.9rem; margin-bottom: 3px; }
.val-label { color: var(--text-muted); }
.val-data { font-weight: 600; color: var(--text-main); }
.alert-vent { color: var(--danger); font-weight: bold; }

/* Profil de Sol */
.soil-cross-section {
    display: flex; flex-direction: column; gap: 1px; margin-top: 12px;
    border-top: 4px solid var(--color-primary) !important;
    border-radius: 4px 4px 2px 2px; overflow: hidden; box-shadow: var(--shadow-sm);
}
.soil-stratum {
    position: relative; display: flex; justify-content: space-between; align-items: center;
    padding: 8px 12px; font-size: 12px; color: #ffffff !important; overflow: hidden;
    background-color: #795548 !important;
}
.soil-stratum.stratum-0 { background-color: #8D6E63 !important; } 
.soil-stratum.stratum-1 { background-color: #795548 !important; }
.soil-stratum.stratum-2 { background-color: #6D4C41 !important; }
.soil-stratum.stratum-3 { background-color: #5D4037 !important; }
.soil-stratum.stratum-4 { background-color: #4E342E !important; }

.soil-moist-bar {
    position: absolute; top: 0; left: 0; height: 100%;
    background-color: rgba(64, 196, 255, 0.3); z-index: 0; pointer-events: none;
}
.soil-stratum span { position: relative; z-index: 1; font-weight: 600; text-shadow: 1px 1px 2px rgba(0,0,0,0.5); }

.btn-action-pro { background-color: var(--bg-light); color: var(--text-main); border: 1px solid var(--border-color); width: 100%; }
.btn-action-pro:hover { background-color: var(--border-color); }

/* =========================================================
   BLOC 5 : MODALS & SIDEBAR (Ancien)
   ========================================================= */
.modal {
    display: none; position: fixed; z-index: 2000; left: 0; top: 0;
    width: 100%; height: 100%; background-color: rgba(0,0,0,0.5);
    align-items: center; justify-content: center;
}
.modal-content {
    background-color: var(--surface); padding: 25px; border-radius: var(--radius);
    width: 90%; max-width: 400px; position: relative; box-shadow: var(--shadow-lg);
}
.close, .close-sb {
    position: absolute; right: 15px; top: 15px; font-size: 24px; font-weight: bold;
    color: var(--text-muted); cursor: pointer;
}

/* Panneau latéral pour la météo (Sidebar) */
.sidebar {
    position: fixed; top: 60px; right: -350px; width: 350px; height: calc(100vh - 60px);
    background-color: var(--text-main); color: white; transition: right 0.3s ease;
    z-index: 1500; box-shadow: -4px 0 15px rgba(0,0,0,0.2); overflow-y: auto; padding: 20px;
}
.sidebar.open { right: 0; }
.sidebar-header { margin-bottom: 20px; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 10px; }
.sb-section { margin-bottom: 20px; background: rgba(0,0,0,0.2); padding: 15px; border-radius: var(--radius); }
.sb-section h3 { font-size: 1rem; color: var(--color-secondary); margin-bottom: 10px; }
.sb-kpi { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 0.95rem; }
.previ-jour { padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,0.1); }
.previ-jour:last-child { border-bottom: none; }

/* =========================================================
   BLOC 6 : PAGES PUBLIQUES & MARKETING (Accueil, Login)
   ========================================================= */
/* Permettre le scroll uniquement sur les pages publiques */
body:not(:has(#map)) { overflow: auto; height: auto; }

.hero-section { background: linear-gradient(135deg, #f3f4f6 0%, #e8f5e9 100%); padding: 100px 20px; text-align: center; }
.hero-content h1 { font-size: 3rem; margin-bottom: 20px; color: var(--text-main); }
.hero-content p { font-size: 1.2rem; max-width: 800px; margin: 0 auto 40px auto; color: var(--text-muted); }
.hero-actions { display: flex; gap: 20px; justify-content: center; }

.features-section, .story-section { padding: 80px 20px; max-width: 1200px; margin: 0 auto; }
.section-title { text-align: center; font-size: 2.5rem; margin-bottom: 50px; }

.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 30px; }
.feature-card { background-color: var(--surface); padding: 40px 30px; border-radius: var(--radius); box-shadow: var(--shadow-md); text-align: center; }
.feature-icon { font-size: 3rem; margin-bottom: 20px; }

.story-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 50px; align-items: center; }
.story-text h3 { font-size: 1.8rem; margin-bottom: 20px; color: var(--color-primary); }
.image-placeholder { background-color: #e8f5e9; height: 300px; border-radius: var(--radius); display: flex; justify-content: center; align-items: center; border: 2px dashed var(--color-primary); font-size: 3rem; }

/* Login */
.login-wrapper { min-height: calc(100vh - 60px); display: flex; justify-content: center; align-items: center; padding: 20px; background-color: var(--bg-light); }
.login-card { background-color: var(--surface); width: 100%; max-width: 450px; padding: 40px; border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.login-header h2 { color: var(--color-primary); font-weight: 800; text-align: center; margin-bottom: 5px; }
.login-header p { text-align: center; color: var(--text-muted); margin-bottom: 30px; }
.logo-icon-large { font-size: 3rem; text-align: center; margin-bottom: 10px; }
.login-footer { margin-top: 30px; padding-top: 20px; border-top: 1px solid var(--border-color); text-align: center; }
.back-link { color: var(--text-muted); text-decoration: none; font-size: 0.9rem; }
.back-link:hover { color: var(--color-primary); }

@media (max-width: 768px) {
    .story-grid { grid-template-columns: 1fr; }
    .hero-actions { flex-direction: column; }
    .sidebar { width: 100%; right: -100%; }
}

/* =========================================================
   BLOC 6.1 : MENU PUBLIC (Accueil, Inscription, etc.)
   ========================================================= */
.navbar-public {
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px); /* Effet verre dépoli moderne */
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 2000;
    padding: 15px 0;
    box-shadow: var(--shadow-sm);
}
.nav-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.nav-content .logo {
    color: var(--color-primary);
    font-weight: 800;
    font-size: 1.5rem;
    text-decoration: none;
    letter-spacing: 0.5px;
}
.nav-links {
    display: flex;
    gap: 30px;
    align-items: center;
}
.nav-links a:not(.btn) {
    color: var(--text-main);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: color 0.2s;
}
.nav-links a:not(.btn):hover {
    color: var(--color-primary);
}

/* Alignement du label et du lien "Mot de passe oublié" */
.label-flex {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 5px;
}
.label-flex label {
    margin-bottom: 0; /* Annule la marge par défaut du label */
}
.forgot-link {
    color: var(--color-primary);
    font-size: 0.85rem;
    text-decoration: none;
    font-weight: 600;
    transition: opacity 0.2s;
}
.forgot-link:hover {
    opacity: 0.8;
    text-decoration: underline;
}