/* ==================================== */
/* 1. CONFIGURATION GÉNÉRALE (Reset & Base) */
/* ==================================== */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f7fa; /* Fond général gris très clair */
    color: #333;
    line-height: 1.6;
    overflow-x: hidden; /* Empêche le scroll horizontal indésirable */
}

h1, h2, h3 {
    color: #34495e;
    margin-top: 0;
    margin-bottom: 20px;
}

/* ❌ IMPORTANT : On masque la navbar Bootstrap par défaut */
.navbar {
    display: none !important;
}

/* ==================================== */
/* 2. STRUCTURE PRINCIPALE (Sidebar & Main) */
/* ==================================== */

/* --- A. Contenu Principal (Zone de droite) --- */
main {
    margin-left: 260px; /* Laisse l'espace pour la sidebar (260px) */
    padding: 20px; 
    transition: margin-left 0.3s ease; 
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Conteneur blanc pour le contenu des pages */
main .container {
    flex: 1; 
    width: 100%; 
    max-width: 100%; /* Prend toute la largeur disponible dans le main */
    background-color: #ffffff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* Fallback pour les pages qui n'utilisent pas <main> (ex: login) */
.container { 
    width: 90%;
    max-width: 1200px;
    margin: 20px auto;
    background-color: #ffffff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* --- B. Menu Latéral (Sidebar) --- */
.sidebar {
    width: 260px;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    background-color: #2c3e50; 
    color: white;
    box-shadow: 2px 0 5px rgba(0,0,0,0.2);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

/* En-tête (Logo, Titre, Info utilisateur) */
.sidebar-header {
    padding: 20px 15px;
    background-color: #1a252f;
    border-bottom: 1px solid #34495e;
    text-align: center;
}

/* Le lien qui englobe le logo et le titre (pour le rendre cliquable vers l'accueil) */
.brand-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none !important; 
    color: inherit;
    transition: opacity 0.3s;
}

/* Style du Logo */
.sidebar-logo {
    max-width: 80px; 
    height: auto;
    margin-bottom: 10px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.1);
    background: #fff;
    padding: 2px;
}

/* Phrase "Logiciel de gestion optique" */
.app-subtitle {
    display: block;
    font-size: 0.7rem;
    color: #3498db; 
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 2px;
    font-weight: 600;
}

.sidebar-header h3 {
    margin: 5px 0 15px 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: #ecf0f1;
    text-transform: uppercase;
}

/* Info utilisateur */
.user-info {
    background: rgba(255, 255, 255, 0.05);
    padding: 8px;
    border-radius: 6px;
    width: 100%;
}
.user-info small {
    display: block;
    color: #bdc3c7;
    font-size: 0.85rem;
}
.role-badge {
    color: #f1c40f !important; 
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.7rem !important;
    margin-top: 2px;
}

/* Navigation Links */
.sidebar-nav {
    flex-grow: 1;
    overflow-y: auto; 
    padding-top: 10px;
}

.sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    text-decoration: none;
    color: #bdc3c7; 
    font-size: 1rem;
    border-left: 4px solid transparent;
    transition: all 0.3s ease;
}

.sidebar-nav li a:hover {
    background-color: #34495e;
    color: white;
    border-left-color: #3498db;
}

/* État Actif */
.sidebar-nav li a.active {
    background-color: #34495e;
    color: white;
    font-weight: 600;
    border-left-color: #f1c40f; 
}

.sidebar-nav li a i {
    margin-right: 15px;
    width: 20px; 
    text-align: center;
}

/* Pied du menu (Déconnexion) */
.sidebar-footer {
    padding: 15px;
    border-top: 1px solid #34495e;
    background-color: #1a252f;
}

.sidebar-footer a {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #e74c3c; 
    font-weight: bold;
    transition: color 0.3s;
}

/* Bouton Toggle (Caché sur Desktop) et Responsive */
.menu-toggle {
    display: none;
}
@media (max-width: 992px) {
    .sidebar { transform: translateX(-100%); width: 250px; }
    .sidebar.open { transform: translateX(0); box-shadow: 5px 0 15px rgba(0,0,0,0.5); }
    main { margin-left: 0; padding-top: 60px; }
    .menu-toggle { display: block; position: fixed; top: 15px; left: 15px; z-index: 1100; }
    #content-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.6); z-index: 999; }
    #content-overlay.active { display: block; }
}

/* ==================================== */
/* 3. COMPOSANTS UI (Dashboard, Tables, Forms) */
/* ==================================== */

/* --- A. Dashboard Cards (De votre accueil.php) --- */
.dashboard-stats {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.stat-card {
    background: white;
    border-radius: 8px;
    padding: 25px;
    flex: 1;
    min-width: 250px; /* Assure qu'elles ne sont pas trop petites */
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    border-top: 4px solid #3498db;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.stat-card h3 {
    font-size: 1.1rem;
    color: #7f8c8d;
    margin-bottom: 15px;
    text-transform: uppercase;
    font-weight: 500;
}

.stat-card .stat-value {
    font-size: 2.2rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 15px;
}

/* --- B. Tableaux --- */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    background-color: #fff;
    border: 1px solid #dee2e6;
}

table th, table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
    vertical-align: middle;
}

table th {
    background-color: #e9ecef;
    color: #495057;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
}

table tbody tr:hover {
    background-color: #f1f3f5;
}

/* Styles spécifiques pour les lignes d'alerte (selon votre accueil.php) */
.dashboard-section table tr[style*="background-color: #f8d7da;"] {
    color: #721c24; /* Danger: Stock Épuisé */
}
.dashboard-section table tr[style*="background-color: #fff3cd;"] {
    color: #856404; /* Warning: Stock Faible */
}

/* --- C. Boutons et autres composants (conservés pour la cohérence) --- */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 1rem;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
    text-align: center;
}
.btn-small { /* Votre classe dans stat-card */
    padding: 6px 12px;
    font-size: 0.9rem;
}

/* --- D. Footer --- */
footer {
    text-align: center;
    padding: 25px;
    color: #6c757d;
    font-size: 0.9rem;
    border-top: 1px solid #eee;
    background-color: #f8f9fa;
    margin-top: auto; 
}
/* ========================================= */
/* 1. FORMULAIRES MODERNES (Champs de saisie) */
/* ========================================= */

.form-group {
    margin-bottom: 20px;
}

/* INPUTS */
.form-control:not(select) {
    border-radius: 8px;
    border: 1px solid #d0d0d0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    padding: 20px 15px;
    transition: all 0.3s ease;
    color: #495057;
}

/* SELECT (menu déroulant) */
select.form-control {
    border-radius: 8px;
    border: 1px solid #d0d0d0;
    padding: 10px 12px; /* 🔥 padding NORMAL */
    height: auto;
    color: #495057;
    background-color: #ffffff;
}



/* Effet de focus plus moderne */
.form-control:focus {
    border-color: #007bff; /* La couleur primaire de Bootstrap */
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Assurer un bon look pour les labels */
label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 5px;
    display: block; /* S'assurer qu'ils sont sur leur propre ligne */
}

/* Style pour les petits textes d'aide */
.form-text {
    font-size: 0.85rem;
    color: #6c757d;
}
/* ==================================== */
/* 2. BOUTONS MODERNES (CORRIGÉ) */
/* ==================================== */

.btn {
    /* Arrondissement plus prononcé */
    border-radius: 10px; 
    /* Légère ombre par défaut */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    font-weight: 600;
    padding: 10px 20px;
    transition: all 0.3s ease;
    border: none; /* Supprimer la bordure par défaut de Bootstrap */
}

/* Effet de survol (Hover/Focus) */
.btn:hover, .btn:focus {
    /* Augmenter l'ombre (effet de "lévitation") */
    box-shadow: 0 8px 12px rgba(0, 0, 0, 0.2); 
    /* Léger effet de zoom ou de décalage si vous le souhaitez */
    transform: translateY(-1px); 
}

/* Bouton Primaire (Couleur principale) */
.btn-primary {
    background-color: #007bff; /* Votre couleur primaire (Bleu) */
    color: white; /* CORRECTION: Texte blanc sur fond bleu */
}
.btn-primary:hover {
    background-color: #0056b3; 
    color: white; /* CORRECTION: Texte blanc sur fond bleu */
}

/* Bouton Secondaire (Neutre) */
.btn-light, .btn-secondary {
    background-color: #e9ecef; /* Fond neutre et clair */
    color: #495057; /* Texte gris foncé */
    border: 1px solid #ced4da; /* Bordure neutre */
}
.btn-light:hover, .btn-secondary:hover {
    background-color: #d8dde1;
}

/* Bouton d'action (Info/Bleu clair) */
.btn-info {
    background-color: #17a2b8;
    color: white; /* AJOUT/CORRECTION: Texte blanc */
}
.btn-info:hover {
    background-color: #117a8b;
}

/* Bouton Danger (Rouge) */
.btn-danger {
    background-color: #dc3545;
    color: white; /* AJOUT/CORRECTION: Texte blanc */
}
.btn-danger:hover {
    background-color: #c82333;
}
/* ========================================= */
/* Correction Couleur Texte Menu Déroulant */
/* ========================================= */

/* Cible tous les éléments <select> qui utilisent la classe Bootstrap form-control */
.form-control[type="text"],
.form-control[type="email"],
.form-control[type="tel"],
.form-control[type="date"],
select.form-control,
.form-control {
    /* Couleur du texte pour garantir la visibilité sur fond blanc/clair */
    color: #495057 !important; /* Force le gris foncé pour le texte des formulaires */
}

/* S'assurer que les options à l'intérieur du menu sont aussi visibles */
select.form-control option {
    color: #000000; /* Forcer le noir pour les options */
}
select.form-control option {
    color: #000000;
    background-color: #ffffff;
}
