/* G_Affectation : badges « ou il se vend » et page Affectation Produit. */

.gaff-mention { display: inline-flex; flex-wrap: wrap; gap: 4px; vertical-align: middle; }
.gaff-badge { font-weight: 600; font-size: .74rem; border-radius: 999px; padding: .32em .7em; background: rgba(13, 110, 253, .1); color: #0b5ed7; border: 1px solid rgba(13, 110, 253, .25); white-space: normal; text-align: left; }
.gaff-badge-partout { background: rgba(108, 117, 125, .12); color: #495057; border-color: rgba(108, 117, 125, .28); }
.gaff-badge-inactif { background: rgba(108, 117, 125, .08); color: #6c757d; border-style: dashed; text-decoration: line-through; }
.gaff-badge-alerte { background: rgba(253, 126, 20, .14); color: #b35900; border-color: rgba(253, 126, 20, .35); }
.gaff-badge-groupe { background: rgba(111, 66, 193, .12); color: #5a32a3; border-color: rgba(111, 66, 193, .3); }
.gaff-badge-ici { background: rgba(25, 135, 84, .14); color: #146c43; border-color: rgba(25, 135, 84, .35); }
.gaff-badge-pas-ici { background: rgba(108, 117, 125, .14); color: #5c636a; border-color: rgba(108, 117, 125, .3); }

:where(body.theme-dark, html[data-faccontrol-theme="dark"] body) .gaff-badge { color: #9ec5fe; }
:where(body.theme-dark, html[data-faccontrol-theme="dark"] body) .gaff-badge-partout,
:where(body.theme-dark, html[data-faccontrol-theme="dark"] body) .gaff-badge-pas-ici,
:where(body.theme-dark, html[data-faccontrol-theme="dark"] body) .gaff-badge-inactif { color: #ced4da; }
:where(body.theme-dark, html[data-faccontrol-theme="dark"] body) .gaff-badge-ici { color: #75b798; }
:where(body.theme-dark, html[data-faccontrol-theme="dark"] body) .gaff-badge-alerte { color: #ffb366; }

/* --- Page ------------------------------------------------------------------ */

.gaff-page { padding-bottom: 150px; }
.gaff-page .fc-settings-card { margin-bottom: 18px; }
.gaff-card-body { padding: 4px 22px 22px; }
.gaff-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.gaff-filters .form-label { font-weight: 600; font-size: .82rem; margin-bottom: 4px; }
.gaff-page .product-search-stage { margin-top: 16px; }

.gaff-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.gaff-toolbar .gaff-count { color: var(--text-muted, #6c757d); font-size: .9rem; }

.gaff-category { border: 1px solid var(--border-color, #e5e7eb); border-radius: 10px; margin-bottom: 10px; background: var(--bg-card, #fff); }
.gaff-category-head { display: flex; align-items: center; gap: 12px; padding: 10px 14px; }
.gaff-category-head .form-check-input { width: 1.25rem; height: 1.25rem; margin: 0; flex: none; cursor: pointer; }
.gaff-category-toggle { flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 10px; background: none; border: 0; padding: 4px 0; text-align: left; font-weight: 600; color: inherit; min-height: 36px; }
.gaff-category-toggle .bi-chevron-down { transition: transform .2s ease; }
.gaff-category[data-open="true"] .gaff-category-toggle .bi-chevron-down { transform: rotate(180deg); }
.gaff-category-meta { font-weight: 500; font-size: .82rem; color: var(--text-muted, #6c757d); white-space: nowrap; }
.gaff-category-body { border-top: 1px solid var(--border-color, #e5e7eb); padding: 6px 14px 12px; }

.gaff-product { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px 12px; align-items: center; padding: 8px 4px; border-bottom: 1px dashed var(--border-color, #e5e7eb); }
.gaff-product:last-child { border-bottom: 0; }
.gaff-product .form-check-input { width: 1.15rem; height: 1.15rem; margin: 0; cursor: pointer; }
.gaff-product-name { font-weight: 600; overflow-wrap: anywhere; }
.gaff-product-code { color: var(--text-muted, #6c757d); font-size: .8rem; }
.gaff-product-inactive .gaff-product-name { color: var(--text-muted, #6c757d); text-decoration: line-through; }
.gaff-product .gaff-mention { justify-content: flex-end; }
.gaff-product.is-updated { animation: gaff-flash 1.6s ease; }
@keyframes gaff-flash { 0% { background: rgba(25, 135, 84, .18); } 100% { background: transparent; } }
.gaff-more { margin-top: 8px; }
.gaff-empty { padding: 30px 10px; text-align: center; color: var(--text-muted, #6c757d); }

/* Barre de declaration collante. */
.gaff-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030; background: var(--bg-card, #fff); border-top: 1px solid var(--border-color, #dee2e6); box-shadow: 0 -6px 20px rgba(15, 23, 42, .08); padding: 10px 18px; }
body:not(.toggle-sidebar) .gaff-bar { left: 300px; }
.gaff-bar-inner { display: flex; flex-wrap: wrap; align-items: end; gap: 10px 14px; }
.gaff-bar-count { font-weight: 700; min-width: 150px; flex: 0 1 190px; }
.gaff-bar-count small { display: block; font-weight: 500; color: var(--text-muted, #6c757d); }
.gaff-bar .form-label { font-size: .76rem; font-weight: 600; margin-bottom: 2px; }
.gaff-bar-field { min-width: 150px; flex: 1 1 150px; }
.gaff-bar-mode { min-width: 215px; flex: 1 1 215px; }
.gaff-bar-motif { flex: 1 1 140px; min-width: 140px; }
.gaff-bar-stock { display: flex; align-items: center; gap: 6px; min-height: 38px; }

/* Panneau d'apercu. */
.gaff-preview .offcanvas-body { padding-top: 6px; }
.gaff-preview.offcanvas-end { width: min(980px, 100vw); }
.gaff-counters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.gaff-counter { border: 1px solid var(--border-color, #e5e7eb); border-radius: 10px; padding: 8px 12px; min-width: 120px; }
.gaff-counter strong { display: block; font-size: 1.2rem; }
.gaff-counter.is-warning { border-color: rgba(253, 126, 20, .45); background: rgba(253, 126, 20, .08); color: #b35900; }
.gaff-preview-note { border-left: 4px solid #198754; background: rgba(25, 135, 84, .08); padding: 8px 12px; border-radius: 6px; margin-bottom: 12px; font-weight: 600; }
.gaff-preview-table { font-size: .85rem; }
.gaff-preview-table td, .gaff-preview-table th { vertical-align: top; }
.gaff-warning { color: #b35900; }
.gaff-warning::before { content: "⚠ "; }
.gaff-info { color: var(--text-muted, #6c757d); }
.gaff-result { margin-bottom: 18px; }

/* Parametrage des points de vente (mentions). */
:where(body.theme-dark, html[data-faccontrol-theme="dark"] body) .gaff-badge-groupe { color: #c29ffa; }
.gaff-settings-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 18px; }
.gaff-settings-table td, .gaff-settings-table th { vertical-align: middle; }
.gaff-settings-table .form-select { min-width: 170px; }
.gaff-mention-list { display: flex; flex-direction: column; gap: 8px; }
.gaff-mention-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; border: 1px solid var(--border-color, #e5e7eb); border-radius: 10px; padding: 8px 10px; }
.gaff-mention-item small { display: block; color: var(--text-muted, #6c757d); }
.gaff-mention-actions { display: flex; gap: 4px; flex: none; }
.gaff-mention-new { display: flex; gap: 6px; margin-top: 10px; }
.gaff-settings-message { margin-top: 10px; }
@media (max-width: 991.98px) { .gaff-settings-grid { grid-template-columns: 1fr; } }
.gaff-result .btn { margin-top: 6px; }

/* Sous 1200 px, la barre laterale passe par-dessus le contenu : la barre prend toute la largeur. */
@media (max-width: 1199.98px) { body:not(.toggle-sidebar) .gaff-bar, body .gaff-bar { left: 0; } }
@media (max-width: 767.98px) {
  .gaff-product { grid-template-columns: auto minmax(0, 1fr); }
  .gaff-product .gaff-mention { grid-column: 2; justify-content: flex-start; }
  .gaff-page { padding-bottom: 330px; }
}
@media (max-width: 575.98px) {
  .gaff-card-body { padding: 4px 14px 16px; }
  .gaff-category-head .form-check-input, .gaff-product .form-check-input { width: 1.6rem; height: 1.6rem; }
  .gaff-category-toggle { min-height: 44px; }
  .gaff-product { min-height: 44px; }
  .gaff-bar .btn, .gaff-bar .form-select, .gaff-bar .form-control { min-height: 44px; }
  /* Barre compacte sur deux colonnes : elle laisse la liste visible. */
  .gaff-bar { padding: 8px 12px; }
  .gaff-bar-inner { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px 8px; align-items: end; }
  .gaff-bar-count { grid-column: 1 / -1; min-width: 0; }
  .gaff-bar-field, .gaff-bar-mode, .gaff-bar-motif { min-width: 0; }
  .gaff-bar-stock { grid-column: 1 / -1; min-height: 32px; }
  .gaff-bar #gaffDeclare { width: 100%; }
  .gaff-page { padding-bottom: 300px; }
}
