/**
 * KPI Le Pain - Styles personnalisés
 */

/* Variables */
:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --light-bg: #f8f9fa;
    --dark-bg: #212529;
}

/* Navbar */
.kpi-navbar {
    background: linear-gradient(135deg, #2c5282 0%, #3b82c4 100%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    padding-top: 0;
    padding-bottom: 0;
}

.kpi-navbar .navbar-brand {
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: 0.3px;
    padding: 0.75rem 0;
}

.kpi-navbar .nav-link {
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.7rem 0.75rem;
    border-bottom: 2px solid transparent;
    transition: background-color 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.kpi-navbar .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.kpi-navbar .nav-link.active {
    background-color: rgba(255, 255, 255, 0.12);
    border-bottom-color: #63b3ed;
}

.kpi-navbar .nav-link i {
    font-size: 0.9rem;
    width: 1rem;
    text-align: center;
}

.kpi-navbar .dropdown-menu {
    border: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    border-radius: 0.5rem;
    padding: 0.35rem 0;
}

.kpi-navbar .dropdown-item {
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
}

.kpi-navbar .dropdown-item i {
    width: 1.1rem;
    text-align: center;
    color: #6c757d;
}

.kpi-navbar .dropdown-item:hover i {
    color: #2c5282;
}

.kpi-navbar .dropdown-header {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Global */
body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: #f5f7fa;
}

main {
    flex: 1;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 2rem;
    background: white;
    border-radius: 1rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.login-logo {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
}

.login-logo i {
    font-size: 2.5rem;
    color: white;
}

/* Cards */
.card {
    border: none;
    border-radius: 0.75rem;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

.card-header {
    background-color: white;
    border-bottom: 1px solid #eee;
    font-weight: 600;
}

/* Stat Cards */
.stat-card {
    position: relative;
    overflow: hidden;
}

.stat-card .stat-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 3rem;
    opacity: 0.15;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-card .stat-label {
    font-size: 0.875rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card.bg-primary .stat-label,
.stat-card.bg-success .stat-label,
.stat-card.bg-info .stat-label,
.stat-card.bg-danger .stat-label,
.stat-card.bg-warning .stat-label {
    color: rgba(255, 255, 255, 0.8);
}

/* Charts */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

.chart-container-lg {
    height: 400px;
}

.chart-container.chart-clickable canvas {
    cursor: pointer;
}

.chart-hint {
    font-size: 0.75rem;
    color: #6c757d;
    text-align: center;
    margin-top: 0.5rem;
}

/* Tables */
.table-responsive {
    border-radius: 0.5rem;
}

.table thead th {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    color: #495057;
}

.table tbody tr:hover {
    background-color: #f1f3f5;
}

/* DataTables customization */
.dataTables_wrapper .dataTables_filter input {
    border-radius: 0.375rem;
    border: 1px solid #ced4da;
    padding: 0.375rem 0.75rem;
}

.dataTables_wrapper .dataTables_length select {
    border-radius: 0.375rem;
    border: 1px solid #ced4da;
    padding: 0.375rem 1.75rem 0.375rem 0.75rem;
}

/* Import Section */
.upload-zone {
    border: 2px dashed #dee2e6;
    border-radius: 1rem;
    padding: 3rem;
    text-align: center;
    background-color: #fafbfc;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--primary-color);
    background-color: #e7f1ff;
}

.upload-zone .upload-icon {
    font-size: 4rem;
    color: #adb5bd;
    margin-bottom: 1rem;
}

.upload-zone:hover .upload-icon,
.upload-zone.dragover .upload-icon {
    color: var(--primary-color);
}

/* Period Selector */
.period-selector {
    background: white;
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    margin-bottom: 1.5rem;
}

.period-selector .form-label {
    font-weight: 600;
    color: #495057;
}

/* Badges */
.badge-role-admin {
    background-color: #dc3545;
}

.badge-role-editeur {
    background-color: #fd7e14;
}

.badge-role-utilisateur {
    background-color: #0dcaf0;
}

/* Progress Bars */
.progress {
    height: 0.5rem;
    border-radius: 0.25rem;
    background-color: #e9ecef;
}

/* Sidebar (for admin) */
.sidebar {
    min-height: calc(100vh - 56px);
    background-color: #212529;
}

.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.8);
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    margin: 0.125rem 0.5rem;
}

.sidebar .nav-link:hover {
    color: white;
    background-color: rgba(255, 255, 255, 0.1);
}

.sidebar .nav-link.active {
    color: white;
    background-color: var(--primary-color);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* Loading Spinner */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* Responsive */
@media (max-width: 768px) {
    .stat-card .stat-value {
        font-size: 1.5rem;
    }

    .chart-container {
        height: 250px;
    }

    .upload-zone {
        padding: 2rem 1rem;
    }
}

/* Print styles */
@media print {
    .navbar, .footer, .btn, .dataTables_filter, .dataTables_length, .dataTables_paginate {
        display: none !important;
    }

    .card {
        box-shadow: none;
        border: 1px solid #dee2e6;
    }

    .chart-container {
        page-break-inside: avoid;
    }
}

/* Toast notifications */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 1055;
}

/* Tab customization */
.nav-tabs .nav-link {
    color: #495057;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 0.75rem 1.5rem;
}

.nav-tabs .nav-link:hover {
    border-color: transparent;
    background-color: #f8f9fa;
}

.nav-tabs .nav-link.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    font-weight: 600;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: #6c757d;
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Correlation indicator */
.correlation-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 600;
}

.correlation-positive {
    background-color: #d1e7dd;
    color: #0f5132;
}

.correlation-negative {
    background-color: #f8d7da;
    color: #842029;
}

.correlation-neutral {
    background-color: #fff3cd;
    color: #664d03;
}
