/* ==========================================================================
   BASES
   ========================================================================== */
body {
    margin: 0;
    background-color: #F9FAFB;
    font-family: sans-serif;
}

.contenu {
    position: relative;
    top: 60px;
    padding: 20px;
    min-height: calc(100vh - 120px);
}

.titre-central {
    text-align: center;
    margin: 20px 0;
}

footer {
    text-align: center;
    padding: 20px;
    background: #222;
    color: white;
    margin-top: 40px;
}

/* ==========================================================================
   NAVIGATION (NAVBAR & MENUS)
   ========================================================================== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background: #222;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    z-index: 1000;
}

.nav {
    background: none;
    border: none;
    padding: 15px;
    cursor: pointer;
}

.nav img {
    width: 40px;
    height: 40px;
    object-fit: cover;
}

.loritz img {   
    height: 50px;
    width: auto;
}

/* Menu Latéral Gauche */
#side-menu {
    position: fixed;
    top: 0;
    left: -300px;
    width: 250px;
    height: 100vh;
    background: #333;
    color: white;
    padding: 20px;
    transition: left 0.3s ease;
    z-index: 999;
}

#side-menu.open { left: 0; }

#side-menu ul {
    list-style: none;
    padding: 0;
    margin-top: 80px;
}

#side-menu li { border-bottom: 1px solid #444; }

#side-menu li a {
    color: white;
    text-decoration: none;
    display: block;
    padding: 18px 10px;
    transition: background 0.2s;
}

#side-menu li a:hover { background: #444; }

/* Menu Profil Droite */
#side-profil {
    position: fixed;
    right: 25px;
    top: -600px; 
    width: 280px;
    background: #2b2b2b;
    color: white;
    padding: 20px;
    transition: top 0.5s ease;
    z-index: 999;
    text-align: center;
    border-left: 4px solid #FD7E14;
    box-shadow: -5px 0 15px rgba(0,0,0,0.5);
    border-radius: 0 0 10px 10px;
}

#side-profil.open { top: 60px; }

/* ==========================================================================
   AUTHENTIFICATION & FORMULAIRES
   ========================================================================== */
.auth-form input {
    width: 90%;
    padding: 12px;
    margin-bottom: 15px;
    border-radius: 6px;
    border: 1px solid #444;
    background: #1a1a1a;
    color: white;
}

.btn-auth {
    width: 100%;
    padding: 12px;
    background: #FD7E14;
    border: none;
    color: white;
    font-weight: bold;
    border-radius: 6px;
    cursor: pointer;
    transition: 0.3s;
}

.btn-auth:hover { background: #e06b0d; }

.error-msg { 
    background: #4a1a1a; 
    color: #ff9999; 
    padding: 10px; 
    border-radius: 5px; 
    margin-bottom: 15px; 
    font-size: 13px; 
}

/* ==========================================================================
   DASHBOARD & STATS
   ========================================================================== */
.dashboard-stats {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.stat-card-activity, .stat-card-energy {
    background: #FFFFFF;
    padding: 15px 25px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 15px;
    min-width: 200px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid #DADDE7;
    transition: border-bottom 0.2s;
}

.stat-card-activity:hover { border-bottom: 4px solid #228BE6; }
.stat-card-energy:hover { border-bottom: 4px solid #FD7E14; }

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.energy { background: #FFF4E6; }
.air { background: #D3D3D3; }
.eau { background: #E7F5FF; }
.activite { background: #E7F5FF; color: #228BE6; }

.stat-label { font-size: 0.75rem; color: #868E96; text-transform: uppercase; }
.stat-valeur { font-size: 1.3rem; font-weight: bold; color: #212529; }

/* ==========================================================================
   GRAPHIQUE 
   ========================================================================== */
.main-visual-wrapper {
    display: flex;
    justify-content: center; 
    align-items: center;
    width: 100%;
    max-width: 1200px; 
    margin: 0 auto; 
}

/* Graphique */
.chart-container {
    flex: 1;
    height: 450px; 
    width: 100%; 
    background: white;
    border-radius: 12px;
    border: 1px solid #DADDE7;
    padding: 25px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

.main-visual-wrapper::after {
    display: none;
}

.titre-central, .period-buttons {
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 10px;
}

.semaine-grid {
    display: flex;
    gap: 8px;
    padding: 10px 20px;
    overflow-x: auto;
}
.semaine-col {
    flex: 1;
    min-width: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.semaine-label {
    font-size: 11px;
    color: #ccc;
    text-align: center;
    margin-bottom: 6px;
    font-weight: bold;
}
.semaine-heures {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 2px;
}
.semaine-heure-cell {
    height: 18px;
    width: 100%;
    border-radius: 3px;
    position: relative;
    cursor: pointer;
    transition: opacity 0.2s;
}
.semaine-heure-cell:hover { opacity: 0.8; }
.heure-label {
    position: absolute;
    left: -28px;
    font-size: 9px;
    color: #aaa;
    top: 50%;
    transform: translateY(-50%);
}
.semaine-legende {
    display: flex;
    gap: 20px;
    padding: 10px 20px;
    color: #ccc;
    font-size: 13px;
    align-items: center;
}

/* ==========================================================================
   BOUTONS Dates
   ========================================================================== */
.period-buttons { 
    text-align: center; 
    margin: 20px 0; 
}

.btn-period { 
    background: #333; 
    color: white; 
    border: none; 
    padding: 10px 18px; 
    margin: 0 5px; 
    border-radius: 4px; 
    cursor: pointer; 
    font-weight: bold;
}

.btn-period.active { background: #FD7E14; }
.btn-period.active:hover { background: #FA7A12; }
.btn-period:hover { background: #555; }

/* ==========================================================================
   7. PAGE ACCUEIL 
   ========================================================================== */
#contenu-box {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 50px;
    padding: 40px 20px;
    flex-wrap: wrap;
}

.accueil {
    background-color: #FFFFFF !important; 
    border-radius: 15px;
    padding: 25px;
    width: 300px;
    min-height: 300px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08); 
    border: 1px solid #f0f0f0;
    text-align: center;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.accueil:hover {
    transform: translateY(-5px);
}

.accueil .icon { font-size: 3rem; margin-bottom: 10px; }
.accueil h3 { margin-bottom: 20px; color: #333; font-size: 1.5rem; }

.info-row {
    width: 100%;
    border-top: 1px solid #eee; 
    padding: 15px 0;
    margin-top: 5px;
}

.info-label {
    display: block;
    font-size: 0.75rem;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
}

.info-value {
    display: block;
    font-size: 1.3rem;
    font-weight: bold;
    color: #212529;
}

.accueil p {
    color: #666;
    font-size: 0.95rem;
    margin-top: 10px;
}

#box-elec:hover { border-bottom: 4px solid #FD7E14; }
#graph-eau:hover { border-bottom: 4px solid #228BE6; }
#compresseur-air-onoff:hover { border-bottom: 4px solid #40C057; }

/* ==========================================================================
   CALENDRIER
   ========================================================================== */
.month-calendar-wrapper {
    display: flex;
    justify-content: center;
    width: 100%;
    max-width: 1200px;
    margin: 200px auto; 
}

.calendar-container {
    flex: 1;
    background: white;
    border-radius: 15px;
    border: 1px solid #DADDE7;
    padding: 30px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.06);
}

.calendar-title {
    text-align: center;
    margin-bottom: 25px;
    font-size: 1.2rem;
    color: #2D3436;
    font-weight: 700;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-template-rows: repeat(5, 55px) auto; 
    gap: 10px;
}

.calendar-day {
    height: 55px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #F8F9FD;
    border-radius: 10px;
    border: 1px solid #EDF0F5;
    font-size: 14px;
    color: #636E72;
}

.calendar-day {
    height: 65px;        
    flex-direction: column;
    gap: 4px;
}

.cal-day-num {
    font-size: 14px;
    font-weight: 600;
    color: #636E72;
}

.cal-conso {
    font-size: 11px;
    color: #FD7E14;
    font-weight: 600;
}

.cal-nav-btn {
    background: #FD7E14;
    color: white;
    border: none;
    padding: 6px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.4rem;
    text-decoration: none;
    line-height: 1;
}

.cal-nav-btn:hover { background: #e06b0d; }

.calendar-day.out-of-range {
    opacity: 0.3;
    background: transparent;
    border-style: dashed;
}

.calendar-day.today {
    background: #FFF4E6;
    border-color: #FD7E14;
    color: #FD7E14;
    font-weight: bold;
    box-shadow: inset 0 0 0 1px #FD7E14;
}

.calendar-footer {
    text-align: center;
    font-weight: 800;
    color: #FD7E14;
    padding-top: 15px;
    margin-top: 10px;
    border-top: 2px solid #F1F3F5;
    font-size: 0.75rem;
}


/* ==========================================================================
   Graphique condensateur d'air
   ========================================================================== */

#chart-semaine-wrapper {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
}


#chart-semaine-wrapper .semaine-grid {
    background: #FFFFFF !important;
    border-radius: 15px;
    border: 1px solid #DADDE7;
    padding: 30px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
}

#chart-semaine-wrapper .semaine-label {
    font-size: 13px;
    color: #2D3436 !important;
    text-align: center;
    margin-bottom: 10px;
    font-weight: 700;
    height: 17px;
}

#chart-semaine-wrapper .heures-axis-col {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 45px;
    margin-top: 27px; 
    height: 478px;    
    padding-bottom: 2px;
}

#chart-semaine-wrapper .axis-heure-label {
    color: #636E72 !important;
    font-size: 11px;
    font-weight: 600;
    text-align: right;
    padding-right: 10px;
}

#chart-semaine-wrapper .semaine-heure-cell.line-marker {
    border-bottom: 1px solid #E2E8F0 !important;
}

#chart-semaine-wrapper .semaine-legende {
    display: flex;
    justify-content: center;
    gap: 25px;
    padding: 15px 20px;
    color: #2D3436 !important; 
    font-size: 13px;
    font-weight: 600;
    margin-top: 5px;
}


#chart-semaine-wrapper .semaine-heure-cell[style*="#1e1e1e"],
#chart-semaine-wrapper .semaine-legende span span[style*="#1e1e1e"] {
    background-color: #F8F9FD !important;
    border: 1px solid #EDF0F5 !important;
}

#chart-semaine-wrapper .semaine-heure-cell[style*="#e74c3c"],
#chart-semaine-wrapper .semaine-legende span span[style*="#e74c3c"] {
    background-color: #FFE3E3 !important;
    border: 1px solid #FCA5A5 !important;
}

#chart-semaine-wrapper .semaine-heure-cell[style*="#2ecc71"],
#chart-semaine-wrapper .semaine-legende span span[style*="#2ecc71"] {
    background-color: #40C057 !important;
    border: none !important;
}


.titre-section-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin: 30px 0 15px 0;
}

.titre-section-container h2 {
    margin: 0;
    color: #2D3436;
    font-size: 24px;
    font-weight: 700;
}

.date-navigator-center {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #FFFFFF;
    padding: 8px 16px;
    border-radius: 10px;
    border: 1px solid #DADDE7;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.date-nav-arrow {
    text-decoration: none;
    color: #636E72;
    font-size: 22px;
    font-weight: 700;
    padding: 0 5px;
    transition: color 0.2s;
}
.date-nav-arrow:hover { color: #FD7E14; }
.date-nav-arrow.disabled { opacity: 0.2; pointer-events: none; }

.date-display-label {
    color: #2D3436;
    font-weight: 700;
    font-size: 15px;
}

.datepicker-input {
    background: #F8F9FD;
    border: 1px solid #DADDE7;
    color: #2D3436;
    padding: 5px 8px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    font-size: 13px;
}
.datepicker-input:focus {
    outline: none;
    border-color: #FD7E14;
}

.semaine-heure-cell {
    box-sizing: border-box;
    border-radius: 4px;
}