/* ==========================================================================
   GLOBAL STYLES & BLEU VIBRANT D'ORIGINE (CORRIGÉ - ZÉRO INVISIBILITÉ)
   ========================================================================== */
:root {
    --gestock-orange: #FFA500;
    --purchases-blue: #007bff;
    --sales-green: #28a745;
    --services-cyan: #0dcaf0;
    --expenses-red: #dc3545;
    --taxes-purple: #6f42c1;
    --stock-orange: #fd7e14;
    --reports-dark-blue: #0d6efd;
    
    /* Retour au fond bleu lumineux et élégant d'origine */
    --main-bg: linear-gradient(135deg, #e0eafc 0%, #cfdef3 100%);
    --glass-bg: rgba(255, 255, 255, 0.95); 
    --glass-border: rgba(255, 255, 255, 0.9);
    --text-dark: #0f172a;
    --text-muted: #334155;
    --vibrant-shadow: 0 4px 20px rgba(31, 38, 135, 0.12);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Poppins', sans-serif;
    background: var(--main-bg);
    background-attachment: fixed;
    color: var(--text-dark) !important;
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   FORCER LA LISIBILITÉ TOTALE (PLUS AUCUNE ÉCRITURE INVISIBLE)
   ========================================================================== */
h1, h2, h3, h4, h5, h6, 
p, span, label, th, td, 
strong, b, .form-label {
    color: var(--text-dark) !important;
}

/* Tableaux : Facturation électronique et Dépenses (Désignation, Quantité, Montants bien visibles) */
.table {
    color: var(--text-dark) !important;
}

.table th {
    background-color: #f1f5f9 !important;
    color: #0f172a !important;
    font-weight: 700 !important;
    border-color: #cbd5e1 !important;
}

.table td {
    color: #0f172a !important;
    vertical-align: middle !important;
    font-weight: 500;
}

/* Champs de saisie à l'intérieur des tableaux (factures, dépenses) */
.table input.form-control, 
.table select.form-select {
    background-color: #ffffff !important;
    color: #0f172a !important;
    border: 1px solid #94a3b8 !important;
    font-weight: 600 !important;
}

/* ==========================================================================
   HEADER & NAVIGATION
   ========================================================================== */
header {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 1030;
    padding: 8px 0;
}

.header-title {
    color: var(--purchases-blue) !important;
    text-transform: uppercase;
    font-size: 1.5rem;
    letter-spacing: 2px;
    font-weight: 800;
    text-decoration: none;
}

.navbar-nav .nav-link {
    font-weight: 700;
    color: var(--text-dark) !important;
    margin: 0 2px;
    border-radius: 8px;
    padding: 6px 12px !important;
    font-size: 0.88rem;
    transition: all 0.2s ease;
}

.nav-link.btn-achats.active { background: var(--purchases-blue) !important; color: #fff !important; }
.nav-link.btn-ventes.active { background: var(--sales-green) !important; color: #fff !important; }
.nav-link.btn-services.active { background: var(--services-cyan) !important; color: var(--text-dark) !important; }
.nav-link.btn-depenses.active { background: var(--expenses-red) !important; color: #fff !important; }
.nav-link.btn-taxes.active { background: var(--taxes-purple) !important; color: #fff !important; }
.nav-link.btn-stock.active { background: var(--stock-orange) !important; color: #fff !important; }
.nav-link.btn-rapports.active { background: var(--reports-dark-blue) !important; color: #fff !important; }

/* ==========================================================================
   COMPOSANTS GLASSMORPHISM & CONTENEURS GÉNÉRAUX
   ========================================================================== */
.filter-section, .table-container, .card:not([style*="background"]) {
    background: var(--glass-bg) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border) !important;
    border-radius: 12px !important;
    box-shadow: var(--vibrant-shadow) !important;
    margin-bottom: 15px !important;
    padding: 15px !important;
    color: var(--text-dark) !important;
}

.card .text-muted, .dashboard-card .text-muted, .filter-section .text-muted {
    color: var(--text-muted) !important;
}

.modal-content {
    background: var(--glass-bg) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 12px !important;
    box-shadow: var(--vibrant-shadow) !important;
    color: var(--text-dark) !important;
}

.chart-container {
    background: var(--glass-bg) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 12px !important;
    padding: 15px !important;
    margin-bottom: 15px !important;
    position: relative;
    height: 280px !important;
}

/* ==========================================================================
   FORMULAIRES & BOUTONS
   ========================================================================== */
input.form-control, select.form-select, textarea.form-control {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 8px;
    padding: 9px 12px !important;
    font-size: 0.92rem;
    color: #0f172a !important;
    font-weight: 600 !important;
}

input.form-control::placeholder, textarea.form-control::placeholder {
    color: #64748b !important;
    font-weight: 400;
}

input.form-control:focus, select.form-select:focus, textarea.form-control:focus {
    border-color: var(--purchases-blue) !important;
    background-color: #ffffff !important;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15) !important;
}

.form-label {
    font-weight: 700 !important;
    color: var(--text-dark) !important;
}

.btn {
    border-radius: 8px !important;
    font-weight: 600;
    padding: 8px 16px !important;
    font-size: 0.9rem;
}

/* ==========================================================================
   PAGE DE CONNEXION (CLAIRE ET BIEN LISIBLE)
   ========================================================================== */
.login-container, .auth-card {
    background: rgba(255, 255, 255, 0.95) !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 16px !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1) !important;
    padding: 25px !important;
}

.login-container h1, .login-container h2, .login-container h3, 
.auth-card h1, .auth-card h2, .auth-card h3 {
    color: var(--text-dark) !important;
    font-weight: 800 !important;
}

.login-container label, .auth-card label {
    color: var(--text-dark) !important;
    font-weight: 700 !important;
}

/* ==========================================================================
   DASHBOARD & WIDGETS (CORRECTION TEXTE BLANC SUR FOND BLANC)
   ========================================================================== */
.dashboard-card {
    padding: 15px !important;
    text-align: center;
    border-radius: 12px;
    background: var(--glass-bg) !important;
    border: 1px solid var(--glass-border);
    margin-bottom: 15px !important;
    color: var(--text-dark) !important;
}

.dashboard-card * {
    color: var(--text-dark) !important;
}

.dashboard-card .icon-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 8px;
    font-size: 1.1rem;
}

.dashboard-card h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #334155 !important;
    font-weight: 700;
    margin-bottom: 4px;
}

.dashboard-card .value {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-dark) !important;
    margin: 0;
    display: block;
}

/* ==========================================================================
   RESPONSIVE & CORRECTION MENU MOBILE (DROPDOWN FIX)
   ========================================================================== */
@media (max-width: 991.98px) {
    .navbar-collapse {
        background-color: rgba(255, 255, 255, 0.98) !important;
        padding: 1rem;
        border-radius: 0.5rem;
        box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
        margin-top: 0.5rem;
        overflow-y: visible !important;
    }

    .navbar-collapse .nav-link {
        color: var(--text-dark) !important;
    }

    .navbar-collapse .dropdown-menu {
        position: absolute !important;
        background-color: #ffffff !important;
        box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
        border: 1px solid rgba(0,0,0,.15) !important;
    }
}
