/* --- Reset Box Sizing (Bonne pratique) --- */
html {
  box-sizing: border-box;
}
*, *:before, *:after {
  box-sizing: inherit;
}
/* --- Fin du Reset --- */

/* --- Styles Généraux --- */
body {
    font-family: sans-serif;
    margin: 0;
    background-color: #f4f4f4;
    color: #333;
}

/* --- Page de Connexion --- */
.login-container {
    max-width: 400px;
    margin: 50px auto;
    padding: 30px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.login-container h1 {
    margin-bottom: 20px;
    color: #555;
}

.login-container div {
    margin-bottom: 15px;
    text-align: left;
}

.login-container label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.login-container input[type="text"],
.login-container input[type="password"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.login-container button {
    padding: 10px 20px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    width: 100%;
}

.login-container button:hover {
    background-color: #0056b3;
}

.error {
    color: #dc3545;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 15px;
    text-align: center;
}
.error[style="text-align: left;"] {
    text-align: left !important;
}


/* --- Dashboard Header --- */
.dashboard-header {
    background-color: #333;
    color: white;
    padding: 15px 30px;
    display: flex;
    align-items: center;
}
.dashboard-header h1 {
    margin: 0;
    font-size: 1.5em;
    flex-grow: 1; /* Garde ceci pour pousser user-info à droite */
    text-align: left; /* <<< MODIFIÉ */
    /* margin-left: -40px; -> SUPPRIMÉ */
    margin-left: 15px; /* <<< AJOUTÉ (Optionnel: espace à gauche) */
    padding-right: 20px; /* Garde l'espace avant user-info */
}
.user-info {
    white-space: nowrap;
}

.user-info span {
    margin-right: 15px;
}

.logout-button {
    color: #fff;
    background-color: #dc3545;
    padding: 8px 12px;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.logout-button:hover {
    background-color: #c82333;
}

/* --- Layout de base du Dashboard --- */
.dashboard-layout {
    display: flex;
    min-height: calc(100vh - 70px - 50px);
}

/* --- Styles de base de la Sidebar --- */
.sidebar {
    width: 230px;
    flex-shrink: 0;
    background-color: #f8f9fa;
    border-right: 1px solid #dee2e6;
    padding: 20px;
}

.sidebar h3 {
    margin-top: 0;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ccc;
    color: #495057;
    font-size: 1.1em;
}

.sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar hr {
    margin: 10px 0;
    border: 0;
    border-top: 1px solid #ddd;
}

.sidebar li a {
    display: block;
    padding: 10px 15px;
    color: #343a40;
    text-decoration: none;
    border-radius: 4px;
    margin-bottom: 5px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.sidebar li a:hover {
    background-color: #e9ecef;
    color: #0056b3;
}

.sidebar li a.active {
    background-color: #007bff;
    color: white;
    font-weight: bold;
}

/* --- Contenu Principal --- */
.dashboard-content {
    flex-grow: 1;
    padding: 30px;
    background-color: #fff;
    overflow-y: auto;
}

.dashboard-content h2 {
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
    margin-top: 0;
    margin-bottom: 20px;
}

/* --- Footer --- */
.dashboard-footer {
    text-align: center;
    padding: 15px;
    color: #777;
    font-size: 0.9em;
    border-top: 1px solid #eee;
    background-color: #f8f9fa;
}

/* --- Placeholder spécifique (dans projects/home.php) --- */
.projects-placeholder {
    background-color: #e9ecef;
    padding: 20px;
    border-radius: 5px;
    margin-top: 20px;
}
.projects-placeholder h4 {
    margin-top: 0;
    margin-bottom: 10px;
}
.projects-placeholder ul {
    list-style: none;
    padding: 0;
}
.projects-placeholder li {
   margin-bottom: 8px;
}
.projects-placeholder li a {
    text-decoration: none;
    color: #007bff;
}
.projects-placeholder li a:hover {
    text-decoration: underline;
}

/* ================================================ */
/* --- SECTION RESPONSIVE --- */
/* ================================================ */

/* --- Styles du bouton Toggle Sidebar (Hamburger) --- */
.sidebar-toggle-btn {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0 15px;
    order: -1;
}

/* --- Styles pour écrans MOYENS et PETITS (Tablettes et Mobiles) --- */
@media (max-width: 768px) {

    .sidebar-toggle-btn {
        display: block;
    }

    .dashboard-header h1 { /* Style mobile déjà à gauche */
         margin-left: 0;
         text-align: left;
         font-size: 1.2em;
         padding-right: 10px;
         flex-grow: 1; /* Garde flex-grow pour pousser user-info */
    }

    .dashboard-layout {
        display: block;
        position: relative;
        overflow-x: hidden;
    }

    .sidebar {
        position: fixed;
        left: -250px;
        top: 0;
        width: 230px;
        height: 100%;
        z-index: 1000;
        padding-top: 20px;
        transition: left 0.3s ease-in-out;
        box-shadow: 2px 0 5px rgba(0,0,0,0.2);
        background-color: #f8f9fa;
        border-right: 1px solid #dee2e6;
        overflow-y: auto;
    }

    .sidebar.visible {
        left: 0;
    }

    .dashboard-content {
        margin-left: 0;
        width: 100%;
        padding: 15px;
        transition: margin-left 0.3s ease-in-out;
    }

    body.sidebar-open .dashboard-content {
        margin-left: 230px;
    }

     .user-info span {
        display: none;
     }
     .user-info .logout-button {
         padding: 5px 8px;
     }
}

/* --- Optionnel: Styles pour TRES PETITS écrans --- */
@media (max-width: 480px) {
    .dashboard-header {
        padding: 10px 15px;
    }
     .dashboard-header h1 {
        font-size: 1.1em;
     }
    .sidebar {
        width: 200px;
        left: -220px;
        padding-top: 15px;
    }
     body.sidebar-open .dashboard-content {
        margin-left: 200px;
     }

     .dashboard-content h2 {
        font-size: 1.3em;
     }
}

/* --- Styles pour GRANDS écrans (Desktop) --- */
@media (min-width: 769px) {
    .dashboard-layout {
         display: flex;
         min-height: calc(100vh - 70px - 50px);
    }
    .sidebar {
        position: static;
        width: 230px;
        height: auto;
        left: auto;
        flex-shrink: 0;
        transition: none;
        padding-top: 20px;
        box-shadow: none;
        overflow-y: initial;
        z-index: auto;
    }
    .sidebar-toggle-btn {
        display: none;
    }
    .dashboard-content {
        flex-grow: 1;
        width: auto;
        padding: 30px;
        margin-left: 0;
        transition: none;
    }
     .dashboard-header h1 { /* Règle Desktop mise à jour */
         flex-grow: 1;
         text-align: left; /* <<< MODIFIÉ */
         /* margin-left: -40px; -> SUPPRIMÉ */
         margin-left: 15px; /* <<< AJOUTÉ */
         font-size: 1.5em;
         padding-right: 20px;
     }
     .user-info span {
        display: inline;
     }
     .user-info .logout-button {
         padding: 8px 12px;
     }
     body.sidebar-open .dashboard-content {
        margin-left: 0;
     }
}