/* iskamvariants — бутоните на комбинациите в стила на Medusa (option-select.tsx). */
.iv {
  --iv-brand: #e2001a;
  --iv-price: #e2001a;
  --iv-border: #d5dae0;
  --iv-grey-bg: #eceef1;
  --iv-grey: #9aa3ad;
  --iv-text: #212121;
  --iv-muted: #6b7785;
  --iv-x: #e0473e;
  --iv-tick: #1f9d55;
  --iv-radius: 8px;
  margin: 0 0 6px;
}
.iv-group { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
.iv-legend {
  display: block; width: auto; border: 0; padding: 0;
  margin: 0 0 10px; font-size: 14px; line-height: 1.4; font-weight: 400; color: var(--iv-text);
  text-transform: none;
}
/* Еднакви колони: стойност сама на последния ред запазва ширината си. */
/* --iv-ch: знаците на най-дългата стойност в групата (от шаблона) → бутонът е поне толкова широк, колкото
   текста + плика, но не по-тесен от 96px и не по-широк от 180px (по-дългите се пренасят на интервалите). */
.iv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, max(96px, min(180px, calc(var(--iv-ch, 0) * 0.6em + 36px)))), 1fr)); gap: 8px; }
.iv-group--swatch .iv-grid { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); }
.iv-cell { position: relative; min-width: 0; }
.iv-input { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); border: 0; opacity: 0; }
.iv-btn {
  position: relative; display: flex; align-items: center; justify-content: center; flex-direction: column;
  width: 100%; min-height: 40px; margin: 0; padding: 6px 8px; overflow: hidden;
  border: 1px solid var(--iv-border); border-radius: var(--iv-radius);
  background: #fff; color: var(--iv-text);
  font-size: 14px; font-weight: 400; line-height: 1.2; text-align: center; text-transform: none;
  cursor: pointer; user-select: none; transition: box-shadow .15s ease-in-out, border-color .15s ease-in-out;
}
.iv-btn:hover { border-color: var(--iv-grey); box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 0 0 1px rgba(0,0,0,.02); }
.iv-input:focus-visible + .iv-btn { outline: 2px solid var(--iv-brand); outline-offset: 2px; }
/* Избраната: по :checked — сменя се веднага при клик, без да чака отговора на сървъра. */
.iv-input:checked + .iv-btn, .iv-input:checked + .iv-btn:hover { border-color: var(--iv-brand); box-shadow: inset 0 0 0 1px var(--iv-brand); }
.iv-btn--out, .iv-btn--none { background: var(--iv-grey-bg); color: var(--iv-grey); }
.iv-btn--none { border-style: dashed; cursor: not-allowed; }
.iv-btn--none:hover { border-color: var(--iv-border); box-shadow: none; }
.iv-name { display: inline-flex; align-items: center; justify-content: center; max-width: 100%; overflow-wrap: break-word; }
.iv-env { flex: 0 0 auto; margin-right: 6px; }
/* Червен X през целия бутон. */
.iv-x { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.iv-x line { stroke: var(--iv-x); stroke-width: 1.4; }
/* Зелената отметка горе вдясно на избраната стойност. */
.iv-tick {
  position: absolute; top: -6px; right: -6px; z-index: 2;
  display: none; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--iv-tick); color: #fff; box-shadow: 0 0 0 2px #fff, 0 1px 2px rgba(0,0,0,.15);
  pointer-events: none;
}
.iv-input:checked ~ .iv-tick { display: flex; }
/* Докато PrestaShop зарежда новата комбинация: цените и „Изчерпан“ са бледи. */
.iv--loading { cursor: progress; }
.iv--loading .iv-price, .iv--loading .iv-oos { opacity: .4; transition: opacity .12s; }
/* Групите с картинка/цвят: картинката в бутона, името под нея. */
.iv-group--swatch .iv-btn { padding: 4px 4px 6px; gap: 4px; }
.iv-swatch { display: block; width: 100%; height: 56px; border-radius: 5px; background: #f5f5f5 center / cover no-repeat; }
.iv-group--swatch .iv-btn--out .iv-swatch, .iv-group--swatch .iv-btn--none .iv-swatch { opacity: .55; filter: grayscale(.4); }
.iv-group--swatch .iv-name { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; font-size: 12px; line-height: 1.25; }
/* Цената под бутона (редът остава и когато стойност няма цена). */
.iv-price { display: block; min-height: 18px; margin-top: 4px; text-align: center; font-size: 13px; font-weight: 600; line-height: 18px; color: var(--iv-price); }
.iv-price--out { color: var(--iv-grey); }
/* „… го няма в …. Има в: …“ */
.iv-missing { margin-top: 10px; padding: 8px 12px; border: 1px solid #f1c9c6; border-radius: var(--iv-radius); background: #fdf3f2; color: #5a2a26; font-size: 13px; }
.iv-missing[hidden] { display: none; }
.iv-missing .iv-alts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
.iv-pill {
  display: inline-block; margin: 0; padding: 2px 10px; border: 1px solid #cfd4da; border-radius: 999px;
  background: #fff; color: var(--iv-text); font-size: 13px; line-height: 1.5; cursor: pointer;
}
.iv-pill:hover { border-color: var(--iv-brand); }
.iv-pill--out { border-style: dashed; color: #8c959f; }
/* Изчерпана комбинация. */
.iv-oos { display: flex; flex-direction: column; gap: 6px; margin: 2px 0 12px; font-size: 14px; }
.iv-oos p { margin: 0; }
.iv-oos-word { color: var(--iv-price); }
.iv-oos-rest { color: var(--iv-muted); }
.iv-nearby { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: #444; font-size: 13px; }
.iv-notify {
  display: inline-flex; align-items: center; gap: 8px; width: fit-content; margin-top: 6px; padding: 10px 16px;
  border: 1px solid var(--iv-brand); border-radius: var(--iv-radius); background: #fff; color: var(--iv-brand);
  font-size: 15px; font-weight: 600; line-height: 1.2; cursor: pointer;
}
.iv-notify:hover { background: #fdf3f2; }
/* Наличността на PrestaShop над блока дублира „Изчерпан“. */
#add-to-cart-or-refresh:has(.iv--oos) #product-availability.product-unavailable { display: none; }

/* Прозорецът „Уведоми ме“. */
.iv-modal { position: fixed; inset: 0; z-index: 100000; display: flex; align-items: center; justify-content: center; padding: 12px; background: rgba(0,0,0,.6); }
.iv-dialog { width: 100%; max-width: 460px; max-height: calc(100vh - 24px); overflow: auto; border-radius: 10px; background: #fff; color: #212121; box-shadow: 0 20px 50px rgba(0,0,0,.3); font-size: 14px; }
.iv-dialog-head { display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; border-bottom: 1px solid #eee; }
.iv-dialog-head > div { flex: 1; min-width: 0; }
.iv-dialog-title { margin: 0; font-size: 16px; font-weight: 600; color: #212121; }
.iv-dialog-sub { margin: 2px 0 0; font-size: 13px; color: #555; }
.iv-close { flex: 0 0 auto; width: 36px; height: 36px; border: 0; border-radius: 50%; background: transparent; color: #555; font-size: 24px; line-height: 1; cursor: pointer; }
.iv-close:hover { background: #f2f2f2; }
.iv-form, .iv-done { display: flex; flex-direction: column; gap: 12px; padding: 16px; }
.iv-form label { display: flex; flex-direction: column; gap: 4px; margin: 0; font-weight: 400; }
.iv-form label span { font-size: 13px; color: #444; }
.iv-form input[type=email] { height: 42px; padding: 0 12px; border: 1px solid #cfd4da; border-radius: var(--iv-radius, 8px); font-size: 15px; outline: none; }
.iv-form input[type=email]:focus { border-color: #e2001a; }
.iv-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }
.iv-submit { display: flex; align-items: center; justify-content: center; gap: 8px; height: 46px; border: 0; border-radius: 8px; background: #e2001a; color: #fff; font-size: 16px; cursor: pointer; }
.iv-submit:hover { filter: brightness(.95); }
.iv-submit[disabled] { opacity: .6; cursor: default; }
.iv-error { margin: 0; color: #e2001a; }
.iv-privacy { margin: 0; font-size: 12px; line-height: 1.4; color: #6b7785; }
.iv-privacy a { text-decoration: underline; color: inherit; }
.iv-done p { margin: 0; }
.iv-done .iv-close-btn { align-self: flex-end; padding: 8px 16px; border: 1px solid #cfd4da; border-radius: 8px; background: #fff; cursor: pointer; }
body.iv-modal-open { overflow: hidden; }

@media (max-width: 575px) {
  /* На телефон без плика в бутона (сивото и X стигат) — по-тесни бутони, кратките размери са по 4 на ред. */
  .iv-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, max(72px, min(160px, calc(var(--iv-ch, 0) * 0.6em + 16px)))), 1fr)); gap: 8px 6px; }
  .iv-env { display: none; }
  .iv-btn { padding: 6px 4px; }
  .iv-notify { width: 100%; justify-content: center; }
  /* На телефон прозорецът е отдолу, на цялата ширина. */
  .iv-modal { align-items: flex-end; padding: 0; }
  .iv-dialog { max-width: none; border-radius: 14px 14px 0 0; max-height: 92vh; }
}
