/* ==========================
   STYLES PRINCIPAUX
   ========================== */

:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --light-bg: #f8f9fa;
    --border-radius: 8px;
    --box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--light-bg);
    overflow-x: hidden;
}

/* ==========================
   NAVIGATION & SIDEBAR
   ========================== */

.navbar {
    box-shadow: var(--box-shadow);
    border-bottom: 2px solid #0a58ca;
}

.navbar-brand {
    font-weight: 600;
    font-size: 1.3rem;
    letter-spacing: 0.5px;
}

.sidebar {
    position: relative;
    height: 100vh;
    padding-top: 1rem;
    border-right: 1px solid #dee2e6;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.05);
}

.sidebar .nav-link {
    color: #495057;
    font-weight: 500;
    padding: 0.8rem 1rem;
    margin-bottom: 0.3rem;
    border-radius: 6px;
    transition: var(--transition);
}

.sidebar .nav-link:hover {
    color: var(--primary-color);
    background-color: #e7f1ff;
    padding-left: 1.5rem;
}

.sidebar .nav-link.active {
    color: white;
    background-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(13, 110, 253, 0.3);
}

.sidebar .nav-link i {
    margin-right: 0.8rem;
    width: 20px;
}

/* ==========================
   CARDS & MODALS
   ========================== */

.card {
    border: 1px solid #e9ecef;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    margin-bottom: 1.5rem;
}

.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1);
}

.card-header {
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.metric-card {
    border-left: 4px solid var(--primary-color);
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
}

.metric-icon {
    font-size: 2.5rem;
    opacity: 0.2;
}

/* ==========================
   TABLES
   ========================== */

.table {
    background-color: white;
    border-radius: var(--border-radius);
    overflow: hidden;
}

.table thead {
    background-color: #f8f9fa;
}

.table thead th {
    font-weight: 600;
    color: #495057;
    border: none;
    padding: 1rem;
}

.table tbody td {
    padding: 1rem;
    border-color: #e9ecef;
    vertical-align: middle;
}

.table tbody tr {
    transition: var(--transition);
}

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

.table-responsive {
    border-radius: var(--border-radius);
    overflow: hidden;
}

/* ==========================
   BUTTONS
   ========================== */

.btn {
    font-weight: 500;
    transition: var(--transition);
    border-radius: 6px;
    padding: 0.5rem 1rem;
}

.btn-primary {
    background-color: var(--primary-color);
    border: none;
    box-shadow: 0 2px 4px rgba(13, 110, 253, 0.2);
}

.btn-primary:hover {
    background-color: #0b5ed7;
    box-shadow: 0 4px 8px rgba(13, 110, 253, 0.3);
    transform: translateY(-2px);
}

.btn-outline-primary:hover {
    transform: translateY(-2px);
}

.btn-sm {
    padding: 0.35rem 0.7rem;
    font-size: 0.875rem;
}

/* ==========================
   BADGES
   ========================== */

.badge {
    padding: 0.5rem 0.8rem;
    font-weight: 500;
    border-radius: 20px;
}

/* ==========================
   FORMS
   ========================== */

.form-control,
.form-select {
    border: 1px solid #dee2e6;
    border-radius: 6px;
    transition: var(--transition);
    padding: 0.6rem 0.8rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.form-label {
    font-weight: 500;
    color: #495057;
    margin-bottom: 0.5rem;
}

/* ==========================
   MODALS
   ========================== */

.modal-content {
    border: 1px solid #dee2e6;
    border-radius: var(--border-radius);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.modal-header {
    border-bottom: 1px solid #dee2e6;
    background-color: #f8f9fa;
}

.modal-title {
    font-weight: 600;
    color: #212529;
}

/* ==========================
   TAB NAVIGATION
   ========================== */

.nav-tabs {
    border-bottom: 2px solid #e9ecef;
}

.nav-tabs .nav-link {
    color: #495057;
    border: none;
    font-weight: 500;
    transition: var(--transition);
    border-bottom: 3px solid transparent;
}

.nav-tabs .nav-link:hover {
    border-bottom-color: #dee2e6;
    color: #0d6efd;
}

.nav-tabs .nav-link.active {
    border-bottom-color: var(--primary-color);
    color: var(--primary-color);
    background-color: transparent;
}

/* ==========================
   LIST GROUPS
   ========================== */

.list-group-item {
    border: 1px solid #e9ecef;
    padding: 1rem;
    transition: var(--transition);
}

.list-group-item:hover {
    background-color: #f8f9fa;
}

/* ==========================
   PAGINATION
   ========================== */

.pagination {
    gap: 0.5rem;
}

.page-link {
    border-radius: 6px;
    border: 1px solid #dee2e6;
    color: var(--primary-color);
    font-weight: 500;
}

.page-link:hover {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* ==========================
   MAIN CONTENT
   ========================== */

main {
    min-height: 100vh;
    background-color: var(--light-bg);
}

h1 {
    color: #212529;
    font-weight: 700;
    margin-bottom: 2rem;
}

h5 {
    color: #212529;
    font-weight: 600;
}

h6 {
    color: #495057;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}

/* ==========================
   RESPONSIVE DESIGN
   ========================== */

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -250px;
        width: 250px;
        height: 100vh;
        z-index: 1000;
        transition: var(--transition);
        margin-top: 0;
    }

    .sidebar.show {
        left: 0;
    }

    main {
        margin-top: 1rem;
    }

    .col-md-10 {
        margin-left: 0 !important;
    }

    .navbar {
        padding: 0.5rem 1rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    .metric-icon {
        font-size: 2rem;
    }

    .table {
        font-size: 0.9rem;
    }

    .btn-sm {
        padding: 0.3rem 0.6rem;
        font-size: 0.8rem;
    }
}

@media (max-width: 576px) {
    .card {
        margin-bottom: 1rem;
    }

    .row.g-3 > [class*='col-'] {
        margin-bottom: 0.5rem;
    }

    h1 {
        font-size: 1.25rem;
    }

    .nav-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
    }

    .nav-tabs .nav-link {
        white-space: nowrap;
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
}

/* ==========================
   ANIMATIONS
   ========================== */

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: slideIn 0.3s ease-out;
}

/* ==========================
   UTILITAIRES
   ========================== */

.text-muted {
    color: #6c757d !important;
}

.bg-light {
    background-color: #f8f9fa !important;
}

hr {
    border-color: #e9ecef;
    margin: 2rem 0;
}

.position-sticky {
    top: 0;
}

/* ==========================
   CHARTS
   ========================== */

canvas {
    max-height: 300px;
    margin: 1rem 0;
}

/* ==========================
   CUSTOM SCROLLBAR
   ========================== */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ==========================
   ÉTATS ET FEEDBACK
   ========================== */

.alert {
    border-radius: var(--border-radius);
    border: 1px solid;
}

.spinner-border {
    width: 1.5rem;
    height: 1.5rem;
}

/* ==========================
   VALIDATION FORMS
   ========================== */

.was-validated .form-control:valid {
    border-color: var(--success-color);
}

.was-validated .form-control:invalid {
    border-color: var(--danger-color);
}

/* ==========================
   DARK MODE SUPPORT (Optionnel)
   ========================== */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #1a1a1a;
        color: #e0e0e0;
    }

    .card,
    .table {
        background-color: #2a2a2a;
        color: #e0e0e0;
    }

    .sidebar {
        background-color: #1a1a1a;
        border-right-color: #404040;
    }

    .sidebar .nav-link {
        color: #b0b0b0;
    }

    .sidebar .nav-link:hover {
        background-color: #333333;
    }

    .form-control,
    .form-select {
        background-color: #2a2a2a;
        border-color: #404040;
        color: #e0e0e0;
    }

    h1, h5, h6 {
        color: #e0e0e0;
    }
}