/* ==========================================================================
   Bulk-Orders — composants d'interface (listes, cartes, filtres…)
   --accent est défini dans base.html.twig selon la couleur des paramètres.
   ========================================================================== */

:root {
    --accent: #28a745;
    --surface: #fff;
    --border: #e7eaee;
    --muted: #6c757d;
    --text: #1f2d3d;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
    --shadow-hover: 0 4px 12px rgba(16, 24, 40, .12);
}

body { color: var(--text); }
.content-wrapper { background: #f4f6f9; }
.content-header { padding: 18px .5rem 6px; }
.content { padding-bottom: 96px; }
.welcome { font-size: 1.6rem; font-weight: 300; }
.flash { border-radius: var(--radius-sm); border: 0; box-shadow: var(--shadow); }
.nav-sidebar .nav-header { font-size: .72rem; letter-spacing: .08em; opacity: .6; padding-top: 1rem; }
.user-dropdown { min-width: 220px; }
.text-accent { color: var(--accent) !important; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover, .btn-accent:focus { color: #fff; filter: brightness(.93); }
.btn-soft { background: #f1f3f5; border: 0; color: var(--text); }
.btn-soft:hover { background: #e7eaee; }
.btn-icon { width: 36px; height: 36px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; }

/* ---- En-tête de page ---------------------------------------------------- */
.page-head {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: .75rem; margin-bottom: 1rem; width: 100%;
}
.page-head h1 { font-size: 1.6rem; font-weight: 600; margin: 0; }
.page-head .subtitle { color: var(--muted); margin: .15rem 0 0; }
.page-head .actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.back-link { color: var(--muted); font-size: .9rem; display: inline-block; margin-bottom: .25rem; }
.back-link:hover { color: var(--text); }

/* ---- Barre d'outils : recherche + filtres ------------------------------- */
.toolbar { display: flex; flex-wrap: wrap; gap: .5rem .75rem; align-items: center; margin-bottom: 1rem; }
.search-box { position: relative; flex: 1 1 240px; max-width: 420px; }
.search-box i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-box input {
    width: 100%; border: 1px solid var(--border); border-radius: 999px;
    padding: .45rem 1rem .45rem 2.2rem; background: var(--surface); outline: none;
}
.search-box input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0, 0, 0, .05); }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip {
    border: 1px solid var(--border); background: var(--surface); color: var(--text);
    border-radius: 999px; padding: .3rem .8rem; font-size: .88rem; cursor: pointer; line-height: 1.3;
}
.chip:hover { border-color: #cfd5db; }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip .count { opacity: .7; margin-left: .25rem; }

/* ---- Panneaux ----------------------------------------------------------- */
.panel {
    background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
    margin-bottom: 1.25rem; overflow: hidden; width: 100%;
}
.panel-head {
    display: flex; align-items: center; justify-content: space-between; gap: .75rem;
    padding: .9rem 1.1rem; border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.panel-head h2, .panel-head h3 { font-size: 1.1rem; font-weight: 600; margin: 0; }
.panel-head .meta { color: var(--muted); font-size: .88rem; }
.panel-body { padding: 1.1rem; }
.panel-foot { padding: .8rem 1.1rem; border-top: 1px solid var(--border); background: #fafbfc; }
.panel.collapsed .panel-collapsible { display: none; }
.filtering .panel.collapsed .panel-collapsible { display: block; }
.panel-toggle { cursor: pointer; user-select: none; }
.panel-toggle .fa-chevron-down { transition: transform .2s; color: var(--muted); }
.panel.collapsed .panel-toggle .fa-chevron-down { transform: rotate(-90deg); }

/* ---- Listes (remplacent les tableaux) ----------------------------------- */
.rows { list-style: none; margin: 0; padding: 0; }
.row-item {
    display: flex; align-items: center; gap: .9rem; padding: .8rem 1.1rem;
    border-bottom: 1px solid var(--border); color: inherit; background: var(--surface);
}
.row-item:last-child { border-bottom: 0; }
a.row-item:hover, .row-item.clickable:hover { background: #f8f9fb; color: inherit; text-decoration: none; }
a.row-item::after {
    content: "\f054"; font-family: "Font Awesome 5 Free"; font-weight: 900;
    color: #c3c9d0; font-size: .8rem; margin-left: auto; padding-left: .5rem;
}
.row-main { flex: 1 1 auto; min-width: 0; }
.row-title { font-weight: 600; line-height: 1.3; }
.row-meta { color: var(--muted); font-size: .88rem; }
.row-meta > span + span::before { content: "·"; margin: 0 .4rem; }
.row-aside { flex: 0 0 auto; text-align: right; display: flex; align-items: center; gap: .5rem; }
.row-item.is-muted { opacity: .6; }
.row-item form { margin: 0; }

/* ---- Grille de cartes --------------------------------------------------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; width: 100%; }
.card-grid.wide { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.tile {
    background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: .5rem;
    color: inherit; position: relative; transition: box-shadow .15s, transform .15s;
    border-top: 3px solid transparent;
}
a.tile:hover { box-shadow: var(--shadow-hover); transform: translateY(-1px); color: inherit; text-decoration: none; }
.tile-title { font-weight: 600; font-size: 1.02rem; line-height: 1.3; }
.tile-sub { color: var(--muted); font-size: .88rem; }
.tile-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.tile.status-danger { border-top-color: #dc3545; }
.tile.status-warning { border-top-color: #ffc107; }
.tile.status-success { border-top-color: #28a745; }

/* ---- Sections par catégorie --------------------------------------------- */
.cat-section { width: 100%; margin-bottom: 1.5rem; }
.cat-title {
    display: flex; align-items: center; gap: .6rem; font-size: 1.05rem; font-weight: 600;
    margin: 0 0 .75rem; color: var(--text);
}
.cat-title .cat-icon {
    width: 32px; height: 32px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center;
    background: var(--accent); color: #fff; font-size: .9rem;
}
.cat-title .count { color: var(--muted); font-weight: 400; font-size: .9rem; }

/* ---- Avatars, pastilles ------------------------------------------------- */
.avatar {
    width: 40px; height: 40px; border-radius: 50%; flex: 0 0 auto;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: .9rem; color: #fff; background: var(--accent);
}
.avatar-sm { width: 28px; height: 28px; font-size: .72rem; }
.avatar-light { background: rgba(255, 255, 255, .25); }
.pill {
    display: inline-flex; align-items: center; gap: .3rem; border-radius: 999px;
    padding: .15rem .6rem; font-size: .78rem; font-weight: 600; white-space: nowrap; line-height: 1.5;
}
.pill-success { background: #e6f4ea; color: #1e7e34; }
.pill-warning { background: #fff4d6; color: #8a6100; }
.pill-danger { background: #fde8ea; color: #b02a37; }
.pill-info { background: #e3f2fb; color: #0f6d8c; }
.pill-muted { background: #eef0f3; color: #57606a; }
.pill-accent { background: var(--accent); color: #fff; }

.price { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.price-old { color: var(--muted); text-decoration: line-through; font-weight: 400; font-size: .85em; margin-right: .3rem; }
.num { font-variant-numeric: tabular-nums; }

/* ---- Lignes de produits dans une commande ------------------------------- */
.lines { list-style: none; margin: 0; padding: 0; }
.lines li { display: flex; align-items: baseline; gap: .5rem; padding: .2rem 0; }
.lines .qty { font-weight: 700; min-width: 2.2rem; color: var(--accent); font-variant-numeric: tabular-nums; }
.lines .name { flex: 1 1 auto; min-width: 0; }
.lines .pack { color: var(--muted); font-size: .85rem; }

/* ---- Statistiques ------------------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .75rem; width: 100%; margin-bottom: 1rem; }
.stat { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: .8rem 1rem; }
.stat .label { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 1.45rem; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---- Jours de commande -------------------------------------------------- */
.date-badge {
    flex: 0 0 auto; width: 58px; border-radius: 10px; overflow: hidden; text-align: center;
    background: #f1f3f5; line-height: 1.1;
}
.date-badge .m { background: var(--accent); color: #fff; font-size: .7rem; text-transform: uppercase; padding: 2px 0; letter-spacing: .05em; }
.date-badge .d { font-size: 1.45rem; font-weight: 700; padding: 3px 0 0; }
.date-badge .w { font-size: .7rem; color: var(--muted); padding-bottom: 4px; }
.gauge { height: 6px; border-radius: 999px; background: #eef0f3; overflow: hidden; margin-top: .35rem; }
.gauge > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }

/* ---- Prise de commande -------------------------------------------------- */
.shop-item { flex-direction: row; align-items: center; gap: .9rem; padding: .8rem 1rem; }
.shop-item.selected { box-shadow: 0 0 0 2px var(--accent), var(--shadow); }
.shop-item .info { flex: 1 1 auto; min-width: 0; }
.qty-stepper { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 999px; background: #fff; flex: 0 0 auto; }
.qty-stepper button {
    width: 34px; height: 34px; border: 0; background: transparent; border-radius: 50%;
    color: var(--text); font-size: .85rem; cursor: pointer;
}
.qty-stepper button:hover { background: #f1f3f5; }
.qty-stepper button:disabled { opacity: .3; cursor: default; background: transparent; }
.qty-stepper input {
    width: 38px; border: 0; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums;
    -moz-appearance: textfield; background: transparent; padding: 0;
}
.qty-stepper input::-webkit-outer-spin-button, .qty-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.order-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030;
    background: var(--surface); box-shadow: 0 -4px 16px rgba(16, 24, 40, .12);
    padding: .75rem 1rem; display: flex; align-items: center; gap: .75rem;
}
@media (min-width: 992px) {
    body:not(.sidebar-collapse) .order-bar { left: 250px; }
    .sidebar-collapse .order-bar { left: 4.6rem; }
}
.order-bar .summary { flex: 1 1 auto; min-width: 0; line-height: 1.25; }
.order-bar .btn { white-space: nowrap; }
.order-bar .summary .total { font-size: 1.25rem; font-weight: 700; }
.order-bar .summary .detail { color: var(--muted); font-size: .85rem; }
.order-bar .over { color: #dc3545; font-weight: 600; }

/* ---- État vide ---------------------------------------------------------- */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--muted); width: 100%; }
.empty-state i { font-size: 2.5rem; opacity: .35; margin-bottom: .75rem; display: block; }
.empty-state h3 { font-size: 1.15rem; color: var(--text); }

/* ---- Formulaires -------------------------------------------------------- */
.form-panel { max-width: 720px; }
.form-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-top: 1rem; }
.form-actions .spacer { flex: 1 1 auto; }
.choice-group { margin-bottom: 1rem; }
.choice-group-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .4rem; }
.choice-group-head strong { font-size: .95rem; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .35rem .75rem; }
.choice-grid .form-check { background: #f8f9fb; border-radius: var(--radius-sm); padding: .45rem .75rem .45rem 2rem; margin: 0; }
.choice-grid .form-check-input { margin-left: -1.3rem; }

/* ---- Paramètres : pastilles de couleur ---------------------------------- */
.swatches { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.swatch { width: 44px; height: 44px; border-radius: 50%; position: relative; cursor: pointer; margin: 0; }
.swatch input { position: absolute; opacity: 0; }
.swatch.active, .swatch:has(input:checked) { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--text); }

/* ---- Filtrage côté client ----------------------------------------------- */
.is-hidden { display: none !important; }

@media (max-width: 575.98px) {
    .page-head h1 { font-size: 1.35rem; }
    .row-item { padding: .75rem .9rem; gap: .7rem; }
    .panel-head, .panel-body { padding-left: .9rem; padding-right: .9rem; }
    .hide-xs { display: none !important; }
}

@media print {
    .main-sidebar, .main-header, .toolbar, .order-bar, .no-print { display: none !important; }
    .content-wrapper { margin-left: 0 !important; }
    .panel { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
    .panel.collapsed .panel-collapsible { display: block; }
}
