/* =============================================================================
 * Tamalou Orthopedie - Entete & mega-menu (front)
 * CSS pur & leger, zero Elementor. Les variables couleur --tml-* sont
 * definies ici par defaut et surchargees par le bloc :root que le plugin
 * injecte dans le <head> (issu de la config style). Meme selecteur (:root),
 * le bloc injecte est parse apres -> il gagne.
 * ========================================================================== */

:root {
  --tml-green:    #6bbd45;
  --tml-green-dk: #5aad34;
  --tml-accent:   #5ab031;
  --tml-pale:     #cfe9c7;
  --tml-panel:    #c9e7c1;
  --tml-navy:     #04092d;
  --tml-sep:      #a6c959;
  --tml-cart:     #69727d;
  --tml-badge:    #e24545;
  --tml-card:     rgba(255,255,255,.55);
  --tml-radius:   14px;
  --tml-maxw:     1440px;
  --tml-shadow:   0 22px 45px rgba(20,50,15,.18);
  --tml-f-body:   'Roboto', system-ui, -apple-system, sans-serif;
  --tml-f-menu:   'Jost', 'Roboto', system-ui, sans-serif;
}

.tml-topbar *, .tml-topbar *::before, .tml-topbar *::after,
.tml-header *, .tml-header *::before, .tml-header *::after,
.tml-drawer *, .tml-drawer *::before, .tml-drawer *::after,
.tml-cart-drawer *, .tml-cart-drawer *::before, .tml-cart-drawer *::after { box-sizing: border-box; }
.tml-topbar a, .tml-header a, .tml-drawer a, .tml-cart-drawer a { text-decoration: none; color: inherit; }
.tml-topbar img, .tml-header img, .tml-drawer img, .tml-cart-drawer img { max-width: 100%; display: block; }
body.tml-noscroll { overflow: hidden; }
/* Les tiroirs (mobile + panier) sont en position:fixed hors-champ a droite :
   on empeche tout scroll horizontal parasite. 'clip' n'etablit pas de conteneur
   de defilement -> n'affecte pas position:sticky ni le scroll vertical. */
html { overflow-x: clip; }

/* Conteneur du header : sert de contexte aux container queries. Les tiroirs
 * (mobile + panier) sont volontairement HORS de .tml-root pour rester en
 * position:fixed relative a la fenetre (container-type etablirait sinon un
 * nouveau bloc contenant qui casserait le fixed). */
.tml-root { container-type: inline-size; container-name: tmlroot; }

/* =========================================================================
 * BARRE HAUTE (verte)
 * ====================================================================== */
.tml-topbar { background: var(--tml-green); color: #fff; }
.tml-topbar__in {
  max-width: var(--tml-maxw);
  margin: 0 auto;
  min-height: 57px;
  padding: 8px 26px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 18px;
}
.tb-phone { display: flex; align-items: center; gap: 9px; font-size: 15px; font-weight: 500; }
.tb-phone svg { width: 20px; height: 20px; flex: none; }
.tb-phone a { color: #fff; }
.tb-delivery { text-align: center; font-size: 15px; font-weight: 500; white-space: nowrap; }

/* --- recherche --- */
.tb-search { position: relative; justify-self: end; display: flex; align-items: center; width: 100%; max-width: 430px; }
/* !important : le champ/bouton sont des <input>/<button> souvent restyles par le
   theme (bordure, fond, arrondi). On force l'apparence "pilule blanche + bouton
   rond vert" quel que soit le theme. */
.tb-search__field {
  width: 100%; height: 46px !important; margin: 0; box-sizing: border-box;
  border: 0 !important; border-radius: 999px !important; box-shadow: none !important;
  padding: 0 52px 0 22px; font-family: var(--tml-f-body); font-size: 15px;
  color: #222; background: #fff !important; outline: none !important;
  -webkit-appearance: none; appearance: none; line-height: normal;
}
.tb-search__field::placeholder { color: #8a8f98; opacity: 1; }
.tb-search__field::-webkit-search-cancel-button,
.tb-search__field::-webkit-search-decoration { -webkit-appearance: none; display: none; }
/* bouton rond, centre via top/bottom + margin:auto (robuste : ne depend pas de
   transform, que le theme peut ecraser). min/max-height forces contre le theme. */
.tb-search__btn {
  position: absolute; right: 4px; top: 0; bottom: 0; margin: auto 0; transform: none !important;
  width: 38px !important; height: 38px !important;
  min-width: 38px !important; min-height: 38px !important; max-height: 38px !important;
  padding: 0 !important; line-height: 0 !important;
  border: 0 !important; border-radius: 50% !important; box-shadow: none !important;
  background: var(--tml-green) !important; color: #fff !important;
  display: grid; place-items: center; cursor: pointer; transition: background .15s;
}
.tb-search__btn:hover { background: var(--tml-green-dk) !important; }
.tb-search__btn svg { width: 18px !important; height: 18px !important; }

/* --- resultats live --- */
.tb-search__results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: #fff; border-radius: 12px; box-shadow: 0 16px 40px rgba(0,0,0,.2);
  overflow-y: auto; max-height: min(70vh, 470px); display: none; z-index: 60;
}
.tb-search__results.show { display: block; }
.sr-section { padding: 4px 0 6px; }
.sr-section + .sr-section { border-top: 1px solid #eef1ea; }
.sr-head {
  padding: 9px 16px 5px; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--tml-accent);
}
.sr-item {
  display: flex; align-items: center; gap: 12px; padding: 8px 16px;
  color: var(--tml-navy); transition: background .12s;
}
.sr-item:hover { background: #f2f8ec; }
.sr-thumb {
  width: 42px; height: 42px; border-radius: 8px; overflow: hidden; flex: none;
  display: grid; place-items: center; background: #f2f4f0; color: var(--tml-accent);
  border: 1px solid #eef1ea;
}
.sr-thumb img { width: 100%; height: 100%; object-fit: cover; }
.sr-thumb svg { width: 20px; height: 20px; }
.sr-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.sr-title { font-size: 14px; font-weight: 600; color: var(--tml-navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-sub { font-size: 12px; color: #7a8189; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-search__results mark { background: #eaf6d8; color: inherit; padding: 0 1px; border-radius: 2px; }
.sr-empty { padding: 16px; font-size: 14px; color: #7a7f88; }

/* =========================================================================
 * BARRE PRINCIPALE (vert pale) : logo / nav / panier
 * ====================================================================== */
.tml-header { background: var(--tml-pale); position: relative; z-index: 50; }
.tml-header__in {
  max-width: var(--tml-maxw); margin: 0 auto; min-height: 78px;
  padding: 10px 22px; display: flex; align-items: center; gap: 14px;
}
.tml-logo img { height: 44px; width: auto; }

.tml-nav { flex: 1; display: flex; justify-content: center; min-width: 0; }
.tml-menu {
  list-style: none; margin: 0; padding: 0; display: flex; align-items: center;
  gap: 1px; flex-wrap: nowrap; justify-content: center;
}
.nav-item { position: relative; }
.nav-link {
  display: flex; align-items: center; gap: 3px; padding: 9px 7px;
  font-family: var(--tml-f-body); font-size: 14px; font-weight: 600;
  color: var(--tml-navy); white-space: nowrap; cursor: pointer; transition: color .15s;
}
.nav-link .chev { width: 15px; height: 15px; color: var(--tml-accent); transition: transform .2s; }
.nav-item:hover .nav-link, .nav-item.open .nav-link { color: var(--tml-accent); }
.nav-item:hover .nav-link .chev, .nav-item.open .nav-link .chev { transform: rotate(180deg); }

/* --- actions (panier + burger) --- */
.tml-actions { display: flex; align-items: center; gap: 14px; }
.tml-cart { position: relative; color: var(--tml-cart); display: inline-flex; }
.tml-cart svg { width: 27px; height: 27px; }
.tml-cart__badge {
  position: absolute; top: -7px; right: -9px; min-width: 18px; height: 18px;
  padding: 0 4px; border-radius: 20px; background: var(--tml-badge); color: #fff;
  font-size: 11px; font-weight: 700; display: grid; place-items: center; line-height: 1;
}
.tml-burger {
  display: none; align-items: center; gap: 8px; border: none; border-radius: 8px;
  background: var(--tml-green); cursor: pointer; padding: 9px 12px;
}
.tml-burger-lines { display: flex; flex-direction: column; justify-content: space-between; width: 24px; height: 18px; flex: none; }
.tml-burger-lines span { display: block; height: 3px; border-radius: 3px; background: #fff; }
.tml-burger-label { color: #fff; font-weight: 600; font-size: 14px; line-height: 1; white-space: nowrap; }
/* Burger avec image personnalisee (au lieu des 3 barres) */
.tml-burger--img { background: none; padding: 0; }
.tml-burger--img img { width: 40px; height: 40px; object-fit: contain; display: block; }
.tml-burger--img .tml-burger-label { color: var(--tml-navy); }

/* =========================================================================
 * MEGA-MENU (desktop)
 * ====================================================================== */
.mega {
  position: absolute; top: 100%; left: 0; margin-top: 0;
  background: var(--tml-panel); border-radius: 0 0 var(--tml-radius) var(--tml-radius);
  box-shadow: var(--tml-shadow); padding: 24px 26px 28px;
  opacity: 0; visibility: hidden; transform: translateY(8px);
  transition: opacity .18s ease, transform .18s ease, visibility .18s; z-index: 40;
}
.nav-item:nth-child(n+6) .mega { left: auto; right: 0; }
.mega--wide { left: 0; right: auto; transform: translateY(8px); width: min(1240px, calc(100vw - 40px)); }

@media (hover: hover) {
  .nav-item:hover > .mega { opacity: 1; visibility: visible; transform: translateY(0); }
}
.nav-item.open > .mega { opacity: 1; visibility: visible; transform: translateY(0); }

.mega-inner { display: flex; gap: 26px; align-items: flex-start; }
.mega-cols { flex: 1; }
.mega--wide .mega-cols { column-count: 3; column-gap: 30px; }
.mega:not(.mega--wide) .mega-cols { display: flex; flex-direction: column; gap: 20px; min-width: 300px; }

/* --- une section --- */
.msec { break-inside: avoid; margin-bottom: 22px; }
.mega:not(.mega--wide) .msec { margin-bottom: 0; }
.msec-head {
  display: flex; align-items: center; gap: 10px; background: var(--tml-card);
  border-radius: 10px; padding: 11px 15px; margin-bottom: 6px;
  font-family: var(--tml-f-menu); font-size: 15px; font-weight: 600; color: var(--tml-accent);
}
.msec-ic { display: inline-grid; place-items: center; color: var(--tml-accent); }
.msec-ic svg { width: 26px; height: 20px; }
.msec-ic img { width: 26px; height: 22px; object-fit: contain; }
.msec-links { display: flex; flex-direction: column; padding: 0 4px; }
.ml {
  display: block; padding: 12px 2px; font-family: var(--tml-f-menu);
  font-size: 17px; font-weight: 600; color: var(--tml-navy);
  border-bottom: .8px solid var(--tml-sep); transition: color .12s, padding-left .12s;
}
.ml:hover { color: var(--tml-accent); padding-left: 6px; }

/* --- accordeon Pathologies --- */
.patho { border-bottom: .8px solid var(--tml-sep); }
.patho-toggle {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 12px 2px; border: none; background: none; cursor: pointer;
  font-family: var(--tml-f-menu); font-size: 17px; font-weight: 600;
  color: var(--tml-accent); text-align: left;
}
.patho-toggle .chev { width: 16px; height: 16px; transition: transform .2s; }
.patho.open .patho-toggle .chev { transform: rotate(180deg); }
.patho-panel { display: none; grid-template-columns: 1fr 1fr; gap: 2px 18px; padding: 4px 2px 10px; }
.patho.open .patho-panel { display: grid; }
.patho-panel a { font-size: 13.5px; font-weight: 500; color: var(--tml-navy); padding: 5px 0; }
.patho-panel a:hover { color: var(--tml-accent); }

/* --- carte promo --- */
.mpromo { flex: none; width: 230px; }
.mpromo-head {
  display: flex; align-items: center; gap: 10px; background: var(--tml-card);
  border-radius: 10px; padding: 11px 15px; margin-bottom: 14px;
  font-family: var(--tml-f-menu); font-size: 15px; font-weight: 600; color: var(--tml-accent);
}
.mpromo-head .msec-ic svg { width: 26px; height: 20px; }
.promo-card {
  position: relative; display: block; background: #fff; border-radius: 12px;
  padding: 18px 16px 20px; box-shadow: 0 10px 26px rgba(20,50,15,.14);
  text-align: center; overflow: hidden;
}
.promo-badge {
  position: absolute; top: 14px; right: 0; background: var(--tml-green); color: #fff;
  font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: 7px 18px 7px 14px; border-radius: 4px 0 0 4px;
}
.promo-img { display: grid; place-items: center; height: 130px; margin: 10px 0 12px; }
.promo-img img { max-height: 130px; width: auto; object-fit: contain; }
.promo-title { display: block; font-family: var(--tml-f-menu); font-size: 17px; font-weight: 700; color: var(--tml-accent); }

/* =========================================================================
 * DRAWER MOBILE
 * ====================================================================== */
.tml-drawer-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); opacity: 0; visibility: hidden;
  transition: opacity .25s, visibility .25s; z-index: 90;
}
.tml-drawer-overlay.show { opacity: 1; visibility: visible; }
.tml-drawer {
  position: fixed; top: 0; right: 0; height: 100%; width: min(340px, 88vw);
  background: #fff !important; color: var(--tml-navy); transform: translateX(100%);
  transition: transform .28s ease; z-index: 100; display: flex; flex-direction: column;
  box-shadow: -12px 0 40px rgba(0,0,0,.25);
}
.tml-drawer.open { transform: translateX(0); }
.tml-drawer__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; background: var(--tml-pale) !important; flex: none;
}
.tml-drawer__head img { height: 34px; width: auto; }
.tml-drawer__close { border: none !important; background: none !important; color: var(--tml-navy) !important; font-size: 30px; line-height: 1; cursor: pointer; padding: 0; }
.tml-drawer__nav { overflow-y: auto; padding: 0 0 24px; background: #fff; flex: 1; }
.dr-item { border-bottom: 1px solid #eef1ea; }
/* En-tete d'onglet (Chaussures...) : clair, robuste contre le theme */
.dr-top {
  width: 100% !important; display: flex !important; align-items: center; justify-content: space-between;
  gap: 10px; padding: 15px 18px !important; border: 0 !important;
  background: #fff !important; color: var(--tml-navy) !important;
  font-family: var(--tml-f-menu); font-size: 16px; font-weight: 700; text-align: left; cursor: pointer;
}
.dr-top .chev { width: 16px; height: 16px; color: var(--tml-accent); flex: none; transition: transform .2s; }
.dr-item.open > .dr-top { background: var(--tml-pale) !important; }
.dr-item.open > .dr-top .chev { transform: rotate(180deg); }
.dr-sub { display: none; background: #f6f9f3; padding: 4px 0 8px; }
.dr-item.open > .dr-sub { display: block; }
/* En-tete de section avec icone / image */
.dr-sec {
  display: flex !important; align-items: center; gap: 10px; padding: 11px 18px 7px !important;
  font-family: var(--tml-f-menu); font-size: 14px; font-weight: 700; color: var(--tml-accent) !important;
  background: transparent !important;
}
.dr-sec-ic { width: 30px; height: 26px; display: grid; place-items: center; color: var(--tml-accent); flex: none; }
.dr-sec-ic svg { width: 26px; height: 22px; }
.dr-sec-ic img { max-width: 30px; max-height: 26px; object-fit: contain; border-radius: 5px; }
/* Liens de la section */
.dr-link {
  display: block !important; padding: 9px 18px 9px 48px !important; font-size: 14px;
  color: var(--tml-navy) !important; background: transparent !important;
}
.dr-link:hover { color: var(--tml-accent) !important; }

/* =========================================================================
 * TIROIR PANIER (coulissant, droite)
 * ====================================================================== */
.tml-cart-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); opacity: 0; visibility: hidden;
  transition: opacity .25s, visibility .25s; z-index: 95;
}
.tml-cart-overlay.show { opacity: 1; visibility: visible; }
.tml-cart-drawer {
  position: fixed; top: 0; right: 0; height: 100%; width: min(380px, 90vw);
  background: #fff; transform: translateX(100%); visibility: hidden;
  transition: transform .28s ease, visibility .28s;
  z-index: 105; display: flex; flex-direction: column; box-shadow: -12px 0 40px rgba(0,0,0,.3);
}
.tml-cart-drawer.open { transform: translateX(0); visibility: visible; }
.cd-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; background: var(--tml-pale);
}
.cd-head h3 { margin: 0; font-family: var(--tml-f-menu); font-size: 18px; color: var(--tml-navy); }
.cd-close { border: none; background: none; color: var(--tml-navy); font-size: 30px; line-height: 1; cursor: pointer; }
.cd-body { flex: 1; overflow-y: auto; padding: 14px 18px; }
.cd-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid #eef1ea; }
.cd-item img { width: 58px; height: 58px; object-fit: contain; border-radius: 8px; border: 1px solid #eef1ea; flex: none; }
.cd-item__info { display: flex; flex-direction: column; gap: 2px; }
.cd-item__info b { font-size: 14px; color: var(--tml-navy); }
.cd-item__info small { font-size: 12px; color: #7a8189; }
.cd-item__price { font-size: 14px; font-weight: 700; color: var(--tml-accent); }
.cd-empty { text-align: center; padding: 40px 10px; }
.cd-empty b { display: block; font-size: 16px; color: var(--tml-navy); margin-bottom: 6px; }
.cd-empty span { font-size: 13px; color: #7a8189; }
.cd-foot { border-top: 1px solid #eef1ea; padding: 16px 18px; }
.cd-total { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cd-total span { font-size: 14px; color: #6b7280; }
.cd-total b { font-size: 20px; font-family: var(--tml-f-menu); color: var(--tml-navy); }
.cd-btn { display: block; text-align: center; padding: 12px; border-radius: 9px; font-weight: 700; font-size: 14px; margin-bottom: 8px; }
.cd-btn--ghost { border: 1.5px solid var(--tml-sep); color: var(--tml-navy); }
.cd-btn--ghost:hover { border-color: var(--tml-accent); color: var(--tml-accent); }
.cd-btn--primary { background: var(--tml-green); color: #fff; }
.cd-btn--primary:hover { background: var(--tml-green-dk); }
.cd-reassure { text-align: center; font-size: 12px; color: #8a8f98; margin: 6px 0 0; }

/* =========================================================================
 * RESPONSIVE
 * Les regles @container (avec les breakpoints CHOISIS par l'utilisateur) sont
 * generees dynamiquement : cote front par TML_Settings::responsive_css() (injecte
 * dans le <head>), cote apercu admin par builder.js. Voir .tml-root plus haut.
 * ====================================================================== */
