/* =========================================================
   BROCMANAGER - STYLE GLOBAL
   ========================================================= */

/* ------------ Variables de thème ------------ */
:root {
    --bm-bg: #f6faff;         /* fond global clair */
    --bm-bg-card: #ffffff;    /* cartes / sidebar / topbar clair */
    --bm-bg-soft: #f8fafc;

    --bm-text-main: #637381;
    --bm-text-strong: #212b36;
    --bm-text-muted: #9ca3af;

    --bm-primary: #3056d3;
    --bm-primary-soft: #e5ebff;
    --bm-primary-hover: #2646b3;

    --bm-accent: #34c9a4;

    --bm-border-soft: #e5e7eb;
    --bm-border-subtle: #edf0f4;

    --bm-icon-circle: #eff2f7;

    --bm-sidebar-width: 290px;
    --bm-header-height: 90px;
}

/* Anti-flash global : pas de transitions quand body a .theme-switching */
body.theme-switching *,
body.theme-switching *::before,
body.theme-switching *::after {
    transition: none !important;
}

/* ------------ Thème sombre ------------ */
/* Palette “Taildash-like” adaptée à BrocManager */
body.dark-mode {
    /* Fonds */
    --bm-bg: #1a222c;          /* fond global / maincontent */
    --bm-bg-card: #24303f;     /* sidebar, topbar, cartes */
    --bm-bg-soft: #2f3b49;     /* inputs, blocs secondaires */

    /* Texte */
    --bm-text-strong: #ffffff; /* titres, valeurs */
    --bm-text-main:   #aeb7c0; /* texte courant */
    --bm-text-muted:  #aeb7c0; /* texte secondaire (légendes) */

    /* Bordures */
    --bm-border-soft:   #24303f; /* séparateurs “soft” */
    --bm-border-subtle: #24303f; /* bordures de cartes */

    /* Accent / brand */
    --bm-primary:       #3056d3;   /* bleu principal */
    --bm-primary-hover: #ffffff0d; /* hover subtil en dark */
    --bm-primary-soft:  #1a222c;   /* fonds légers bleutés */

    /* Icônes / avatars */
    --bm-icon-circle: #3056d3;     /* rond derrière les icônes */
}

/* Icônes et textes dans les cercles bleus en dark mode */
body.dark-mode .topbar-user-avatar {
    color: #ffffff !important;
}

body.dark-mode .quick-icon {
    color: #ffffff !important;
}

body.dark-mode .btn-icon .icon,
body.dark-mode .btn-icon i,
body.dark-mode .btn-icon svg {
    color: #ffffff !important;
}

/* ------------ Reset léger ------------ */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    font-family: 'Montserrat', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--bm-text-main);
    background-color: var(--bm-bg);
}

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

img {
    max-width: 100%;
    height: auto;
    display: block;
}

button,
input,
select,
textarea {
    font-family: inherit;
    font-size: 14px;
    color: var(--bm-text-strong);
}

/* On évite les ombres bleues natives */
input:focus,
select:focus,
textarea:focus,
button:focus {
    outline: none;
}

/* =========================================================
   LAYOUT GLOBAL
   ========================================================= */

.app-shell {
    display: flex;
    min-height: 100vh;
    background-color: var(--bm-bg);
}

/* ---------- Sidebar ---------- */

.sidebar {
    width: var(--bm-sidebar-width);
    flex-shrink: 0;
    background-color: var(--bm-bg-card); /* clair: blanc / sombre: #24303f */
    border-right: 1px solid var(--bm-border-soft);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;

    /* Masquer la barre de défilement */
    scrollbar-width: none;           /* Firefox */
}

.sidebar::-webkit-scrollbar {        /* Chrome / Edge / Safari */
    display: none;
}

/* En-tête de la sidebar (logo) */
.sidebar-header {
    height: var(--bm-header-height);
    min-height: var(--bm-header-height);
    display: flex;
    align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid var(--bm-border-soft);
}

.sidebar-logo-circle {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    background: #3056d3;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    margin-right: 10px;
    font-size: 14px;
}

.sidebar-logo-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--bm-text-strong);
}

/* Navigation */
.sidebar-nav {
    padding: 16px 12px 24px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Ancien titre de section (si jamais réutilisé quelque part) */
.sidebar-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;

    font-size: 14px;
    font-weight: 500;
    color: var(--bm-text-main);

    margin: 10px 8px 4px;
    padding: 8px 12px;
    border-radius: 9px;

    cursor: pointer;
    user-select: none;

    transition: background-color 0.15s ease, color 0.15s ease;
}

.sidebar-section-title::after {
    content: "▾";
    font-size: 16px;
    line-height: 1;
    margin-left: 8px;
    color: inherit;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.sidebar-section-title.is-collapsed::after {
    transform: rotate(-90deg);
    opacity: 0.6;
}

.sidebar-section-title:hover {
    background-color: var(--bm-primary);
    color: #ffffff;
}

.sidebar-section-title:hover::after {
    color: #ffffff;
}

/* Liens masqués quand repliés (si utilisé) */
.sidebar-link.is-hidden {
    display: none;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 9px;
    color: var(--bm-text-main);
    font-size: 15px;
    font-weight: 500;
    transition:
        background-color 0.15s ease,
        color 0.15s ease;
}

.sidebar-link:hover {
    background-color: var(--bm-primary);
    color: #ffffff;
}

.sidebar-link.is-active {
    background-color: var(--bm-primary);
    color: #ffffff; /* texte blanc sur le bleu */
}

.sidebar-link-text {
    white-space: nowrap;
}

/* =========================
   ACCORDÉON SIDEBAR
   ========================= */

.sidebar-group {
    margin-top: 8px;
}

/* Header cliquable du groupe (style proche d'un .sidebar-link) */
.sidebar-group-header {
    width: 100%;
    border: none;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: 9px;
    color: var(--bm-text-main);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    gap: 10px;
    transition:
        background-color 0.15s ease,
        color 0.15s ease,
        box-shadow 0.15s ease;
}

/* Hover des titres principaux : bleu plein */
.sidebar-group-header:hover {
    background-color: var(--bm-primary);
    color: #ffffff;
}

/* Partie gauche : icône + texte */
.sidebar-group-main {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Icône du groupe */
.sidebar-group-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Chevron à droite */
.sidebar-group-chevron {
    width: 16px;
    height: 16px;
    opacity: 0.7;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

/* Groupe ouvert : même style que lien actif */
.sidebar-group.is-open > .sidebar-group-header {
    background-color: var(--bm-primary);
    color: #ffffff;
}

.sidebar-group.is-open .sidebar-group-icon {
    color: #ffffff;
}

.sidebar-group.is-open .sidebar-group-chevron {
    transform: rotate(180deg);
    opacity: 1;
}

/* Sous-menu (liens internes) */
.sidebar-submenu {
    display: none;            /* fermé par défaut */
    margin-top: 2px;
    padding-bottom: 4px;
}

/* Quand le groupe est ouvert, on affiche les liens internes */
.sidebar-group.is-open > .sidebar-submenu {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Liens internes (sans icône, même taille de texte) */
.sidebar-sub-link {
    display: block;
    padding: 6px 12px 6px 42px; /* aligné sous le texte des titres principaux */
    border-radius: 9px;
    font-size: 14px;
    font-weight: 500;
    color: var(--bm-text-main);
    text-decoration: none;
    transition:
        background-color 0.15s ease,
        color 0.15s ease;
}

/* Hover : rectangle transparent + texte bleu */
.sidebar-sub-link:hover {
    background-color: rgba(48, 86, 211, 0.08);
    color: var(--bm-primary);
}

/* Lien interne actif (page courante) */
.sidebar-sub-link.is-active {
    background-color: rgba(48, 86, 211, 0.08);
    color: var(--bm-primary);
    font-weight: 600;
}

/* --- Spécifique dark mode : couleurs du menu --- */
body.dark-mode .sidebar-logo-title {
    color: #ffffff;
}

body.dark-mode .sidebar-link,
body.dark-mode .sidebar-group-header,
body.dark-mode .sidebar-sub-link {
    color: #aeb7bf;
    background-color: transparent;
}

body.dark-mode .sidebar-link:hover,
body.dark-mode .sidebar-group-header:hover {
    background-color: var(--bm-primary);
    color: #ffffff;
}

body.dark-mode .sidebar-sub-link:hover {
    background-color: rgba(48, 86, 211, 0.2);
    color: var(--bm-primary);
}

body.dark-mode .sidebar-link.is-active {
    background-color: var(--bm-primary);
    color: #ffffff;
}

body.dark-mode .sidebar-group.is-open > .sidebar-group-header {
    background-color: var(--bm-primary);
    color: #ffffff;
}

/* ---------- Partie droite (topbar + contenu) ---------- */

.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: var(--bm-bg); /* clair: #f6faff, sombre: #1a222c */
}

/* Topbar */
.topbar {
    height: var(--bm-header-height);
    min-height: var(--bm-header-height);
    position: sticky;
    top: 0;
    z-index: 40;
    width: 100%;
    background-color: var(--bm-bg-card); /* clair: blanc, sombre: #24303f */
    border-bottom: 1px solid var(--bm-border-soft);

    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Bouton hamburger (mobile only)
   → affichage géré plus bas via .btn-icon.mobile-menu-toggle */
.mobile-menu-toggle {
    /* pas de display ici pour éviter les conflits avec .btn-icon */
}

/* Barre de recherche dans la topbar */
.topbar-search {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 260px;
    max-width: 360px;
    padding: 6px 12px;
    border-radius: 999px;
    background-color: var(--bm-bg-soft);
    border: 1px solid var(--bm-border-soft);
}

.topbar-search-icon {
    width: 16px;
    height: 16px;
    color: var(--bm-text-muted);
    flex-shrink: 0;
}

.topbar-search-input {
    border: none;
    background: transparent;
    width: 100%;
    font-size: 13px;
    color: var(--bm-text-strong);
}

.topbar-search-input::placeholder {
    color: var(--bm-text-muted);
}

.topbar-search-input:focus {
    outline: none;
}

.topbar-appname {
    font-size: 18px;
    font-weight: 600;
    color: var(--bm-text-strong);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    background-color: var(--bm-icon-circle);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--bm-primary);
    font-size: 14px;
}

.topbar-user-email {
    font-size: 13px;
    font-weight: 500;
    color: var(--bm-text-strong);
}

.topbar-user-role {
    font-size: 11px;
    color: var(--bm-text-muted);
}

/* =========================
   MENU UTILISATEUR (TOPBAR)
   ========================= */

.user-menu-wrapper {
    position: relative;
}

.topbar-user-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0 4px 8px;
    background: transparent;
    border: none;
    cursor: pointer;
}

.topbar-user-trigger:focus-visible {
    outline: 2px solid var(--bm-primary);
    outline-offset: 2px;
}

.user-menu-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 180px;
    padding: 6px;
    border-radius: 12px;
    border: 1px solid var(--bm-border-subtle);
    background-color: var(--bm-bg-card);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
    z-index: 50;
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 13px;
    color: var(--bm-text-strong);
    text-decoration: none;
    cursor: pointer;
    transition:
        background-color 0.15s ease,
        color 0.15s ease;
}

.user-menu-item i,
.user-menu-item svg {
    flex-shrink: 0;
    color: var(--bm-text-muted);
}

.user-menu-item:hover {
    background-color: var(--bm-primary-soft);
    color: var(--bm-text-strong);
}

.user-menu-item-danger {
    color: #b91c1c;
}

.user-menu-item-danger i,
.user-menu-item-danger svg {
    color: #b91c1c;
}

.user-menu-item-danger:hover {
    background-color: #fee2e2;
    color: #7f1d1d;
}

.user-menu-separator {
    height: 1px;
    margin: 4px 6px;
    background-color: var(--bm-border-soft);
}

/* Ajustement en mode sombre */
body.dark-mode .user-menu-dropdown {
    background-color: var(--bm-bg-card);
    border-color: var(--bm-border-subtle);
}

body.dark-mode .user-menu-item:hover {
    background-color: var(--bm-bg-soft);
}

body.dark-mode .user-menu-item-danger:hover {
    background-color: rgba(248, 113, 113, 0.12);
}

/* Bouton thème dans la topbar */
.topbar-theme-toggle {
    /* hérite de .btn-icon */
}

/* Icônes du bouton de thème (Lucide moon / sun) */
.theme-icon {
    transition: opacity 0.15s ease;
}

.theme-icon-sun {
    display: none;
}

body.dark-mode .theme-icon-moon {
    display: none;
}

body.dark-mode .theme-icon-sun {
    display: inline-block;
}

/* =========================================================
   BADGES GLOBAUX BROCMANAGER
   Palette :
   - Primary  : #3056d3
   - Success  : #219653
   - Danger   : #d34053
   - Warning  : #ffa70b
   Fonds = couleur + alpha (ex : #2196531a)
   ========================================================= */

/* Base commune des badges */
.bm-badge,
.badge-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    border: none; /* plus de bordure */
}

/* Palette générique (bm-badge-*) */
.bm-badge-primary {
    background-color: #3056d31a;
    color: #3056d3;
}

.bm-badge-success {
    background-color: #2196531a;
    color: #219653;
}

.bm-badge-danger {
    background-color: #d340531a;
    color: #d34053;
}

.bm-badge-warning {
    background-color: #ffa70b1a;
    color: #ffa70b;
}

/* Variantes soft (optionnelles) */
.bm-badge-primary-soft {
    background-color: #3056d30f;
    color: #3056d3;
}

.bm-badge-warning-soft {
    background-color: #ffa70b0f;
    color: #a16207;
}

.bm-badge-danger-soft {
    background-color: #d340530f;
    color: #b91c1c;
}

.bm-badge-success-soft {
    background-color: #2196530f;
    color: #166534;
}

/* Compat OLD BADGES (En stock / En vente / Vendu) */
.badge-en-stock {
    background-color: #3056d3;
    color: #ffffff;
}

.badge-en-vente {
    background-color: #219653;
    color: #ffffff;
}

.badge-vendu {
    background-color: #d34053;
    color: #ffffff;
}

.badge-autre {
    background-color: #3056d3;
    color: #ffffff;
}

/* Dark mode : mêmes couleurs, un peu plus opaques + texte plus clair */
body.dark-mode .bm-badge-primary,
body.dark-mode .badge-en-vente {
    background-color: rgba(33, 150, 83);
    color: rgb(255, 255, 255);
}

body.dark-mode .bm-badge-success,
body.dark-mode .badge-en-stock {
    background-color: rgba(48,86, 211);
    color: rgb(255, 255, 255);
}

body.dark-mode .bm-badge-danger,
body.dark-mode .badge-vendu {
    background-color: rgba(211, 64, 83);
    color: rgb(255, 255, 255);
}

body.dark-mode .bm-badge-warning,
body.dark-mode .badge-autre {
    background-color: rgba(48,86, 211);
    color: rgb(255, 255, 255);
}

/* Optionnel : léger halo en dark mode pour mieux détacher les badges */
body.dark-mode .bm-badge,
body.dark-mode .badge-status {
    box-shadow: 0 0 0 0px rgba(15, 23, 42, 0.45);
}

/* Contenu principal */
.main-content {
    flex: 1;
    padding: 24px 32px 32px;
}

/* Conteneur standard des pages (utilisé partout) */
.page-container {
    max-width: 1120px;
    margin: 0 auto;
}

/* =========================================================
   BADGE ÉVÈNEMENT
   (utilise en général .bm-badge-* + .badge-event)
   ========================================================= */

.badge-event {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    border: none;
}

/* Ici, les couleurs viennent directement de .bm-badge-success / warning / danger
   donc pas besoin de redéfinir. */


/* =========================================================
   BADGE ÉTAT ÉVÉNEMENT (Inscrit / Réservé / Annulé / Autre)
   – version forcée, palette BrocManager
   ========================================================= */

.event-state-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    border: none;
}

/* Mode clair */
.event-state-badge--inscrit {
    background-color: #2196531a;
    color: #219653;
}

.event-state-badge--reserve {
    background-color: #3056d31a;
    color: #3056d3;
}

.event-state-badge--annule {
    background-color: #d340531a;
    color: #d34053;
}

.event-state-badge--autre {
    background-color: #ffa70b1a;
    color: #ffa70b;
}

/* Dark mode : on renforce légèrement l'alpha + texte plus clair */
body.dark-mode .event-state-badge--inscrit {
    background-color: #21965333;
    color: #bbf7d0;
}

body.dark-mode .event-state-badge--reserve {
    background-color: #3056d3;
    color: #e5edff;
}

body.dark-mode .event-state-badge--annule {
    background-color: #d3405333;
    color: #fecaca;
}

body.dark-mode .event-state-badge--autre {
    background-color: #ffa70b33;
    color: #fef9c3;
}

/* =========================================================
   TITRES & TYPO
   ========================================================= */

.page-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 22px;
    font-weight: 600;
    color: var(--bm-text-strong);
}

/* Icônes dans les titres de page */
.page-title i,
.page-title svg,
.page-title .lucide {
    color: var(--bm-primary);
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--bm-text-strong);
}

.index-title {
    color: var(--bm-text-strong);
}

/* =========================================================
   BOUTONS
   ========================================================= */

.btn-primary,
.btn-secondary,
.btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition:
        background-color 0.15s ease,
        color 0.15s ease,
        box-shadow 0.15s ease,
        transform 0.1s ease;
    background: transparent;
}

/* Bouton principal : bleu plein */
.btn-primary {
    background-color: #3056d3;
    color: #ffffff;
}

.btn-primary:hover {
    background-color: #2646b3;
    transform: translateY(-1px);
    box-shadow: 0 12px 22px rgba(48, 86, 211, 0.3);
}

/* Bouton secondaire : fond soft bleu translucide */
.btn-secondary {
    background-color: #3056d31a;
    color: #3056d3;
}

.btn-secondary:hover {
    background-color: #3056d326;
}

/* Bouton outline : fond transparent + contour léger */
.btn-outline {
    background-color: transparent;
    color: #3056d3;
    box-shadow: 0 0 0 0px #3056d333;
}

.btn-outline:hover {
    background-color: #3056d30d;
}

/* Dark mode : on garde le contraste correct */
body.dark-mode .btn-secondary {
    background-color: #3056d3;
    color: #e5edff;
}

body.dark-mode .btn-secondary:hover {
    background-color: #3056d344;
}

body.dark-mode .btn-outline {
    background-color: transparent;
    color: #e5edff;
    box-shadow: 0 0 0 1px #3056d366;
}

body.dark-mode .btn-outline:hover {
    background-color: #3056d31a;
}

/* Petits boutons icône */
.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background-color: var(--bm-icon-circle);
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition:
        background-color 0.15s ease,
        border-color 0.15s ease,
        transform 0.1s ease;
}

.btn-icon .icon,
.btn-icon i,
.btn-icon svg {
    width: 16px;
    height: 16px;
    color: var(--bm-primary);
}

.btn-icon:hover {
    background-color: #dfe4ee;
    border-color: var(--bm-primary-soft);
    transform: translateY(-1px);
}

body.dark-mode .btn-icon:hover {
    background-color: #24303f;
}

/* Bouton burger : caché par défaut sur desktop (plus spécifique que .btn-icon) */
.btn-icon.mobile-menu-toggle {
    display: none;
}

/* =========================================================
   CARTES / BLOCS
   ========================================================= */

.card,
.stat-card,
.product-card {
    background-color: var(--bm-bg-card);
    border-radius: 16px;
    border: 1px solid var(--bm-border-subtle);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.05);
}

.stats-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.stat-card {
    padding: 18px 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.stat-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.stat-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--bm-text-strong);
}

.stat-subtitle {
    font-size: 12px;
    color: var(--bm-text-muted);
}

.stat-value {
    margin-top: 10px;
    font-size: 26px;
    font-weight: 600;
    color: var(--bm-text-strong);
}

/* Icône ronde utilisée dans quick / stats */
.quick-icon {
    width: 46px;
    height: 46px;
    border-radius: 999px;
    background-color: var(--bm-icon-circle);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--bm-primary);
}

/* =========================================================
   DASHBOARD - ACCÈS RAPIDES
   ========================================================= */

.dashboard-container {
    max-width: 1120px;
    margin: 0 auto;
}

.quick-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.quick-card {
    background-color: var(--bm-bg-card);
    border-radius: 16px;
    border: 1px solid var(--bm-border-subtle);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.05);
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    transition:
        transform 0.12s ease,
        box-shadow 0.12s ease,
        border-color 0.12s ease,
        background-color 0.12s ease;
}

.quick-card-main {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Petites cartes de synthèse (frais eBay, etc.) */
.synth-card {
    background-color: var(--bm-bg-soft);
    border-radius: 12px;
    border: none;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.synth-card[class*="border-"] {
    border: none !important;
}

.quick-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--bm-text-strong);
}

.quick-subtitle {
    font-size: 12px;
    color: var(--bm-text-muted);
}

.quick-arrow i {
    width: 18px;
    height: 18px;
    color: var(--bm-text-muted);
}

/* =========================================================
   LISTE ARTICLES - CARTES PRODUITS
   ========================================================= */

.product-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.product-photo {
    position: relative;
    background-color: #f1f5f9;
    border-bottom: 1px solid var(--bm-border-subtle);
    aspect-ratio: 16 / 9;
    max-height: 220px;
    overflow: hidden;
}

.product-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-no-img {
    width: 100%;
    height: 100%;
    font-size: 11px;
    color: var(--bm-text-muted);
    background-color: #2f3b49;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-badge {
    position: absolute;
    right: 10px;
    top: 10px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 11px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.product-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--bm-text-strong);
    margin-bottom: 4px;
}

.product-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

/* Détails repliables */
.product-details {
    font-size: 12px;
    color: var(--bm-text-main);
}

.product-details p {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2px;
}

.product-details span:first-child {
    color: var(--bm-text-muted);
}

/* =========================================================
   FILTRES / FORMULAIRES
   ========================================================= */

.filters-box {
    background-color: var(--bm-bg-card);
    border-radius: 16px;
    border: 1px solid var(--bm-border-subtle);
    padding: 12px 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px 18px;
    align-items: center;
}

.label-sm {
    font-size: 12px;
    font-weight: 500;
    color: var(--bm-text-strong);
}

.input-sm {
    min-width: 160px;
    padding: 6px 10px;
    font-size: 13px;
    border-radius: 10px;
    border: 1px solid var(--bm-border-soft);
    background-color: var(--bm-bg-soft);
    color: var(--bm-text-strong);
    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease,
        background-color 0.15s ease;
}

.input-sm:focus {
    border-color: var(--bm-primary);
    box-shadow: 0 0 0 1px rgba(48, 86, 211, 0.25);
    background-color: #ffffff;
}

.card input:focus,
.card select:focus,
.card textarea:focus {
    border-color: var(--bm-primary);
    box-shadow: 0 0 0 1px rgba(48, 86, 211, 0.25);
    background-color: #ffffff;
}

/* override dark mode */
body.dark-mode .input-sm:focus,
body.dark-mode .card input:focus,
body.dark-mode .card select:focus,
body.dark-mode .card textarea:focus {
    background-color: var(--bm-bg-soft);
}

/* Champs génériques dans les formulaires (add/edit + profil, etc.) */
.card input[type="text"],
.card input[type="number"],
.card input[type="date"],
.card input[type="time"],
.card input[type="email"],
.card input[type="password"],
.card select,
.card textarea {
    width: 100%;
    padding: 8px 10px;
    font-size: 13px;
    border-radius: 10px;
    border: 1px solid var(--bm-border-soft);
    background-color: var(--bm-bg-soft);
    color: var(--bm-text-strong);
    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease,
        background-color 0.15s ease;
}

.card input:focus,
.card select:focus,
.card textarea:focus {
    border-color: var(--bm-primary);
    box-shadow: 0 0 0 1px rgba(48, 86, 211, 0.25);
    background-color: #ffffff;
}

.card label,
label.block.text-sm.font-medium {
    font-size: 14px;
    font-weight: 600;
    color: var(--bm-text-strong);
}

/* =========================================================
   TRI / PETITS LIENS
   ========================================================= */

.sort-btn {
    font-size: 12px;
    padding: 5px 10px;
    border-radius: 999px;
    border: 1px solid var(--bm-border-soft);
    background-color: var(--bm-bg-card);
    color: var(--bm-text-main);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition:
        background-color 0.15s ease,
        color 0.15s ease,
        border-color 0.15s ease;
}

.sort-btn.active {
    background-color: var(--bm-primary);
    color: #ffffff;
    border-color: var(--bm-primary);
}

/* =========================================================
   TABLEAUX
   ========================================================= */

table {
    border-collapse: collapse;
}

table th,
table td {
    font-size: 13px;
}

table th {
    font-weight: 600;
}

/* =========================================================
   DIVERS
   ========================================================= */

.text-muted {
    color: var(--bm-text-muted);
}

/* =========================================================
   DARK MODE - OVERRIDES DES COULEURS TAILWIND EN DUR
   ========================================================= */

body.dark-mode .text-\[\#111827\],
body.dark-mode .text-\[\#212b36\],
body.dark-mode .text-slate-800,
body.dark-mode .text-slate-900 {
    color: var(--bm-text-strong) !important;
}

body.dark-mode .text-\[\#4b5563\],
body.dark-mode .text-\[\#637381\],
body.dark-mode .text-slate-500,
body.dark-mode .text-slate-400,
body.dark-mode .text-gray-500 {
    color: var(--bm-text-main) !important;
}

body.dark-mode .text-\[\#9ca3af\],
body.dark-mode .text-slate-300,
body.dark-mode .text-gray-400 {
    color: var(--bm-text-muted) !important;
}

body.dark-mode .bg-white {
    background-color: var(--bm-bg-card) !important;
}

body.dark-mode .card .bg-\[\#f8fafc\] {
    background-color: var(--bm-bg-soft) !important;
}

body.dark-mode .bg-gray-50 {
    background-color: var(--bm-bg-card) !important;
}

body.dark-mode .hover\:bg-gray-50:hover,
body.dark-mode tr.hover\:bg-gray-50:hover {
    background-color: var(--bm-bg-soft) !important;
}

body.dark-mode .bg-slate-50 {
    background-color: var(--bm-bg-soft) !important;
}

body.dark-mode .hover\:bg-slate-50:hover,
body.dark-mode tr.hover\:bg-slate-50:hover {
    background-color: var(--bm-bg-soft) !important;
}

body.dark-mode .text-\[\#4b5563\] {
    color: var(--bm-text-main) !important;
}

body.dark-mode .bg-slate-100,
body.dark-mode .bg-slate-200 {
    background-color: var(--bm-bg-soft) !important;
}

body.dark-mode .border-slate-100,
body.dark-mode .border-slate-200,
body.dark-mode .border-gray-200 {
    border-color: var(--bm-border-subtle) !important;
}

/* =========================================================
   SIDEBAR - ITEM ACTIF EN DARK MODE
   ========================================================= */

body.dark-mode .sidebar-sub-link.is-active {
    background-color: rgba(255, 255, 255, 0.05); /* bleu bien visible */
    color: #ffffff;                            /* texte blanc */
    font-weight: 600;
}

/* Optionnel : hover des sous-liens en dark, un peu plus marqué */
body.dark-mode .sidebar-sub-link:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: #ffffff;
}

/* =========================================================
   RESPONSIVE - MOBILE
   ========================================================= */

@media (max-width: 768px) {

    /* Pas de scroll horizontal */
    body {
        overflow-x: hidden;
    }

    /* -------- TOPBAR -------- */

    .topbar {
        padding: 8px 12px;
        flex-direction: column;   /* 2 lignes : icônes puis burger+search */
        align-items: stretch;
        height: auto;
        min-height: 0;
        gap: 8px; /* espace entre ligne 1 et ligne 2 */
    }

    .topbar-left,
    .topbar-right {
        width: 100%;
        display: flex;
        align-items: center;
    }

    /* LIGNE 1 : agenda + thème + profil (icônes) */
    .topbar-right {
        order: 1;                 /* passe en premier */
        gap: 8px;
        justify-content: flex-end; /* icônes alignées à droite */
    }

    /* LIGNE 2 : burger + recherche */
    .topbar-left {
        order: 2;                 /* passe en deuxième */
        gap: 8px;
        justify-content: flex-start;
    }

    .btn-icon.mobile-menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }

    .topbar-search {
        flex: 1;
        min-width: 0;
        max-width: 100%;
    }

    .topbar-user-email,
    .topbar-user-role {
        display: none;
    }

    /* -------- CONTENU -------- */

    .main-content {
        padding: 16px;
    }

    .page-container {
        max-width: 100%;
    }

    /* -------- SIDEBAR EN MODE "DRAWER" -------- */

    .sidebar {
        position: fixed;
        top: var(--bm-header-height);
        left: 0;
        width: 260px;
        height: calc(100vh - var(--bm-header-height));
        transform: translateX(-100%);
        transition: transform 0.2s ease-out;
        z-index: 30;
        bottom: auto;
    }

    .sidebar.is-open {
        transform: translateX(0);
    }

    /* ===== Liste trajets carburant - mobile ===== */
    .trajets-table-wrapper {
        overflow-x: visible;
    }

    .trajets-table {
        width: 100%;
        min-width: 0;
        table-layout: auto;
    }

    .trajets-table th,
    .trajets-table td {
        padding: 6px 4px;
        font-size: 11px;
    }

    .trajets-table .col-ville {
        max-width: 140px;
        word-wrap: break-word;
    }

    .trajets-table .col-distance,
    .trajets-table .col-cost {
        width: 70px;
        white-space: nowrap;
    }

    .trajets-table .col-actions {
        white-space: nowrap;
    }
}

/* Footer */
.app-footer {
    text-align: center;
    padding: 12px 0;
    font-size: 12px;
    color: var(--bm-text-muted);
}
