@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap');

:root {
    --primary-color: #4A90E2;
    --secondary-color: #f0f2f5;
    --text-color: #333;
    --light-text-color: #666;
    --border-color: #e0e0e0;
    --card-bg: #fff;
    --sidebar-bg: #007FFF; 
    --sidebar-text: #ecf0f1;
    --sidebar-hover: #34495e;
    --positive-change: #28a745;
    --negative-change: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    
    /* Variables de composants */
    --box-shadow-light: 0 2px 8px rgba(0, 0, 0, 0.08);
    --box-shadow-medium: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* --- STRUCTURE DE BASE --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--secondary-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    display: flex;
    width: 100%;
    min-height: 100vh;
    align-items: stretch;
}

/* --- SIDEBAR --- */
.sidebar {
    background-color: #2b2d42;
    width: 280px;
    height: 100vh; /* Prend toute la hauteur de l'écran */
    position: fixed; /* Reste bloqué même si on défile */
    top: 0;
    left: 0;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    overflow-y: auto; /* Permet de défiler à l'intérieur de la sidebar si le menu est long */
}
.sidebar {
    width: 250px;
    min-width: 250px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    padding: 20px 0;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    z-index: 1000;
}
/* Ajoutez ceci dans la section <style> de sidebar.php */
.sidebar-header h3 {
    color: white !important;
}
/* Ciblage précis du titre dans la sidebar */
.sidebar-header h3 {
    color: #ffffff !important; /* Force la couleur blanche */
    margin-top: 10px;
    font-size: 1.2rem;
    font-weight: 600;
    text-align: center;
}
.sidebar-title {
    color: white;
    /* autres styles si besoin */
}
.sidebar-header {
    text-align: center;
    margin-bottom: 30px;
    padding: 0 20px;
}

.sidebar-header h3 {
    font-size: 1.8em;
    font-weight: 700;
    color: #fff;
}

.navigation ul { list-style: none; }

.navigation ul li a {
    display: flex;
    align-items: center;
    padding: 12px 25px;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: all 0.3s ease;
}

.navigation ul li.active a,
.navigation ul li a:hover {
    background-color: var(--sidebar-hover);
    color: #fff;
    border-left: 5px solid var(--card-bg);
}

/* --- CONTENU PRINCIPAL --- */
.main-content {
    flex-grow: 1;
    padding: 30px;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.header-bar {
    background-color: var(--card-bg);
    padding: 20px 30px;
    border-radius: 8px;
    box-shadow: var(--box-shadow-light);
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* --- MESSAGES D'ALERTE (PHP SESSIONS) --- */
.alert {
    padding: 15px 20px;
    margin-bottom: 25px;
    border-radius: 6px;
    border-left: 5px solid;
    font-weight: 500;
}

.alert-success { background-color: #d4edda; color: #155724; border-color: #28a745; }
.alert-error, .alert-danger { background-color: #f8d7da; color: #721c24; border-color: #dc3545; }
.alert-warning { background-color: #fff3cd; color: #856404; border-color: #ffc107; }
.alert-info { background-color: #d1ecf1; color: #0c5460; border-color: #17a2b8; }

/* --- TABLEAUX --- */
.data-table-container {
    background-color: var(--card-bg);
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--box-shadow-medium);
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background-color: #f8f9fa;
    padding: 12px;
    text-align: left;
    font-size: 0.9em;
    color: var(--light-text-color);
    border-bottom: 2px solid var(--border-color);
}

.data-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

/* Couleurs de lignes pour stock.php */
.row-critical { background-color: #fff5f5 !important; }
.row-warning { background-color: #fffdf0 !important; }

/* --- BADGES --- */
.status-badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.75em;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-block;
}

.status-in-stock, .status-livré, .status-active { background: #d4edda; color: #155724; }
.status-low-stock, .status-en-attente { background: #fff3cd; color: #856404; }
.status-out-of-stock, .status-annulé, .status-error { background: #f8d7da; color: #721c24; }
.status-inactive, .status-archived { background: #e9ecef; color: #6c757d; }

/* --- MODALES --- */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(3px);
}

.modal-content {
    background-color: var(--card-bg);
    margin: 10% auto;
    padding: 30px;
    width: 90%;
    max-width: 600px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    position: relative;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* --- PAGINATION --- */
.pagination-container {
    margin-top: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.pagination {
    display: flex;
    gap: 5px;
}

.page-link {
    padding: 8px 16px;
    background: #fff;
    border: 1px solid var(--border-color);
    color: var(--primary-color);
    text-decoration: none;
    border-radius: 4px;
    font-weight: bold;
    transition: 0.2s;
}

.page-link:hover { background: #f8f9fa; }
.page-link.active { background: var(--primary-color); color: #fff; border-color: var(--primary-color); }
.page-link.disabled { color: #ccc; pointer-events: none; background: #fafafa; }

/* --- BOUTONS --- */
.btn {
    padding: 10px 20px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: 0.3s;
    text-decoration: none;
}

.btn-primary { background: var(--primary-color); color: #fff; }
.btn-primary:hover { background: var(--button-primary-hover); }
.btn-secondary { background: #7f8c8d; color: #fff; }

/* --- Styles pour stock.php (APCSC) --- */

/* Conteneur de statistiques compact */
.stats-container {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.stat-card {
    flex: 1;
    background: white;
    padding: 10px 15px;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border-left: 4px solid #ddd;
}

.stat-card label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #7f8c8d;
    margin-bottom: 2px;
}

.stat-card span {
    font-size: 1.25rem;
    font-weight: bold;
    color: #2c3e50;
}

.stat-card.out { border-left-color: #dc3545; }
.stat-card.low { border-left-color: #ffc107; }

/* Table de données optimisée */
.data-table-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.08);
    overflow: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead tr {
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
}

.data-table th {
    padding: 10px;
    font-size: 0.9rem;
    color: #495057;
}

.data-table td {
    padding: 8px 10px; /* Padding réduit pour supprimer les espaces */
    vertical-align: middle;
    border-bottom: 1px solid #f1f1f1;
}

/* Badges de statut compacts */
.status-badge {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-block;
}

.status-in-stock { background: #e6ffe6; color: #1e8449; border: 1px solid #c3e6cb; }
.status-low-stock { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }
.status-out-of-stock { background: #f8d7da; color: #dc3545; border: 1px solid #f5c6cb; }
.status-inactive { background: #e9ecef; color: #6c757d; border: 1px solid #dee2e6; }

/* Alertes de lignes */
.row-critical { background-color: #fff5f5 !important; }
.row-warning { background-color: #fffdf0 !important; }

/* Typographie secondaire */
small {
    color: #95a5a6;
    display: block;
    font-size: 0.75rem;
    margin-top: -2px;
}

/* Pagination compacte */
.pagination-container {
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #fff;
    border-top: 1px solid #eee;
}

.pagination {
    display: flex;
    gap: 4px;
}

.page-link {
    padding: 5px 10px;
    background: #f8f9fa;
    border: 1px solid #ddd;
    text-decoration: none;
    color: #3498db;
    border-radius: 4px;
    font-size: 0.85rem;
}

.page-link.active {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

.page-link.disabled {
    color: #ccc;
    pointer-events: none;
    background: #fafafa;
}

/* --- RESPONSIVE --- */
@media (max-width: 768px) {
    .container { flex-direction: column; }
    .sidebar { width: 100%; min-height: auto; }
    .main-content { padding: 15px; }
}