/*
 * Smart Glasses Compare
 */
/* Poppins loaded via hookDisplayHeader */

/* Fallbacks — overridden by inline :root vars from BO config */
:root {
  --sgc-primary:      #0a0a0a;
  --sgc-secondary:    #555555;
  --sgc-accent:       #4C3CFF;
  --sgc-bg:           #ffffff;
  --sgc-text:         #1a1a1a;
  --sgc-border:       #a2a2a2;
  --sgc-muted:        #999999;
  --sgc-price-color:  #4C3CFF;
  --sgc-radius:       12px;
  --sgc-btn-radius:   999px;
  --sgc-img-height:   220px;
  --sgc-title-size:   3.2rem;
  --sgc-max-width:    1350px;
  --sgc-grad-start:   #000000;
  --sgc-grad-mid:     #4C3CFF;
  --sgc-grad-end:     #87A1FF;
}

#sgc-app *, #sgc-app *::before, #sgc-app *::after { box-sizing: border-box; }

#sgc-app {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color:      var(--sgc-text);
  background: var(--sgc-bg);
  max-width:  var(--sgc-max-width);
  margin:     0 auto;
  padding:    0 24px;
}

.sgc-hidden { display: none !important; }

/* ── Titre ───────────────────────────────────────────────── */
.sgc-header { text-align: center; padding: 64px 0 48px; }

.sgc-title {
  font-family: 'Poppins', sans-serif;
  font-size: clamp(2rem, 5vw, var(--sgc-title-size));
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--sgc-text);
  margin: 0 0 12px;
}

.sgc-subtitle {
  font-family: 'Poppins', sans-serif;
  font-size: 1.05rem;
  font-weight: 400;
  color: var(--sgc-secondary);
  margin: 0;
  line-height: 1.6;
}

/* ── Sélecteurs — sticky on scroll ───────────────────────── */
.sgc-selectors {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 50;
  background: #ffffff;
  transition: box-shadow 0.2s;
}

.sgc-selectors.sgc-selectors--stuck {
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

.sgc-select-col { display: flex; align-items: center; }
.sgc-select-wrapper { position: relative; width: 100%; }

.sgc-select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  background: #fff;
  border: 1.5px solid var(--sgc-border);
  border-radius: var(--sgc-radius);
  padding: 12px 44px 12px 20px;
  font-family: 'Poppins', sans-serif;
  font-size: 1rem;
  font-weight: 500;
  color: var(--sgc-text);
  cursor: pointer;
  transition: border-color 0.15s;
}

.sgc-select:focus { outline: none; border-color: var(--sgc-accent); }

.sgc-select-chevron {
  position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
  pointer-events: none; color: var(--sgc-text); display: flex;
}

.sgc-select option:disabled {
  color: var(--sgc-muted); font-style: italic; text-decoration: line-through;
}

/* ── Cartes produits ─────────────────────────────────────── */
.sgc-products {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  padding: 32px 0 64px;
}

.sgc-product-col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}

.sgc-product-image-wrap {
  width: 100%;
  height: var(--sgc-img-height);
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 18px;
}

.sgc-product-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.sgc-product-name {
  font-family: 'Poppins', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 8px;
  line-height: 1.3;
}

.sgc-product-desc {
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--sgc-secondary);
  line-height: 1.55;
  margin: 0 0 14px;
  min-height: 70px;
  white-space: pre-line !important;
}

.sgc-product-price { margin-bottom: 16px; }

.sgc-product-price-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--sgc-price-color);
}

.sgc-product-price-value {
  display: block;
  font-family: 'Poppins', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--sgc-text);
}

/* ── Bouton gradient ─────────────────────────────────────── */
.sgc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 13px 24px;
  border-radius: var(--sgc-btn-radius);
  font-family: 'Poppins', sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  border: none;
  color: #ffffff !important;
  background-image: linear-gradient(34deg, var(--sgc-grad-start) -10%, var(--sgc-grad-mid) 30%, var(--sgc-grad-end) 70%, var(--sgc-grad-mid) 90%, var(--sgc-grad-start) 120%);
  background-size: 300% 100%;
  background-position: 0% 50%;
  cursor: pointer;
  will-change: background-position;
  -webkit-transition: background-position 0.6s ease;
  transition: background-position 0.6s ease;
}

.sgc-btn:hover {
  background-position: 50% 20%;
  color: #ffffff !important;
}

.sgc-btn:active { background-position: 50% 50%; }

/* ── Bouton Ajouter au panier ────────────────────────────── */
.sgc-btn-cart {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 11px 20px;
  margin-top: 8px;
  border-radius: 999px;
  font-family: 'Poppins', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  border: 1.5px solid var(--sgc-accent);
  color: var(--sgc-accent);
  background: transparent;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.sgc-btn-cart:hover {
  background: var(--sgc-accent);
  color: #ffffff;
}

.sgc-btn-cart.sgc-btn-cart--done {
  border-color: #22c55e;
  color: #22c55e;
  pointer-events: none;
}

.sgc-btn-cart svg { flex-shrink: 0; }

/* ── Attributs produit ────────────────────────────────────── */
.sgc-product-attributes {
  margin-top: 16px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sgc-attr-group {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.sgc-attr-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--sgc-accent);
  white-space: nowrap;
  flex-shrink: 0;
}

.sgc-attr-label::after { content: ':'; }

.sgc-attr-values { display: inline; }

.sgc-attr-value {
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--sgc-secondary);
}

.sgc-attr-value + .sgc-attr-value::before { content: ', '; }

/* ── Caractéristiques ────────────────────────────────────── */
.sgc-specs { padding-bottom: 80px; background: #ffffff; }

.sgc-spec-group {
  border-top: 1px solid var(--sgc-border);
  padding-top: 28px;
  margin-bottom: 8px;
  background: #ffffff;
}

.sgc-spec-group-title {
  font-family: 'Poppins', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--sgc-text);
  margin: 0 0 16px;
}

.sgc-spec-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) repeat(3, 1fr);
  gap: 32px;
  padding: 14px 0;
  border-bottom: 1px solid #f0f0f0;
  background: #ffffff;
  align-items: center;
}

.sgc-spec-label {
  font-family: 'Poppins', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--sgc-text);
  line-height: 1.4;
}

.sgc-spec-row:last-child { border-bottom: none; }

.sgc-spec-row.sgc-spec-row--diff {
  background: #ffffff;
  margin: 0 -12px;
  padding: 14px 12px;
  border-radius: 6px;
  border-bottom-color: transparent;
}

.sgc-spec-cell { text-align: center; }

.sgc-spec-value {
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--sgc-text);
  line-height: 1.6;
}

.sgc-spec-value--empty { color: var(--sgc-muted); }

/* ── Transitions AJAX ────────────────────────────────────── */
#sgc-products-container,
#sgc-specs-container { transition: opacity 0.3s ease; }

.sgc-fadein { animation: sgcFadeIn 0.35s ease both; }

@keyframes sgcFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Boutons bas de page ─────────────────────────────────── */
.sgc-bottom-cta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  padding: 40px 0 64px;
  border-top: 1px solid var(--sgc-border);
  margin-top: 24px;
}

.sgc-bottom-cta-col { display: flex; justify-content: center; }

.sgc-bottom-cta .sgc-btn {
  max-width: 320px;
  font-size: 0.82rem;
  padding: 12px 20px;
}

/* ── État vide ───────────────────────────────────────────── */
.sgc-empty-state { text-align: center; padding: 80px 24px; }
.sgc-empty-text  { font-size: 1rem; color: var(--sgc-muted); margin: 0; }

/* ── Doublon ─────────────────────────────────────────────── */
.sgc-dup-warning {
  font-size: 0.78rem; color: #b91c1c; text-align: center;
  padding: 5px 8px; border: 1px solid #fecaca; border-radius: 6px;
  background: #fff5f5; opacity: 0; max-height: 0; overflow: hidden;
  transition: opacity 0.25s, max-height 0.25s; margin: 6px 0 0;
}
.sgc-dup-warning--visible { opacity: 1; max-height: 60px; }

/* ── Nav ─────────────────────────────────────────────────── */
.sgc-nav-item { list-style: none; }
.sgc-nav-link {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 0.88rem; font-weight: 500;
  color: inherit; text-decoration: none; padding: 3px 6px;
}
.sgc-nav-link:hover { opacity: 0.7; }

/* ══════════════════════════════════════════════════════════
   MOBILE — 2 colonnes côte à côte, 3ème masquée
   ══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  #sgc-app { padding: 0 12px; }
  .sgc-header { padding: 32px 0 24px; }
  .sgc-title  { font-size: 1.6rem; }

  /* Selectors: 2 visible, 3rd hidden */
  .sgc-selectors {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 12px 0;
  }
  .sgc-select-col:nth-child(n+3) { display: none; }
  .sgc-select { font-size: 0.82rem; padding: 10px 36px 10px 14px; border-radius: 10px; }

  /* Products: 2 columns */
  .sgc-products {
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding: 20px 0 40px;
  }
  .sgc-product-col:nth-child(n+3) { display: none; }

  .sgc-product-image-wrap { height: 140px; margin-bottom: 12px; }
  .sgc-product-name { font-size: 0.88rem; }
  .sgc-product-desc { font-size: 0.75rem; min-height: 54px; margin-bottom: 10px; }
  .sgc-product-price-label { font-size: 0.72rem; }
  .sgc-product-price-value { font-size: 1.05rem; }
  .sgc-product-price { margin-bottom: 10px; }
  .sgc-btn { padding: 10px 16px; font-size: 0.78rem; }
  .sgc-btn-cart { padding: 8px 14px; font-size: 0.75rem; }

  .sgc-product-attributes { gap: 4px; margin-top: 10px; }
  .sgc-attr-label { font-size: 0.6rem; }
  .sgc-attr-value { font-size: 0.68rem; }

  /* Specs: 2 columns */
  .sgc-spec-row {
    grid-template-columns: minmax(110px, 1fr) 1fr 1fr;
    gap: 12px;
  }
  .sgc-spec-row > .sgc-spec-cell:nth-child(n+4) { display: none; }
  .sgc-spec-label { font-size: 0.8rem; }
  .sgc-spec-group-title { font-size: 0.92rem; }
  .sgc-spec-value { font-size: 0.8rem; }

  /* Bottom CTA: 2 columns */
  .sgc-bottom-cta {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 24px 0 40px;
  }
  .sgc-bottom-cta-col:nth-child(n+3) { display: none; }
  .sgc-bottom-cta .sgc-btn { font-size: 0.72rem; padding: 10px 12px; }
}

@media (max-width: 380px) {
  .sgc-title { font-size: 1.3rem; }
  .sgc-product-image-wrap { height: 110px; }
}

@media print { .sgc-sticky-bar, .sgc-selectors { position: static; } }

/* ── 2 / 4 colonnes desktop ─────────────────────────────── */
[data-max-slots="2"] .sgc-selectors,
[data-max-slots="2"] .sgc-products,
[data-max-slots="2"] .sgc-bottom-cta { grid-template-columns: repeat(2, 1fr); }
[data-max-slots="2"] .sgc-spec-row { grid-template-columns: minmax(180px, 1.2fr) repeat(2, 1fr); }

[data-max-slots="4"] .sgc-selectors,
[data-max-slots="4"] .sgc-products,
[data-max-slots="4"] .sgc-bottom-cta { grid-template-columns: repeat(4, 1fr); }
[data-max-slots="4"] .sgc-spec-row { grid-template-columns: minmax(160px, 1fr) repeat(4, 1fr); }
