/*
 * /technique/style.css
 * Styles complets pour l'application GMAO (Thème Sombre)
 */

/* ================================================= */
/* 0. VARIABLES GLOBALES ET RESET DE BASE */
/* ================================================= */

:root {
    /* Couleurs du Thème */
    --color-primary: #1e3a5f;       /* Bleu foncé (Utilisé dans les titres ou fonds subtils) */
    --color-accent-primary: #ffc300; /* Jaune/Orange vif (Pour l'accentuation, titres de section) */
    --color-accent-secondary: #00bfff; /* Bleu ciel (Pour l'information, boutons info) */
    --color-success: #28a745;       /* Vert standard (Boutons succès) */
    --color-danger: #dc3545;        /* Rouge standard (Alertes, boutons danger) */
    
    /* Couleurs de Fond et Texte */
    --color-background-dark: #121212; /* Fond très sombre */
    --color-background-card: #1a1a2e; /* Fond des cartes/contenus */
    --color-background-sidebar: #181818; /* Fond de la sidebar */
    --color-text-light: #ffffff;    /* Texte clair principal */
    --color-border: #333366;           /* Bordures et séparateurs */
    
    /* Espacement */
    --spacing-default: 15px;
}

/* Réinitialisation de base */
* {
    box-sizing: border-box;
}

html, body {
    height: 100%; 
    margin: 0;
    padding: 0;
    font-family: 'Roboto', 'Arial', sans-serif;
    background-color: var(--color-background-dark) !important; 
    color: var(--color-text-light); 
}
a {
    color: var(--color-accent-secondary); 
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

/* ================================================= */
/* 1. MISE EN PAGE PRINCIPALE (Flexbox) */
/* ================================================= */

.app-container {
    display: flex; 
    min-height: 100vh;
    width: 100%;
}

.main-content {
    flex-grow: 1; 
    padding: 20px;
    overflow-y: auto; 
    display: flex; 
    flex-direction: column;
}

/* ================================================= */
/* 2. SIDEBAR (Navigation Latérale) */
/* ================================================= */

.sidebar {
    width: 250px;
    background-color: var(--color-background-sidebar); 
    color: var(--color-text-light);
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.7); 
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    z-index: 1000;
}

.logo-area {
    padding: 20px 0;
    text-align: center;
    border-bottom: 1px solid var(--color-border);
}
.logo-main {
    max-width: 120px;
    height: auto;
}

.sidebar-menu {
    flex-grow: 1;
    overflow-y: auto;
    padding-top: 10px;
}
.sidebar-menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.sidebar-header {
    color: var(--color-accent-primary);
    text-transform: uppercase;
    font-size: 0.75em;
    padding: 15px 20px 5px 20px;
    font-weight: bold;
    letter-spacing: 0.5px;
}

.sidebar a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: var(--color-text-light);
    text-decoration: none;
    transition: background-color 0.2s;
    font-size: 0.9em;
}
.sidebar a i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
    color: var(--color-accent-secondary);
}

.sidebar a:hover {
    background-color: rgba(255, 195, 0, 0.1); 
}
.sidebar a.active {
    background-color: var(--color-accent-primary); 
    color: var(--color-background-dark); 
    font-weight: bold;
}
.sidebar a.active i {
    color: var(--color-background-dark);
}

.logout-link {
    padding: 15px 0;
    border-top: 1px solid var(--color-border);
}
.logout-link a {
    color: var(--color-danger) !important;
}
.logout-link a i {
    color: var(--color-danger) !important;
}

/* ================================================= */
/* 3. HEADER ET CONTENU */
/* ================================================= */

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background-color: var(--color-background-card); 
    color: var(--color-text-light);
    margin: -20px -20px 20px -20px; 
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    border-radius: 0 0 8px 8px;
    flex-shrink: 0;
}
.user-info span, .date-time i {
    color: var(--color-accent-primary);
}
.text-role {
    font-weight: bold;
    color: var(--color-accent-secondary);
}

.content-area {
    flex-grow: 1;
}

.container {
    width: 100%;
    max-width: 1300px;
    margin: 0 auto;
    padding-right: 15px;
    padding-left: 15px;
    box-sizing: border-box;
}

.page-header h1 {
    color: var(--color-text-light);
    margin-bottom: 25px;
    font-size: 2em;
}
.page-header h1 i {
    margin-right: 10px;
    color: var(--color-accent-secondary);
}


/* Styles de carte/boîte de contenu */
.card, .content-box {
    background-color: var(--color-background-card);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3); 
}
.content-box h2 {
    color: var(--color-accent-primary); 
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.5em;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 10px;
}
.content-box h2 i {
    margin-right: 10px;
    color: var(--color-accent-secondary);
}


/* ================================================= */
/* 4. BOUTONS (Esthétique Moderne) */
/* ================================================= */

.btn {
    display: inline-flex; 
    align-items: center; 
    padding: 0.75rem 1.25rem; 
    font-size: 1rem;
    font-weight: bold;
    border: none; 
    border-radius: 8px; 
    cursor: pointer;
    transition: all 0.2s ease-in-out; 
    text-decoration: none; 
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3); 
    min-width: 200px; 
    justify-content: center;
    color: var(--color-text-light); 
}

.btn i {
    margin-right: 8px; 
}

.btn:hover {
    transform: translateY(-2px); 
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4); 
}

/* Bouton Info (Créer Commande Manuelle) */
.btn-info {
    background-color: var(--color-accent-secondary); 
    background-image: linear-gradient(135deg, var(--color-accent-secondary) 0%, #007bff 100%); 
}
.btn-info:hover {
    background-color: #0099e6; 
    background-image: linear-gradient(135deg, #0099e6 0%, #0066cc 100%);
}

/* Bouton Success (Entrée Manuelle de Stock) */
.btn-success {
    background-color: var(--color-success); 
    background-image: linear-gradient(135deg, var(--color-success) 0%, #218838 100%); 
}
.btn-success:hover {
    background-color: #218838;
    background-image: linear-gradient(135deg, #218838 0%, #1e7e34 100%);
}

/* Bouton Principal */
.btn-primary {
    color: var(--color-background-dark) !important; 
    background-color: var(--color-accent-primary); 
    border-color: var(--color-accent-primary);
    font-weight: bold; 
    background-image: linear-gradient(135deg, var(--color-accent-primary) 0%, #ffbb00 100%);
}
.btn-primary:hover {
    background-color: #e6b200; 
    border-color: #e6b200;
    color: var(--color-background-dark) !important; 
    background-image: linear-gradient(135deg, #e6b200 0%, #cc9900 100%);
}

/* Bouton Secondaire (Annuler, Fermer) */
.btn-secondary {
    background-color: #6c757d;
    background-image: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
}
.btn-secondary:hover {
    background-color: #5a6268;
    background-image: linear-gradient(135deg, #5a6268 0%, #495057 100%);
}

/* Bouton Danger (Supprimer) */
.btn-danger {
    background-color: var(--color-danger);
    background-image: linear-gradient(135deg, var(--color-danger) 0%, #c82333 100%);
}
.btn-danger:hover {
    background-color: #c82333;
    background-image: linear-gradient(135deg, #c82333 0%, #bd2130 100%);
}

/* Bouton Compact (actions inline dans les tableaux) */
.btn-sm {
    min-width:auto;
    padding: 0.4rem 0.7rem;
    font-size: 0.85rem;
    box-shadow: none;
}


/* ================================================= */
/* 5. CLASSES UTILITAIRES DE MISE EN PAGE */
/* ================================================= */

/* Flexbox */
.d-flex {
    display: flex !important;
}
.justify-content-start {
    justify-content: flex-start !important;
}

/* Espacement */
.mr-3 { 
    margin-right: 1rem !important; 
}
.mb-4 { 
    margin-bottom: 1.5rem !important; 
}
.ml-2 {
    margin-left: 0.5rem !important;
}


/* ================================================= */
/* 6. TABLEAUX ET ALERTES */
/* ================================================= */

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.table {
    width: 100%;
    margin-bottom: 1rem;
    color: var(--color-text-light);
    border-collapse: collapse;
}
.table th, .table td { 
    padding: 0.75rem; 
    border-top: 1px solid var(--color-border);
    vertical-align: middle;
}
.table thead th { 
    border-bottom: 2px solid var(--color-border);
    color: var(--color-accent-primary);
    text-align: left;
    font-weight: normal;
}
.table-striped tbody tr:nth-of-type(odd) { 
    background-color: rgba(255, 255, 255, 0.05); 
}
.table-hover tbody tr:hover { 
    background-color: rgba(255, 255, 255, 0.1); 
}

/* Alertes */
.alert {
    padding: var(--spacing-default);
    margin-bottom: var(--spacing-default);
    border-radius: 4px;
    font-weight: bold;
    border: none;
}
.alert-success { background-color: #1e3c23; color: #7fbf8a; } 
.alert-danger { background-color: #4f2323; color: #ea868f; }   
.alert-info { background-color: #1a3c5a; color: #90c2e6; }     
.alert-warning { background-color: #5a4b1a; color: #ffdc7a; }  
.alert i {
    margin-right: 8px;
}

.table-warning { background-color: rgba(255, 195, 0, 0.15) !important; }
.table-danger { background-color: rgba(220, 53, 69, 0.15) !important; }

/* Badges */
.badge {
    display: inline-block;
    padding: 0.3em 0.6em;
    font-size: 75%;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.25rem;
}
.badge-danger { background-color: var(--color-danger); color: white; }
.badge-info { background-color: var(--color-accent-secondary); color: white; }
.badge-success { background-color: var(--color-success); color: white; }
.badge-warning { background-color: var(--color-accent-primary); color: var(--color-background-dark); }
.badge-secondary { background-color: #6c757d; color: white; }

/* Bouton Warning (Valider un compte en attente) */
.btn-warning {
    color: var(--color-background-dark) !important;
    background-color: var(--color-accent-primary);
    background-image: linear-gradient(135deg, var(--color-accent-primary) 0%, #e6b200 100%);
}
.btn-warning:hover {
    background-color: #e6b200;
    background-image: linear-gradient(135deg, #e6b200 0%, #cc9900 100%);
}

/* ================================================= */
/* 7. DASHBOARD (KPI Cards and Module Grid) */
/* ================================================= */

/* Titre de Section */
.separator-heading {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--color-accent-primary); 
    border-bottom: 2px solid var(--color-border);
    padding-bottom: 5px;
    margin-top: 30px;
    margin-bottom: 20px;
}

/* Grille pour les KPI */
.kpi-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); 
    gap: var(--spacing-default);
}

.kpi-card {
    background-color: var(--color-background-card);
    padding: var(--spacing-default);
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s, box-shadow 0.2s;
    border-left: 5px solid var(--color-border); 
}

.kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.kpi-icon {
    font-size: 2.5rem;
    margin-bottom: 5px;
}

.kpi-value {
    font-size: 3rem; 
    font-weight: 800;
    margin: 5px 0;
    line-height: 1;
}

.kpi-label {
    font-size: 0.9rem;
    text-transform: uppercase;
    color: #bbb;
}

/* Couleurs spécifiques des KPI pour l'alerte visuelle */
.danger-kpi { border-left-color: var(--color-danger); } 
.danger-kpi .kpi-icon { color: var(--color-danger); }

.warning-kpi { border-left-color: var(--color-accent-primary); } 
.warning-kpi .kpi-icon { color: var(--color-accent-primary); }

.info-kpi { border-left-color: var(--color-accent-secondary); } 
.info-kpi .kpi-icon { color: var(--color-accent-secondary); }

.success-kpi { border-left-color: var(--color-success); } 
.success-kpi .kpi-icon { color: var(--color-success); }


/* Grid pour les modules d'accès rapides */
.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.module-card {
    background-color: var(--color-background-card);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 200px; 
}

.module-card h3 {
    font-size: 1.25rem;
    color: var(--color-accent-primary);
    margin-top: 0;
}

.module-card .module-description {
    font-size: 0.95rem;
    color: #aaa;
    flex-grow: 1; 
}

.btn-module {
    display: block;
    width: 100%;
    padding: 10px;
    text-align: center;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 700;
    margin-top: 15px;
    transition: opacity 0.2s;
}

.btn-module:hover {
    opacity: 0.85;
}

/* ================================================= */
/* 8. RESPONSIVITÉ DE BASE */
/* ================================================= */

@media (max-width: 992px) {
    /* CORRECTION : les regles .app-container et .sidebar ci-dessous
       dataient d'avant le menu hamburger (mise en page empilee simple).
       Elles entraient en conflit avec les regles plus recentes de
       template.php (menu hamburger, sidebar hors-ecran en position
       fixed) sur la meme plage d'ecran, ce qui compressait le contenu
       principal dans une colonne etroite au lieu de prendre toute la
       largeur. template.php gere desormais entierement la mise en page
       en dessous de 992px (deux paliers : 769-992px et <=768px) --
       retirees d'ici pour ne plus les contredire. */
    .main-content {
        padding: 10px;
    }
    .btn {
        min-width: unset;
        width: 100%;
        margin-bottom: 10px !important;
    }
    .mb-4.d-flex {
        flex-direction: column;
    }
    .mr-3 {
        margin-right: 0 !important;
    }
}


/* ================================================= */
/* 9. STYLES SPÉCIFIQUES CONNEXION/ENREGISTREMENT (SUPER ESTHÉTIQUE) */
/* ================================================= */

/* 1. CENTRAGE GARANTI */
.login-page-body { 
    display: flex;
    justify-content: center;
    align-items: center; 
    min-height: 100vh;
    padding: 20px;
    background-color: var(--color-background-dark) !important; 
}

/* 2. CONTENEUR FLOTTANT AVEC GLOW AMÉLIORÉ */
.register-container, .login-container { 
    width: 100%;
    max-width: 480px; /* Légèrement plus large pour l'esthétique */
    padding: 40px; 
    background-color: var(--color-background-card) !important; 
    border-radius: 12px; /* Bords plus arrondis */
    /* Ombre plus prononcée pour l'effet 'flottant' */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.9); 
    text-align: center; 
    border: 1px solid rgba(255, 195, 0, 0.1); /* Bordure subtilement jaune */
    transition: box-shadow 0.3s ease-in-out;
}

.register-container:hover, .login-container:hover {
    /* Lueur plus intense au survol */
    box-shadow: 0 0 30px rgba(255, 195, 0, 0.5), 0 10px 30px rgba(0, 0, 0, 0.9);
}

.logo-login { 
    max-width: 150px; 
    margin-bottom: 25px; /* Plus d'espace */
}

/* 3. COULEUR JAUNE IMPOSÉE & TYPOGRAPHIE AFFINÉE */
.register-container h1, .login-container h1 { 
    color: var(--color-accent-primary) !important; 
    margin-top: 15px; 
    margin-bottom: 5px; 
    font-size: 1.8em; /* Plus grand */
    font-weight: 500; 
}
.register-container p.subtitle, .login-container p.subtitle {
    color: var(--color-accent-primary) !important; /* GARANTI EN JAUNE */
    font-size: 1.1em;
    margin-bottom: 35px; 
    font-weight: 400;
}

/* AMÉLIORATION DU FORMULAIRE */
.form-group { 
    margin-bottom: 25px; 
    text-align: left; 
}
.form-group label { 
    display: block; 
    margin-bottom: 8px; 
    font-weight: 500; 
    color: var(--color-text-light); 
    font-size: 1em; 
}
.form-group input { 
    width: 100%; 
    padding: 15px; 
    border: 1px solid var(--color-border); 
    border-radius: 8px; /* Bords des inputs plus doux */
    background-color: #212529; 
    color: var(--color-text-light); 
    box-sizing: border-box; 
    transition: border-color 0.3s, box-shadow 0.3s;
    font-size: 1.1em; 
}
.form-group input:focus {
    border-color: var(--color-accent-primary);
    outline: none;
    /* Lueur de focus plus forte et plus belle */
    box-shadow: 0 0 0 3px rgba(255, 195, 0, 0.6); 
}

/* Bouton d'Enregistrement/Connexion (Inchangé, déjà super) */
.btn-register, .btn-login { 
    width: 100%; 
    padding: 16px; /* Légèrement plus grand */
    font-size: 1.2em; 
    margin-top: 30px; 
    font-weight: bold; 
    
    color: var(--color-background-dark) !important; 
    background-color: var(--color-accent-primary); 
    border: none; 
    border-radius: 8px; /* Bords du bouton plus doux */
    cursor: pointer; 
    transition: all 0.2s; 
    background-image: linear-gradient(135deg, var(--color-accent-primary) 0%, #ffbb00 100%);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.btn-register:hover, .btn-login:hover {
    background-color: #e6b200; 
    background-image: linear-gradient(135deg, #e6b200 0%, #cc9900 100%);
    transform: translateY(-1px); /* Petite animation au survol */
    box-shadow: 0 6px 10px rgba(0, 0, 0, 0.5);
}
.btn-register i, .btn-login i {
    margin-right: 8px;
}

/* Alertes spécifiques (Inchangé) */
.alert-error, .alert-success { 
    padding: 15px; 
    border-radius: 5px; 
    margin-bottom: 20px; 
    font-weight: 500;
    text-align: left;
}
.alert-error {
    background-color: #4f2323; 
    color: #ea868f; 
}
.alert-success {
    background-color: #1e3c23; 
    color: #7fbf8a; 
}
.alert-error i, .alert-success i {
    margin-right: 10px;
}

/* Lien de connexion/enregistrement (Inchangé) */
.login-link, .register-link { 
    margin-top: 25px; 
    font-size: 0.9em; 
    color: var(--color-text-light); 
}
.login-link a, .register-link a { 
    color: var(--color-accent-primary); 
    text-decoration: none; 
    font-weight: bold; 
}
.login-link a:hover, .register-link a:hover {
    text-decoration: underline;
}