/* ============================================================
   AutoTunisie — Styles de l'espace d'administration
   ============================================================ */

/* ---- Page de connexion ---- */
.page-login {
    min-height: 100vh;
    background: linear-gradient(135deg, #1a2744, #1e3a8a);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Boîte de connexion centrée */
.login-conteneur {
    width: 100%;
    max-width: 420px;
    padding: 1rem;
}

.login-boite {
    background: #ffffff;
    border-radius: 16px;
    padding: 2.5rem;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-entete {
    text-align: center;
    margin-bottom: 2rem;
}

.login-icone {
    font-size: 3rem;
    margin-bottom: .7rem;
}

.login-entete h1 {
    font-size: 1.5rem;
    font-weight: 800;
    color: #1a2744;
    margin-bottom: .3rem;
}

.login-entete p {
    font-size: .88rem;
    color: #6b7280;
}

/* Lien de retour sous le formulaire de login */
.lien-login-retour {
    display: block;
    text-align: center;
    margin-top: 1.2rem;
    font-size: .85rem;
    color: #6b7280;
    transition: color .2s;
}

.lien-login-retour:hover {
    color: #1e3a8a;
}

/* ============================================================
   LAYOUT PRINCIPAL DU DASHBOARD (sidebar + contenu)
   ============================================================ */
.admin-body {
    display: flex;
    min-height: 100vh;
    background-color: #f3f4f8;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ---- Barre latérale ---- */
.admin-sidebar {
    width: 230px;
    background-color: #1a2744;
    color: #ffffff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 50;
    overflow-y: auto;
}

/* Logo dans la sidebar */
.sidebar-entete {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: 1.5rem 1.2rem;
    font-size: 1.1rem;
    font-weight: 700;
    border-bottom: 1px solid rgba(255,255,255,.1);
}

/* Liens de navigation dans la sidebar */
.sidebar-nav {
    padding: 1rem 0;
    flex: 1;
}

.sidebar-lien {
    display: block;
    padding: .75rem 1.2rem;
    color: rgba(255,255,255,.7);
    font-size: .9rem;
    font-weight: 500;
    transition: all .2s ease;
    border-left: 3px solid transparent;
}

.sidebar-lien:hover {
    color: #ffffff;
    background-color: rgba(255,255,255,.06);
    border-left-color: rgba(255,255,255,.3);
}

/* Lien actif dans la sidebar */
.sidebar-lien.actif {
    color: #ffffff;
    background-color: rgba(245,158,11,.15);
    border-left-color: #f59e0b;
}

/* Lien de déconnexion — rouge discret */
.sidebar-lien.danger {
    color: #fca5a5;
    margin-top: auto;
}

.sidebar-lien.danger:hover {
    color: #ef4444;
    background-color: rgba(239,68,68,.08);
    border-left-color: #ef4444;
}

/* ---- Zone de contenu principal ---- */
.admin-contenu {
    margin-left: 230px;
    flex: 1;
    padding: 2rem;
    max-width: calc(100vw - 230px);
}

/* En-tête du dashboard (titre + bouton) */
.admin-entete {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: .8rem;
}

.admin-entete h1 {
    font-size: 1.5rem;
    font-weight: 800;
    color: #1a2744;
}

.admin-entete p {
    font-size: .85rem;
    color: #6b7280;
    margin-top: .2rem;
}

/* ============================================================
   CARTES DE STATISTIQUES
   ============================================================ */
.stats-grille {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

/* Chaque carte de statistique */
.stat-carte {
    background: #ffffff;
    border-radius: 12px;
    padding: 1.3rem 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform .2s;
}

.stat-carte:hover {
    transform: translateY(-2px);
}

.stat-icone {
    font-size: 2rem;
    flex-shrink: 0;
}

/* Nombre affiché en grand */
.stat-nombre {
    font-size: 1.5rem;
    font-weight: 800;
    color: #1a2744;
    line-height: 1.1;
}

.stat-label {
    font-size: .8rem;
    color: #6b7280;
    margin-top: .15rem;
}

/* ============================================================
   SECTIONS ET TABLEAUX
   ============================================================ */
.admin-section {
    background: #ffffff;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
    margin-bottom: 2rem;
}

/* En-tête d'une section (titre + bouton d'action) */
.section-entete {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.2rem;
    flex-wrap: wrap;
    gap: .5rem;
}

.section-entete h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1a2744;
}

/* Wrapper avec défilement horizontal sur petit écran */
.tableau-wrapper {
    overflow-x: auto;
}

/* Tableau de données */
.tableau-admin {
    width: 100%;
    border-collapse: collapse;
    font-size: .88rem;
    min-width: 700px;
}

.tableau-admin thead th {
    background-color: #f3f4f8;
    color: #6b7280;
    font-weight: 600;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .5px;
    padding: .75rem 1rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.tableau-admin tbody td {
    padding: .85rem 1rem;
    border-bottom: 1px solid #f3f4f8;
    color: #1f2937;
    vertical-align: middle;
}

.tableau-admin tbody tr:hover td {
    background-color: #fafbff;
}

.tableau-admin tbody tr:last-child td {
    border-bottom: none;
}

/* Cellule avec plusieurs boutons d'action */
.actions-cellule {
    display: flex;
    gap: .4rem;
    flex-wrap: wrap;
}

/* Cellule lieu de prise en charge — texte tronqué avec tooltip au survol */
.lieu-cellule {
    max-width: 180px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: help;
}

/* Message quand le tableau est vide */
.cellule-vide {
    text-align: center;
    padding: 2.5rem !important;
    color: #9ca3af;
    font-style: italic;
}

/* Bouton petit (dans les tableaux) */
.btn-petit {
    padding: .3rem .7rem !important;
    font-size: .78rem !important;
    border-radius: 6px !important;
}

/* ============================================================
   FORMULAIRES ADMIN (ajout/modification)
   ============================================================ */
.formulaire-admin {
    background: #ffffff;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
}

/* Grille de champs sur plusieurs colonnes */
.grille-champs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

/* Case à cocher (disponible) */
.champ-checkbox label {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-weight: 500;
    cursor: pointer;
    font-size: .9rem;
}

.champ-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #1e3a8a;
}

/* Boutons en bas du formulaire */
.actions-formulaire {
    display: flex;
    gap: .8rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

/* ---- Étoiles dans le tableau des avis ---- */
.etoiles-pleines { color: #f59e0b; }
.etoiles-vides   { color: #d1d5db; }

/* ============================================================
   RESPONSIVE ADMIN
   ============================================================ */
@media (max-width: 768px) {

    /* La sidebar devient une barre horizontale en haut */
    .admin-body {
        flex-direction: column;
    }

    .admin-sidebar {
        width: 100%;
        height: auto;
        position: relative;
        flex-direction: column;
    }

    /* Les liens de nav en ligne avec défilement horizontal */
    .sidebar-nav {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        padding: .4rem;
        gap: .2rem;
        scrollbar-width: none;
    }
    .sidebar-nav::-webkit-scrollbar { display: none; }

    .sidebar-lien {
        white-space: nowrap;
        flex-shrink: 0;
        border-left: none !important;
        border-bottom: 2px solid transparent;
        padding: .5rem .9rem;
        font-size: .82rem;
    }

    .sidebar-lien.actif {
        border-left: none;
        border-bottom-color: #f59e0b;
    }

    /* Le contenu occupe toute la largeur */
    .admin-contenu {
        margin-left: 0;
        max-width: 100%;
        padding: 1rem;
    }

    /* Stats en 2 colonnes sur tablette */
    .stats-grille {
        grid-template-columns: 1fr 1fr;
    }

    /* En-tête admin plus compact */
    .admin-entete {
        flex-direction: column;
        align-items: flex-start;
        gap: .6rem;
    }

    /* Grille de champs du formulaire en 1 colonne */
    .grille-champs {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {

    /* Stats en 1 colonne sur petit mobile */
    .stats-grille {
        grid-template-columns: 1fr;
    }

    .formulaire-admin {
        padding: 1rem;
    }

    .actions-formulaire {
        flex-direction: column;
    }

    .actions-formulaire .btn {
        width: 100%;
        text-align: center;
    }
}
