/* Import des couleurs */
@import url('colors.css');

* { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-dark);
    overflow-x: hidden;
    padding-bottom: 120px; /* Marge pour ne pas cacher le contenu sous les boutons fixes */
}

/* --- HEADER --- */
header {
    background-color: var(--primary);
    color: var(--white);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    position: sticky;
    top: 0;
    z-index: 100;
}

.menu-btn { font-size: 24px; cursor: pointer; width: 30px; }
.app-title { font-size: 1.2rem; font-weight: bold; display: flex; align-items: center; gap: 10px; }

/* --- SIDEBAR MENU --- */
.sidebar {
    height: 100%; width: 260px;
    position: fixed; z-index: 1000; top: 0; left: -270px;
    background-color: var(--white);
    transition: 0.3s;
    box-shadow: 2px 0 10px rgba(0,0,0,0.2);
    display: flex; flex-direction: column;
}
.sidebar.open { left: 0; }

.sidebar-header {
    background-color: var(--primary); color: var(--white);
    padding: 20px; display: flex; justify-content: space-between; align-items: center;
}
.close-btn { font-size: 30px; cursor: pointer; }

.menu-item {
    padding: 15px 20px; text-decoration: none; font-size: 16px;
    color: var(--text-dark); border-bottom: 1px solid #f0f0f0;
    display: block; transition: 0.2s;
}
.menu-item:hover {
    background-color: var(--secondary); padding-left: 25px;
    color: var(--primary); font-weight: 500;
}

/* Overlay sombre pour le menu et les modals */
.overlay {
    position: fixed; display: none; width: 100%; height: 100%;
    top: 0; left: 0; background-color: rgba(0,0,0,0.5); z-index: 900;
}
.overlay.active { display: block; }

/* --- STATS DASHBOARD --- */
.stats-row {
    display: flex; justify-content: space-between;
    padding: 20px; gap: 10px; margin-top: 10px;
}
.stat-card {
    background: var(--white); padding: 15px 10px;
    border-radius: 12px; text-align: center; flex: 1;
    box-shadow: var(--shadow);
}
.stat-number { font-size: 1.5rem; font-weight: bold; display: block; }
.stat-label { font-size: 0.8rem; color: var(--text-grey); margin-top: 5px; display: block; }

/* --- ALERTES --- */
.section-title {
    padding: 0 20px; margin-bottom: 15px;
    font-size: 0.9rem; font-weight: bold; color: var(--text-grey);
    text-transform: uppercase; letter-spacing: 1px;
    display: flex; align-items: center; gap: 8px;
}
.alerts-container {
    display: flex; flex-direction: column; gap: 15px;
    padding: 0 20px; 
}
.alert-card {
    background: var(--white); border-left: 5px solid;
    border-radius: 8px; padding: 15px;
    box-shadow: var(--shadow); position: relative;
    transition: opacity 0.3s ease;
}

/* Mapping couleurs (CORRIGÉ POUR CORRESPONDRE AU JS) */
.border-danger { border-color: var(--danger); }   /* Rouge */
.border-warning { border-color: var(--warning); } /* Orange */
.border-neutral { border-color: var(--neutral); } /* Jaune */
.border-info { border-color: var(--info); }       /* Bleu */
.border-success { border-color: var(--success); } /* Vert */

.alert-header { display: flex; justify-content: space-between; margin-bottom: 5px; }
.alert-title { font-weight: bold; font-size: 1rem; }
.close-alert { color: #999; cursor: pointer; font-size: 1.5rem; line-height: 1; padding: 0 5px; }
.close-alert:hover { color: var(--danger); }
.alert-info { font-size: 0.9rem; color: var(--text-grey); display: flex; justify-content: space-between; }
.days-count { font-weight: bold; color: var(--text-dark); }

/* --- BOUTONS ACTIONS (FIXES EN BAS) --- */
.actions-container-fixed {
    position: fixed; bottom: 0; left: 0; right: 0;
    background: linear-gradient(to top, rgba(244,247,246,1) 85%, rgba(244,247,246,0));
    padding: 20px; z-index: 50;
}
.actions-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 15px;
    max-width: 600px; margin: 0 auto;
}
.btn-action {
    border: none; padding: 15px; border-radius: 12px;
    font-size: 1rem; font-weight: bold; cursor: pointer;
    display: flex; flex-direction: column; align-items: center;
    gap: 8px; box-shadow: var(--shadow);
    transition: transform 0.1s;
}
.btn-action:active { transform: scale(0.95); }
.btn-light { background-color: var(--white); color: var(--text-dark); }
.btn-primary { background-color: var(--primary); color: var(--white); }
.plus-icon { font-size: 1.5rem; color: #8e44ad; }

/* --- MODALS (FENÊTRES SURGISSANTES) --- */
/* C'est nouveau : pour les formulaires d'ajout */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.5); /* Fond noir transparent */
    display: flex; justify-content: center; align-items: center;
    z-index: 2000;
    opacity: 0; pointer-events: none; /* Caché par défaut */
    transition: opacity 0.3s ease;
}

.modal.active {
    opacity: 1; pointer-events: all; /* Visible */
}

.modal-content {
    background-color: var(--white);
    padding: 25px;
    border-radius: 15px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal.active .modal-content {
    transform: translateY(0); /* Animation de montée */
}

.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 20px;
}
.modal-header h3 { margin: 0; color: var(--primary); }

.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: 500; font-size: 0.9rem; }
.form-group input, .form-group select {
    width: 100%; padding: 10px;
    border: 1px solid #ddd; border-radius: 8px;
    font-size: 1rem;
}

.modal-actions {
    display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px;
}

.btn-cancel {
    background: #f1f1f1; border: none; padding: 10px 20px;
    border-radius: 8px; cursor: pointer; color: #666;
}
.btn-save {
    background: var(--primary); border: none; padding: 10px 20px;
    border-radius: 8px; cursor: pointer; color: white; font-weight: bold;
}