/*
 * STANISLAS DUCREUX — compléments de charte et composants propres à la
 * plateforme, chargés après ducreux-theme.css (le gabarit SmartHR recoloré).
 *
 * CHARTE STANISLAS DUCREUX (le logo reçu, resources/brand) : le noir du logo,
 * #231F20, pour le logo, l'action (boutons, liens, menu actif) et les fonds
 * (favicon, icône de l'appli) ; des gris chauds pour les fonds clairs ; le
 * vert des feuilles du sigle, #4F6B4A, pour les accents.
 * Le gabarit est recoloré par scripts/theme/recolor.php "#231F20" ; les
 * logos et icônes viennent de resources/brand (scripts/brand/exporter.py).
 */
:root {
  --sd-primary: #231F20;
  --sd-primary-hover: #000000;
  --sd-primary-tint: #F2F0EE;
  --sd-accent: #4F6B4A;
  --sd-accent-ring: rgba(79, 107, 74, .25);
  --sd-ink: #231F20;
  --sd-muted: #6B6B6B;
  --sd-line: #E7E4E1;
  /* Les étapes d'une commande (App\Enums\OrderStatus::color). */
  --sd-success: #03A94D;
  --sd-warning: #E89A00;
  --sd-danger: #D92D20;
  /* Variables du gabarit qui pilotent le menu actif et quelques bordures. */
  --primary-rgb: 35, 31, 32;
  --primary-transparent: #F2F0EE;
  --primary-linear-gradient: linear-gradient(270deg, rgba(35, 31, 32, 0.12) 0%, #FFFFFF 100%);
}

/* ---------- Logo ---------- */
.sidebar .sidebar-logo .logo img,
.header .header-left .logo img,
.header .header-left .dark-logo img { width: auto; height: 42px; max-width: 100%; }
.sidebar .sidebar-logo .logo-small img,
.logo-small img { width: auto; height: 38px; }

/* ---------- Menu latéral : fond blanc, logo noir, rubrique active sur fond grège ---------- */
.sidebar .sidebar-logo { display: flex; align-items: center; padding-top: 0; }
.sidebar .sidebar-menu > ul { padding-bottom: 28px; }
.mini-sidebar .sidebar .sidebar-logo { justify-content: center; }
@media (max-width: 991.98px) {
  .sidebar .sidebar-logo { display: none; }
}
.sidebar .sidebar-menu > ul > li > ul > li > a:hover { background: #F7F6F4; }
.sidebar .sidebar-menu > ul > li ul li a.active,
.sidebar .sidebar-menu > ul > li ul > li.active a { background: var(--sd-primary-tint); border-radius: 5px; }
.sidebar .sidebar-menu > ul > li ul li a.active span,
.sidebar .sidebar-menu > ul > li ul li a.active i,
.sidebar .sidebar-menu > ul > li ul > li.active a span,
.sidebar .sidebar-menu > ul > li ul > li.active a i { color: var(--sd-primary); }
.sidebar .sidebar-menu > ul > li ul li a.active span,
.sidebar .sidebar-menu > ul > li ul > li.active a span { font-weight: 600; }

/* ---------- Page de connexion : le panneau de marque ---------- */
.sd-auth-panel { background: linear-gradient(160deg, #FBFAF8 0%, #EFECE8 100%); color: var(--sd-muted); }
.sd-auth-logo { height: 220px; width: auto; margin-bottom: 30px; }
/* Le sélecteur de langue de la page de connexion : deux boutons dans une pilule, la langue en cours en bleu. */
.sd-lang-switch { display: inline-flex; padding: 3px; border: 1px solid var(--sd-line); border-radius: 999px; background: #F3F5F7; }
.sd-lang-switch button { border: 0; background: transparent; color: var(--sd-muted); font-size: 13px; font-weight: 500; line-height: 1.2; padding: 6px 16px; border-radius: 999px; transition: background .15s, color .15s; }
.sd-lang-switch button:hover { color: var(--sd-ink); }
.sd-lang-switch button[aria-pressed="true"] { background: var(--sd-primary); color: #FFF; box-shadow: 0 1px 2px rgba(0, 0, 0, .14); }
.sd-lang-switch button:focus-visible { outline: 2px solid var(--sd-primary); outline-offset: 2px; }

/* ---------- Boutons, liens, champs ---------- */
.btn-primary, .btn.btn-primary { background-color: var(--sd-primary); border-color: var(--sd-primary); color: #fff; }
.btn-primary:hover, .btn-primary:focus, .btn.btn-primary:hover, .btn.btn-primary:focus { background-color: var(--sd-primary-hover) !important; border-color: var(--sd-primary-hover) !important; color: #fff; }
.btn-outline-primary { color: var(--sd-primary); border-color: var(--sd-primary); }
.btn-outline-primary:hover { background-color: var(--sd-primary); border-color: var(--sd-primary); color: #fff; }
.bg-primary { background-color: var(--sd-primary) !important; }
.text-primary { color: var(--sd-primary) !important; }
a:hover { color: var(--sd-primary); }
.form-control:focus, .form-select:focus { border-color: var(--sd-accent); box-shadow: 0 0 0 .2rem var(--sd-accent-ring); }
.form-check-input:checked { background-color: var(--sd-primary); border-color: var(--sd-primary); }
.page-link.active, .active > .page-link { background-color: var(--sd-primary); border-color: var(--sd-primary); }
.nav-tabs .nav-link.active, .nav-tabs .nav-item.show .nav-link { color: var(--sd-primary); border-bottom-color: var(--sd-primary); }
.form-label .req { color: var(--sd-danger); margin-left: 2px; }
.form-text { font-size: 12.5px; }

/* ---------- En-tête de page ---------- */
.sd-page-head { gap: 12px; }
.sd-page-head h2 { font-size: 22px; }
.sd-page-head .breadcrumb { font-size: 13px; }

/* ---------- Tuiles de chiffres clés ---------- */
.sd-kpi { position: relative; border: 1px solid var(--sd-line); border-radius: 10px; background: #fff; padding: 16px 18px; height: 100%; display: flex; align-items: center; gap: 14px; }
.sd-kpi .sd-kpi-icon { width: 44px; height: 44px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; font-size: 22px; flex: none; }
.sd-kpi .sd-kpi-value { font-size: 24px; font-weight: 700; line-height: 1.1; color: var(--sd-ink); }
.sd-kpi .sd-kpi-label { font-size: 13px; color: var(--sd-muted); }
.sd-tone-primary { background: var(--sd-primary-tint); color: var(--sd-primary); }
.sd-tone-accent { background: #EEF3EC; color: var(--sd-accent); }
.sd-tone-success { background: #E8FAF0; color: #038A3F; }
.sd-tone-warning { background: #FEF0C7; color: #B54708; }
.sd-tone-danger { background: #FDE7E7; color: #B00B0B; }
.sd-tone-secondary { background: #F1F3F5; color: #4B5563; }
.sd-tone-info { background: #E7F1FF; color: #1B6FD1; }
.sd-tone-purple { background: #F1ECFD; color: #6941C6; }

/* ---------- Les étapes d'une commande : la frise ---------- */
.sd-steps { display: flex; gap: 0; list-style: none; padding: 0; margin: 0; overflow-x: auto; }
.sd-steps li { flex: 1 1 0; min-width: 96px; text-align: center; position: relative; padding-top: 34px; font-size: 12.5px; color: var(--sd-muted); }
.sd-steps li::before { content: ""; position: absolute; top: 13px; left: 0; right: 0; height: 3px; background: var(--sd-line); }
.sd-steps li:first-child::before { left: 50%; }
.sd-steps li:last-child::before { right: 50%; }
.sd-steps li .sd-step-dot { position: absolute; top: 2px; left: 50%; transform: translateX(-50%); width: 26px; height: 26px; border-radius: 50%; background: #fff; border: 3px solid var(--sd-line); display: inline-flex; align-items: center; justify-content: center; font-size: 13px; z-index: 1; }
.sd-steps li.is-done { color: var(--sd-ink); }
.sd-steps li.is-done::before { background: var(--sd-primary); }
.sd-steps li.is-done .sd-step-dot { background: var(--sd-primary); border-color: var(--sd-primary); color: #fff; }
.sd-steps li.is-current { color: var(--sd-primary); font-weight: 600; }
.sd-steps li.is-current .sd-step-dot { border-color: var(--sd-primary); color: var(--sd-primary); box-shadow: 0 0 0 4px var(--sd-accent-ring); }
.sd-steps .sd-step-time { display: block; font-weight: 400; color: var(--sd-muted); font-size: 11.5px; }
/* Sur un téléphone, les étapes se lisent de haut en bas. */
@media (max-width: 575.98px) {
  .sd-steps { flex-direction: column; overflow: visible; }
  .sd-steps li { flex: none; min-width: 0; text-align: left; padding: 4px 0 16px 40px; }
  .sd-steps li::before { top: 0; bottom: 0; left: 12px; right: auto; width: 3px; height: auto; }
  .sd-steps li:first-child::before { top: 14px; left: 12px; }
  .sd-steps li:last-child::before { right: auto; bottom: auto; height: 14px; }
  .sd-steps li .sd-step-dot { left: 13.5px; }
  .sd-steps .sd-step-time { display: inline; margin-left: 6px; }
}

/* ---------- L'historique d'une commande ---------- */
.sd-history { list-style: none; padding: 0; margin: 0; }
.sd-history li { display: flex; gap: 12px; padding: 9px 0; border-bottom: 1px solid #F1F3F5; }
.sd-history li:last-child { border-bottom: 0; }
.sd-history .sd-history-icon { width: 30px; height: 30px; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center; font-size: 15px; }
.sd-history .sd-history-time { font-size: 12px; color: var(--sd-muted); white-space: nowrap; }

/* ---------- Cartes ---------- */
.sd-map { height: 460px; border-radius: 10px; border: 1px solid var(--sd-line); z-index: 0; }
.sd-map.is-small { height: 300px; }
.sd-map.is-tall { height: calc(100vh - 240px); min-height: 420px; }
.sd-pin { width: 30px; height: 30px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .35); display: flex; align-items: center; justify-content: center; }
.sd-pin span { transform: rotate(45deg); color: #fff; font-weight: 700; font-size: 13px; }
.sd-pin.is-store { background: var(--sd-primary); }
.sd-pin.is-place { background: var(--sd-accent); }
/* Les listes courtes du tableau de bord (orders._compact). */
.sd-compact { list-style: none; margin: 0; padding: 0; }
.sd-compact li { position: relative; padding: 12px 20px; border-bottom: 1px solid var(--sd-line); }
.sd-compact li:last-child { border-bottom: 0; }
.sd-compact li:hover { background: #FAF9F7; }
.sd-compact .sd-compact-route { font-size: 13px; color: #4B5563; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.leaflet-popup-content h6 { margin-bottom: 4px; }

/* ---------- Tableaux ---------- */
.table td, .table th { vertical-align: middle; }
.table .sd-mono, .sd-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; letter-spacing: .02em; }
.table-hover tbody tr.is-link { cursor: pointer; }
.sd-filters .form-control, .sd-filters .form-select { min-width: 150px; }

/* ---------- États vides et messages ---------- */
.sd-empty { text-align: center; padding: 36px 16px; color: var(--sd-muted); }
.sd-empty i { font-size: 34px; color: #C2CAD3; display: block; margin-bottom: 8px; }
.sd-text-danger { color: var(--sd-danger); }
.sd-text-warning { color: #B54708; }
.sd-text-info { color: #1B84FF; }
.sd-text-success { color: #038A3F; }
.sd-secret { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--sd-ink); color: #E3EAF2; padding: 10px 12px; border-radius: 8px; word-break: break-all; }

/* ---------- Le message de la carte (fiche d'une commande) ---------- */
.sd-card-message { font-family: Georgia, 'Times New Roman', serif; font-style: italic; font-size: 16px; line-height: 1.6; color: var(--sd-ink); border-left: 3px solid var(--sd-accent); padding: 4px 0 4px 16px; }
.sd-card-message footer { font-style: normal; font-size: 14px; color: var(--sd-muted); }
.sd-card-message footer::before { content: '— '; }

/*
 * Les images du catalogue (produits, rubriques, bannières), dans
 * les listes et sur les fiches : assez grandes pour reconnaître l'article,
 * entières (contain) sur un fond clair ; les photos à fond perdu (rubriques,
 * bannières) remplissent leur cadre (is-cover).
 */
.sd-pic { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; overflow: hidden; border-radius: 10px; background: #F2F4F7; border: 1px solid #EAECF0; }
.sd-pic img { width: 100%; height: 100%; object-fit: contain; }
.sd-pic.is-cover img { object-fit: cover; }
/* En rond, comme l'appli montre l'image d'une rubrique. */
.sd-pic.is-round { border-radius: 50%; }
.sd-pic > i { font-size: 28px; color: #98A2B3; }
.sd-pic-list { width: 96px; height: 96px; }
.sd-pic-row { width: 72px; height: 72px; }
.sd-pic-sheet { width: 240px; height: 240px; max-width: 100%; }
.sd-pic-logo { width: 160px; height: 96px; padding: 8px; }
.sd-pic-logo-lg { width: 300px; height: 170px; padding: 12px; max-width: 100%; }
.sd-pic-wide { width: 200px; height: 100px; }
.sd-pic-wide-lg { width: 420px; height: 210px; max-width: 100%; }

@media print {
  .header, .sidebar, .footer, .sd-no-print, .sidebar-overlay { display: none !important; }
  .page-wrapper { margin: 0 !important; padding: 0 !important; }
  .page-wrapper .content { padding: 0 !important; }
  .card { border: none !important; box-shadow: none !important; }
  body { background: #fff !important; }
}

/* Les cellules qui passent à la ligne (le gabarit garde tout sur une ligne : .table td { white-space: nowrap }). */
.table td.sd-wrap { white-space: normal; min-width: 220px; }
.table td.sd-wrap.sd-wrap-sm { min-width: 150px; }
/* Les listes de commandes : des colonnes plus serrées, pour que le montant et l'étape restent visibles. */
.table.sd-orders th, .table.sd-orders td { padding-left: 14px; padding-right: 14px; }
.table.sd-orders th:first-child, .table.sd-orders td:first-child { padding-left: 20px; }

/* Les bandeaux d'avertissement et d'information, lisibles (le gabarit écrit en jaune sur crème). */
.alert-warning { background-color: #FBF4E2; border-color: #F0DFB0; color: #6B4E00; }
.alert-warning .alert-link { color: #4D3800; }
.alert-info { background-color: #EEF2EE; border-color: #D5DFD3; color: #2F4A2B; }
.alert-info .alert-link { color: #231F20; }

/* Les titres à l'encre de la maison (le gabarit les écrit en bleu nuit, #202C4B). */
h1, .h1, h2, .h2, h3, .h3, h4, .h4, h5, .h5, h6, .h6 { color: var(--sd-ink); }

/* ---------- Les pages publiques (retour du paiement, pages légales : layouts/public) ---------- */
.sd-public { background: #F7F5F3; min-height: 100vh; }
.sd-public-head { background: #fff; border-bottom: 1px solid var(--sd-line); padding: 14px 20px; }
.sd-public-head img { height: 40px; width: auto; }
/* Le choix de la langue d'une page publique : des liens (?langue=…), comme les boutons de la connexion. */
.sd-lang-switch a { color: var(--sd-muted); font-size: 13px; font-weight: 500; line-height: 1.2; padding: 6px 16px; border-radius: 999px; text-decoration: none; transition: background .15s, color .15s; }
.sd-lang-switch a:hover { color: var(--sd-ink); }
.sd-lang-switch a[aria-current="true"] { background: var(--sd-primary); color: #FFF; box-shadow: 0 1px 2px rgba(0, 0, 0, .14); }
/* Les pages légales (règles de confidentialité, suppression de compte). */
.sd-legal { font-size: 15px; line-height: 1.6; color: var(--sd-ink); }
.sd-legal h2 { font-size: 1.1rem; font-weight: 600; margin: 1.75rem 0 .6rem; }
.sd-legal ul, .sd-legal ol { padding-left: 1.25rem; }
.sd-legal ul { list-style: disc; }
.sd-legal ol { list-style: decimal; }
.sd-legal a { color: var(--sd-accent); text-decoration: underline; text-underline-offset: 2px; }
.sd-legal a.btn { text-decoration: none; }
.sd-legal li { margin-bottom: .4rem; }
.sd-legal address { padding: .75rem 1rem; border-left: 3px solid var(--sd-accent); background: #F7F5F3; }
.sd-legal-contents { columns: 2; column-gap: 2rem; font-size: 14px; }
@media (max-width: 575px) { .sd-legal-contents { columns: 1; } }
