html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    height: 100%;
}

.page {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.sidebar {
    background-color: #2c3e50;
    width: 250px;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    color: white;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    background-color: #1a252f;
    flex-shrink: 0;
    height: 80px;
}

.sidebar-header h3 {
    text-align: center;
    padding: 20px;
    margin: 0;
    color: white;
}

.sidebar-nav {
    position: absolute;
    top: 80px;
    bottom: 0;
    left: 0;
    right: 0;
    overflow-y: scroll;
    overflow-x: hidden;
    padding-bottom: 20px;
    scrollbar-width: thin;
    scrollbar-color: #34495e #1a252f;
}

/* Webkit (Chrome, Safari, Edge) */
.sidebar-nav::-webkit-scrollbar {
    width: 8px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: #1a252f;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: #34495e;
    border-radius: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: #3498db;
}

.sidebar .nav-link {
    color: #ecf0f1;
    padding: 15px 20px;
    display: block;
    text-decoration: none;
    transition: background-color 0.3s;
}

.sidebar .nav-link:hover {
    background-color: #34495e;
}

.sidebar .nav-link.active {
    background-color: #3498db;
}

.sidebar .btn-link {
    color: #ecf0f1;
    text-align: left;
    width: 100%;
    text-decoration: none;
}

.nav-category {
    color: #95a5a6;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 15px 20px 8px 20px;
    margin-top: 10px;
    border-top: 1px solid #34495e;
}

.nav-category:first-child {
    margin-top: 0;
    border-top: none;
}

main {
    flex: 1;
    margin-left: 250px;
}

.top-row {
    background-color: #f8f9fa;
    border-bottom: 1px solid #d6d5d5;
    height: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.content {
    padding-top: 1.1rem;
}

/* Login Styles */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    padding: 40px;
    width: 100%;
    max-width: 450px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h2 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-weight: 600;
}

.login-header p {
    color: #7f8c8d;
    margin: 0;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #2c3e50;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn-block {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    font-weight: 500;
    border-radius: 5px;
    margin-top: 20px;
}

.login-footer {
    text-align: center;
    margin-top: 30px;
    color: #95a5a6;
}

.alert {
    padding: 12px 15px;
    border-radius: 5px;
    margin-bottom: 15px;
    animation: slideIn 0.3s ease-in;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    font-weight: 500;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    font-weight: 500;
}

.alert i {
    margin-right: 8px;
}

.validation-message {
    color: #dc3545;
    font-size: 12px;
    margin-top: 5px;
}

/* Dashboard Styles */
.dashboard h1 {
    color: #2c3e50;
    margin-bottom: 20px;
}

.card {
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.card-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    padding: 15px 20px;
}

.spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.2em;
}

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }

    main {
        margin-left: 0;
    }

    .login-card {
        margin: 20px;
    }
}

/* Styles pour la page Réceptions */
.table-sm th, .table-sm td {
    padding: 0.5rem;
    font-size: 0.875rem;
}

.table-bordered th, .table-bordered td {
    border: 1px solid #dee2e6;
}

.table-light {
    background-color: #f8f9fa;
}

.table-secondary {
    background-color: #e9ecef;
}

.alert-sm {
    padding: 0.5rem 1rem;
    margin-bottom: 0.5rem;
}

/* Badges pour les pertes et gains */
.badge.bg-success {
    background-color: #28a745 !important;
}

.badge.bg-danger {
    background-color: #dc3545 !important;
}

.badge.bg-info {
    background-color: #17a2b8 !important;
}

.badge.bg-secondary {
    background-color: #6c757d !important;
}

/* Amélioration des cartes */
.card-header.bg-primary {
    background-color: #007bff !important;
}

.card.border-primary {
    border-color: #007bff !important;
}

/* Responsive pour les tableaux */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ============================================
   STYLES POUR LE DASHBOARD
   ============================================ */

.dashboard-container {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dashboard-title {
    color: #2c3e50;
    font-weight: 700;
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.dashboard-title i {
    color: #3498db;
    margin-right: 0.5rem;
}

.dashboard-actions {
    display: flex;
    gap: 0.5rem;
}

.loading-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
}

/* KPI Cards */
.kpi-section,
.charts-section,
.comparison-section,
.performance-section,
.alerts-activity-section,
.metrics-section,
.dispatching-section {
    margin-bottom: 2rem;
}

/* Stat boxes pour les résumés dans dispatching */
.stat-box {
    padding: 1rem;
    border-radius: 8px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    text-align: center;
    transition: all 0.3s ease;
}

.stat-box:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.stat-box .stat-label {
    font-size: 0.85rem;
    color: #6c757d;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.stat-box .stat-value {
    font-size: 1.75rem;
    font-weight: bold;
    margin: 0;
}


.kpi-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
    overflow: hidden;
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--kpi-color) 0%, var(--kpi-color-light) 100%);
}

.kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.kpi-primary {
    --kpi-color: #007bff;
    --kpi-color-light: #4dabf7;
}

.kpi-success {
    --kpi-color: #28a745;
    --kpi-color-light: #51cf66;
}

.kpi-info {
    --kpi-color: #17a2b8;
    --kpi-color-light: #22b8cf;
}

.kpi-warning {
    --kpi-color: #ffc107;
    --kpi-color-light: #ffd43b;
}

.kpi-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    background: linear-gradient(135deg, var(--kpi-color) 0%, var(--kpi-color-light) 100%);
    color: white;
    flex-shrink: 0;
}

.kpi-content {
    flex: 1;
}

.kpi-label {
    font-size: 0.875rem;
    color: #6c757d;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.kpi-value {
    font-size: 2rem;
    font-weight: 700;
    color: #2c3e50;
    line-height: 1;
    margin-bottom: 0.25rem;
}

.kpi-subtitle {
    font-size: 0.813rem;
    color: #6c757d;
}

.kpi-subtitle .text-success i,
.kpi-subtitle .text-danger i {
    font-size: 0.75rem;
}

/* Dashboard Cards */
.dashboard-card {
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: none;
    transition: all 0.3s ease;
    height: 100%;
}

.dashboard-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.dashboard-card .card-header {
    background: white;
    border-bottom: 2px solid #f0f0f0;
    border-radius: 12px 12px 0 0;
    padding: 1rem 1.5rem;
}

.dashboard-card .card-title {
    font-weight: 600;
    color: #2c3e50;
    font-size: 1.1rem;
}

.dashboard-card .card-title i {
    color: #3498db;
    margin-right: 0.5rem;
}

.dashboard-card .card-body {
    padding: 1.5rem;
}

/* Comparison Table */
.comparison-table {
    margin-bottom: 0;
}

.comparison-table thead th {
    background-color: #f8f9fa;
    color: #2c3e50;
    font-weight: 600;
    border-bottom: 2px solid #dee2e6;
}

.comparison-table tbody tr:hover {
    background-color: #f8f9fa;
}

/* Performance Cards */
.list-group-item {
    border: none;
    border-bottom: 1px solid #e9ecef;
    padding: 0.75rem 0;
}

.list-group-item:last-child {
    border-bottom: none;
}

/* Alerts */
.alerts-list .alert {
    margin-bottom: 0.75rem;
}

.alerts-list .alert:last-child {
    margin-bottom: 0;
}

/* Metric Items */
.metric-item {
    margin-bottom: 1rem;
}

.metric-item:last-child {
    margin-bottom: 0;
}

.progress {
    height: 8px;
    border-radius: 4px;
    background-color: #e9ecef;
}

.progress-bar {
    transition: width 0.6s ease;
}

/* Score Circle */
.score-circle {
    position: relative;
    display: inline-block;
}

.score-text {
    font-size: 2rem;
    font-weight: 700;
    fill: #2c3e50;
}

.quality-breakdown {
    margin-top: 1rem;
}

.quality-breakdown .badge {
    width: 80px;
    text-align: center;
}

/* Badges personnalisés */
.badge {
    padding: 0.35em 0.65em;
    font-weight: 500;
    border-radius: 6px;
}

.badge.bg-primary {
    background-color: #007bff !important;
}

.badge.bg-success {
    background-color: #28a745 !important;
}

.badge.bg-warning {
    background-color: #ffc107 !important;
    color: #000 !important;
}

.badge.bg-danger {
    background-color: #dc3545 !important;
}

.badge.bg-info {
    background-color: #17a2b8 !important;
}

.badge.bg-secondary {
    background-color: #6c757d !important;
}

/* Responsive */
@media (max-width: 992px) {
    .kpi-card {
        margin-bottom: 1rem;
    }
    
    .dashboard-card {
        margin-bottom: 1rem;
    }
}

@media (max-width: 768px) {
    .kpi-value {
        font-size: 1.5rem;
    }
    
    .kpi-icon {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
    
    .dashboard-title {
        font-size: 1.5rem;
    }
    
    .comparison-table {
        font-size: 0.875rem;
    }
}

/* Animation des graphiques */
canvas {
    animation: chartFadeIn 0.8s ease-in;
}

@keyframes chartFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

