/* =============================================================================
   MAC — Recherche guidée V3 (2026-10-28)
   Modale de recherche « guidage simple » validée (maquette
   audits/2026-10-28-recherche/concept-3.html) : 3 portes d'entrée, champ
   unique SANS double cadre (les anciennes règles mac-search-form__* de
   mac-mineral-direct.css / mac-pulse02.css ne s'appliquent plus aux classes
   mac-sg-*), teintes en pastilles, produits en lignes.
   Jetons : --mac-* (mac-pulse02.css) avec valeurs de repli.
   ========================================================================== */
:root {
  --mac-sg-ink: var(--mac-ink, #0F172A);
  --mac-sg-paper: var(--mac-paper, #FAFAF8);
  --mac-sg-white: var(--mac-white, #FFFFFF);
  --mac-sg-muted: var(--mac-text-muted, #475569);
  --mac-sg-border: var(--mac-border, #D1D5DB);
  --mac-sg-line: #E5E7EB;
  --mac-sg-turq: var(--mac-turquoise, #00D1C1);
  --mac-sg-cobalt: var(--mac-cobalt, #2563FF);
  --mac-sg-check: #00897E;
  --mac-sg-title: var(--mac-font-title, "MAC Sora", Arial, sans-serif);
  --mac-sg-body: var(--mac-font-body, "MAC Manrope", Arial, sans-serif);
}

/* ── Voile et carte ───────────────────────────────────────────────────── */
.mac-sg-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(15, 23, 42, .45);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 7vh 20px 20px;
  opacity: 0;
  transition: opacity 200ms ease;
}
.mac-sg-overlay.is-open { opacity: 1; }
.mac-sg-overlay[hidden] { display: none; }

.mac-sg-modal {
  width: min(760px, 92%);
  max-height: 84vh;
  display: flex;
  flex-direction: column;
  background: #F6F7F9;
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(15, 23, 42, .35);
  overflow: hidden;
  transform: translateY(-8px);
  transition: transform 200ms ease;
}
.mac-sg-overlay.is-open .mac-sg-modal { transform: translateY(0); }

/* ── En-tête (bande blanche) ─────────────────────────────────────────── */
.mac-sg-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 22px 12px;
  background: var(--mac-sg-white);
  border-bottom: 1px solid var(--mac-sg-line);
}
.mac-sg-title { font: 700 19px var(--mac-sg-title); color: var(--mac-sg-ink); }
.mac-sg-close {
  margin-left: auto;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: var(--mac-sg-paper);
  color: var(--mac-sg-muted);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.mac-sg-close:hover { background: var(--mac-sg-line); color: var(--mac-sg-ink); }

/* ── Portes de guidage (cartes blanches sur fond doux) ────────────────── */
.mac-sg-doors {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 14px 22px 4px;
}
.mac-sg-door {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 13px 16px 12px;
  border: 1.5px solid var(--mac-sg-line);
  border-radius: 13px;
  background: var(--mac-sg-white);
  box-shadow: 0 2px 8px rgba(15, 23, 42, .05);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.mac-sg-door:hover { border-color: var(--mac-sg-turq); }
.mac-sg-door.is-on {
  border: 2px solid var(--mac-sg-ink);
  box-shadow: 0 6px 18px rgba(15, 23, 42, .12);
}
.mac-sg-door__ic {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--mac-sg-paper);
  color: var(--mac-sg-ink);
}
.mac-sg-door.is-on .mac-sg-door__ic {
  background: var(--mac-sg-ink);
  color: #fff;
}
.mac-sg-door b {
  display: flex;
  align-items: center;
  gap: 8px;
  font: 700 13.5px/1.3 var(--mac-sg-title);
  color: var(--mac-sg-ink);
}
.mac-sg-door__chk {
  display: none;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--mac-sg-check);
  color: #fff;
  place-items: center;
  font: 700 9px var(--mac-sg-body);
}
.mac-sg-door.is-on .mac-sg-door__chk { display: inline-grid; }
.mac-sg-door small {
  color: var(--mac-sg-muted);
  font: 400 11px/1.45 var(--mac-sg-body);
}

/* ── Champ unique (un seul cadre, celui-ci) ───────────────────────────── */
.mac-sg-form { padding: 12px 22px 4px; }
.mac-sg-field {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  border: 2px solid var(--mac-sg-ink);
  border-radius: 15px;
  background: var(--mac-sg-white);
  transition: box-shadow 150ms ease;
}
.mac-sg-field:focus-within { box-shadow: 0 0 0 4px rgba(0, 209, 193, .18); }
.mac-sg-field__glass { color: var(--mac-sg-muted); flex: 0 0 auto; }
/* Spécificité renforcée (0,2,0) : une règle générique du thème sur
   input[type="search"] redessinait une seconde bordure arrondie dans le champ
   (double cadre constaté le 2026-10-28) — bordure et rayon verrouillés ici. */
.mac-sg-field .mac-sg-field__input {
  flex: 1;
  min-width: 0;
  height: 52px;
  border: 0;
  border-radius: 0;
  outline: 0;
  background: transparent;
  box-shadow: none;
  -webkit-appearance: none;
  appearance: none;
  font: 600 17px var(--mac-sg-title);
  color: var(--mac-sg-ink);
}
.mac-sg-field .mac-sg-field__input:focus { outline: 0; box-shadow: none; }
.mac-sg-field .mac-sg-field__input::placeholder { color: #9AA3B2; font-weight: 500; }
.mac-sg-field .mac-sg-field__input::-webkit-search-cancel-button { display: none; }
.mac-sg-field__clear {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: var(--mac-sg-paper);
  color: var(--mac-sg-muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

/* ── Corps résultats ──────────────────────────────────────────────────── */
.mac-sg-body {
  flex: 1;
  min-height: 120px;
  overflow-y: auto;
  padding: 8px 16px 6px;
}
.mac-sg-group { margin-top: 10px; }
.mac-sg-group__h {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  padding: 0 6px;
  font: 700 10.5px var(--mac-sg-body);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--mac-sg-muted);
}
.mac-sg-group__h .mac-sg-count {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--mac-sg-paper);
  color: var(--mac-sg-ink);
  font-size: 10px;
}

/* Lignes produit / conseil */
.mac-sg-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  margin-bottom: 8px;
  border: 1px solid var(--mac-sg-line);
  border-radius: 12px;
  background: var(--mac-sg-white);
  cursor: pointer;
}
.mac-sg-row:hover, .mac-sg-row.is-active { border-color: var(--mac-sg-turq); background: #F1FCFA; }
.mac-sg-row.is-active { outline: 1.5px solid var(--mac-sg-turq); }
.mac-sg-row__thumb {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  border: 1px solid var(--mac-sg-line);
  object-fit: cover;
  flex: 0 0 auto;
  background: var(--mac-sg-paper);
}
.mac-sg-row__body { flex: 1; min-width: 0; }
.mac-sg-row__title {
  display: block;
  font: 600 14px/1.35 var(--mac-sg-body);
  color: var(--mac-sg-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mac-sg-row__sub {
  display: block;
  margin-top: 1px;
  color: var(--mac-sg-muted);
  font-size: 11.5px;
}
.mac-sg-row__price {
  margin-left: auto;
  white-space: nowrap;
  font: 700 14px var(--mac-sg-title);
  color: var(--mac-sg-ink);
}

/* Grille de teintes */
.mac-sg-swatches {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.mac-sg-swatch {
  border: 1px solid var(--mac-sg-border);
  border-radius: 11px;
  background: var(--mac-sg-white);
  padding: 7px;
  cursor: pointer;
  text-align: left;
}
.mac-sg-swatch:hover, .mac-sg-swatch.is-active {
  border-color: var(--mac-sg-turq);
  background: #F1FCFA;
}
.mac-sg-swatch.is-active { outline: 1.5px solid var(--mac-sg-turq); }
.mac-sg-swatch__sw {
  display: block;
  height: 34px;
  border-radius: 8px;
  border: 1px solid rgba(15, 23, 42, .12);
}
.mac-sg-swatch__title {
  display: block;
  margin-top: 5px;
  font: 700 11px var(--mac-sg-body);
  color: var(--mac-sg-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mac-sg-swatch__sub {
  display: block;
  font-size: 10px;
  color: var(--mac-sg-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── États : attente, vide, chargement ────────────────────────────────── */
.mac-search-idle__hint,
.mac-sg-hint { color: var(--mac-sg-muted); }
.mac-search-idle {
  padding: 26px 12px 30px;
  text-align: center;
}
.mac-search-idle__hint { margin: 0; font-size: 13.5px; }
.mac-search-loading {
  display: flex;
  justify-content: center;
  gap: 7px;
  padding: 34px 0;
}
.mac-search-loading span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--mac-sg-turq);
  animation: mac-sg-bounce 900ms infinite ease-in-out;
}
.mac-search-loading span:nth-child(2) { animation-delay: 120ms; }
.mac-search-loading span:nth-child(3) { animation-delay: 240ms; }
@keyframes mac-sg-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: .5; }
  40% { transform: translateY(-6px); opacity: 1; }
}
.mac-search-empty { padding: 22px 12px 26px; text-align: center; }
.mac-search-empty__title { margin: 0 0 6px; font: 700 15px var(--mac-sg-title); color: var(--mac-sg-ink); }
.mac-search-empty__hint { margin: 0 0 12px; font-size: 13px; color: var(--mac-sg-muted); }
.mac-search-empty__links { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.mac-search-empty__link {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 15px;
  border: 1px solid var(--mac-sg-border);
  border-radius: 999px;
  background: var(--mac-sg-white);
  color: var(--mac-sg-cobalt);
  font: 600 12.5px var(--mac-sg-body);
  text-decoration: none;
}
.mac-search-empty__link:hover { border-color: var(--mac-sg-cobalt); }

/* ── Pied de raccourcis ───────────────────────────────────────────────── */
.mac-sg-hint {
  margin: 0;
  padding: 10px 22px 14px;
  border-top: 1px solid var(--mac-sg-line);
  text-align: center;
  font-size: 11.5px;
}
.mac-sg-hint kbd {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border: 1px solid var(--mac-sg-border);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--mac-sg-paper);
  font: 700 10.5px var(--mac-sg-body);
  color: var(--mac-sg-muted);
}

/* ── GSM : plein écran, champ collant, portes défilantes ──────────────── */
@media (max-width: 640px) {
  .mac-sg-overlay { padding: 0; }
  .mac-sg-modal {
    width: 100%;
    height: 100%;
    max-height: none;
    border-radius: 0;
    transform: none;
  }
  .mac-sg-head { padding: 14px 16px 4px; }
  .mac-sg-title { font-size: 17px; }
  .mac-sg-doors {
    padding: 8px 16px 2px;
    flex-wrap: nowrap;
    overflow-x: auto;
  }
  .mac-sg-form { padding: 10px 16px 4px; }
  .mac-sg-field__input { height: 48px; font-size: 15px; }
  .mac-sg-body { padding: 8px 12px 6px; }
  .mac-sg-swatches { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mac-sg-hint { display: none; }
}
