/* Styles personnalisés pour le dashboard */

:root {
    --primary-color: rgb(105, 108, 255);
    --secondary-color: #6c757d;
    --success-color: rgb(113, 221, 55);
    --danger-color: rgb(255, 62, 29);
    --warning-color: rgb(255, 171, 0);
    --info-color: rgb(3, 195, 236);
    --sidebar-width: 260px;
    --sidebar-bg: #2b2c40;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f9;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: #697a8d;
}

/* Empêcher le débordement global */
* {
    box-sizing: border-box;
}

.card,
.card-header,
.card-body,
.card-footer {
    overflow: hidden;
}

.row {
    overflow: visible;
}

/* Désactiver les transitions au chargement pour éviter le FOUC */
.preload * {
    transition: none !important;
}

/* Sidebar - Sneat Style */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: white;
    padding: 0;
    overflow-x: hidden;
    overflow-y: auto;
    z-index: 1050;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Scrollbar personnalisée pour la sidebar */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Logo Section */
.sidebar .logo {
    padding: 25px 20px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 10px;
    background: rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 10;
    /* Hauteur fixe pour éviter le saut */
    min-height: 88px;
}

.sidebar .logo h3 {
    font-size: 1.5rem;
    margin: 0;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
    /* Hauteur fixe */
    min-height: 38px;
    transition: gap 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar .logo h3 i {
    color: var(--primary-color);
    font-size: 1.75rem;
    /* Pas de transition sur la taille car elle reste fixe */
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Navigation Links - Sneat Style */
.sidebar .nav {
    padding: 10px 0;
}

.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.7);
    padding: 11px 20px;
    margin: 2px 12px;
    border-radius: 6px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9375rem;
    font-weight: 400;
    text-decoration: none;
    position: relative;
    overflow: hidden;
    /* Hauteur fixe pour éviter les sauts */
    min-height: 44px;
}

.sidebar .nav-link span {
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

/* Hover effect avec barre latérale */
.sidebar .nav-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--primary-color);
    transform: scaleY(0);
    transition: transform 0.2s ease;
}

.sidebar .nav-link:hover::before {
    transform: scaleY(1);
}

.sidebar .nav-link:hover {
    background-color: rgba(105, 108, 255, 0.08);
    color: white;
    padding-left: 24px;
}

/* Active state - Sneat Style */
.sidebar .nav-link.active {
    background: linear-gradient(90deg, rgba(105, 108, 255, 0.16) 0%, rgba(105, 108, 255, 0.08) 100%);
    color: var(--primary-color);
    font-weight: 500;
    box-shadow: 0 2px 6px rgba(105, 108, 255, 0.2);
}

.sidebar .nav-link.active::before {
    transform: scaleY(1);
}

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

/* Icon styling */
.sidebar .nav-link i {
    width: 22px;
    height: 22px;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar .nav-link:hover i {
    transform: scale(1.1);
}

/* Divider */
.sidebar hr {
    border-color: rgba(255, 255, 255, 0.08);
    margin: 15px 20px;
    opacity: 1;
}

/* Toggle button pour desktop */
.sidebar-toggle-btn {
    position: fixed;
    left: 248px;
    top: 40px;
    width: 28px;
    height: 28px;
    background: var(--primary-color);
    border: 3px solid white;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1060;
    transition: left 0.3s ease, transform 0.2s ease;
    color: white;
    font-size: 0.875rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.sidebar-toggle-btn:hover {
    background: #5457d8;
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Texte du logo brand */
.sidebar-brand-text {
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Main content */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 20px;
    min-height: 100vh;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Effet de pulsation pour les notifications (optionnel) */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Badge de notification sur les items de menu (si nécessaire plus tard) */
.sidebar .nav-link .badge {
    margin-left: auto;
    font-size: 0.625rem;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
}

/* Header - Sneat Style */
.header {
    background: white;
    padding: 18px 28px;
    border-radius: 10px;
    margin-bottom: 25px;
    box-shadow: 0 2px 6px rgba(67, 89, 113, 0.12);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.header:hover {
    box-shadow: 0 4px 10px rgba(67, 89, 113, 0.15);
}

.header h1 {
    margin: 0;
    font-size: 1.75rem;
    color: #566a7f;
    font-weight: 500;
    letter-spacing: -0.5px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}

/* Header Search - Retractable */
.header-search {
    position: relative;
    display: flex;
    align-items: center;
}

.header-search .search-toggle {
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.header-search .search-toggle:hover {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.header-search .search-input-wrapper {
    position: absolute;
    right: 0;
    top: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    opacity: 0;
    visibility: hidden;
    width: 0;
    transition: all 0.3s ease;
    z-index: 1000;
}

.header-search.active .search-toggle {
    display: none;
}

.header-search.active .search-input-wrapper {
    opacity: 1;
    visibility: visible;
    width: 350px;
}

.header-search .search-input-wrapper > div:first-child {
    display: flex;
    align-items: center;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(67, 89, 113, 0.15);
}

.header-search .search-input {
    border: 1px solid #d9dee3;
    border-radius: 8px 0 0 8px;
    padding: 10px 15px;
    font-size: 0.9375rem;
    flex: 1;
    border-right: none;
}

.header-search .search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: none;
}

.header-search .search-close {
    padding: 10px 15px;
    color: #697a8d;
    text-decoration: none;
    border-radius: 0 8px 8px 0;
    transition: all 0.3s ease;
    border: 1px solid #d9dee3;
    border-left: none;
    background: white;
}

.header-search .search-close:hover {
    color: var(--danger-color);
    background: #f5f5f9;
}

.header-search .search-results {
    position: relative;
    margin-top: 10px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(67, 89, 113, 0.2);
    max-height: 400px;
    overflow-y: auto;
    display: none;
}

.header-search .search-results.show {
    display: block;
}

.header-search .search-results .search-category {
    padding: 8px 16px;
    background: #f5f5f9;
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--primary-color);
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-search .search-results .search-category i {
    font-size: 0.875rem;
}

.header-search .search-results .search-item {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.2s ease;
}

.header-search .search-results .search-item:last-child {
    border-bottom: none;
}

.header-search .search-results .search-item:hover {
    background: #f5f5f9;
}

.header-search .search-results .search-item-title {
    font-weight: 600;
    color: #566a7f;
    margin-bottom: 4px;
    font-size: 0.9375rem;
}

.header-search .search-results .search-item-details {
    font-size: 0.8125rem;
    color: #697a8d;
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.header-search .search-results .search-item-code {
    color: var(--primary-color);
    font-weight: 500;
}

.header-search .search-results .search-item-stock {
    color: var(--success-color);
}

.header-search .search-results .search-item-stock.low {
    color: var(--warning-color);
}

.header-search .search-results .search-item-stock.out {
    color: var(--danger-color);
}

.header-search .search-results .no-results {
    padding: 20px;
    text-align: center;
    color: #697a8d;
    font-size: 0.875rem;
}

.header-search .search-results .loading {
    padding: 20px;
    text-align: center;
    color: var(--primary-color);
}

/* ========================================
   SIDEBAR COLLAPSED MODE (DESKTOP ONLY)
   ======================================== */

@media (min-width: 993px) {
    /* Afficher le bouton de toggle en desktop uniquement */
    .sidebar-toggle-btn {
        display: flex !important;
    }

    /* Sidebar en mode collapsed */
    .sidebar.collapsed {
        width: 80px;
    }

    .sidebar.collapsed .logo {
        /* Garder la même hauteur */
        min-height: 88px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .sidebar.collapsed .logo h3 {
        flex-direction: row;
        justify-content: center;
        /* Garder la même hauteur */
        min-height: 38px;
        gap: 0;
    }

    .sidebar.collapsed .logo h3 i {
        /* Garder exactement la même taille */
        font-size: 1.75rem;
        width: 28px;
        height: 28px;
    }

    .sidebar.collapsed .sidebar-brand-text {
        opacity: 0;
        width: 0;
        overflow: hidden;
    }

    /* Menu links en mode collapsed */
    .sidebar.collapsed .nav-link {
        justify-content: center;
        padding: 11px 0;
        margin: 2px 12px;
        position: relative;
        /* Garder la même hauteur */
        min-height: 44px;
    }

    .sidebar.collapsed .nav-link i {
        margin-right: 0;
        /* Garder exactement la même taille */
        width: 22px;
        height: 22px;
        font-size: 1.25rem;
    }

    .sidebar.collapsed .nav-link span {
        opacity: 0;
        width: 0;
        overflow: hidden;
    }

    /* Tooltip au survol en mode collapsed */
    .sidebar.collapsed .nav-link::after {
        content: attr(data-tooltip);
        position: absolute;
        left: 100%;
        top: 50%;
        transform: translateY(-50%);
        margin-left: 15px;
        padding: 0.5rem 0.75rem;
        background: #2b2c40;
        color: white;
        border-radius: 6px;
        font-size: 0.875rem;
        white-space: nowrap;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity 0.2s ease, visibility 0.2s ease;
        z-index: 1100;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }

    .sidebar.collapsed .nav-link:hover::after {
        opacity: 1;
        visibility: visible;
    }

    /* Ajuster le bouton toggle en mode collapsed */
    .sidebar.collapsed ~ .sidebar-toggle-btn {
        left: 68px;
    }

    /* Ajuster le main-content en mode collapsed avec transition */
    body:has(.sidebar.collapsed) .main-content {
        margin-left: 80px;
        transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
}

/* Désactiver le mode collapsed en dessous de 993px */
@media (max-width: 992px) {
    .sidebar.collapsed {
        width: var(--sidebar-width) !important;
    }

    .sidebar-toggle-btn {
        display: none !important;
    }

    body:has(.sidebar.collapsed) .main-content {
        margin-left: 0 !important;
    }
}

/* Responsive pour la recherche */
@media (max-width: 768px) {
    .header-search {
        position: static;
    }

    .header-search .search-toggle {
        display: flex !important;
    }

    .header-search .search-input-wrapper {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100% !important;
        max-width: 100%;
        padding: 15px;
        background: rgba(0, 0, 0, 0.95);
        z-index: 2000;
        height: 100vh;
        overflow-y: auto;
        pointer-events: none;
    }

    .header-search.active .search-toggle {
        display: none !important;
    }

    .header-search.active .search-input-wrapper {
        width: 100% !important;
        pointer-events: auto;
    }

    .header-search .search-input-wrapper > div:first-child {
        background: white;
        border-radius: 8px;
        pointer-events: auto;
    }

    .header-search .search-input {
        font-size: 1rem;
        padding: 12px 15px;
    }

    .header-search .search-close {
        padding: 12px 15px;
    }

    .header-search .search-results {
        max-height: calc(100vh - 120px);
        margin-top: 10px;
        border-radius: 8px;
        pointer-events: auto;
    }

    .header-search .search-results .search-item {
        padding: 14px 16px;
    }

    .header-search .search-results .search-item-title {
        font-size: 1rem;
        margin-bottom: 6px;
    }

    .header-search .search-results .search-item-details {
        font-size: 0.875rem;
        flex-wrap: wrap;
    }

    .header-search .search-results .search-category {
        padding: 10px 16px;
        font-size: 0.875rem;
        position: sticky;
        top: 0;
        z-index: 10;
        background: #f5f5f9;
    }
}

@media (max-width: 576px) {
    .header-search .search-input {
        font-size: 0.9375rem;
    }

    .header-search .search-results .search-item-title {
        font-size: 0.9375rem;
    }

    .header-search .search-results .search-item-details {
        font-size: 0.8125rem;
    }
}

/* Cards KPI - Sneat Style */
.kpi-card {
    background: white;
    border-radius: 10px;
    padding: 16px;
    box-shadow: 0 2px 6px rgba(67, 89, 113, 0.12);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    height: 100%;
    border: 1px solid rgba(0,0,0,0.05);
    position: relative;
    overflow: hidden;
}

.kpi-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: currentColor;
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.kpi-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 8px 20px rgba(67, 89, 113, 0.2);
}

.kpi-card:hover::after {
    transform: scaleX(1);
}

.kpi-card .icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    margin-bottom: 10px;
    transition: transform 0.3s ease;
}

.kpi-card:hover .icon {
    transform: scale(1.05);
}

.kpi-card.primary {
    color: rgb(105, 108, 255);
}

.kpi-card.primary .icon {
    background: linear-gradient(135deg, rgba(105, 108, 255, 0.15), rgba(105, 108, 255, 0.05));
    color: rgb(105, 108, 255);
}

.kpi-card.success {
    color: rgb(113, 221, 55);
}

.kpi-card.success .icon {
    background: linear-gradient(135deg, rgba(113, 221, 55, 0.15), rgba(113, 221, 55, 0.05));
    color: rgb(113, 221, 55);
}

.kpi-card.danger {
    color: rgb(255, 62, 29);
}

.kpi-card.danger .icon {
    background: linear-gradient(135deg, rgba(255, 62, 29, 0.15), rgba(255, 62, 29, 0.05));
    color: rgb(255, 62, 29);
}

.kpi-card.warning {
    color: rgb(255, 171, 0);
}

.kpi-card.warning .icon {
    background: linear-gradient(135deg, rgba(255, 171, 0, 0.15), rgba(255, 171, 0, 0.05));
    color: rgb(255, 171, 0);
}

.kpi-card.info {
    color: rgb(3, 195, 236);
}

.kpi-card.info .icon {
    background: linear-gradient(135deg, rgba(3, 195, 236, 0.15), rgba(3, 195, 236, 0.05));
    color: rgb(3, 195, 236);
}

.kpi-card h3 {
    font-size: 1.75rem;
    margin: 8px 0 4px 0;
    color: #2c3e50;
    font-weight: 700;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.kpi-card p {
    color: #6c757d;
    margin: 0;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.3;
}

/* Charts - Sneat Style */
.chart-container {
    background: white;
    border-radius: 10px;
    padding: 24px;
    box-shadow: 0 2px 6px rgba(67, 89, 113, 0.12);
    margin-bottom: 25px;
    border: 1px solid rgba(0,0,0,0.05);
    transition: all 0.3s ease;
    position: relative;
    overflow: visible;
}

/* Chart Controls */
.chart-controls {
    background-color: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
}

.chart-controls .btn-group {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.chart-controls .date-range-controls {
    margin-top: 0;
}

.chart-controls .date-range-controls input[type="date"] {
    min-width: 130px;
}

/* Sur desktop, améliorer l'alignement */
@media (min-width: 768px) {
    .chart-controls .date-range-controls input[type="date"] {
        max-width: 150px;
    }
}

.chart-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, rgb(105, 108, 255), rgb(113, 221, 55));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.chart-container:hover::before {
    opacity: 1;
}

.chart-container:hover {
    box-shadow: 0 6px 16px rgba(67, 89, 113, 0.18);
    transform: translateY(-2px);
}

.chart-container h4 {
    margin-bottom: 20px;
    font-weight: 600;
    color: #566a7f;
    font-size: 1.125rem;
    letter-spacing: -0.2px;
}

.chart-container canvas {
    max-height: 400px;
}

/* Tables - Sneat Style */
.table-container {
    background: white;
    border-radius: 10px;
    padding: 24px;
    box-shadow: 0 2px 6px rgba(67, 89, 113, 0.12);
    border: 1px solid rgba(0,0,0,0.05);
    transition: box-shadow 0.2s ease;
    width: 100%;
}

.table-container:hover {
    box-shadow: 0 4px 10px rgba(67, 89, 113, 0.15);
}

.table-container .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    margin: 0;
}

.table-container h4 {
    margin-bottom: 20px;
    color: #1a1a1a;
    font-weight: 600;
    font-size: 1.1rem;
}

.table {
    margin-bottom: 0;
    font-size: 0.9rem;
    color: #2d3748;
    width: 100%;
}

/* Forcer les tableaux à utiliser toute la largeur disponible */
.table-responsive {
    width: 100%;
}

.table-responsive > .table {
    width: 100%;
    margin-bottom: 0;
}

/* Sur desktop/tablette paysage, utiliser table-layout fixed pour forcer 100% de largeur */
@media (min-width: 768px) {
    .table-container .table {
        width: 100%;
        table-layout: fixed;
    }

    /* Les colonnes sans largeur définie prendront l'espace restant */
    .table thead th,
    .table tbody td {
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* Sur mobile portrait, permettre le scroll horizontal avec taille naturelle */
@media (max-width: 767px) {
    .table-container .table {
        width: auto;
        min-width: 100%;
        table-layout: auto;
    }
}

.table thead th {
    background-color: #f8f9fa;
    color: #495057;
    border-bottom: 1px solid #dee2e6;
    border-top: none;
    font-weight: 600;
    text-transform: none;
    font-size: 0.85rem;
    letter-spacing: 0.3px;
    padding: 14px 12px;
    vertical-align: middle;
}

.table tbody tr {
    border-bottom: 1px solid #f1f3f5;
    transition: background-color 0.15s ease;
}

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

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

.table tbody td {
    padding: 12px;
    vertical-align: middle;
    color: #4a5568;
    font-size: 0.875rem;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: #fafbfc;
}

.table-striped tbody tr:nth-of-type(odd):hover {
    background-color: #f1f3f5;
}

.table-sm thead th {
    padding: 10px 8px;
}

.table-sm tbody td {
    padding: 10px 8px;
}

/* Listes dans les table-containers (dashboard) */
.table-container .list-unstyled {
    width: 100%;
    margin: 0;
    padding: 0;
}

.table-container .list-unstyled li {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Badges - Sneat Style */
.badge {
    padding: 5px 10px;
    font-weight: 500;
    font-size: 0.8125rem;
    border-radius: 5px;
    letter-spacing: 0.2px;
    line-height: 1.2;
}

.badge.bg-success {
    background-color: #71dd37 !important;
}

.badge.bg-danger {
    background-color: #ff3e1d !important;
}

.badge.bg-warning {
    background-color: #ffab00 !important;
}

.badge.bg-info {
    background-color: #03c3ec !important;
}

/* Pagination */
.pagination {
    margin-top: 20px;
}

.pagination .page-link {
    color: #495057;
    border: 1px solid #dee2e6;
    padding: 8px 12px;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.pagination .page-link:hover {
    background-color: #f8f9fa;
    border-color: #dee2e6;
    color: #0d6efd;
}

.pagination .page-item.active .page-link {
    background-color: #0d6efd;
    border-color: #0d6efd;
    color: white;
}

.pagination .page-item.disabled .page-link {
    color: #adb5bd;
    background-color: white;
    border-color: #dee2e6;
}

/* Boutons */
.btn {
    font-size: 0.875rem;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 0.8rem;
}

.btn-primary {
    background: linear-gradient(135deg, rgb(105, 108, 255), rgb(90, 93, 230));
    border: none;
    box-shadow: 0 2px 6px rgba(105, 108, 255, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, rgb(90, 93, 230), rgb(75, 78, 200));
    box-shadow: 0 4px 12px rgba(105, 108, 255, 0.4);
    transform: translateY(-1px);
}

.btn-outline-primary {
    color: rgb(105, 108, 255);
    border: 1px solid rgb(105, 108, 255);
    background: transparent;
}

.btn-outline-primary:hover {
    background: rgba(105, 108, 255, 0.1);
    color: rgb(105, 108, 255);
    border-color: rgb(105, 108, 255);
}

.btn-outline-primary.active {
    background: rgb(105, 108, 255);
    color: white;
    border-color: rgb(105, 108, 255);
}

.btn-info {
    background: linear-gradient(135deg, rgb(3, 195, 236), rgb(2, 175, 215));
    box-shadow: 0 2px 6px rgba(3, 195, 236, 0.3);
}

.btn-info:hover {
    background: linear-gradient(135deg, rgb(2, 175, 215), rgb(1, 155, 195));
    box-shadow: 0 4px 12px rgba(3, 195, 236, 0.4);
    transform: translateY(-1px);
}

.btn-success {
    background: linear-gradient(135deg, rgb(113, 221, 55), rgb(95, 195, 40));
    box-shadow: 0 2px 6px rgba(113, 221, 55, 0.3);
}

.btn-success:hover {
    background: linear-gradient(135deg, rgb(95, 195, 40), rgb(80, 175, 30));
    box-shadow: 0 4px 12px rgba(113, 221, 55, 0.4);
    transform: translateY(-1px);
}

/* Form controls */
.form-select,
.form-control {
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 0.875rem;
    padding: 8px 12px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    max-width: 100%;
    box-sizing: border-box;
}

.form-select:focus,
.form-control:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

.form-select-sm {
    padding: 5px 10px;
    font-size: 0.8rem;
    max-width: 100%;
    box-sizing: border-box;
}

/* Modal Sections */
.modal-section {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid #e9ecef;
}

.modal-section:last-child {
    margin-bottom: 0;
}

.modal-section-title {
    color: #2c3e50;
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #dee2e6;
    display: flex;
    align-items: center;
}

.modal-section-title i {
    color: #6c757d;
}

/* Tableaux dans les modals - Style moderne préservé */
.modal-section .table,
.modal-body .table {
    margin-bottom: 0;
}

.modal-section .table thead.table-light th,
.modal-body .table thead.table-light th {
    background-color: #f8f9fa;
    position: sticky;
    top: 0;
    z-index: 1;
}

.modal-section .table tr,
.modal-body .table tr {
    transition: background-color 0.15s ease;
}

.modal-section .table tr:hover,
.modal-body .table tr:hover {
    background-color: rgba(67, 89, 113, 0.04);
}

.info-group {
    margin-bottom: 20px;
}

.info-group:last-child {
    margin-bottom: 0;
}

.info-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #697a8d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.info-group .info-value {
    font-size: 1rem;
    color: #566a7f;
    font-weight: 500;
    padding: 0;
}

.modal-body {
    padding: 24px;
}

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

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

/* Login Page */
.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: 15px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
}

.login-card h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #2c3e50;
}

.login-card .btn-primary {
    width: 100%;
    padding: 12px;
    font-weight: 600;
}

/* Desktop - Sidebar toujours visible (Bootstrap XL breakpoint) */
@media (min-width: 1200px) {
    .sidebar {
        transform: translateX(0) !important;
    }

    .main-content {
        margin-left: var(--sidebar-width) !important;
        transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    /* Mais permettre l'ajustement en mode collapsed */
    body:has(.sidebar.collapsed) .main-content {
        margin-left: 80px !important;
        transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
}

/* Responsive - Sneat Mobile/Tablet Behavior */
/* Mobile, Tablette et Tablette Paysage (< 1200px) */
@media (max-width: 1199px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: none;
    }

    .sidebar.show {
        transform: translateX(0);
        z-index: 1051;
        box-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
    }

    .main-content {
        margin-left: 0;
        padding: 12px;
        width: 100%;
        transition: margin-left 0.3s ease;
    }

    /* Logo pour mobile */
    .sidebar .logo {
        padding: 20px;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .sidebar .logo h3 {
        font-size: 1.25rem;
    }

    .header {
        flex-wrap: wrap;
        padding: 12px 15px;
        gap: 10px;
        background: #fff;
        box-shadow: 0 2px 8px rgba(67, 89, 113, 0.1);
        margin-bottom: 15px;
    }

    .header h1 {
        font-size: 1.25rem;
        font-weight: 600;
    }

    /* Grid responsive - Cards prennent toute la largeur sur mobile */
    .row > [class*="col-"] {
        padding-left: 8px;
        padding-right: 8px;
    }

    .row {
        margin-left: -8px;
        margin-right: -8px;
    }

    .mb-4 {
        margin-bottom: 1rem !important;
    }

    .mb-3 {
        margin-bottom: 0.75rem !important;
    }

    /* Assurer le scroll horizontal des tables */
    .table-responsive {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        display: block;
        width: 100%;
    }

    .table {
        min-width: 100%;
        width: max-content;
    }

    /* KPI Cards en mode mobile - Style Sneat */
    .kpi-card {
        padding: 16px;
        margin-bottom: 0;
        border-radius: 8px;
        transition: all 0.2s ease;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
    }

    .kpi-card:hover {
        transform: none;
        box-shadow: 0 2px 6px rgba(67, 89, 113, 0.12);
    }

    .kpi-card .icon {
        width: 44px;
        height: 44px;
        font-size: 1.1rem;
        margin-bottom: 10px;
        border-radius: 8px;
    }

    .kpi-card h3 {
        font-size: 1.5rem;
        font-weight: 700;
        margin-bottom: 4px;
        line-height: 1.2;
    }

    .kpi-card p {
        font-size: 0.8125rem;
        color: #697a8d;
        margin-bottom: 0;
        line-height: 1.3;
    }

    /* Contrôles de graphiques - Style Sneat */
    .chart-container {
        padding: 16px;
        margin-bottom: 15px;
        background: #fff;
        border-radius: 8px;
        box-shadow: 0 2px 6px rgba(67, 89, 113, 0.12);
    }

    .chart-container h4 {
        font-size: 1rem;
        font-weight: 600;
        margin-bottom: 12px;
        color: #566a7f;
    }

    .chart-container canvas {
        max-height: 250px;
    }

    /* Chart Controls - Mobile */
    .chart-controls {
        padding: 10px;
    }

    .chart-controls .btn-group {
        margin-bottom: 10px;
    }

    .chart-controls .btn-group .btn {
        font-size: 0.75rem;
        padding: 8px 12px;
        flex: 1;
    }

    .chart-controls .date-range-controls {
        margin-top: 0;
    }

    .chart-controls .date-range-controls input[type="date"] {
        min-width: auto;
        max-width: none;
        font-size: 0.8125rem;
        padding: 6px 8px;
    }

    .chart-controls .date-range-controls .btn {
        white-space: nowrap;
        font-size: 0.8125rem;
        padding: 6px 12px;
    }

    .chart-controls .date-range-controls span {
        font-size: 0.875rem;
    }

    /* Boutons généraux en mode mobile - Sneat Style */
    .btn {
        font-size: 0.8125rem;
        padding: 8px 16px;
        border-radius: 6px;
        font-weight: 500;
        transition: all 0.2s ease;
    }

    .btn-sm {
        font-size: 0.75rem;
        padding: 5px 12px;
    }

    .btn-primary {
        background-color: #696cff;
        border-color: #696cff;
    }

    .btn-primary:hover {
        background-color: #5f61e6;
        border-color: #5f61e6;
    }

    .btn-outline-primary {
        color: #696cff;
        border-color: #d9dee3;
    }

    .btn-outline-primary:hover {
        background-color: rgba(105, 108, 255, 0.08);
        border-color: #696cff;
    }

    .btn-group {
        gap: 4px;
    }

    .btn-group .btn {
        border-radius: 6px !important;
    }

    /* Tables responsives - Sneat Style */
    .table-container {
        padding: 16px;
        height: auto !important;
        max-height: none;
        background: #fff;
        border-radius: 8px;
        box-shadow: 0 2px 6px rgba(67, 89, 113, 0.12);
        margin-bottom: 15px;
        overflow: hidden;
    }

    .table-container h4 {
        font-size: 1rem;
        font-weight: 600;
        margin-bottom: 12px;
        color: #566a7f;
    }

    /* Wrapper pour le scroll horizontal */
    .table-responsive {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        margin: 0 -16px;
        padding: 0 16px;
    }

    .table {
        font-size: 0.8125rem;
        margin-bottom: 0;
        min-width: 600px;
    }

    .table thead th {
        font-size: 0.75rem;
        padding: 8px 6px;
        white-space: nowrap;
        background: #f8f9fa;
        border-bottom: 1px solid #dee2e6;
        font-weight: 600;
        color: #566a7f;
        position: sticky;
        top: 0;
        z-index: 10;
    }

    .table tbody td {
        padding: 8px 6px;
        white-space: nowrap;
        vertical-align: middle;
        border-bottom: 1px solid #f0f0f0;
        font-size: 0.8125rem;
    }

    .table tbody tr:hover {
        background-color: rgba(67, 89, 113, 0.04);
    }

    /* Réduire la taille des badges avec style amélioré */
    .badge {
        font-size: 0.6875rem;
        padding: 3px 7px;
        border-radius: 4px;
        font-weight: 600;
        white-space: nowrap;
    }

    /* User info dans le header */
    .user-info {
        gap: 10px;
        font-size: 0.9rem;
    }

    .user-avatar {
        width: 35px;
        height: 35px;
        font-size: 0.9rem;
    }
}

/* Extra small devices (< 576px) - Sneat Ultra Mobile */
@media (max-width: 576px) {
    .main-content {
        padding: 10px;
    }

    .header {
        padding: 10px 12px;
    }

    .header h1 {
        font-size: 1.125rem;
    }

    /* KPI Cards ultra-compactes */
    .kpi-card {
        padding: 14px;
    }

    .kpi-card .icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .kpi-card h3 {
        font-size: 1.375rem;
    }

    .kpi-card p {
        font-size: 0.75rem;
    }

    /* Charts ultra-compacts */
    .chart-container {
        padding: 14px;
    }

    .chart-container h4 {
        font-size: 0.9375rem;
    }

    .chart-container canvas {
        max-height: 220px;
    }

    /* Chart Controls - Ultra Mobile */
    .chart-controls {
        padding: 8px;
    }

    .chart-controls .btn-group .btn {
        font-size: 0.6875rem;
        padding: 6px 8px;
    }

    .chart-controls .date-range-controls input[type="date"] {
        font-size: 0.75rem;
        padding: 5px 6px;
    }

    .chart-controls .date-range-controls .btn {
        padding: 5px 10px;
        font-size: 0.75rem;
    }

    .chart-controls .date-range-controls .btn i {
        font-size: 0.75rem;
    }

    .chart-controls .date-range-controls span {
        font-size: 0.75rem;
    }

    /* Tables ultra-compactes */
    .table-container {
        padding: 12px;
    }

    .table-container h4 {
        font-size: 0.9375rem;
        margin-bottom: 10px;
    }

    .table {
        font-size: 0.75rem;
        min-width: 550px;
    }

    .table thead th {
        font-size: 0.6875rem;
        padding: 6px 4px;
    }

    .table tbody td {
        padding: 6px 4px;
        font-size: 0.75rem;
    }

    .badge {
        font-size: 0.625rem;
        padding: 2px 6px;
    }

    /* Boutons */
    .btn {
        font-size: 0.75rem;
        padding: 7px 14px;
    }

    .btn-sm {
        font-size: 0.6875rem;
        padding: 4px 10px;
    }

    /* User avatar */
    .user-avatar {
        width: 32px;
        height: 32px;
        font-size: 0.875rem;
    }

    .user-info {
        gap: 8px;
        font-size: 0.8125rem;
    }
}

/* Articles Page - Responsive */
@media (max-width: 768px) {
    /* Filtres empilés verticalement */
    .filters .row > div {
        margin-bottom: 10px;
    }

    .filters .col-md-3,
    .filters .col-md-2,
    .filters .col-md-1 {
        width: 100%;
        flex: 0 0 100%;
        max-width: 100%;
    }

    /* Bouton de recherche en pleine largeur */
    .filters .col-md-1 .btn {
        width: 100%;
        margin-top: 0;
    }

    /* Table plus compacte */
    .table thead th,
    .table tbody td {
        font-size: 0.8rem;
        padding: 8px 4px;
        white-space: nowrap;
    }

    /* Pagination plus petite */
    .pagination .page-link {
        padding: 0.25rem 0.5rem;
        font-size: 0.85rem;
    }

    /* Modal article détail */
    .modal-dialog.modal-lg {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }

    .modal-body h6 {
        font-size: 0.95rem;
        margin-top: 10px;
        margin-bottom: 10px;
    }

    .modal-body .table-sm th,
    .modal-body .table-sm td {
        font-size: 0.8rem;
        padding: 4px;
    }

    /* Réorganiser les colonnes du modal en full width */
    .modal-body .col-md-6 {
        width: 100%;
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 15px;
    }
}

@media (max-width: 576px) {
    /* Table encore plus compacte */
    .table thead th,
    .table tbody td {
        font-size: 0.75rem;
        padding: 6px 3px;
        white-space: nowrap;
    }

    /* Bouton action plus petit */
    .btn-sm {
        padding: 0.15rem 0.4rem;
        font-size: 0.75rem;
    }

    /* Filtres encore plus compacts */
    .filters {
        padding: 12px;
    }

    .filters .form-label {
        font-size: 0.85rem;
        margin-bottom: 4px;
    }

    .filters .form-control,
    .filters .form-select {
        font-size: 0.85rem;
        padding: 0.375rem 0.5rem;
    }

    /* Modal corrections/mouvements en scroll horizontal si besoin */
    .modal-body .table-responsive {
        max-height: 200px;
    }

    .modal-body .table-sm thead th,
    .modal-body .table-sm tbody td {
        font-size: 0.7rem;
        padding: 3px 2px;
        white-space: nowrap;
    }

    /* Pagination très compacte */
    .pagination .page-link {
        padding: 0.2rem 0.4rem;
        font-size: 0.75rem;
    }

    .pagination .page-item {
        margin: 0 1px;
    }

    /* Limiter le nombre de pages affichées */
    .pagination .page-item:not(.active):nth-child(n+6):nth-last-child(n+3) {
        display: none;
    }
}

/* Ventes Page - Responsive */
@media (max-width: 768px) {
    /* Filtres empilés verticalement */
    .filters .col-md-2 {
        width: 100%;
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 10px;
    }

    /* Boutons d'action en pleine largeur */
    .filters .btn {
        margin-bottom: 8px;
    }

    /* KPI Cards ventes */
    .row.mt-4 .col-md-4 {
        margin-bottom: 15px;
    }

    /* Modal ticket détail */
    .modal-body .col-md-6 {
        width: 100%;
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 10px;
    }

    .modal-body .table-sm {
        font-size: 0.8rem;
    }

    .modal-body .table-sm th,
    .modal-body .table-sm td {
        padding: 6px 4px;
    }

    /* Modal statistiques */
    .modal-dialog.modal-xl {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }

    #statsModalBody .col-md-3,
    #statsModalBody .col-md-6 {
        width: 100%;
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 15px;
    }

    #statsModalBody .kpi-card {
        padding: 12px;
    }

    #statsModalBody .kpi-card h6 {
        font-size: 0.85rem;
        margin-bottom: 8px;
    }

    #statsModalBody .kpi-card h4 {
        font-size: 1.3rem;
    }

    #statsModalBody h5 {
        font-size: 1.1rem;
        margin-top: 15px;
        margin-bottom: 10px;
    }

    #statsModalBody h6 {
        font-size: 0.95rem;
    }

    #statsModalBody .table-responsive {
        max-height: 250px;
    }
}

@media (max-width: 576px) {
    /* Table ventes compacte */
    .table thead th,
    .table tbody td {
        font-size: 0.75rem;
        padding: 6px 3px;
        white-space: nowrap;
    }

    /* Filtres ultra compacts */
    .filters {
        padding: 10px;
    }

    .filters .form-label {
        font-size: 0.8rem;
        margin-bottom: 3px;
    }

    .filters .form-control,
    .filters .form-select {
        font-size: 0.8rem;
        padding: 0.3rem 0.4rem;
    }

    .filters .btn {
        font-size: 0.85rem;
        padding: 0.4rem 0.6rem;
    }

    .filters .btn i {
        margin-right: 4px;
    }

    /* KPI cards plus compacts */
    .row.mt-4 {
        margin-top: 1rem !important;
    }

    .row.mt-4 .kpi-card {
        padding: 12px;
    }

    .row.mt-4 .kpi-card .icon {
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
    }

    .row.mt-4 .kpi-card h3 {
        font-size: 1.4rem;
    }

    .row.mt-4 .kpi-card p {
        font-size: 0.8rem;
    }

    /* Modal ticket */
    .modal-body p {
        font-size: 0.85rem;
        margin-bottom: 8px;
    }

    .modal-body h6 {
        font-size: 0.9rem;
        margin-top: 12px;
        margin-bottom: 8px;
    }

    .modal-body .table-sm {
        font-size: 0.7rem;
    }

    .modal-body .table-sm th,
    .modal-body .table-sm td {
        padding: 4px 2px;
        white-space: nowrap;
    }

    /* Modal statistiques ultra compact */
    #statsModalBody .kpi-card {
        padding: 10px;
    }

    #statsModalBody .kpi-card h6 {
        font-size: 0.75rem;
        margin-bottom: 5px;
    }

    #statsModalBody .kpi-card h4 {
        font-size: 1.1rem;
    }

    #statsModalBody h5 {
        font-size: 1rem;
        margin-top: 12px;
        margin-bottom: 8px;
    }

    #statsModalBody h6 {
        font-size: 0.85rem;
    }

    #statsModalBody .table-sm {
        font-size: 0.7rem;
    }

    #statsModalBody .table-sm th,
    #statsModalBody .table-sm td {
        padding: 4px 2px;
    }

    #statsModalBody .table-responsive {
        max-height: 200px;
    }

    /* Badges plus petits */
    #statsModalBody .badge {
        font-size: 0.65rem;
        padding: 2px 4px;
    }
}

/* Clients Page - Responsive */
@media (max-width: 768px) {
    /* Filtres clients */
    .filters .col-md-4,
    .filters .col-md-3 {
        width: 100%;
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 10px;
    }

    /* Modal situation client */
    #situationContent .col-md-3,
    #situationContent .col-md-4 {
        width: 100%;
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 10px;
    }

    #situationContent .card {
        margin-bottom: 10px;
    }
}

/* Fournisseurs Page - Responsive */
@media (max-width: 768px) {
    /* Modal fournisseur */
    .modal-body .col-md-6 {
        width: 100%;
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 15px;
    }
}

/* Stocks Page - Responsive */
@media (max-width: 768px) {
    /* Tabs navigation */
    .nav-tabs .nav-link {
        font-size: 0.85rem;
        padding: 0.5rem 0.75rem;
    }

    /* Tables stock en colonnes */
    .tab-pane .row .col-md-6 {
        width: 100%;
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 15px;
    }

    /* Filtres mouvements */
    #mouvements .col-md-3,
    #mouvements .col-md-2 {
        width: 100%;
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 10px;
    }

    /* Tables plus compactes */
    .table-sm {
        font-size: 0.8rem;
    }

    .table-sm th,
    .table-sm td {
        padding: 6px 4px;
        white-space: nowrap;
    }
}

@media (max-width: 576px) {
    /* Tabs encore plus compacts */
    .nav-tabs .nav-link {
        font-size: 0.75rem;
        padding: 0.4rem 0.5rem;
    }

    /* KPI cards stocks */
    .row.mb-4 .col-md-3 {
        margin-bottom: 10px;
    }

    /* Table mouvements ultra compact */
    #mouvements .table {
        font-size: 0.7rem;
    }

    #mouvements .table thead th,
    #mouvements .table tbody td {
        padding: 4px 2px;
        white-space: nowrap;
    }

    /* Table inventaire */
    #inventaire .table {
        font-size: 0.75rem;
    }

    #inventaire .table thead th,
    #inventaire .table tbody td {
        padding: 6px 3px;
        white-space: nowrap;
    }
}

/* Articles Table - Modern E-commerce Style */
.card.border-0.shadow-sm .table tbody tr {
    transition: all 0.2s ease;
    cursor: pointer;
}

.card.border-0.shadow-sm .table tbody tr:hover {
    background-color: rgba(67, 89, 113, 0.04);
    box-shadow: 0 0 0 1px rgba(67, 89, 113, 0.08) inset;
}

.card.border-0.shadow-sm .table tbody tr:hover td .btn.btn-icon {
    color: var(--primary-color) !important;
}

/* Badges modernes pour les familles et stocks */
.badge.bg-label-primary {
    background-color: rgba(105, 108, 255, 0.12) !important;
    color: #696cff !important;
    border: none;
    font-weight: 500;
}

/* Bouton action icon style */
.btn.btn-icon {
    transition: all 0.2s ease;
}

.btn.btn-icon:hover {
    background-color: rgba(105, 108, 255, 0.08) !important;
    transform: scale(1.1);
}

/* Card header/footer style */
.card .card-header {
    padding: 1.125rem 1.5rem;
}

.card .card-footer {
    padding: 1rem 1.5rem;
}

/* Navigation et Pagination - Responsive Moderne (Sneat Style) */
@media (max-width: 768px) {
    /* Pagination responsive */
    .pagination {
        flex-wrap: wrap;
        justify-content: center !important;
        gap: 0.25rem;
        margin-top: 1rem;
    }

    .pagination .page-item {
        margin: 0.125rem;
    }

    .pagination .page-link {
        padding: 0.375rem 0.65rem;
        font-size: 0.8125rem;
        min-width: 36px;
        text-align: center;
        border-radius: 6px !important;
    }

    /* Masquer les pages intermédiaires sur mobile */
    .pagination .page-item:not(.active):not(:first-child):not(:last-child):not(.disabled) {
        display: none;
    }

    .pagination .page-item.active,
    .pagination .page-item:first-child,
    .pagination .page-item:last-child {
        display: inline-block;
    }

    /* Card header responsive */
    .card-header {
        padding: 0.875rem 1rem;
    }

    .card-header h5 {
        font-size: 0.9375rem;
    }

    .card-header .d-flex {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .card-header .d-flex > div:last-child {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    /* Select dans card header ne doit pas déborder */
    .card-header .form-select,
    .card-header .form-select-sm {
        max-width: 100%;
        box-sizing: border-box;
    }

    /* Filtres responsive */
    .filters {
        padding: 0.875rem 1rem;
        margin-bottom: 1rem;
    }

    .filters .row {
        margin-left: -0.5rem;
        margin-right: -0.5rem;
    }

    .filters .row > div {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
        margin-bottom: 0.75rem;
    }

    .filters .form-label {
        font-size: 0.8125rem;
        margin-bottom: 0.375rem;
    }

    .filters .btn {
        width: 100%;
        margin-top: 0.5rem;
    }

    /* Assurer que les selects et inputs ne débordent pas */
    .filters .form-control,
    .filters .form-select {
        max-width: 100%;
        box-sizing: border-box;
    }

    /* Contrôles d'affichage responsive */
    .card-header select.form-select-sm {
        width: auto !important;
        min-width: 70px;
    }

    .card-header label.small,
    .card-header label.text-muted {
        font-size: 0.75rem;
    }

    /* Note: Les styles de tableaux modernes (card.border-0.shadow-sm) ne doivent pas être affectés */
    /* Styles responsive uniquement pour les anciens tableaux (.table-container) */
    .table-container .table {
        font-size: 0.8125rem;
    }

    .table-container .table th,
    .table-container .table td {
        padding: 0.5rem 0.5rem !important;
        font-size: 0.75rem !important;
    }

    .table-container .table th {
        font-size: 0.6875rem !important;
    }

    /* Pas de modification des tableaux modernes en card sur mobile - ils gardent leur style */
    /* Pas de modification des tableaux dans les modals non plus */
    .modal-section .table th,
    .modal-section .table td,
    .modal-body .table th,
    .modal-body .table td {
        padding: 0.75rem 1rem !important;
        font-size: 0.875rem !important;
    }

    .modal-section .table th,
    .modal-body .table th {
        font-size: 0.8125rem !important;
    }
}

/* Responsive - Très petits écrans (Mobile Portrait) */
@media (max-width: 576px) {
    /* Pagination ultra compacte */
    .pagination .page-link {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
        min-width: 32px;
    }

    /* Masquer le label "Afficher" sur très petits écrans */
    .card-header label.small,
    .card-header label.text-muted {
        display: none;
    }

    /* Headers de tableaux anciens encore plus petits */
    .table-container .table th {
        font-size: 0.625rem !important;
        letter-spacing: 0.3px !important;
    }

    /* Tableaux dans modals restent lisibles sur mobile */
    .modal-section .table th,
    .modal-section .table td,
    .modal-body .table th,
    .modal-body .table td {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.75rem !important;
    }

    .modal-section .table th,
    .modal-body .table th {
        font-size: 0.6875rem !important;
    }

    /* Card header en colonne sur très petits écrans */
    .card-header h5 {
        font-size: 0.875rem !important;
        margin-bottom: 0.5rem;
    }

    .card-header select.form-select-sm {
        font-size: 0.75rem;
    }

    /* Filtres très compacts */
    .filters {
        padding: 0.75rem;
    }

    .filters .form-control,
    .filters .form-select {
        font-size: 0.8125rem;
        padding: 0.5rem 0.75rem;
        max-width: 100%;
        box-sizing: border-box;
    }
}

/* Marges Page - Responsive */
@media (max-width: 768px) {
    /* Filtres marges */
    .filters .col-md-3,
    .filters .col-md-2 {
        width: 100%;
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 10px;
    }

    /* Graphiques en colonnes */
    .row .col-md-8,
    .row .col-md-4 {
        width: 100%;
        flex: 0 0 100%;
        max-width: 100%;
    }

    /* Indicateur de chargement repositionné */
    #loadingIndicator {
        top: 10px !important;
        right: 10px !important;
        left: 10px;
    }

    #loadingIndicator .alert {
        font-size: 0.85rem;
        padding: 8px 12px;
    }
}

@media (max-width: 576px) {
    /* KPI cards marges compacts */
    .row.mb-4 .kpi-card {
        padding: 12px;
    }

    .row.mb-4 .kpi-card .icon {
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
    }

    .row.mb-4 .kpi-card h3 {
        font-size: 1.3rem;
    }

    /* Graphiques plus petits */
    .chart-container canvas {
        max-height: 200px !important;
    }

    /* Tables marges très compactes */
    #topArticlesBody,
    #famillesBody {
        font-size: 0.75rem;
    }

    #topArticlesBody tr td,
    #topArticlesBody tr th,
    #famillesBody tr td,
    #famillesBody tr th {
        padding: 6px 3px;
        white-space: nowrap;
    }

    /* Badges très petits */
    .badge {
        font-size: 0.65rem;
        padding: 2px 4px;
    }
}

/* Login Page - Responsive */
@media (max-width: 576px) {
    .login-card {
        padding: 25px;
        margin: 15px;
    }

    .login-card h2 {
        font-size: 1.5rem;
        margin-bottom: 20px;
    }

    .login-card .form-control {
        font-size: 0.9rem;
    }

    .login-card .btn-primary {
        padding: 10px;
        font-size: 0.95rem;
    }
}

/* Base Template - Responsive Enhancements (Sneat Style) */

/* Overlay - Sneat Style */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(67, 89, 113, 0.5);
    backdrop-filter: blur(2px);
    z-index: 1050;
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-overlay.show {
    display: block;
    opacity: 1;
}

/* Toggle Button - Sneat Style */
#sidebarToggle {
    border: none;
    background: transparent;
    font-size: 1.375rem;
    padding: 8px;
    color: #697a8d;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 6px;
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

#sidebarToggle:hover {
    background: rgba(105, 108, 255, 0.08);
    color: var(--primary-color);
}

#sidebarToggle:active {
    transform: scale(0.92);
}

#sidebarToggle:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(105, 108, 255, 0.15);
}

/* Afficher le bouton hamburger uniquement sur mobile/tablette (< 1200px) */
@media (max-width: 1199px) {
    #sidebarToggle {
        display: inline-flex !important;
    }
}

/* Cacher le bouton hamburger sur desktop (≥ 1200px) */
@media (min-width: 1200px) {
    #sidebarToggle {
        display: none !important;
    }

    .sidebar-overlay {
        display: none !important;
    }
}

/* Tabs Navigation - Style Boutons */
.nav-tabs {
    border-bottom: none;
    gap: 10px;
    margin-bottom: 1.5rem;
}

.nav-tabs .nav-link {
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    color: #6c757d;
    background-color: #f8f9fa;
    font-weight: 500;
    transition: all 0.2s ease;
    margin-bottom: 0;
}

.nav-tabs .nav-link:hover {
    background-color: #e9ecef;
    color: #495057;
    transform: translateY(-1px);
}

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

.nav-tabs .nav-item {
    margin-bottom: 0;
}

/* Row & Column fixes - Assurer la largeur complète */
.row {
    margin-left: -12px;
    margin-right: -12px;
    width: calc(100% + 24px);
}

.row > * {
    padding-left: 12px;
    padding-right: 12px;
}

/* Assurer que les containers prennent toute la largeur */
.container-fluid {
    width: 100%;
    padding-left: 12px;
    padding-right: 12px;
}

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

.mb-4 {
    margin-bottom: 1.5rem !important;
}

.mt-4 {
    margin-top: 1.5rem !important;
}

/* Loading spinner */
.spinner-border {
    width: 3rem;
    height: 3rem;
}

/* Alerts */
.alert {
    border-radius: 8px;
    border: none;
}

/* Filters */
.filters {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 25px;
}

.filters .form-label {
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.9rem;
}

/* Date Range Inputs */
.gap-1 {
    gap: 0.5rem !important;
}

.gap-2 {
    gap: 1rem !important;
}

#dateRangeInputs {
    margin-left: 0.5rem;
}

#dateRangeInputs input[type="date"] {
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    padding: 0.25rem 0.5rem;
}

#dateRangeInputs input[type="date"]:focus {
    border-color: var(--primary-color);
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Footer */
.footer {
    margin-top: 2rem;
    padding: 1rem 0;
    border-top: 1px solid #dee2e6;
    background-color: #f8f9fa;
    color: #6c757d;
    font-size: 0.875rem;
}

.footer p {
    margin: 0;
}

@media (max-width: 768px) {
    .footer {
        font-size: 0.75rem;
        padding: 0.75rem 0;
    }
}

/* Dashboard - New Styles pour le dashboard refait */
.nav-pills .nav-link {
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #697a8d;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.nav-pills .nav-link:hover {
    background-color: rgba(105, 108, 255, 0.08);
    color: #696cff;
}

.nav-pills .nav-link.active {
    background-color: #696cff;
    color: white;
    border-color: #696cff;
}

.nav-pills .nav-link i {
    font-size: 0.875rem;
}

.nav-pills .badge {
    font-size: 0.625rem;
    padding: 2px 5px;
}

/* Card avec onglets */
.card .nav-pills {
    background: transparent;
    padding: 0;
    gap: 5px;
}

/* Tabs content spacing */
.tab-content {
    padding-top: 1rem;
}

.tab-pane {
    animation: fadeIn 0.3s ease-in;
}

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