/* ===========================
   VARIABLES CSS
   =========================== */
:root {
    --primary-color: #258cfb;
    --primary-hover: #1a6dc9;
    --secondary-color: #6c757d;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --border-color: #e5e7eb;
    --border-color-dark: #d1d5db;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --transition-speed: 0.3s;
    --box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --box-shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.06);
    --box-shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);
    --box-shadow-hover: 0 20px 25px rgba(0, 0, 0, 0.1), 0 10px 10px rgba(0, 0, 0, 0.04);
    --background-light: #f9fafb;
    --text-primary: #111827;
    --text-secondary: #6b7280;
}

/* ===========================
   TYPOGRAPHIE DE BASE
   =========================== */
html {
    font-size: 14px;
    scroll-behavior: smooth;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

html {
    position: relative;
    min-height: 100%;
}

body {
    margin-bottom: 60px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--background-light);
}

/* ===========================
   ÉTATS DE FOCUS & BOUTONS
   =========================== */
.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus,
.form-select:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem var(--primary-color);
    outline: none;
}

.btn {
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-speed) ease;
    font-weight: 500;
    padding: 0.625rem 1.25rem;
    border: none;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--box-shadow-md);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover), #155a9e);
    box-shadow: var(--box-shadow-lg);
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color), #059669);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color), #dc2626);
}

/* ===========================
   FORMULAIRES
   =========================== */
.form-control,
.form-select {
    border-radius: var(--border-radius-sm);
    border: 2px solid var(--border-color);
    transition: all var(--transition-speed) ease;
    padding: 0.625rem 0.875rem;
    font-size: 0.95rem;
}

.form-control:hover,
.form-select:hover {
    border-color: var(--border-color-dark);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(37, 140, 251, 0.15);
}

.form-floating {
    position: relative;
}

.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
    color: var(--text-secondary);
    text-align: end;
    transition: all var(--transition-speed) ease;
}

.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
    text-align: start;
    opacity: 0.6;
}

.form-floating > label {
    color: var(--text-secondary);
    transition: all var(--transition-speed) ease;
}

.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label {
    color: var(--primary-color);
    font-weight: 500;
}

/* ===========================
   UTILITAIRES
   =========================== */
.currency-symbol-small {
    font-size: 0.7em;
    vertical-align: super;
    font-weight: 600;
    color: var(--text-secondary);
}

/* ===========================
   FOOTER
   =========================== */
footer {
    font-size: 0.9em;
    padding: 1rem 0;
    background: linear-gradient(180deg, #ffffff 0%, #f9fafb 100%);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
    line-height: 5px;
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color var(--transition-speed) ease;
}

footer a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

footer .container {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

footer p {
    margin-bottom: 0;
    line-height: 5px;
}

footer .row {
    margin-top: 0;
    margin-bottom: 0;
}

footer div {
    line-height: 5px;
}

/* ===========================
   TABLEAUX
   =========================== */
.bordered-table {
    border: 2px solid var(--border-color); /* bordure extérieure de 2px à la table.*/
    border-radius: var(--border-radius);/*Arrondit les coins de la table.*/
    padding: 0;/**/
    overflow: hidden;/*Coupe tout ce qui dépasse*/
    box-shadow: var(--box-shadow);/**/
    background: white;/**/
}

.bordered-table th,
.bordered-table td {
    border-right: 2px solid var(--border-color);
    padding: 1rem 1.25rem;
    vertical-align: middle;
}

.bordered-table th:last-child,
.bordered-table td:last-child {
    border-right: none;
}

.bordered-table thead {
    background: linear-gradient(180deg, #f9fafb 0%, #f3f4f6 100%);
}

.bordered-table thead th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color-dark);
}

.bordered-table tbody tr {
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.bordered-table tbody tr:last-child {
    border-bottom: none;
}

.bordered-table tbody tr:hover {
    background-color: rgba(37, 140, 251, 0.06);
    box-shadow: inset 0 0 0 1px rgba(37, 140, 251, 0.2);
}

.custom-table {
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
}

.custom-table th,
.custom-table td {
    border-right: 1px solid var(--border-color);
    padding: 0.875rem 1rem;
}

.custom-table th:last-child,
.custom-table td:last-child {
    border-right: none;
}

/* ===========================
   CONTENEUR
   =========================== */
.container {
    max-width: 90%;
    padding: 0 1rem;
}

@media (min-width: 1400px) {
    .container {
        max-width: 85%;
    }
}

@media (min-width: 1600px) {
    .container {
        max-width: 90%;
    }
}

/* ===========================
   LOGOS
   =========================== */
.logo {
    height: 35px;
    transition: all var(--transition-speed) ease;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.logo:hover {
    transform: scale(1.05);
}

.dark-logo {
    display: none;
}

.light-logo {
    display: inline-block;
}

/* ===========================
   BACKGROUNDS & DÉCORATION
   =========================== */
.home-background {
    background-image: var(--home-bg-logo);
    background-repeat: no-repeat;
    background-position: center center;
    background-size: contain;
    min-height: 500px;
    opacity: 0.3;
    position: relative;
}

.home-background::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, transparent 0%, rgba(249, 250, 251, 0.9) 100%);
    pointer-events: none;
}

/* ===========================
   LAYOUT FLEX
   =========================== */
.d-flex-container {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    align-items: stretch;
}

.search-box {
    flex-grow: 1;
    min-width: 280px;
}

.filter-box {
    min-width: 250px;
    max-width: 320px;
}

@media (max-width: 768px) {
    .d-flex-container {
        flex-direction: column;
    }
    .table-responsive {
        overflow-x: auto !important;
    }
    .search-box,
    .filter-box {
        width: 100%;
        max-width: 100%;
        min-width: 100%;
    }
}

/* ===========================
   CARDS & COMPOSANTS
   =========================== */
.card {
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--box-shadow);
    transition: all var(--transition-speed) ease;
    background: white;
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--box-shadow-hover);
    transform: translateY(-4px);
    border-color: var(--border-color-dark);
}

.card-header {
    background: linear-gradient(180deg, #ffffff 0%, #f9fafb 100%);
    border-bottom: 2px solid var(--border-color);
    font-weight: 600;
    padding: 1rem 1.25rem;
    color: var(--text-primary);
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    background-color: #f9fafb;
    border-top: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
}

/* ===========================
   BADGES & ALERTS
   =========================== */
.badge {
    border-radius: 6px;
    font-weight: 500;
    padding: 0.35em 0.65em;
    font-size: 0.85em;
}

.alert {
    border-radius: var(--border-radius-sm);
    border-left: 4px solid;
    box-shadow: var(--box-shadow);
}

.alert-success {
    background-color: #ecfdf5;
    border-color: var(--success-color);
    color: #065f46;
}

.alert-danger {
    background-color: #fef2f2;
    border-color: var(--danger-color);
    color: #991b1b;
}

.alert-warning {
    background-color: #fffbeb;
    border-color: var(--warning-color);
    color: #92400e;
}

.alert-info {
    background-color: #eff6ff;
    border-color: var(--primary-color);
    color: #1e40af;
}

/* ===========================
   ANIMATIONS
   =========================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

.slide-in {
    animation: slideIn 0.5s ease-out;
}

/* ===========================
   NAVBAR
   =========================== */
.navbar {
    background: white !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    transition: all var(--transition-speed) ease;
    position: relative;
    z-index: 1030 !important;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-primary) !important;
}

.nav-link {
    color: var(--text-secondary) !important;
    font-weight: 500;
    transition: all var(--transition-speed) ease;
    padding: 0.5rem 1rem !important;
    border-radius: var(--border-radius-sm);
}

.nav-link:hover {
    color: var(--primary-color) !important;
    background-color: rgba(37, 140, 251, 0.08);
}

.nav-link.active {
    color: var(--primary-color) !important;
    background-color: rgba(37, 140, 251, 0.12);
}

.dropdown-menu {
    border: 1px solid var(--border-color);
    box-shadow: var(--box-shadow-lg);
    border-radius: var(--border-radius-sm);
    padding: 0.5rem;
    overflow: visible !important;
    max-height: none !important;
    z-index: 1031 !important;
}

.dropdown-item {
    border-radius: 6px;
    transition: all var(--transition-speed) ease;
    padding: 0.625rem 1rem;
    color: var(--text-primary);
}

.dropdown-item:hover {
    background: linear-gradient(90deg, rgba(37, 140, 251, 0.1), rgba(37, 140, 251, 0.05));
    color: var(--primary-color);
    transform: translateX(4px);
}

/* ===========================
   PAGINATION
   =========================== */
.pagination {
    gap: 0.5rem;
}

.page-link {
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    transition: all var(--transition-speed) ease;
    padding: 0.5rem 0.875rem;
}

.page-link:hover {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--box-shadow-md);
}

.page-item.active .page-link {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    border-color: var(--primary-color);
    box-shadow: var(--box-shadow);
}

/* ===========================
   LISTES SANS SCROLL
   =========================== */

/* Éliminer le scroll des list-groups */
.list-group {
    overflow: visible !important;
    max-height: none !important;
}

.list-group-item {
    overflow: visible !important;
}

/* Éliminer le scroll des listes générales */
ul,
ol {
    overflow: visible !important;
    max-height: none !important;
}

/* Éliminer le scroll des accordions */
.accordion {
    overflow: visible !important;
}

.accordion-body {
    overflow: visible !important;
    max-height: none !important;
}

/* Éliminer le scroll des modals si nécessaire */
.modal-body {
    overflow-y: auto !important;
    max-height: 70vh !important;
}

/* Éliminer le scroll des offcanvas */
.offcanvas-body {
    overflow-y: auto !important;
}

/* Conteneurs avec classe personnalisée */
.list-container,
.items-list {
    overflow: visible !important;
    max-height: none !important;
}

/* Tables sans scroll horizontal sauf si nécessaire */
.table-responsive {
    overflow-x: visible  !important;
}

/* ===========================
   PRINT STYLES
   =========================== */
@media print {
    header,
    footer,
    #action-buttons,
    .container > h2,
    #pdfTypeModal,
    .no-print,
    .btn,
    .navbar {
        display: none !important;
    }

    .container {
        max-width: 100% !important;
    }

    body {
        padding-top: 0 !important;
        margin-top: 0 !important;
        margin-bottom: 0 !important;
        background: white !important;
    }

    .card,
    .bordered-table {
        box-shadow: none !important;
        page-break-inside: avoid;
        border: 1px solid #000;
    }

    a {
        text-decoration: none;
        color: inherit !important;
    }

    * {
        background: white !important;
        color: black !important;
        box-shadow: none !important;
    }

    .table {
        border: 1px solid #000;
    }

    .table th,
    .table td {
        border: 1px solid #000 !important;
    }
}