/* Pièces Auto v2.0 — fitment surfaces (v2.1 accordion block at bottom) */

.tml-fit-badge {
  display: inline-block;
  margin: 8px 0;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
}
.tml-fit-badge.tml-fit-ok { background: #dcfce7; color: #166534; border: 1px solid #16a34a; }
.tml-fit-badge.tml-fit-ko { background: #fee2e2; color: #991b1b; border: 1px solid #dc2626; }

.tml-fit-banner {
  background: #f5f7fa;
  border: 1px solid #dde3f0;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 13px;
}
.tml-fit-banner[data-state="no-vehicle"] { background: #fff7ed; border-color: #fdba74; }
.tml-fit-banner .tml-fit-toggle {
  display: flex; align-items: center; gap: 10px; cursor: pointer; margin: 0;
}
.tml-fit-banner .tml-fit-toggle input[type=checkbox] { transform: scale(1.1); margin: 0; }
.tml-fit-banner .tml-fit-link { color: #2563eb; text-decoration: none; font-weight: 600; }
.tml-fit-banner .tml-fit-link:hover { text-decoration: underline; }

/* v2.3.3 — garage-switch dropdown */
.tml-fit-banner[data-state="garage"] {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
}
.tml-fit-banner .tml-fit-label { font-weight: 600; color: #334155; }
.tml-fit-banner .tml-fit-select {
  padding: 6px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  background: #fff;
  font: inherit;
  min-width: 200px;
  cursor: pointer;
}
.tml-fit-banner .tml-fit-select:focus { border-color: #ff9a16; outline: none; }
.tml-fit-banner .tml-fit-link-small { font-size: 12px; font-weight: 500; margin-left: auto; }

.tml-fit-picker select,
.tml-fit-picker .button { width: 100%; }
.tml-fit-picker .tml-fit-save { margin-top: 4px; }

@media (max-width: 640px) {
  .tml-fit-picker > div[style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
}

/* ────────────────────────────────────────────────────────────────────────────
 * Pièces Auto — v2.1 product-page details accordion
 * Targets the <section class="tml-pdet"> emitted by TML_Fitment::render_product_details().
 * Visual conventions:
 *   - border-radius 5px : match Flatsome global button radius
 *   - #ff9a16            : Tomobile brand accent (open-state border + OE brand label)
 * ──────────────────────────────────────────────────────────────────────────── */
.tml-pdet {
  margin: 1rem 0;
  font-size: 0.92em;
}
.tml-pdet-block {
  border: 1px solid #e0e0e0;
  border-radius: 5px;
  margin-bottom: 0.5rem;
  background: #fff;
}
.tml-pdet-block summary {
  padding: 0.55rem 0.9rem;
  cursor: pointer;
  font-weight: 600;
  color: #333;
  list-style: none;
  border-radius: 5px;
}
.tml-pdet-block summary::-webkit-details-marker { display: none; }
.tml-pdet-block summary::after {
  content: "\25BE";
  float: right;
  transition: transform 0.15s ease;
}
.tml-pdet-block[open] summary::after { transform: rotate(180deg); }
.tml-pdet-block[open] { border-color: #ff9a16; }
.tml-pdet-specs {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 0.5rem;
}
.tml-pdet-specs th,
.tml-pdet-specs td {
  padding: 0.3rem 0.9rem;
  border-bottom: 1px solid #f0f0f0;
  text-align: left;
}
.tml-pdet-specs th {
  font-weight: 400;
  color: #666;
  width: 45%;
}
.tml-pdet-specs td { font-weight: 600; }
.tml-pdet-specs tr:last-child th,
.tml-pdet-specs tr:last-child td { border-bottom: 0; }
.tml-pdet-specs code {
  font-family: ui-monospace, monospace;
  font-size: 0.9em;
  color: #555;
}
.tml-pdet-oe {
  margin: 0 0 0.5rem;
  padding: 0.4rem 1.6rem;
  list-style: none;
  columns: 2;
  column-gap: 1.5rem;
}
.tml-pdet-oe li {
  padding: 0.15rem 0;
  font-size: 0.86em;
  break-inside: avoid;
}
.tml-pdet-oe li b {
  color: #ff9a16;
  font-weight: 600;
  margin-right: 0.3rem;
}
.tml-pdet-more {
  margin: 0;
  padding: 0.2rem 0.9rem 0.6rem;
  color: #888;
  font-size: 0.85em;
  font-style: italic;
}
@media (max-width: 600px) {
  .tml-pdet-oe { columns: 1; }
}

/* ────────────────────────────────────────────────────────────────────────────
 * Phase 3.0 — Reusable vehicle picker widget (.tml-vp-*)
 * Used by the rewritten /ajouter-vehicule template and (from 3.1+) by
 * homepage/shop/sidebar widgets via TmlVehiclePicker.mount().
 * ──────────────────────────────────────────────────────────────────────────── */
.tml-vp-card {
  background: #f5f7fa;
  border: 1px solid #dde3f0;
  border-radius: 8px;
  padding: 14px;
  margin: 0 0 18px;
}
.tml-vp-card-warn {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.4);
  color: #92400e;
  font-size: 13px;
}
.tml-vp-card-title {
  font-weight: 600;
  margin-bottom: 10px;
}
.tml-vp-help {
  font-size: 12px;
  color: #64748b;
  margin: 8px 0 0;
}

/* Picker row (cascade selects). Stacked = horizontal 3-col by default. */
.tml-vp-row {
  display: grid;
  gap: 8px;
}
.tml-vp-row.tml-vp-stacked {
  grid-template-columns: 1fr 1fr 1fr;
}
.tml-vp-row.tml-vp-compact {
  grid-template-columns: 1fr;
}
@media (max-width: 640px) {
  .tml-vp-row.tml-vp-stacked { grid-template-columns: 1fr; }
}
.tml-vp select {
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  background: #fff;
  font: inherit;
}
.tml-vp-status {
  margin-top: 8px;
  font-size: 13px;
  color: #16a34a;
  min-height: 18px;
}
.tml-vp-status.tml-vp-ok::before { content: "\2713 "; }

/* Fallback panel (free-text manual entry, behind opt-in) */
.tml-vp-fallback-row {
  margin: 4px 0 12px;
}
.tml-vp-fallback-toggle {
  font-size: 12px;
  color: #f59e0b;
  text-decoration: underline;
  cursor: pointer;
}
.tml-vp-fallback-toggle:hover { color: #b45309; }
.tml-vp-fallback-panel {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 6px;
  padding: 12px;
  margin: 0 0 14px;
}
.tml-vp-fallback-warn {
  font-size: 12px;
  color: #92400e;
  margin-bottom: 10px;
  line-height: 1.5;
}
.tml-vp-fallback-confirm {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
}
.tml-vp-fallback-confirm input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

/* v2.2.7 — Disable button on the empty-results shop banner */
.tml-fit-clear {
  background: rgba(239, 68, 68, 0.12);
  color: #b91c1c;
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 4px 10px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.tml-fit-clear:hover { background: rgba(239, 68, 68, 0.18); }

/* v2.2.8 — VIN decoder card on /ajouter-vehicule */
.tml-vp-vin-card {
  background: #fff7e6;
  border: 1px solid #f5d99a;
  border-radius: 8px;
  padding: 14px;
  margin: 0 0 14px;
}
.tml-vp-vin-title {
  font-weight: 600;
  margin-bottom: 8px;
}
.tml-vp-vin-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.tml-vp-vin-row input {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  font: inherit;
  font-family: ui-monospace, monospace;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.tml-vp-vin-row input:focus { border-color: #ff9a16; outline: none; }
.tml-vp-vin-row button { white-space: nowrap; }
.tml-vp-vin-help {
  font-size: 11px;
  color: #92400e;
  margin-top: 6px;
}
.tml-vp-vin-status {
  margin-top: 10px;
  font-size: 13px;
  min-height: 18px;
  line-height: 1.4;
}
.tml-vp-vin-status.tml-vp-vin-ok      { color: #16a34a; }
.tml-vp-vin-status.tml-vp-vin-warn    { color: #b45309; }
.tml-vp-vin-status.tml-vp-vin-error   { color: #b91c1c; }
.tml-vp-vin-status.tml-vp-vin-loading { color: #64748b; font-style: italic; }



/* ─────────────────────────────────────────────────────────────────────
   v2.4.0 — Pièces Auto Finder widget ([tml_pieces_auto_finder])
   ───────────────────────────────────────────────────────────────────── */
.tml-finder {
  background: #fff;
  border-radius: 14px;
  padding: 32px 36px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
  color: #1a1a1a;
  margin: 0 auto 24px;
  max-width: 1100px;
}
.tml-finder-title {
  font-size: 26px; font-weight: 800; margin: 0 0 4px;
  letter-spacing: -0.5px;
}
.tml-finder-subtitle { color: #6b6b6b; margin: 0 0 24px; font-size: 15px; }

/* picker container — TmlVehiclePicker.mount renders its own .tml-vp-row inside */
.tml-finder-picker { margin-bottom: 18px; }
.tml-finder .tml-vp-row.tml-vp-stacked {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}
.tml-finder .tml-vp-row select {
  height: 52px;
  border: 1.5px solid #e5e5e5;
  border-radius: 10px;
  padding: 0 16px;
  font-size: 15px;
  background: #fff;
  color: #1a1a1a;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.tml-finder .tml-vp-row select:hover:not(:disabled) { border-color: #ff9a16; }
.tml-finder .tml-vp-row select:focus {
  outline: none; border-color: #ff9a16;
  box-shadow: 0 0 0 3px rgba(255,154,22,0.15);
}
.tml-finder .tml-vp-row select:disabled { background: #f7f7f7; color: #aaa; }
.tml-finder .tml-vp-status { display: none; }

/* vehicle bar */
.tml-finder-vehicle-bar {
  display: flex; align-items: center; gap: 12px;
  background: #fff8ec;
  border: 1px solid #ffd99a;
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 28px;
}
.tml-finder-check {
  width: 28px; height: 28px; border-radius: 50%;
  background: #2ea06a; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; flex-shrink: 0;
}
.tml-finder-vehicle-label { font-weight: 600; font-size: 16px; flex: 1; }
.tml-finder-edit {
  color: #e88500; font-weight: 600; font-size: 14px;
  text-decoration: underline; cursor: pointer;
}
/* v2.6.0 — when a vehicle is active the always-mounted cascade is hidden; the
   bar's "Choisir un autre véhicule" / garage "Autre véhicule…" reveals it. */
.tml-finder-has-vehicle .tml-finder-picker { display: none; }
.tml-finder-has-vehicle.tml-finder-reselecting .tml-finder-picker { display: block; }
.tml-finder-garage-select {
  border: 1px solid #e0c9a0; border-radius: 8px; background: #fff;
  padding: 6px 10px; font-size: 14px; color: #333; cursor: pointer;
  max-width: 230px;
}
.tml-finder-remove {
  color: #9a3b3b; font-weight: 600; font-size: 13px;
  text-decoration: underline; cursor: pointer;
}

/* no-vehicle hint */
.tml-finder-no-vehicle {
  display: flex; align-items: center; gap: 10px;
  color: #6b6b6b; font-size: 14px;
  margin-bottom: 22px; padding: 12px 14px;
  background: #f5f6f8; border-radius: 10px;
}
.tml-finder-no-vehicle::before { content: "↑"; font-weight: 700; color: #ff9a16; }

/* grid section title */
.tml-finder-grid-title {
  font-size: 12px; font-weight: 700; letter-spacing: 1.2px;
  color: #6b6b6b; text-transform: uppercase;
  margin: 8px 0 16px;
}

/* the grid + tiles */
.tml-finder-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.tml-finder-tile {
  background: #fff;
  border: 1.5px solid #e5e5e5;
  border-radius: 12px;
  padding: 22px 12px 16px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
  text-decoration: none;
  color: #1a1a1a;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.tml-finder-tile:hover {
  border-color: #ff9a16;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(255,154,22,0.18);
}
.tml-finder-icon-wrap {
  width: 56px; height: 56px;
  background: #fff8ec;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: #e88500;
  transition: background 0.15s, color 0.15s;
}
.tml-finder-tile:hover .tml-finder-icon-wrap { background: #ff9a16; color: #fff; }
.tml-finder-icon-wrap svg { width: 32px; height: 32px; }
.tml-finder-name { font-size: 13px; font-weight: 600; line-height: 1.2; color: #1a1a1a; }

/* no-vehicle: dim the tiles, JS handler intercepts clicks */
.tml-finder-grid.locked .tml-finder-tile { opacity: 0.45; }
.tml-finder-grid.locked .tml-finder-tile:hover {
  transform: none; box-shadow: none; border-color: #e5e5e5;
}
.tml-finder-grid.locked .tml-finder-tile .tml-finder-icon-wrap {
  background: #f0f0f0; color: #6b6b6b;
}

/* fallback for misconfigured ERP */
.tml-finder-warn {
  background: #fee2e2; color: #991b1b; border: 1px solid #dc2626;
  border-radius: 10px; padding: 14px 18px;
}

/* tablet */
@media (max-width: 900px) {
  .tml-finder-grid { grid-template-columns: repeat(3, 1fr); }
}

/* mobile */
/* v2.5.1 — tighter finder on mobile so the picker + icons take less of the
   first screen and results surface sooner. Icons stay visible (2-col). */
@media (max-width: 720px) {
  .tml-finder { padding: 16px 14px; border-radius: 10px; }
  .tml-finder-title { font-size: 18px; margin-bottom: 2px; }
  .tml-finder-subtitle { font-size: 13px; margin-bottom: 14px; }
  .tml-finder-picker { margin-bottom: 12px; }
  .tml-finder .tml-vp-row.tml-vp-stacked { grid-template-columns: 1fr; gap: 8px; }
  .tml-finder .tml-vp-row select { height: 46px; }
  .tml-finder-vehicle-bar { padding: 10px 12px; margin-bottom: 16px; }
  .tml-finder-no-vehicle { padding: 10px 12px; margin-bottom: 14px; }
  .tml-finder-grid-title { margin: 4px 0 10px; }
  .tml-finder-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .tml-finder-tile { padding: 14px 8px 12px; gap: 8px; }
  .tml-finder-icon-wrap { width: 42px; height: 42px; }
  .tml-finder-icon-wrap svg { width: 24px; height: 24px; }
}

/* v2.5.1 — hide the WooCommerce catalog toolbar on mobile for fitment pages
   (.tml-fit-page is added by TML_SEO::add_body_class). Selectors confirmed
   against the live Flatsome markup; its filter button uses .show-for-medium
   (≤849px). Desktop keeps every control. The result count already carries
   Flatsome's .hide-for-medium, so the theme hides it on mobile already. */
@media (max-width: 849px) {
  .tml-fit-page .woocommerce-breadcrumb,
  .tml-fit-page .category-filtering,
  .tml-fit-page .woocommerce-ordering { display: none !important; }
  /* v2.7.5 — every child of Flatsome's shop title bar is hidden above on mobile
     fitment pages, leaving a tall empty band over the finder. Collapse the now-
     empty container itself. The finder renders via woocommerce_before_shop_loop
     (a sibling BELOW this bar), so hiding it never touches the finder. Desktop
     (>849px) keeps the full title bar + breadcrumb + sort. */
  .tml-fit-page .shop-page-title { display: none !important; }
}

/* ─────────────────────────────────────────────────────────────────────
   v2.7.2 — compact "3A" finder redesign (mobile-first, less empty space)
   ───────────────────────────────────────────────────────────────────── */
.tml-finder { padding: 18px 20px; margin-bottom: 18px; }
.tml-finder-title { font-size: 20px; margin-bottom: 2px; }
.tml-finder-subtitle { font-size: 13.5px; margin-bottom: 14px; }
.tml-finder-picker { margin-bottom: 12px; }
.tml-finder .tml-vp-row select { height: 48px; font-size: 14px; }
.tml-finder-grid-title { font-size: 13px; font-weight: 800; text-transform: none; margin: 8px 0 10px; }

/* Vehicle bar → compact green "chip" (Design 3 result state) */
.tml-finder-vehicle-bar {
  background: #eafaf0; border: 1px solid #bfe9cf; border-radius: 12px;
  padding: 9px 12px; gap: 9px; margin-bottom: 14px;
}
.tml-finder-check { color: #1aa251; font-weight: 700; }
.tml-finder-vehicle-label { font-size: 14px; font-weight: 700; color: #0f6b34; }
.tml-finder-garage-select { max-width: 160px; padding: 6px 9px; }
.tml-finder-remove { white-space: nowrap; }

@media (max-width: 849px) {
  .tml-finder { padding: 13px 12px; border-radius: 12px; margin-bottom: 14px; }
  .tml-finder-title { font-size: 17px; }
  .tml-finder-subtitle { font-size: 12.5px; margin-bottom: 10px; }
  .tml-finder-picker { margin-bottom: 10px; }
  .tml-finder .tml-vp-row select { height: 46px; }
  .tml-finder-vehicle-bar { flex-wrap: wrap; padding: 9px 11px; }
  .tml-finder-vehicle-label { flex: 1 1 100%; }
  .tml-finder-garage-select { flex: 1; max-width: none; }
  /* Categories scroll horizontally — almost no vertical footprint */
  .tml-finder-grid {
    display: flex !important; grid-template-columns: none !important;
    gap: 9px; overflow-x: auto; -webkit-overflow-scrolling: touch;
    padding-bottom: 6px; margin: 0 -2px; scroll-snap-type: x proximity;
  }
  .tml-finder-grid .tml-finder-tile {
    min-width: 92px; flex: 0 0 auto; padding: 12px 6px; scroll-snap-align: start;
  }
  .tml-finder-grid.locked { opacity: 1; }
}
/* v2.7.3 — finder auto-rendered at the top of a category archive: no top gap */
.tml-finder-archive { margin-top: 0; }

/* v2.6 — car-part brand logo above the product title (single product page) */
.tml-brand { margin: 0 0 8px; }
.tml-brand-logo {
  max-height: 42px; max-width: 170px; width: auto; height: auto; display: block;
}
.tml-brand-name {
  font-size: 13px; font-weight: 700; color: #555;
  text-transform: uppercase; letter-spacing: .03em;
}
