﻿/* Reset et Variables */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #209CD5;
    --primary-dark: #1a7fa8;
    --sidebar-blue: #1e3a8a;
    --sidebar-blue-light: #209CD5;
    --secondary-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #209CD5;
    --success-color: #10b981;

    --bg-primary: #ffffff;
    --bg-secondary: #F3F6FB;
    --bg-sidebar: #1e3a8a;
    --bg-hover: #e2e8f0;
    --bg-hover-sidebar: rgba(255, 255, 255, 0.1);

    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --text-sidebar: #ffffff;

    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);

    --sidebar-width: 220px;
    --sidebar-collapsed-width: 64px;
    --topbar-height: 64px;
    --sidebar-header-height: 64px;
}

html {
    background-color: #ffffff;
    min-height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #F3F6FB;
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* Auth Pages - Design moderne et épuré */
.auth-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-wrapper-simple {
    width: 100%;
    max-width: 480px;
}

.auth-form-card {
    background: white;
    border-radius: 16px;
    padding: 48px 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-logo-simple {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: center;
    margin-bottom: 32px;
}

.auth-logo-icon {
    font-size: 36px;
    color: var(--primary-color);
    font-weight: 700;
}

.auth-logo-text {
    font-size: 24px;
    font-weight: 700;
    color: #1e293b;
    letter-spacing: -0.5px;
}

.auth-header-simple {
    text-align: center;
    margin-bottom: 32px;
}

.auth-header-simple h1 {
    font-size: 28px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 8px;
}

.auth-header-simple p {
    font-size: 14px;
    color: #64748b;
}

.auth-form-simple {
    margin-top: 0;
}

.auth-footer-simple {
    text-align: center;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #e2e8f0;
    color: #64748b;
    font-size: 14px;
}

.auth-footer-simple a {
    color: #3b82f6;
    text-decoration: none;
    font-weight: 600;
    margin-left: 4px;
    transition: color 0.2s;
}

.auth-footer-simple a:hover {
    color: #2563eb;
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 640px) {
    .auth-form-card {
        padding: 32px 24px;
    }

    .auth-header-simple h1 {
        font-size: 24px;
    }
}

/* Ancien design (gardé pour compatibilité) */
.auth-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Section gauche avec gradient */
.auth-left {
    flex: 1;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 50%, #6366f1 100%);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 40px;
    position: relative;
    overflow: hidden;
}

.auth-left::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.9) 0%, rgba(139, 92, 246, 0.8) 50%, rgba(99, 102, 241, 0.9) 100%);
    z-index: 1;
}

.auth-logo {
    position: relative;
    z-index: 2;
}

.auth-logo-icon {
    font-size: 32px;
    color: white;
    font-weight: 700;
}

.auth-marketing {
    position: relative;
    z-index: 2;
    color: white;
    max-width: 500px;
}

.auth-marketing-subtitle {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 12px;
}

.auth-marketing-title {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.4;
    color: white;
}

/* Section droite avec formulaire */
.auth-right {
    flex: 1;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    overflow-y: auto;
}

.auth-form-container {
    width: 100%;
    max-width: 480px;
}

.auth-form-logo {
    margin-bottom: 32px;
}

.auth-form-logo-icon {
    font-size: 32px;
    color: var(--primary-color);
    font-weight: 700;
}

.auth-header {
    margin-bottom: 32px;
}

.auth-header h1 {
    font-size: 32px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 12px;
}

.auth-header p {
    font-size: 14px;
    color: #64748b;
    line-height: 1.6;
}

.auth-form {
    margin-top: 32px;
}

.form-row-auth {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #1e293b;
    font-weight: 500;
    font-size: 14px;
}

/* Exception pour les labels de checkbox - inline-flex pour ne pas prendre toute la largeur */
.form-group label.checkbox-form-label {
    display: inline-flex;
    margin-bottom: 0;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 15px;
    transition: all 0.2s;
    background: white;
    color: #1e293b;
    font-family: inherit;
}

/* Exception pour les checkboxes - ne pas prendre 100% de largeur et utiliser le style du tableau */
.form-group input[type="checkbox"],
.form-group .form-checkbox,
.form-group .table-checkbox {
    width: 20px;
    height: 20px;
    padding: 0;
    border: 1.5px solid #d1d5db;
    border-radius: 4px;
    background: white;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    position: relative;
    flex-shrink: 0;
    transition: all 0.2s ease;
    cursor: pointer;
}

.form-group input[type="checkbox"]:hover,
.form-group .form-checkbox:hover,
.form-group .table-checkbox:hover {
    border-color: #06b6d4;
}

.form-group input[type="checkbox"]:checked,
.form-group .form-checkbox:checked,
.form-group .table-checkbox:checked {
    background: #06b6d4;
    border-color: #06b6d4;
}

.form-group input[type="checkbox"]:checked::after,
.form-group .form-checkbox:checked::after,
.form-group .table-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -60%) rotate(45deg);
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
}

.form-group input[type="checkbox"]:focus,
.form-group .form-checkbox:focus,
.form-group .table-checkbox:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.1);
}

.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover {
    border-color: #cbd5e1;
    background: #fafbfc;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
    background: #fafbfc;
}

.password-input-wrapper {
    position: relative;
}

.password-input-wrapper input {
    padding-right: 45px;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.password-toggle:hover {
    color: #3b82f6;
}

.btn-auth-primary {
    width: 100%;
    padding: 16px 24px;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 8px;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
    letter-spacing: 0.3px;
}

.btn-auth-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
    background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
}

.btn-auth-primary:active {
    transform: translateY(0);
}

.auth-separator {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 32px 0;
    color: #94a3b8;
    font-size: 14px;
}

.auth-separator::before,
.auth-separator::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #e2e8f0;
}

.auth-separator span {
    padding: 0 16px;
}

.auth-social {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 32px;
}

.btn-social {
    width: 48px;
    height: 48px;
    border: 1px solid #e2e8f0;
    background: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
}

.btn-social:hover {
    border-color: #3b82f6;
    background: #f8fafc;
    transform: translateY(-1px);
}

.auth-footer {
    text-align: center;
    color: #64748b;
    font-size: 14px;
}

.auth-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    margin-left: 4px;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 1024px) {
    .auth-wrapper {
        flex-direction: column;
    }

    .auth-left {
        min-height: 300px;
        padding: 30px;
    }

    .auth-marketing-title {
        font-size: 24px;
    }

    .auth-right {
        padding: 30px 20px;
    }
}

@media (max-width: 640px) {
    .form-row-auth {
        grid-template-columns: 1fr;
    }

    .auth-left {
        min-height: 200px;
        padding: 24px;
    }

    .auth-marketing-title {
        font-size: 20px;
    }
}

/* Layout Principal */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: var(--sidebar-header-height);
    min-height: var(--sidebar-header-height);
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    z-index: 998;
    box-shadow: var(--shadow-sm);
    transition: padding-left 0.3s ease;
    margin-left: 0;
}

/* Ajuster le padding-left du topbar selon la largeur de la sidebar */
/* La valeur par défaut sera calculée dynamiquement par JavaScript */

/* Responsive - sur mobile, le topbar prend toute la largeur */
@media (max-width: 1024px) {
    .topbar {
        padding-left: 30px;
        width: 100%;
        left: 0;
    }
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: var(--text-primary);
}

.logo {
    display: flex;
    align-items: center;
}

.logo-text {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-actions {
    display: flex;
    gap: 8px;
}

.icon-btn {
    position: relative;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    border-radius: 8px;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.icon-btn .badge {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--danger-color);
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.user-menu {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.user-menu:hover {
    background: var(--bg-hover);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 500;
    font-size: 14px;
    color: var(--text-primary);
}

.user-role {
    font-size: 12px;
    color: var(--text-secondary);
}

.dropdown-arrow {
    color: var(--text-secondary);
    transition: transform 0.2s;
}

.user-menu.show .dropdown-arrow {
    transform: rotate(180deg);
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    min-width: 180px;
    padding: 8px;
    display: none;
    border: 1px solid var(--border-color);
    z-index: 1001;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.2s ease-out, transform 0.2s ease-out;
}

.user-menu.show .user-dropdown {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.user-dropdown a {
    display: block;
    padding: 10px 12px;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    transition: background 0.2s;
}

.user-dropdown a:hover {
    background: var(--bg-hover);
}

/* ============================================
   SIDEBAR - CORRIGÉE
   ============================================ */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: fit-content;
    min-width: 220px;
    max-width: 280px;
    height: 100vh;
    background: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1000;
    transition: min-width 0.3s ease, max-width 0.3s ease, width 0.3s ease;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
}

/* Le topbar commence après la navbar - le padding-left sera calculé par JavaScript */

/* État replié (collapsed) */
.sidebar.collapsed {
    min-width: var(--sidebar-collapsed-width) !important;
    max-width: var(--sidebar-collapsed-width) !important;
}

/* Hover - La sidebar s'étend */
.sidebar.collapsed:hover {
    min-width: 220px !important;
    max-width: 280px !important;
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.15);
    z-index: 1001;
}

/* ============================================
   SIDEBAR HEADER & LOGO
   ============================================ */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 12px;
    border-bottom: 1px solid var(--border-color);
    gap: 8px;
    transition: padding 0.3s ease;
    height: var(--sidebar-header-height);
    min-height: var(--sidebar-header-height);
    flex-shrink: 0;
}

/* Header quand replié */
.sidebar.collapsed:not(:hover) .sidebar-header {
    padding: 12px 8px;
    justify-content: center;
}

/* Header pendant hover */
.sidebar.collapsed:hover .sidebar-header {
    justify-content: space-between;
    padding: 16px 12px;
}

.sidebar-toggle-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
}

.sidebar-toggle-btn:hover {
    background: var(--bg-hover-sidebar);
    color: var(--primary-color);
}

.sidebar.collapsed:not(:hover) .sidebar-toggle-btn {
    color: var(--primary-color);
    background: transparent;
}

.sidebar.collapsed:not(:hover) .sidebar-toggle-btn:hover {
    background: var(--bg-hover);
    color: var(--primary-color);
}

.sidebar-toggle-btn svg {
    width: 20px;
    height: 20px;
    transition: opacity 0.3s, transform 0.3s;
}

/* Logo */
.sidebar-logo {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    flex: 1;
    transition: all 0.3s ease;
    padding: 0;
    margin: 0;
}

.logo-image {
    width: auto;
    max-width: 100px;
    height: auto;
    max-height: 40px;
    object-fit: contain;
    flex-shrink: 0;
    transition: opacity 0.3s ease;
}

/* Logo replié */
.sidebar.collapsed:not(:hover) .logo-image {
    display: none !important;
    opacity: 0;
}

/* Logo pendant hover */
.sidebar.collapsed:hover .logo-image {
    display: block !important;
    opacity: 1;
}

.sidebar-logo .logo-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    display: block;
    white-space: nowrap;
    transition: opacity 0.3s ease;
}

/* Texte replié */
.sidebar.collapsed:not(:hover) .sidebar-logo .logo-text {
    display: none;
    opacity: 0;
}

/* Texte pendant hover */
.sidebar.collapsed:hover .sidebar-logo .logo-text {
    display: block;
    opacity: 1;
}

.sidebar-logo .logo-icon {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin: 0;
    padding: 0;
    line-height: 1;
}

.sidebar.collapsed:not(:hover) .sidebar-logo .logo-icon {
    display: none;
}

/* ============================================
   NAVIGATION DE LA SIDEBAR
   ============================================ */
.sidebar-nav {
    padding: 8px 4px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    position: relative;
}

/* État replié */
.sidebar.collapsed:not(:hover) .nav-item {
    justify-content: center;
    padding: 12px;
}

/* État hover */
.sidebar.collapsed:hover .nav-item {
    justify-content: flex-start;
    padding: 8px 10px;
}

.nav-item:hover {
    background: #f9fafb;
}

.nav-item.active {
    background: #f3f4f6;
    color: var(--primary-color);
    font-weight: 600;
}

.nav-item.active svg {
    color: var(--primary-color);
}

.nav-item svg {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    transition: opacity 0.3s ease;
}

.nav-item span {
    transition: opacity 0.3s ease, width 0.3s ease;
}

/* Texte caché quand replié */
.sidebar.collapsed:not(:hover) .nav-item span {
    opacity: 0;
    width: 0;
    display: none !important;
}

/* Texte visible pendant hover */
.sidebar.collapsed:hover .nav-item span {
    opacity: 1;
    width: auto;
    display: inline-block !important;
}

.nav-item .nav-arrow {
    margin-left: auto;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Flèche tournée quand le groupe est actif */
.nav-group.active .nav-item .nav-arrow {
    transform: rotate(90deg);
}

/* Flèches cachées quand replié */
.sidebar.collapsed:not(:hover) .nav-item .nav-arrow {
    display: none;
}

/* Flèches visibles pendant hover */
.sidebar.collapsed:hover .nav-item .nav-arrow {
    display: block;
}

/* Groupes de navigation */
.nav-group {
    margin-bottom: 8px;
}

.nav-submenu {
    margin-left: 20px;
    margin-top: 4px;
    display: none;
    transition: opacity 0.3s ease, max-height 0.3s ease;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
}

/* Sous-menu visible quand le groupe est actif (sidebar normale - pas collapsed) */
.sidebar:not(.collapsed) .nav-group.active .nav-submenu,
.nav-group.active .nav-submenu {
    display: block !important;
    max-height: 500px;
    opacity: 1;
}

/* Sous-menu caché quand replié et pas en hover */
.sidebar.collapsed:not(:hover) .nav-submenu {
    display: none !important;
    max-height: 0;
    opacity: 0;
}

/* Sous-menu visible pendant hover si actif (sidebar repliée) */
.sidebar.collapsed:hover .nav-group.active .nav-submenu {
    display: block !important;
    max-height: 500px;
    opacity: 1;
}

.nav-subitem {
    display: block;
    padding: 6px 12px 6px 40px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 6px;
    font-size: 13px;
    transition: all 0.2s;
    white-space: nowrap;
}

/* Sous-items cachés quand replié */
.sidebar.collapsed:not(:hover) .nav-subitem {
    display: none;
}

/* Sous-items visibles pendant hover */
.sidebar.collapsed:hover .nav-subitem {
    display: block;
}

.nav-subitem:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-subitem.active {
    color: var(--primary-color);
    font-weight: 600;
    background: rgba(32, 156, 213, 0.1);
}

/* ============================================
   SIDEBAR FOOTER
   ============================================ */
.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
    position: sticky;
    bottom: 0;
    background: var(--bg-primary);
    z-index: 10;
    transition: padding 0.3s ease;
}

/* Footer replié */
.sidebar.collapsed:not(:hover) .sidebar-footer {
    padding: 12px 8px;
}

.sidebar-logout-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #fce7f3;
    color: #ef4444;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.sidebar-logout-btn:hover {
    background: #fbcfe8;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.15);
}

.sidebar-logout-btn:active {
    transform: translateY(0);
}

.sidebar-logout-btn svg {
    flex-shrink: 0;
    color: #ef4444;
}

.sidebar-logout-btn span {
    color: #ef4444;
    transition: opacity 0.3s ease;
}

/* Bouton logout replié */
.sidebar.collapsed:not(:hover) .sidebar-logout-btn {
    justify-content: center;
    padding: 12px;
}

.sidebar.collapsed:not(:hover) .sidebar-logout-btn span {
    display: none;
}

/* Bouton logout pendant hover */
.sidebar.collapsed:hover .sidebar-logout-btn span {
    display: inline;
}

/* User profile dans sidebar */
.sidebar-user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar.collapsed:not(:hover) .sidebar-user-profile {
    justify-content: center;
    flex-direction: column;
}

.user-avatar-sidebar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
    overflow: hidden;
}

.user-avatar-sidebar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-info-sidebar {
    flex: 1;
    min-width: 0;
    transition: opacity 0.3s ease;
}

/* Info user cachée quand replié */
.sidebar.collapsed:not(:hover) .user-info-sidebar {
    display: none;
}

/* Info user visible pendant hover */
.sidebar.collapsed:hover .user-info-sidebar {
    display: flex !important;
    flex-direction: column;
}

.user-name-sidebar {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role-sidebar {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Mode sombre/clair dans footer */
.sidebar-footer .nav-item .dark-mode-label,
.sidebar-footer .nav-item .light-mode-label {
    transition: opacity 0.3s ease;
}

body.dark-mode .sidebar-footer .nav-item .dark-mode-label {
    display: none;
}

body.dark-mode .sidebar-footer .nav-item .light-mode-label {
    display: inline;
}

body:not(.dark-mode) .sidebar-footer .nav-item .light-mode-label {
    display: none;
}

body:not(.dark-mode) .sidebar-footer .nav-item .dark-mode-label {
    display: inline;
}

body.dark-mode .sidebar-footer .nav-item svg circle {
    fill: currentColor;
}

/* Labels mode sombre cachés quand replié */
.sidebar.collapsed:not(:hover) .sidebar-footer .nav-item .dark-mode-label,
.sidebar.collapsed:not(:hover) .sidebar-footer .nav-item .light-mode-label {
    display: none;
}

/* Labels mode sombre visibles pendant hover */
.sidebar.collapsed:hover .sidebar-footer .nav-item .dark-mode-label,
.sidebar.collapsed:hover .sidebar-footer .nav-item .light-mode-label {
    display: inline !important;
}

.nav-subitem:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-subitem.active {
    color: var(--primary-color);
    font-weight: 600;
    background: rgba(32, 156, 213, 0.1);
}

/* Main Content */
.main-content {
    position: relative;
    margin-left: 0;
    padding: 0;
    padding-top: calc(var(--sidebar-header-height) + 20px);
    padding-left: 16px;
    padding-right: 16px;
    padding-bottom: 30px;
    min-height: 100vh;
    background: var(--bg-secondary);
    transition: margin-left 0.3s ease, padding-left 0.3s ease, padding-top 0.3s ease;
    overflow: visible;
    z-index: 1;
}

/* Le margin-left sera calculé dynamiquement par JavaScript selon la largeur réelle de la sidebar */

/* Page Title in Topbar */
.page-title-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-title-topbar h1 {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.page-title-topbar h1 svg {
    width: 24px;
    height: 24px;
    color: var(--primary-color);
}

/* Page Header Actions in Topbar */
.page-header-topbar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.page-subtitle-section {
    margin-bottom: 20px;
    padding-top: 8px;
}

.page-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
}

/* Legacy page-header (kept for compatibility) */
.page-header {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.page-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 20px;
    width: 100%;
}

.page-header h1 {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    flex: 1;
    min-width: 0;
}

/* Si le bouton est directement dans .page-header (comme produits.php, employes.php) */
.page-header>.btn {
    flex-shrink: 0;
    margin: 0;
}

.page-header-title-group {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}

.page-header-title-group h1 {
    margin: 0;
    flex-shrink: 0;
}

.page-header .page-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
    padding: 0;
    flex-shrink: 0;
}

.page-header .tabs {
    margin-bottom: 0;
}

.page-header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 20px;
    width: 100%;
    justify-content: space-between;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    justify-content: center;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--success-color) !important;
    color: white !important;
}

.btn-secondary:hover {
    background: var(--secondary-color) !important;
    opacity: 0.9;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover {
    background: var(--bg-hover);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.btn-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

.btn-link:hover {
    text-decoration: underline;
}

/* Alerts */
.alert {
    padding: 14px 18px;
    border-radius: 10px;
    margin-bottom: 24px;
    font-size: 14px;
    border-left: 4px solid;
    animation: slideInRight 0.3s ease-out;
}

.alert-fixed-top-right {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
    min-width: 300px;
    max-width: 500px;
    margin-bottom: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideInFromTop 0.3s ease-out;
}

@keyframes slideInFromTop {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border-color: #ef4444;
    border-left-color: #ef4444;
}

.alert-success {
    background: #f0fdf4;
    color: #065f46;
    border-color: #10b981;
    border-left-color: #10b981;
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon.blue {
    background: #dbeafe;
    color: var(--primary-color);
}

.stat-icon.green {
    background: #d1fae5;
    color: var(--success-color);
}

.stat-icon.orange {
    background: #fed7aa;
    color: var(--warning-color);
}

.stat-icon.purple {
    background: #e9d5ff;
    color: #9333ea;
}

.stat-content h3 {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    font-weight: 500;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

.stats-mini {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.stat-mini {
    background: white;
    padding: 16px 20px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 120px;
}

.stat-mini .stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-mini .stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}



.table-container {
    background: transparent;
    box-shadow: none;
    border: none;
}

.table-responsive {
    overflow-x: auto;
    width: 100%;
    -webkit-overflow-scrolling: touch;
}

.data-table tr {
    display: table-row;
}

.data-table td,
.data-table th {
    display: table-cell;
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
    background: transparent;
    table-layout: auto;
    border-radius: 12px;
    overflow: visible;
}

.data-table thead {
    background: transparent;
}

.data-table th {
    padding: 16px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: none;
    white-space: nowrap;
    background: transparent;
}

.data-table th[style*="width: auto"] {
    width: auto !important;
    overflow: visible !important;
}

.data-table th:first-child {
    padding-left: 20px;
}

.data-table td {
    padding: 14px 16px;
    border: none;
    font-size: 14px;
    color: var(--text-primary);
    vertical-align: middle;
    white-space: nowrap !important;
    overflow: visible !important;
    text-overflow: clip;
    word-wrap: normal !important;
    word-break: keep-all !important;
    box-sizing: border-box;
    width: auto !important;
    min-width: fit-content;
    max-width: none !important;
}

.data-table td[style*="width: auto"],
.data-table th[style*="width: auto"] {
    width: auto !important;
    overflow: visible !important;
}

.data-table td *,
.data-table td *::before,
.data-table td *::after {
    white-space: nowrap !important;
    display: inline-block;
    vertical-align: middle;
    overflow: visible !important;
    text-overflow: clip;
    word-break: keep-all !important;
    word-wrap: normal !important;
    hyphens: none !important;
    max-width: none !important;
}

.data-table td>div {
    display: inline-flex !important;
    align-items: center;
    white-space: nowrap !important;
    flex-wrap: nowrap !important;
    max-width: none !important;
    overflow: visible !important;
    width: auto !important;
}

.data-table td>div[style*="display: flex"] {
    display: inline-flex !important;
    flex-wrap: nowrap !important;
    white-space: nowrap !important;
    max-width: none !important;
    overflow: visible !important;
    width: auto !important;
}

.data-table td>div * {
    white-space: nowrap !important;
    overflow: visible !important;
    text-overflow: clip;
    max-width: none !important;
    flex-shrink: 0 !important;
}

.data-table td .badge,
.data-table td .status-dropdown,
.data-table td .action-buttons,
.data-table td .user-avatar {
    white-space: nowrap !important;
    overflow: visible !important;
    text-overflow: clip;
    max-width: none !important;
    display: inline-block !important;
}

.data-table td:first-child {
    padding-left: 20px;
}

/* Colonnes spécifiques - grandes et flexibles comme la colonne Client */
/* Prix (DH) - 9ème colonne */
.data-table th:nth-child(9),
.data-table td:nth-child(9) {
    width: auto !important;
    min-width: 120px;
    max-width: none !important;
    overflow: visible !important;
    white-space: nowrap !important;
    text-overflow: clip !important;
}

/* Statut Confirmation - 10ème colonne */
.data-table th:nth-child(10),
.data-table td:nth-child(10) {
    width: auto !important;
    min-width: 180px;
    max-width: none !important;
    overflow: visible !important;
    white-space: nowrap !important;
    text-overflow: clip !important;
}

/* Type Livraison - 11ème colonne */
.data-table th:nth-child(11),
.data-table td:nth-child(11) {
    width: auto !important;
    min-width: 150px;
    max-width: none !important;
    overflow: visible !important;
    white-space: nowrap !important;
    text-overflow: clip !important;
}

/* Statut Livraison - 12ème colonne */
.data-table th:nth-child(12),
.data-table td:nth-child(12) {
    width: auto !important;
    min-width: 180px;
    max-width: none !important;
    overflow: visible !important;
    white-space: nowrap !important;
    text-overflow: clip !important;
}

/* Modifié Par - 13ème colonne */
.data-table th:nth-child(13),
.data-table td:nth-child(13) {
    width: auto !important;
    min-width: 150px;
    max-width: none !important;
    overflow: visible !important;
    white-space: nowrap !important;
    text-overflow: clip !important;
}

/* Styles pour les éléments dans ces colonnes */
.data-table td:nth-child(9)>div,
.data-table td:nth-child(10)>div,
.data-table td:nth-child(11)>div,
.data-table td:nth-child(12)>div,
.data-table td:nth-child(13)>div {
    max-width: none !important;
    overflow: visible !important;
    width: auto !important;
    flex-wrap: nowrap !important;
}

.data-table td:nth-child(9)>div *,
.data-table td:nth-child(10)>div *,
.data-table td:nth-child(11)>div *,
.data-table td:nth-child(12)>div *,
.data-table td:nth-child(13)>div * {
    max-width: none !important;
    overflow: visible !important;
    flex-shrink: 0 !important;
}

.data-table td:nth-child(9) *,
.data-table td:nth-child(10) *,
.data-table td:nth-child(11) *,
.data-table td:nth-child(12) *,
.data-table td:nth-child(13) * {
    max-width: none !important;
    overflow: visible !important;
}

.data-table tbody tr {
    transition: all 0.2s ease;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.data-table tbody tr:hover {
    background: white;
    box-shadow: 0 2px 8px rgba(32, 156, 213, 0.15), 0 0 0 1px rgba(32, 156, 213, 0.2);
    transform: translateY(-1px);
}

.data-table tbody tr.selected {
    background: rgba(32, 156, 213, 0.05) !important;
    border-color: rgba(32, 156, 213, 0.3);
}

/* Espacement entre les lignes */
.data-table tbody tr td {
    padding: 16px;
    border: none;
    white-space: nowrap;
    vertical-align: middle;
    background: transparent;
}

.data-table tbody tr td:first-child {
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
}

.data-table tbody tr td:last-child {
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
}

.data-table tbody tr .text-center {
    text-align: center;
    white-space: normal;
}

.data-table tbody tr .text-center * {
    white-space: normal;
}

/* Checkbox style */
/* Custom Checkbox Style */
.table-checkbox,
.form-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: white;
    border: 1.5px solid #d1d5db;
    border-radius: 4px;
    position: relative;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.table-checkbox:hover,
.form-checkbox:hover {
    border-color: #06b6d4;
}

.table-checkbox:checked,
.form-checkbox:checked {
    background: #06b6d4;
    border-color: #06b6d4;
}

.table-checkbox:checked::after,
.form-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -60%) rotate(45deg);
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
}

.table-checkbox:focus,
.form-checkbox:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.1);
}

.checkbox-form-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 0;
    margin: 0;
    user-select: none;
    width: auto;
}

/* Aligner le form-group contenant le checkbox avec les autres champs (au même niveau que l'input) */
.form-group:has(.checkbox-form-label) {
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin-bottom: 20px;
    padding-top: 28px;
    /* Compenser l'absence de label : margin-bottom du label (8px) + hauteur du label (~20px) */
}

.form-group:has(.checkbox-form-label) .checkbox-form-label {
    padding-top: 0;
    margin-top: 0;
    margin-bottom: 0;
    align-items: center;
}

.checkbox-form-label span {
    font-size: 14px;
    font-weight: 400;
    color: #374151;
}

/* Actions barre pour sélection multiple */
.bulk-actions-bar {
    display: none;
    background: var(--primary-color);
    color: white;
    padding: 12px 20px;
    border-radius: 8px 8px 0 0;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.bulk-actions-bar.show {
    display: flex;
}

.bulk-actions-bar .selected-count {
    font-weight: 600;
    margin-right: auto;
}

.bulk-actions-bar .action-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.bulk-actions-bar .action-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.bulk-actions-bar .action-btn.danger {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.3);
}

.bulk-actions-bar .action-btn.danger:hover {
    background: rgba(239, 68, 68, 0.3);
}

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-muted);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    text-transform: capitalize;
}

.badge-actif,
.badge-en_attente {
    background: #d1fae5;
    color: #065f46;
}

.badge-desactive,
.badge-refusee,
.badge-annulee {
    background: #fee2e2;
    color: #991b1b;
}

.badge-en_cours {
    background: #fed7aa;
    color: #92400e;
}

.badge-livree {
    background: #dbeafe;
    color: #1a7fa8;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-info {
    background: #dbeafe;
    color: #1a7fa8;
}

.badge-admin {
    background: #fce7f3;
    color: #9f1239;
}

/* Badges pour Statut Confirmation */
.badge-en_cours_confirmation {
    background: #fef3c7;
    color: #92400e;
}

.badge-confirmee {
    background: #d1fae5;
    color: #065f46;
}

.badge-fiabilite_faible {
    background: #fee2e2;
    color: #991b1b;
}

.badge-reporte {
    background: #fed7aa;
    color: #92400e;
}

/* Badges pour Type Livraison */
.badge-normal {
    background: #dbeafe;
    color: #1e40af;
}

.badge-echange {
    background: #fce7f3;
    color: #9f1239;
}

.badge-urgence {
    background: #fee2e2;
    color: #991b1b;
}

.badge-remboursement {
    background: #fef3c7;
    color: #92400e;
}

/* Badges pour Statut Livraison */
.badge-en_cours_livraison {
    background: #fef3c7;
    color: #92400e;
}

.badge-recuperee {
    background: #d1fae5;
    color: #065f46;
}

.badge-retour {
    background: #fee2e2;
    color: #991b1b;
}

.badge-retournee {
    background: #fee2e2;
    color: #991b1b;
}

.badge-admin_payee {
    background: #fce7f3;
    color: #9f1239;
}

.badge-fiabilite_faible {
    background: #fee2e2;
    color: #991b1b;
}

.badge-injoignable {
    background: #fef3c7;
    color: #92400e;
}

.badge-entreprise_payee {
    background: #d1fae5;
    color: #065f46;
}

.badge-manager {
    background: #e0e7ff;
    color: #3730a3;
}

.badge-employe {
    background: #f1f5f9;
    color: #475569;
}

.badge-en_cours_confirmation {
    background: #fef3c7;
    color: #92400e;
}

.badge-confirmee {
    background: #d1fae5;
    color: #065f46;
}

.badge-reporte {
    background: #fef3c7;
    color: #92400e;
}

.badge-recuperee {
    background: #dbeafe;
    color: #1a7fa8;
}

.badge-admin_payee,
.badge-entreprise_payee {
    background: #d1fae5;
    color: #065f46;
}

.badge-retournee {
    background: #fee2e2;
    color: #991b1b;
}

/* Action Buttons - Style carré avec icônes blanches */
.action-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
}

.icon-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
    background: transparent;
    color: var(--text-secondary);
}

.icon-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Bouton Voir - Bleu clair */
.icon-btn.view-btn {
    background: #60a5fa;
    color: white;
}

.icon-btn.view-btn:hover {
    background: #3b82f6;
}

/* Bouton Modifier - Turquoise/Cyan */
.icon-btn.edit-btn {
    background: #22d3ee;
    color: white;
}

.icon-btn.edit-btn:hover {
    background: #06b6d4;
}

/* Bouton Activer/Désactiver - Toujours Jaune */
.icon-btn.edit-btn[title="Désactiver"],
.icon-btn.edit-btn[title="Activer"],
.icon-btn.edit-btn[onclick*="desactive"],
.icon-btn.edit-btn[onclick*="confirmToggleStatus"],
button.icon-btn.edit-btn[title*="Désactiver"],
button.icon-btn.edit-btn[title*="Activer"],
.icon-btn[onclick*="confirmToggleStatus"] {
    background: var(--warning-color) !important;
    color: #92400e !important;
}

.icon-btn.edit-btn[title="Désactiver"]:hover,
.icon-btn.edit-btn[title="Activer"]:hover,
.icon-btn.edit-btn[onclick*="desactive"]:hover,
.icon-btn.edit-btn[onclick*="confirmToggleStatus"]:hover,
button.icon-btn.edit-btn[title*="Désactiver"]:hover,
button.icon-btn.edit-btn[title*="Activer"]:hover,
.icon-btn[onclick*="confirmToggleStatus"]:hover {
    background: #d97706 !important;
    color: white !important;
}

body.dark-mode .icon-btn.edit-btn[title="Désactiver"],
body.dark-mode .icon-btn.edit-btn[title="Activer"],
body.dark-mode .icon-btn.edit-btn[onclick*="desactive"],
body.dark-mode .icon-btn.edit-btn[onclick*="confirmToggleStatus"],
body.dark-mode .icon-btn[onclick*="confirmToggleStatus"] {
    background: var(--warning-color) !important;
    color: #92400e !important;
}

body.dark-mode .icon-btn.edit-btn[title="Désactiver"]:hover,
body.dark-mode .icon-btn.edit-btn[title="Activer"]:hover,
body.dark-mode .icon-btn.edit-btn[onclick*="desactive"]:hover,
body.dark-mode .icon-btn.edit-btn[onclick*="confirmToggleStatus"]:hover,
body.dark-mode .icon-btn[onclick*="confirmToggleStatus"]:hover {
    background: #d97706 !important;
    color: white !important;
}

/* Bouton Supprimer - Rouge */
.icon-btn.delete-btn {
    background: #ef4444;
    color: white;
}

.icon-btn.delete-btn:hover {
    background: #dc2626;
}

/* Bouton Marquer comme lue - Jaune */
.icon-btn.mark-read-btn {
    background: #fef3c7 !important;
    color: #d97706 !important;
    border: 1px solid #fbbf24 !important;
}

.icon-btn.mark-read-btn svg {
    stroke: #d97706 !important;
    color: #d97706 !important;
}

.icon-btn.mark-read-btn:hover {
    background: #fde68a !important;
    color: #b45309 !important;
    border-color: #f59e0b !important;
}

.icon-btn.mark-read-btn:hover svg {
    stroke: #b45309 !important;
    color: #b45309 !important;
}

body.dark-mode .icon-btn.mark-read-btn {
    background: rgba(245, 158, 11, 0.2) !important;
    color: #fbbf24 !important;
    border-color: #f59e0b !important;
}

body.dark-mode .icon-btn.mark-read-btn svg {
    stroke: #fbbf24 !important;
    color: #fbbf24 !important;
}

body.dark-mode .icon-btn.mark-read-btn:hover {
    background: rgba(245, 158, 11, 0.3) !important;
    color: #fcd34d !important;
    border-color: #fbbf24 !important;
}

body.dark-mode .icon-btn.mark-read-btn:hover svg {
    stroke: #fcd34d !important;
    color: #fcd34d !important;
}

/* Alertes de fiabilité pour les champs téléphone/WhatsApp/Instagram */
.reliability-alert-simple {
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.reliability-link-inline {
    color: var(--primary-color);
    cursor: pointer;
    font-weight: 500;
    text-decoration: underline;
}

.reliability-link-inline:hover {
    color: var(--primary-dark);
}

/* Icône dans le champ de saisie */
.reliability-icon-container-inline {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 6px;
    pointer-events: none;
    z-index: 10;
}

.reliability-icon-container-inline svg {
    width: 16px;
    height: 16px;
}

/* Styles spécifiques selon le statut */
.reliability-reliable {
    color: #1e40af;
}

.reliability-warning {
    color: #92400e;
}

.reliability-blacklisted {
    color: #991b1b;
}

/* Dark mode */
body.dark-mode .reliability-reliable {
    color: #93c5fd;
}

body.dark-mode .reliability-warning {
    color: #fcd34d;
}

body.dark-mode .reliability-blacklisted {
    color: #fca5a5;
}

body.dark-mode .reliability-link-inline {
    color: var(--primary-color);
}

body.dark-mode .reliability-link-inline:hover {
    color: var(--sidebar-blue-light);
}

/* Container de suggestions de clients */
#clientSuggestionContainer {
    margin-bottom: 16px;
}

#clientSuggestions>div {
    transition: all 0.2s ease;
}

#clientSuggestions>div:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-sm);
}

.icon-btn svg {
    width: 16px;
    height: 16px;
    stroke-width: 2.5;
}

.icon-btn-danger {
    color: var(--danger-color);
}

.icon-btn-danger:hover {
    background: #fee2e2;
}

/* Filters */
.filters-bar {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    position: relative;
    z-index: 10;
    overflow: visible;
}

.filters-form {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
    position: relative;
    z-index: 10;
    overflow: visible;
}

.search-input {
    flex: 1;
    min-width: 200px;
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
}

.filter-select-wrapper {
    z-index: 9999 !important;
    position: relative;
}

.filter-select {
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    background: white;
    min-width: 180px;
    color: var(--text-primary);
    position: relative;
    z-index: 9999;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23334155' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    cursor: pointer;
}

.filter-input {
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    background: white;
    color: var(--text-primary);
    width: 100%;
}

.filter-status-btn {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.filter-badge {
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
}

/* Dropdown de filtres */
.filter-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1001;
    min-width: 300px;
    max-width: 400px;
    padding: 20px;
    max-height: 600px;
    overflow-y: auto;
}

body.dark-mode .filter-dropdown-menu {
    background: var(--bg-primary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

body.dark-mode .filter-select,
body.dark-mode .filter-input {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

body.dark-mode .filter-status-btn {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

body.dark-mode .filter-status-btn:hover {
    background: var(--bg-tertiary);
}

.btn-danger {
    background: #ef4444;
    color: white;
    border-color: #ef4444;
}

.btn-danger:hover {
    background: #dc2626;
    border-color: #dc2626;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;

}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-content.modal-sm {
    max-width: 400px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 24px;
    border-top: 1px solid var(--border-color);
}

/* Order Details Modal Styles */
.order-details-modal {
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

.order-details-header {
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
    border-bottom: 2px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.order-details-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.order-details-footer {
    position: sticky;
    bottom: 0;
    background: white;
    z-index: 10;
    border-top: 2px solid var(--border-color);
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.05);
}

.detail-section {
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 0;
    border: 1px solid var(--border-color);
    transition: transform 0.2s, box-shadow 0.2s;
}

.detail-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.detail-section-commande {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-left: 4px solid #f59e0b;
}

.detail-section-client {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border-left: 4px solid #3b82f6;
}

.detail-section-notes {
    background: linear-gradient(135deg, #e9d5ff 0%, #ddd6fe 100%);
    border-left: 4px solid #8b5cf6;
}

.detail-section-images {
    background: linear-gradient(135deg, #fce7f3 0%, #fbcfe8 100%);
    border-left: 4px solid #ec4899;
}

.detail-section-histoire {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border-left: 4px solid #10b981;
}

.detail-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid rgba(0, 0, 0, 0.1);
}

.detail-section-title svg {
    flex-shrink: 0;
    color: inherit;
}

.detail-section-content {
    display: grid;
    gap: 14px;
}

.detail-row {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    align-items: start;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-row strong {
    color: var(--text-primary);
    font-weight: 600;
}

.detail-value {
    color: var(--text-secondary);
    word-break: break-word;
}

.detail-value.detail-total {
    color: var(--primary-color);
    font-size: 1.1em;
}

.detail-row-full {
    margin-bottom: 16px;
}

.detail-row-full strong {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 600;
}

.detail-text {
    padding: 12px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    white-space: pre-wrap;
    word-wrap: break-word;
    color: var(--text-secondary);
    border: 1px solid rgba(0, 0, 0, 0.05);
    line-height: 1.6;
}

.detail-images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.detail-images-grid img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Dark Mode for Order Details */
body.dark-mode .order-details-header,
body.dark-mode .order-details-footer {
    background: var(--bg-primary);
    border-color: var(--border-color);
}

/* Correction de la couleur du bouton Imprimer - couleur verte */
.order-details-footer .btn-secondary {
    background: var(--success-color) !important;
    color: white !important;
}

.order-details-footer .btn-secondary:hover {
    background: var(--secondary-color) !important;
    opacity: 0.9;
}

body.dark-mode .order-details-footer .btn-secondary {
    background: var(--success-color) !important;
    color: white !important;
}

body.dark-mode .order-details-footer .btn-secondary:hover {
    background: var(--secondary-color) !important;
    opacity: 0.9;
}

body.dark-mode .detail-section {
    border-color: var(--border-color);
}

body.dark-mode .detail-section-commande {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2) 0%, rgba(251, 230, 138, 0.15) 100%);
    border-left-color: #f59e0b;
}

body.dark-mode .detail-section-client {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2) 0%, rgba(191, 219, 254, 0.15) 100%);
    border-left-color: #3b82f6;
}

body.dark-mode .detail-section-notes {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2) 0%, rgba(221, 214, 254, 0.15) 100%);
    border-left-color: #8b5cf6;
}

body.dark-mode .detail-section-images {
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.2) 0%, rgba(251, 207, 232, 0.15) 100%);
    border-left-color: #ec4899;
}

body.dark-mode .detail-section-histoire {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2) 0%, rgba(167, 243, 208, 0.15) 100%);
    border-left-color: #10b981;
}

body.dark-mode .detail-section-title {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .detail-row {
    border-bottom-color: rgba(255, 255, 255, 0.05);
}

body.dark-mode .detail-text {
    background: rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.1);
}

/* Info Client Card Styles (inspired by image) */
.info-client-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.info-client-title {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-title-commande,
.info-title-client,
.info-title-notes,
.info-title-images,
.info-title-historique {
    color: #3b82f6;
}

.info-client-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
}

.info-client-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.info-client-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.info-label {
    font-size: 14px;
    color: #94a3b8;
    font-weight: 400;
}

.info-value {
    font-size: 15px;
    color: #1e293b;
    font-weight: 500;
    word-break: break-word;
}

.info-value.info-bold {
    font-weight: 700;
    color: #1e293b;
}

.info-value.info-blue {
    color: #3b82f6;
    font-weight: 500;
}

.info-phone {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}

body.dark-mode .info-phone {
    color: var(--text-primary);
}

body.dark-mode .info-phone span {
    color: var(--text-primary);
}

.whatsapp-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: #25D366;
    border-radius: 4px;
    padding: 2px;
    transition: transform 0.2s;
}

.whatsapp-icon:hover {
    transform: scale(1.1);
}

.whatsapp-icon svg {
    width: 18px;
    height: 18px;
    stroke: white;
}

.instagram-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    border-radius: 4px;
    padding: 2px;
    transition: transform 0.2s;
    margin-left: 8px;
}

.instagram-icon:hover {
    transform: scale(1.1);
}

.instagram-icon svg {
    width: 18px;
    height: 18px;
    stroke: white;
}

.tracking-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--primary-color);
    border-radius: 4px;
    padding: 2px;
    transition: transform 0.2s;
    margin-left: 8px;
    text-decoration: none;
}

.tracking-icon:hover {
    transform: scale(1.1);
    background: var(--primary-color-dark);
}

.tracking-icon svg {
    width: 16px;
    height: 16px;
    stroke: white;
    fill: none;
}

/* Styles pour le sélecteur de produits */
.product-card-selector {
    transition: all 0.2s ease;
}

.product-card-selector:hover {
    transform: translateY(-2px);
}

.product-card-selector img {
    transition: transform 0.2s ease;
}

.product-card-selector:hover img {
    transform: scale(1.05);
}

/* Dark Mode for Info Client Card */
body.dark-mode .info-client-card {
    background: var(--bg-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

body.dark-mode .info-client-title {
    color: var(--text-primary);
}

body.dark-mode .info-label {
    color: var(--text-muted);
}

body.dark-mode .info-value.info-bold {
    color: var(--text-primary);
}

body.dark-mode .info-value.info-blue {
    color: #60a5fa;
}

.detail-text-simple {
    padding: 12px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 8px;
    white-space: pre-wrap;
    word-wrap: break-word;
    color: var(--text-secondary);
    border: 1px solid rgba(0, 0, 0, 0.05);
    line-height: 1.6;
    margin-top: 8px;
}

.detail-images-grid-simple {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 8px;
}

.detail-images-grid-simple img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.historique-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.historique-date-header {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary-color);
    padding: 8px 0;
    border-bottom: 2px solid var(--primary-color);
    margin-bottom: 12px;
    text-transform: capitalize;
}

.historique-container .historique-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 8px;
    border-left: 3px solid var(--primary-color);
    margin-bottom: 8px;
}

.historique-container .historique-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary-color);
    margin-top: 6px;
    flex-shrink: 0;
}

.historique-container .historique-content {
    flex: 1;
}

.historique-container .historique-status {
    margin-bottom: 8px;
}

.historique-container .historique-info {
    font-size: 13px;
    color: var(--text-secondary);
}

.historique-container .historique-info strong {
    color: var(--text-primary);
    font-weight: 600;
}

body.dark-mode .detail-text-simple {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .historique-container .historique-item {
    background: rgba(255, 255, 255, 0.03);
    border-left-color: var(--primary-color);
}

/* Responsive */
@media (max-width: 768px) {
    .info-client-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.permissions-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 300px;
    overflow-y: auto;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 8px;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid var(--border-color);
}

.checkbox-label:hover {
    background: var(--bg-hover);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.checkbox-label:has(input:checked) {
    background: rgba(59, 130, 246, 0.05);
    border-color: var(--primary-color);
}

.checkbox-label input[type="checkbox"],
.checkbox-permission input[type="checkbox"] {
    margin-top: 4px;
    cursor: pointer;
    width: 20px;
    height: 20px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: white;
    border: 1.5px solid #d1d5db;
    border-radius: 4px;
    position: relative;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.checkbox-label input[type="checkbox"]:hover,
.checkbox-permission input[type="checkbox"]:hover {
    border-color: #06b6d4;
}

.checkbox-label input[type="checkbox"]:checked,
.checkbox-permission input[type="checkbox"]:checked {
    background: #06b6d4;
    border-color: #06b6d4;
}

.checkbox-label input[type="checkbox"]:checked::after,
.checkbox-permission input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -60%) rotate(45deg);
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
}

.checkbox-label input[type="checkbox"]:focus,
.checkbox-permission input[type="checkbox"]:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.1);
}

.checkbox-label span {
    font-weight: 400;
    color: #374151;
    font-size: 14px;
}

.checkbox-label small {
    display: block;
    color: var(--text-secondary);
    font-size: 12px;
    margin-top: 4px;
}

/* Product Items in Order Modal */
.product-item {
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 8px;
    margin-bottom: 12px;
}

.product-select,
.product-quantity {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.product-subtotal {
    font-weight: 600;
    color: var(--primary-color);
    display: block;
    padding: 10px 0;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
}

.dashboard-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.card-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Responsive */
/* Tabs */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0;
}

.page-header-topbar-actions .tabs {
    margin-bottom: 0;
    border-bottom: none;
}

.tab {
    padding: 12px 24px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: -2px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab:hover {
    color: var(--primary-color);
}

.tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Onglets fixes dans le modal de détails produit */
.product-detail-tabs-fixed {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-primary);
    margin-bottom: 0 !important;
    padding-bottom: 0;
}

body.dark-mode .product-detail-tabs-fixed {
    background: var(--bg-primary);
}

/* Onglets fixes dans le modal de détails commande */
.order-detail-tabs-fixed {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-primary);
    margin-bottom: 0 !important;
    padding-bottom: 0;
}

body.dark-mode .order-detail-tabs-fixed {
    background: var(--bg-primary);
}

.profile-tabs-container {
    margin-bottom: 24px;
}

.profile-tabs {
    border-bottom: 2px solid var(--border-color);
}

.form-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 24px;
    margin-top: 0;
}

.section-description {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* Table Improvements */
.data-table {
    background: transparent;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: none;
    table-layout: auto;
    width: 100%;
}

.data-table thead {
    background: var(--bg-secondary);
}

.data-table th {
    background: var(--bg-primary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    white-space: nowrap !important;
}

.data-table tbody tr {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.2s ease;
    background: white;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.data-table tbody tr:hover {
    background: white;
    box-shadow: 0 2px 8px rgba(32, 156, 213, 0.15), 0 0 0 1px rgba(32, 156, 213, 0.2);
    transform: translateY(-1px);
}

.data-table tbody tr.selected {
    background: rgba(32, 156, 213, 0.05) !important;
    border-color: rgba(32, 156, 213, 0.3);
}

.data-table tbody td {
    white-space: nowrap !important;
    max-width: none !important;
    overflow: visible !important;
}

.data-table tbody td *,
.data-table tbody td *::before,
.data-table tbody td *::after {
    white-space: nowrap !important;
    display: inline-block;
    vertical-align: middle;
    max-width: none !important;
    overflow: visible !important;
    word-break: keep-all !important;
    word-wrap: normal !important;
    hyphens: none !important;
}

.data-table tbody td>div {
    display: inline-flex !important;
    align-items: center;
    white-space: nowrap !important;
    flex-wrap: nowrap !important;
    max-width: none !important;
    overflow: visible !important;
    width: auto !important;
    flex-shrink: 0 !important;
}

.data-table tbody td>div[style*="display: flex"] {
    display: inline-flex !important;
    flex-wrap: nowrap !important;
    white-space: nowrap !important;
    max-width: none !important;
    overflow: visible !important;
    width: auto !important;
}

.data-table tbody td>div * {
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    overflow: visible !important;
    max-width: none !important;
}

/* Status Dots */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
}

.status-dot.pending {
    background: var(--danger-color);
}

.status-dot.dispatch {
    background: var(--info-color);
}

.status-dot.completed {
    background: var(--text-muted);
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 24px;
    padding: 16px 0;
    flex-wrap: wrap;
}

.pagination-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pagination-info {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    visibility: visible;
    opacity: 1;
}

.pagination-select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 80px;
}

.pagination-select:hover {
    border-color: var(--primary-color);
}

.pagination-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(32, 156, 213, 0.1);
}

.pagination-numbers {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pagination-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--bg-hover);
    border-color: var(--primary-color);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination-ellipsis {
    padding: 0 8px;
    color: var(--text-secondary);
    font-size: 14px;
}

@media (max-width: 768px) {
    .pagination {
        flex-direction: column;
        align-items: stretch;
    }

    .pagination-left {
        justify-content: center;
    }

    .pagination-numbers {
        justify-content: center;
    }
}

/* CSS-based Sidebar Handling - Body Padding Method */
:root {
    --sidebar-width: 220px;
    --sidebar-collapsed-width: 64px;
}

@media (min-width: 1025px) {

    /* Apply layout offset to body using padding */
    body {
        padding-left: 220px !important;
        transition: padding-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    .topbar {
        padding-left: 250px !important;
        /* 220px + 30px */
        width: 100% !important;
        left: 0 !important;
    }

    /* Collapsed state via body class */
    body.sidebar-collapsed {
        padding-left: 64px !important;
    }

    body.sidebar-collapsed .topbar {
        padding-left: 94px !important;
        /* 64px + 30px */
    }

    /* Hover expand state - Overlay behavior (cleaner) or Push */
    /* To push content on hover while using body padding, we add margin to main-content */
    body.sidebar-collapsed .sidebar:hover~.main-content {
        margin-left: 156px !important;
        /* 220px - 64px */
    }

    body.sidebar-collapsed .sidebar:hover~.topbar {
        padding-left: 250px !important;
    }
}

/* Ensure mobile overrides are stronger */
@media (max-width: 1024px) {
    body {
        padding-left: 0 !important;
    }

    .main-content {
        margin-left: 0 !important;
    }

    .topbar {
        padding-left: 20px !important;
    }

    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar-toggle {
        display: block;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {


    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }



    .search-input,
    .filter-select {
        width: 100%;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stats-mini {
        flex-direction: column;
    }

    .stat-mini {
        width: 100%;
    }

    .table-responsive {
        overflow-x: scroll;
    }

    .action-buttons {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .topbar {
        padding: 0 12px;
    }

    .user-details {
        display: none;
    }

    .modal-content {
        width: 95%;
        max-width: 95%;
        margin: 20px auto;
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* Dark Mode */
body.dark-mode {
    --bg-primary: #1e293b;
    --bg-secondary: #0f172a;
    --bg-sidebar: #0f172a;
    --bg-hover: #334155;

    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;

    --border-color: #334155;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);

    background-color: var(--bg-secondary) !important;
}

body.dark-mode .sidebar {
    background: #1e293b;
    border-right-color: #334155;
}

body.dark-mode .sidebar-footer {
    background: #1e293b;
    border-top-color: #334155;
}

body.dark-mode .sidebar-logout-btn {
    background: #7f1d1d;
    color: #fca5a5;
}

body.dark-mode .sidebar-logout-btn:hover {
    background: #991b1b;
}

body.dark-mode .sidebar-logout-btn svg,
body.dark-mode .sidebar-logout-btn span {
    color: #fca5a5;
}

body.dark-mode .sidebar.collapsed .sidebar-footer {
    background: #1e293b;
}

/* Settings Page Styles */
.settings-form {
    max-width: 800px;
}

.form-section {
    margin-bottom: 32px;
    padding-bottom: 32px;
    border-bottom: 1px solid var(--border-color);
}

.form-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.form-section-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--primary-color);
}

.logo-upload-wrapper {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.current-logo {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.current-logo img,
#logoPreview {
    max-width: 240px;
    max-height: 100px;
    width: auto;
    height: auto;
    object-fit: contain;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px;
    background: var(--bg-secondary);
}

.logo-info {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 0;
}

.form-help {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

body.dark-mode .current-logo img,
body.dark-mode #logoPreview {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

/* Dark Mode - Table Styles */
body.dark-mode .data-table tbody tr {
    background: var(--bg-primary);
}

body.dark-mode .data-table tbody tr:hover {
    background: var(--bg-hover);
    box-shadow: 0 2px 8px rgba(32, 156, 213, 0.2), 0 0 0 1px rgba(32, 156, 213, 0.3);
    transform: translateY(-1px);
}

body.dark-mode .data-table tbody tr.selected {
    background: rgba(32, 156, 213, 0.15) !important;
    border-color: rgba(32, 156, 213, 0.4);
}

body.dark-mode .data-table td {
    color: var(--text-primary);
    border-color: var(--border-color);
}

body.dark-mode .data-table th {
    color: var(--text-secondary);
}

body.dark-mode .sidebar-header {
    border-bottom-color: #334155;
}

body.dark-mode .sidebar-logo .logo-text {
    color: white;
}

body.dark-mode .sidebar-toggle-btn {
    color: var(--primary-color);
}

body.dark-mode .sidebar-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--primary-color);
}

body.dark-mode .sidebar.collapsed .sidebar-toggle-btn {
    color: var(--primary-color);
}

body.dark-mode .sidebar.collapsed .sidebar-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--primary-color);
}

body.dark-mode .search-input-sidebar {
    background: #0f172a;
    border-color: #334155;
    color: white;
}

body.dark-mode .search-input-sidebar:focus {
    background: #0f172a;
    border-color: var(--primary-color);
}

body.dark-mode .search-input-sidebar::placeholder {
    color: #64748b;
}

body.dark-mode .sidebar-search .search-icon {
    color: #64748b;
}

body.dark-mode .nav-item {
    color: #cbd5e1;
}

body.dark-mode .nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

body.dark-mode .nav-item svg {
    color: #94a3b8;
}

body.dark-mode .nav-item:hover svg {
    color: white;
}

body.dark-mode .nav-item.active {
    background: var(--primary-color);
    color: white;
}

body.dark-mode .nav-item.active svg {
    color: white;
}

body.dark-mode .nav-subitem {
    color: #94a3b8;
}

body.dark-mode .nav-subitem:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

body.dark-mode .sidebar-footer {
    border-top-color: #334155;
}

body.dark-mode .user-name-sidebar {
    color: white;
}

body.dark-mode .user-role-sidebar {
    color: #94a3b8;
}

body.dark-mode .auth-page {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
}

body.dark-mode .auth-form-card {
    background: var(--bg-primary);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

body.dark-mode .auth-logo-text {
    color: var(--text-primary);
}

body.dark-mode .auth-header-simple h1 {
    color: var(--text-primary);
}

body.dark-mode .auth-header-simple p {
    color: var(--text-secondary);
}

body.dark-mode .form-group input,
body.dark-mode .form-group select,
body.dark-mode .form-group textarea {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

body.dark-mode .form-group input:hover,
body.dark-mode .form-group select:hover,
body.dark-mode .form-group textarea:hover {
    border-color: #475569;
    background: var(--bg-primary);
}

body.dark-mode .form-group input:focus,
body.dark-mode .form-group select:focus,
body.dark-mode .form-group textarea:focus {
    background: var(--bg-primary);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

body.dark-mode .auth-footer-simple {
    border-top-color: var(--border-color);
    color: var(--text-secondary);
}

body.dark-mode .auth-footer-simple a {
    color: var(--primary-color);
}

body.dark-mode .auth-footer-simple a:hover {
    color: var(--primary-dark);
}

body.dark-mode .auth-right {
    background: var(--bg-primary);
}

body.dark-mode .auth-header h1 {
    color: var(--text-primary);
}

body.dark-mode .auth-header p {
    color: var(--text-secondary);
}

body.dark-mode .form-group label {
    color: var(--text-primary);
}

body.dark-mode .form-group input,
body.dark-mode .form-group select,
body.dark-mode .form-group textarea {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

/* Mode sombre pour les checkboxes dans les formulaires */
body.dark-mode .form-group input[type="checkbox"],
body.dark-mode .form-group .form-checkbox,
body.dark-mode .form-group .table-checkbox {
    background: var(--bg-primary);
    border-color: #4b5563;
}

body.dark-mode .form-group input[type="checkbox"]:hover,
body.dark-mode .form-group .form-checkbox:hover,
body.dark-mode .form-group .table-checkbox:hover {
    border-color: #06b6d4;
}

body.dark-mode .form-group input[type="checkbox"]:checked,
body.dark-mode .form-group .form-checkbox:checked,
body.dark-mode .form-group .table-checkbox:checked {
    background: #06b6d4;
    border-color: #06b6d4;
}

body.dark-mode .form-group input:focus,
body.dark-mode .form-group select:focus,
body.dark-mode .form-group textarea:focus {
    border-color: var(--primary-color);
}

body.dark-mode .btn-social {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

body.dark-mode .btn-social:hover {
    border-color: var(--primary-color);
    background: var(--bg-hover);
}

body.dark-mode .auth-footer {
    color: var(--text-secondary);
}

body.dark-mode .auth-page {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
}

body.dark-mode .auth-form-card {
    background: var(--bg-primary);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

body.dark-mode .auth-logo-text {
    color: var(--text-primary);
}

body.dark-mode .auth-header-simple h1 {
    color: var(--text-primary);
}

body.dark-mode .auth-header-simple p {
    color: var(--text-secondary);
}

body.dark-mode .form-group input,
body.dark-mode .form-group select,
body.dark-mode .form-group textarea {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

body.dark-mode .form-group input:hover,
body.dark-mode .form-group select:hover,
body.dark-mode .form-group textarea:hover {
    border-color: #475569;
    background: var(--bg-primary);
}

body.dark-mode .form-group input:focus,
body.dark-mode .form-group select:focus,
body.dark-mode .form-group textarea:focus {
    background: var(--bg-primary);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

body.dark-mode .auth-footer-simple {
    border-top-color: var(--border-color);
    color: var(--text-secondary);
}

body.dark-mode .topbar {
    background: var(--bg-primary);
    border-bottom-color: var(--border-color);
}

body.dark-mode .sidebar {
    background: var(--bg-sidebar);
    border-right-color: var(--border-color);
}

body.dark-mode .table-container {
    background: transparent;
    border: none;
    box-shadow: none;
}

body.dark-mode .dashboard-card,
body.dark-mode .stat-card,
body.dark-mode .stat-mini,
body.dark-mode .filters-bar {
    background: var(--bg-primary);
    border-color: var(--border-color);
}

body.dark-mode .modal-content {
    background: var(--bg-primary);
    color: var(--text-primary);
}

body.dark-mode .user-dropdown {
    background: var(--bg-primary);
    border-color: var(--border-color);
}

body.dark-mode .data-table thead {
    background: var(--bg-secondary);
}

body.dark-mode .data-table tbody tr {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

body.dark-mode .data-table tbody tr:hover {
    background: var(--bg-hover);
    box-shadow: 0 2px 8px rgba(32, 156, 213, 0.2), 0 0 0 1px rgba(32, 156, 213, 0.3);
    transform: translateY(-1px);
}

body.dark-mode .data-table tbody tr.selected {
    background: rgba(32, 156, 213, 0.15) !important;
    border-color: rgba(32, 156, 213, 0.4);
}

body.dark-mode .data-table td {
    color: var(--text-primary);
    border-color: var(--border-color);
}

body.dark-mode .data-table th {
    color: var(--text-secondary);
}

body.dark-mode .form-group input,
body.dark-mode .form-group select,
body.dark-mode .form-group textarea,
body.dark-mode .search-input,
body.dark-mode .filter-select {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

body.dark-mode .checkbox-label {
    background: var(--bg-secondary);
}

body.dark-mode .table-checkbox,
body.dark-mode .form-checkbox,
body.dark-mode .checkbox-label input[type="checkbox"],
body.dark-mode .checkbox-permission input[type="checkbox"] {
    background: var(--bg-primary);
    border-color: #4b5563;
}

body.dark-mode .table-checkbox:hover,
body.dark-mode .form-checkbox:hover,
body.dark-mode .checkbox-label input[type="checkbox"]:hover,
body.dark-mode .checkbox-permission input[type="checkbox"]:hover {
    border-color: #06b6d4;
}

body.dark-mode .table-checkbox:checked,
body.dark-mode .form-checkbox:checked,
body.dark-mode .checkbox-label input[type="checkbox"]:checked,
body.dark-mode .checkbox-permission input[type="checkbox"]:checked {
    background: #06b6d4;
    border-color: #06b6d4;
}

body.dark-mode .checkbox-label span,
body.dark-mode .checkbox-form-label span {
    color: var(--text-primary);
}

body.dark-mode .permissions-list {
    background: var(--bg-secondary);
}

body.dark-mode .alert-error {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.3);
}

body.dark-mode .alert-success {
    background: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
    border-color: rgba(16, 185, 129, 0.3);
}

body.dark-mode .badge-actif,
body.dark-mode .badge-en_attente {
    background: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
}

body.dark-mode .badge-desactive,
body.dark-mode .badge-refusee,
body.dark-mode .badge-annulee {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

body.dark-mode .badge-en_cours {
    background: rgba(245, 158, 11, 0.2);
    color: #fcd34d;
}

body.dark-mode .badge-livree {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
}

body.dark-mode .badge-warning {
    background: rgba(245, 158, 11, 0.2);
    color: #fcd34d;
}

body.dark-mode .badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
}

body.dark-mode .badge-info {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
}

body.dark-mode .stat-icon.blue {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
}

body.dark-mode .stat-icon.green {
    background: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
}

body.dark-mode .stat-icon.orange {
    background: rgba(245, 158, 11, 0.2);
    color: #fcd34d;
}

body.dark-mode .stat-icon.purple {
    background: rgba(147, 51, 234, 0.2);
    color: #c4b5fd;
}

body.dark-mode .icon-btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

body.dark-mode #darkModeIcon {
    display: none;
}

body.dark-mode #lightModeIcon {
    display: block !important;
}

body:not(.dark-mode) #lightModeIcon {
    display: none !important;
}

/* Historique */
.historique-list {
    padding: 20px 0;
}

.historique-item {
    display: flex;
    gap: 16px;
    padding: 16px 0;
    position: relative;
    padding-left: 40px;
}

.historique-item:not(:last-child)::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 40px;
    bottom: -16px;
    width: 2px;
    background: var(--border-color);
}

.historique-dot {
    position: absolute;
    left: 0;
    top: 20px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary-color);
    border: 3px solid var(--bg-primary);
    z-index: 1;
}

.historique-content {
    flex: 1;
}

.historique-status {
    margin-bottom: 8px;
}

.historique-info {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--text-secondary);
    font-size: 14px;
}

.historique-info svg {
    color: var(--text-muted);
}

.historique-info strong {
    color: var(--text-primary);
    font-weight: 500;
}

/* Badges pour historique */
.badge-en_attente {
    background: #f1f5f9;
    color: #475569;
}

.badge-en_cours_livraison,
.badge-recuperee {
    background: #dbeafe;
    color: #1a7fa8;
}

.badge-livree {
    background: #d1fae5;
    color: #065f46;
}

.badge-retour,
.badge-retournee {
    background: #fee2e2;
    color: #991b1b;
}

.badge-admin_payee,
.badge-entreprise_payee {
    background: #e0e7ff;
    color: #3730a3;
}

.badge-fiabilite_faible,
.badge-injoignable {
    background: #fef3c7;
    color: #92400e;
}

/* Statuts de confirmation - Couleurs distinctes */
.badge-en_cours_confirmation {
    background: #fef3c7;
    color: #92400e;
}

.badge-confirmee {
    background: #d1fae5;
    color: #065f46;
}

.badge-fiabilite_faible {
    background: #fee2e2;
    color: #991b1b;
}

.badge-annulee {
    background: #fee2e2;
    color: #991b1b;
}

.badge-reporte {
    background: #fde68a;
    color: #78350f;
}

/* Types de livraison - Couleurs distinctes */
.badge-normal {
    background: #dbeafe;
    color: #1a7fa8;
}

.badge-echange {
    background: #e0e7ff;
    color: #3730a3;
}

.badge-urgence {
    background: #fee2e2;
    color: #991b1b;
}

.badge-remboursement {
    background: #fce7f3;
    color: #9f1239;
}

/* Statuts de livraison - Couleurs distinctes */
.badge-en_attente {
    background: #f1f5f9;
    color: #475569;
}

.badge-en_cours_livraison {
    background: #dbeafe;
    color: #1a7fa8;
}

.badge-recuperee {
    background: #bfdbfe;
    color: #1e3a8a;
}

.badge-livree {
    background: #d1fae5;
    color: #065f46;
}

.badge-retour {
    background: #fee2e2;
    color: #991b1b;
}

.badge-admin_payee {
    background: #e0e7ff;
    color: #3730a3;
}

.badge-retournee {
    background: #fecaca;
    color: #7f1d1d;
}

.badge-fiabilite_faible {
    background: #fef3c7;
    color: #92400e;
}

.badge-injoignable {
    background: #fed7aa;
    color: #9a3412;
}

.badge-entreprise_payee {
    background: #c7d2fe;
    color: #312e81;
}

/* Dark mode pour tous les badges */
body.dark-mode .badge-en_cours_confirmation {
    background: rgba(245, 158, 11, 0.2);
    color: #fcd34d;
}

body.dark-mode .badge-confirmee {
    background: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
}

body.dark-mode .badge-fiabilite_faible {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

body.dark-mode .badge-annulee {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

body.dark-mode .badge-reporte {
    background: rgba(245, 158, 11, 0.2);
    color: #fcd34d;
}

body.dark-mode .badge-normal {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
}

body.dark-mode .badge-echange {
    background: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
}

body.dark-mode .badge-urgence {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

body.dark-mode .badge-remboursement {
    background: rgba(236, 72, 153, 0.2);
    color: #f9a8d4;
}

body.dark-mode .badge-en_attente {
    background: rgba(148, 163, 184, 0.2);
    color: #cbd5e1;
}

body.dark-mode .badge-en_cours_livraison {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
}

body.dark-mode .badge-recuperee {
    background: rgba(96, 165, 250, 0.2);
    color: #bfdbfe;
}

body.dark-mode .badge-livree {
    background: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
}

body.dark-mode .badge-retour {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

body.dark-mode .badge-admin_payee {
    background: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
}

body.dark-mode .badge-retournee {
    background: rgba(220, 38, 38, 0.2);
    color: #f87171;
}

body.dark-mode .badge-injoignable {
    background: rgba(245, 158, 11, 0.2);
    color: #fcd34d;
}

body.dark-mode .badge-entreprise_payee {
    background: rgba(129, 140, 248, 0.2);
    color: #c7d2fe;
}

/* Système de notifications (Toasts) */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 400px;
}

.toast {
    background: white;
    border-radius: 8px;
    padding: 16px 20px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideInRight 0.3s ease-out;
    border-left: 4px solid;
    min-width: 300px;
}

.toast.success {
    border-left-color: #10b981;
    background: #d1fae5;
    color: #065f46;
}

.toast.error {
    border-left-color: #ef4444;
    background: #fee2e2;
    color: #991b1b;
}

.toast.warning {
    border-left-color: #f59e0b;
    background: #fef3c7;
    color: #92400e;
}

.toast.info {
    border-left-color: #3b82f6;
    background: #dbeafe;
    color: #1a7fa8;
}

.toast-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
}

.toast-message {
    font-size: 13px;
    opacity: 0.9;
}

.toast-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.toast-close:hover {
    opacity: 1;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.toast.hiding {
    animation: slideOutRight 0.3s ease-out forwards;
}

body.dark-mode .toast {
    background: var(--bg-primary);
    color: var(--text-primary);
}

body.dark-mode .toast.success {
    background: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
    border-left-color: #10b981;
}

body.dark-mode .toast.error {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border-left-color: #ef4444;
}

body.dark-mode .toast.warning {
    background: rgba(245, 158, 11, 0.2);
    color: #fcd34d;
    border-left-color: #f59e0b;
}

body.dark-mode .toast.info {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
    border-left-color: #3b82f6;
}

/* Boutons rapides pour changer les statuts */
.quick-status-btn {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    border: 1px solid currentColor;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.quick-status-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.status-dropdown {
    position: relative;
    display: inline-block;
    width: 100%;
}

.status-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 8px 0;
    min-width: 200px;
    width: 100%;
    z-index: 1002;
    margin-top: 4px;
    display: none;
    max-height: 300px;
    overflow-y: auto;
}

.status-dropdown-menu.show {
    display: block;
}

.status-dropdown-item {
    padding: 8px 16px;
    border-radius: 0;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.status-dropdown-item:hover {
    background: var(--bg-secondary);
}

.copy-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--text-secondary);
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
}

.copy-btn:hover {
    color: var(--primary-color);
    transform: scale(1.1);
}

.copy-btn.copied {
    color: var(--success-color);
}

/* Badge cliquable pour changer le statut */
.badge-clickable {
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.badge-clickable:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Historique */
.historique-list {
    padding: 20px 0;
}

.historique-item {
    display: flex;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
    position: relative;
}

.historique-item:last-child {
    border-bottom: none;
}

.historique-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary-color);
    flex-shrink: 0;
    margin-top: 6px;
    position: relative;
}

.historique-item:not(:last-child) .historique-dot::after {
    content: '';
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: calc(100% + 16px);
    background: var(--border-color);
}

.historique-content {
    flex: 1;
}

.historique-status {
    margin-bottom: 8px;
}

.historique-info {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--text-secondary);
    font-size: 14px;
}

.historique-info strong {
    color: var(--text-primary);
    font-weight: 500;
}

.historique-info svg {
    color: var(--text-muted);
}

/* Notification Dropdown */
.notification-dropdown-wrapper {
    position: relative;
}

.notification-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 380px;
    max-height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-color);
    display: none;
    z-index: 1001;
    overflow: hidden;
}

.notification-dropdown.show {
    display: block;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.notification-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-secondary);
}

.notification-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.notification-mark-all {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 12px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.notification-mark-all:hover {
    background: var(--bg-hover);
}

.notification-list {
    max-height: 400px;
    overflow-y: auto;
}

.notification-item {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    gap: 12px;
}

.notification-item:hover {
    background: var(--bg-secondary);
}

.notification-item.unread {
    background: rgba(37, 99, 235, 0.05);
}

.notification-item.unread:hover {
    background: rgba(37, 99, 235, 0.1);
}

.notification-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
}

.notification-icon.success {
    background: #d1fae5;
    color: #065f46;
}

.notification-icon.info {
    background: #dbeafe;
    color: #1a7fa8;
}

.notification-icon.warning {
    background: #fef3c7;
    color: #92400e;
}

.notification-icon.error {
    background: #fee2e2;
    color: #991b1b;
}

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-title {
    font-weight: 500;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.notification-message {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 4px;
}

.notification-time {
    font-size: 11px;
    color: var(--text-muted);
}

.notification-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-secondary);
}

.notification-empty p {
    margin: 0;
    font-size: 14px;
}

body.dark-mode .notification-dropdown {
    background: var(--bg-primary);
    border-color: var(--border-color);
}

.notification-footer {
    padding-top: 6px !important;
    padding-bottom: 12px !important;
    text-align: center !important;
    border-top: 1px solid var(--border-color) !important;
    background: var(--bg-primary) !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
}

.notification-footer a {
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: none;
}

body.dark-mode .notification-header {
    background: var(--bg-secondary);
}

body.dark-mode .notification-item:hover {
    background: var(--bg-secondary);
}

body.dark-mode .notification-item.unread {
    background: rgba(37, 99, 235, 0.1);
}

body.dark-mode .notification-item.unread:hover {
    background: rgba(37, 99, 235, 0.15);
}

/* Message Dropdown */
.message-dropdown-wrapper {
    position: relative;
}

.message-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 380px;
    max-height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-color);
    display: none;
    z-index: 1001;
    overflow: hidden;
}

.message-dropdown.show {
    display: block;
    animation: slideDown 0.3s ease-out;
}

.message-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-secondary);
}

.message-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.message-mark-all {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 12px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.message-mark-all:hover {
    background: var(--bg-hover);
}

.message-list {
    max-height: 400px;
    overflow-y: auto;
}

.message-item {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    gap: 12px;
}

.message-item:hover {
    background: var(--bg-secondary);
}

.message-item.unread {
    background: rgba(37, 99, 235, 0.05);
}

.message-item.unread:hover {
    background: rgba(37, 99, 235, 0.1);
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
    font-weight: 600;
    color: white;
    background: var(--primary-color);
}

.message-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.message-content {
    flex: 1;
    min-width: 0;
}

.message-sender {
    font-weight: 500;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.message-preview {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.message-time {
    font-size: 11px;
    color: var(--text-muted);
}

.message-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-secondary);
}

.message-empty p {
    margin: 0;
    font-size: 14px;
}

body.dark-mode .message-dropdown {
    background: var(--bg-primary);
    border-color: var(--border-color);
}

.message-footer {
    padding: 12px;
    text-align: center;
    border-top: 1px solid var(--border-color);
    background: var(--bg-primary);
}

.message-footer a {
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: none;
}

body.dark-mode .message-header {
    background: var(--bg-secondary);
}

body.dark-mode .message-item:hover {
    background: var(--bg-secondary);
}

body.dark-mode .message-item.unread {
    background: rgba(37, 99, 235, 0.1);
}

body.dark-mode .message-item.unread:hover {
    background: rgba(37, 99, 235, 0.15);
}

/* Badges pour historique */
.historique-item .badge-en_attente {
    background: #f1f5f9;
    color: #475569;
}

.historique-item .badge-en_cours_livraison,
.historique-item .badge-recuperee {
    background: #dbeafe;
    color: #1a7fa8;
}

.historique-item .badge-livree,
.historique-item .badge-admin_payee,
.historique-item .badge-entreprise_payee {
    background: #d1fae5;
    color: #065f46;
}

.historique-item .badge-retour,
.historique-item .badge-retournee {
    background: #fee2e2;
    color: #991b1b;
}

.historique-item .badge-fiabilite_faible,
.historique-item .badge-injoignable {
    background: #fef3c7;
    color: #92400e;
}

/* Profile Page */
.profile-container {
    max-width: 900px;
    margin: 0 auto;
}

.profile-card {
    background: white;
    border-radius: 12px;
    padding: 32px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.profile-header {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}

.profile-avatar-section {
    display: flex;
    align-items: center;
    gap: 24px;
}

.profile-avatar-large {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 36px;
    flex-shrink: 0;
    border: 4px solid var(--bg-secondary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.profile-avatar-large img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.profile-avatar-info h3 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.profile-avatar-info p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.form-section {
    margin-bottom: 32px;
}

.form-section h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-color);
}

.section-description {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-style: italic;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

@media (max-width: 768px) {
    .profile-card {
        padding: 24px;
    }

    .profile-avatar-section {
        flex-direction: column;
        text-align: center;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
    }
}

body.dark-mode .profile-card {
    background: var(--bg-primary);
    border-color: var(--border-color);
}

body.dark-mode .profile-header {
    border-bottom-color: var(--border-color);
}

body.dark-mode .form-section h3 {
    border-bottom-color: var(--border-color);
    color: var(--text-primary);
}

body.dark-mode .form-actions {
    border-top-color: var(--border-color);
}

/* Styles pour les graphiques du dashboard */
.dashboard-card canvas {
    max-height: 100%;
}

.dashboard-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border-color);
}

.dashboard-card .card-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

body.dark-mode .dashboard-card .card-header {
    border-bottom-color: var(--border-color);
}

body.dark-mode .dashboard-card .card-header h2 {
    color: var(--text-primary);
}

/* Responsive pour les graphiques */
@media (max-width: 768px) {
    .dashboard-card {
        padding: 16px;
    }

    .dashboard-card canvas {
        max-height: 250px;
    }
}


/* Mobile Responsiveness Fixes */
@media (max-width: 1024px) {
    .topbar {
        padding-left: 20px !important;
        width: 100% !important;
        left: 0 !important;
    }

    .sidebar-toggle {
        display: flex !important;
    }

    .sidebar,
    .sidebar.collapsed,
    .sidebar.collapsed:hover {
        transform: translateX(-100%);
        min-width: 260px !important;
        max-width: 260px !important;
        width: 260px !important;
        height: 100vh;
        position: fixed;
        left: 0;
        top: 0;
        z-index: 10000;
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.2) !important;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    /* Fix Specificity for Mobile Text Visibility using ID selector */
    #sidebar.active .nav-item span,
    #sidebar.active .logo-text,
    #sidebar.active .nav-arrow,
    #sidebar.active .logo-image,
    #sidebar.active .sidebar-footer span {
        display: inline-block !important;
        opacity: 1 !important;
        width: auto !important;
        visibility: visible !important;
    }

    #sidebar.active .nav-item {
        justify-content: flex-start !important;
        padding: 8px 10px !important;
    }

    #sidebar.active .sidebar-logo .logo-icon {
        display: flex !important;
    }

    /* Ensure the hamburger in sidebar allows closing */
    .sidebar .sidebar-toggle-btn {
        display: flex !important;
    }

    .main-content {

        width: 100%;
    }

    /* Overlay */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 9999;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
        backdrop-filter: blur(2px);
    }

    .sidebar-overlay.active {
        opacity: 1;
        visibility: visible;
    }
}

/* CSS-based Sidebar Handling - Component Padding Method */
:root {
    --sidebar-width: 220px;
    --sidebar-collapsed-width: 64px;
}

@media (min-width: 1025px) {

    /* Remove body padding */
    body {
        padding-left: 0 !important;
    }

    /* Apply offset to content components using padding-left */
    .main-content {
        padding-left: 250px !important;
        /* Matches sidebar width */
        width: 100% !important;
        max-width: 100% !important;
        transition: padding-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .topbar {
        padding-left: 250px !important;
        /* 220px + 30px */
        width: 100% !important;
        left: 0 !important;
        transition: padding-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    /* Collapsed state */
    body.sidebar-collapsed .main-content {
        padding-left: 30px !important;
    }

    body.sidebar-collapsed .topbar {
        padding-left: 94px !important;
        /* 64px + 30px */
    }

    /* Hover expand state - Pure Overlay (no content shift) */
    /* When hovering collapsed sidebar, it expands over the content without moving it */
    body.sidebar-collapsed .sidebar:hover {
        width: 220px !important;
        min-width: 220px !important;
        max-width: 220px !important;
    }

    /* Content stays in place during hover - no padding change */
    body.sidebar-collapsed .sidebar:hover~.main-content {
        padding-left: 64px !important;
        /* Keep stable, no shift */
    }

    body.sidebar-collapsed .sidebar:hover~.topbar {
        padding-left: 94px !important;
        /* Keep stable, no shift */
    }
}

/* Ensure mobile overrides are stronger */
@media (max-width: 1024px) {
    body {
        padding-left: 0 !important;
    }

    .main-content {
        padding-left: 16px !important;
    }

    .topbar {
        padding-left: 20px !important;
    }
}

/* Mobile Responsive Fixes */
@media (max-width: 768px) {

    /* Hide button text on mobile - show only icons */
    .btn-text {
        display: none !important;
    }

    /* Icon-only buttons for Add actions */
    .page-header .btn,
    .page-header-top .btn,
    .page-header button {
        width: 48px !important;
        height: 48px !important;
        padding: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 8px !important;
    }

    /* Header layout - keep title and button on same line */
    .page-header,
    .page-header-top {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 12px !important;
    }

    .page-header h1,
    .page-header-top h1 {
        margin-bottom: 0 !important;
        font-size: 20px !important;
        width: auto !important;
        flex: 1;
    }

    /* Dashboard cards - center like stat cards */
    .dashboard-grid {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        gap: 20px !important;
    }

    .dashboard-card {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 auto !important;
        overflow: hidden;
    }

    /* Main content padding fix */
    .main-content {
        padding-right: 16px !important;
        padding-left: 16px !important;
    }

    /* Ensure charts don't overflow */
    canvas {
        max-width: 100% !important;
    }

    /* Stats grid responsive */
    .stats-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }

    /* Stat-mini cards - 2 per row on mobile */
    .stats-mini {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }

    .stat-mini {
        min-width: unset !important;
        width: 100% !important;
    }

    /* Modal responsive - ensure modals fit within screen */
    .modal-content {
        width: 95% !important;
        max-width: 95% !important;
        margin: 10px auto !important;
        max-height: 95vh !important;
        overflow-y: auto !important;
    }

    .modal-header {
        padding: 16px !important;
    }

    .modal-body {
        padding: 16px !important;
    }

    .modal-footer {
        padding: 16px !important;

        gap: 8px !important;
    }

    .modal-footer .btn {
        width: 100% !important;
    }

    /* Notification and Message dropdowns - adapt to mobile */
    .notification-dropdown,
    .notification-dropdown-wrapper,
    .message-dropdown-wrapper {
        position: static !important;
    }

    /* Notification and Message dropdowns - centered on mobile screen */
    .notification-dropdown,
    .message-dropdown {
        width: 90vw !important;
        max-width: 400px !important;
        left: 50% !important;
        right: auto !important;
        transform: translateX(-50%) !important;
        position: absolute !important;
        top: 64px !important;
        max-height: 80vh !important;
        display: none !important;
        flex-direction: column !important;
        background: var(--bg-primary) !important;
        border-radius: 12px !important;
        box-shadow: var(--shadow-lg) !important;
        border: 1px solid var(--border-color) !important;
        z-index: 1001 !important;
        overflow: hidden !important;
    }

    .notification-dropdown.show,
    .message-dropdown.show {
        display: flex !important;
    }

    .notification-footer,
    .message-footer {
        padding: 12px !important;
        text-align: center !important;
        border-top: 1px solid var(--border-color) !important;
        background: var(--bg-primary) !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
    }

    .notification-footer a,
    .message-footer a {
        color: var(--primary-color) !important;
        font-weight: 600 !important;
        text-decoration: none !important;
        width: 100% !important;
    }

    .notification-list,
    .message-list {
        max-height: 60vh !important;
        overflow-y: auto !important;
    }

    /* Tabs horizontal scroll on mobile */
    .tabs {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        gap: 0 !important;
        border-bottom: 2px solid var(--border-color) !important;
        scrollbar-width: none !important;
        -ms-overflow-style: none !important;
        margin-bottom: 16px !important;
    }

    .order-detail-tabs-fixed,
    .product-detail-tabs-fixed {
        margin-bottom: 0 !important;
    }

    .tabs::-webkit-scrollbar {
        display: none !important;
    }

    .tab {
        flex-shrink: 0 !important;
        white-space: nowrap !important;
        padding: 12px 20px !important;
    }
}