/* =========================================
   1. VARIABLES ET RESET GLOBAL
   ========================================= */
:root {
    --primary-color: #0056b3;       /* Bleu corporatif Gaz Naturel */
    --primary-hover: #004494;
    --secondary-color: #28a745;     /* Vert GNR */
    --secondary-hover: #218838;
    --bg-color: #f4f7f6;            /* Fond gris très clair */
    --card-bg: #ffffff;
    --text-color: #333333;
    --text-muted: #6c757d;
    --danger-color: #dc3545;
    --success-bg: #d4edda;
    --success-text: #155724;
    --danger-bg: #f8d7da;
    --danger-text: #721c24;
    
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.15);
    --radius: 8px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    min-height: 100vh;
}

/* =========================================
   2. NAVIGATION LATÉRALE (SIDEBAR)
   ========================================= */
.sidebar {
    width: 260px;
    background-color: var(--primary-color);
    color: white;
    height: 100vh;
    padding: 25px 0;
    position: fixed;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    z-index: 100;
}

.sidebar h2 {
    text-align: center;
    margin-bottom: 40px;
    font-size: 26px;
    letter-spacing: 1px;
}

.sidebar h2 span {
    color: var(--secondary-color);
}

.sidebar a {
    display: block;
    color: rgba(255, 255, 255, 0.85);
    padding: 15px 25px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

.sidebar a:hover, .sidebar a.active {
    background-color: rgba(255, 255, 255, 0.15);
    color: white;
    border-left: 5px solid var(--secondary-color);
    padding-left: 20px; /* Effet de mouvement au survol */
}

/* =========================================
   3. CONTENU PRINCIPAL ET EN-TÊTE
   ========================================= */
.main-content {
    margin-left: 260px;
    padding: 40px;
    width: calc(100% - 260px);
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

.header h1 {
    font-size: 28px;
    color: var(--primary-color);
    font-weight: 600;
}

.user-info {
    font-weight: 500;
    background: var(--card-bg);
    padding: 10px 18px;
    border-radius: 50px;
    box-shadow: var(--shadow-sm);
    color: var(--primary-color);
    border: 1px solid #e1e5e8;
}

/* =========================================
   4. COMPOSANTS (CARTES, BOUTONS)
   ========================================= */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.card {
    background-color: var(--card-bg);
    padding: 25px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    transition: transform 0.2s ease;
}

.card:hover {
    transform: translateY(-3px);
}

.card h3 {
    font-size: 16px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 15px;
}

.price-text {
    font-size: 28px;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.sub-text {
    font-size: 14px;
    color: var(--text-muted);
}
.trend-down { color: var(--secondary-color); font-weight: 600; }
.trend-up { color: var(--danger-color); font-weight: 600; }

.btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background-color 0.3s ease;
}

.btn:hover { background-color: var(--primary-hover); }

/* =========================================
   5. GRAPHIQUES (CHART.JS)
   ========================================= */
.section-title {
    color: var(--text-color);
    margin-bottom: 25px;
    font-size: 22px;
    border-bottom: 2px solid #e1e5e8;
    padding-bottom: 10px;
}

.charts-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
}

.chart-container {
    background-color: var(--card-bg);
    padding: 25px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    text-align: center;
}

.chart-container h3 {
    color: var(--text-color);
    margin-bottom: 20px;
    font-size: 18px;
    text-transform: none;
}

.update-text {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 15px;
    font-style: italic;
}

/* =========================================
   6. TABLEAUX (PAGE FACTURES)
   ========================================= */
.invoice-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.invoice-table th, .invoice-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #e1e5e8;
}

.invoice-table th {
    background-color: #f8fbfd;
    color: var(--text-muted);
    font-weight: 600;
}

.invoice-table tr:hover td {
    background-color: #fcfdfd;
}

.status {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status.paid { background-color: var(--success-bg); color: var(--success-text); }
.status.unpaid { background-color: var(--danger-bg); color: var(--danger-text); }

/* =========================================
   7. FORMULAIRES ET UPLOAD DE FACTURE
   ========================================= */
.form-standard { margin-top: 20px; }
.form-row { display: flex; gap: 20px; margin-bottom: 20px; }
.form-row .input-group { flex: 1; margin-bottom: 0; }
.input-group { margin-bottom: 20px; }

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-color);
    font-size: 14px;
}

.form-standard input, .form-standard select {
    width: 100%;
    padding: 12px;
    border: 1px solid #cbd5e0;
    border-radius: 5px;
    font-size: 15px;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.form-standard input:focus, .form-standard select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 86, 179, 0.1);
    outline: none;
}

.upload-zone {
    border: 2px dashed var(--primary-color);
    background-color: #f8fbfd;
    padding: 50px 20px;
    text-align: center;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-zone:hover, .upload-zone.dragover {
    background-color: #e6f0fa;
    border-color: var(--primary-hover);
    transform: scale(1.01);
}

.upload-zone p { color: var(--primary-color); font-weight: 500; }

/* =========================================
   8. PAGE DE CONNEXION (LOGIN)
   ========================================= */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: linear-gradient(135deg, var(--primary-color) 0%, #002e60 100%);
}

.login-container {
    background-color: var(--card-bg);
    padding: 50px 40px;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
}

.login-header { text-align: center; margin-bottom: 35px; }
.login-header h2 { font-size: 32px; color: var(--text-color); margin-bottom: 10px; }
.login-header h2 span { color: var(--secondary-color); }
.login-header p { color: var(--text-muted); }

.login-form input[type="email"],
.login-form input[type="password"] {
    width: 100%;
    padding: 14px;
    border: 1px solid #cbd5e0;
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.login-form input:focus {
    border-color: var(--primary-color);
    outline: none;
}

.btn-login {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    margin-bottom: 20px;
    margin-top: 10px;
}

.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    font-size: 14px;
}

.forgot-password, .login-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.forgot-password:hover, .login-footer a:hover { text-decoration: underline; }

.login-footer {
    text-align: center;
    font-size: 14px;
    color: var(--text-muted);
    border-top: 1px solid #e1e5e8;
    padding-top: 20px;
}

/* =========================================
   9. RESPONSIVE DESIGN (Mobiles & Tablettes)
   ========================================= */
@media (max-width: 1024px) {
    .charts-section { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    body { flex-direction: column; }
    
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        padding: 15px 0;
        display: flex;
        flex-direction: column;
    }
    
    .sidebar h2 { margin-bottom: 15px; }
    
    .sidebar a {
        padding: 12px 20px;
        text-align: center;
        border-left: none;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }
    
    .sidebar a:hover, .sidebar a.active {
        border-left: none;
        background-color: rgba(255, 255, 255, 0.1);
    }

    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 20px;
    }

    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
}