/* Product page: alert inside variant dropdown; gallery strip kept */

/* First row in open dropdown — matches trigger placeholder */
.tvs__list-hint {
  margin: 0;
  padding: 0;
  list-style: none;
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
}

.tvs__list-hint__row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 10px 12px;
  box-sizing: border-box;
  background: #fff;
  pointer-events: none;
  user-select: none;
}

.tvs__list-hint__row .tvs__name.is-placeholder {
  color: #dc2626;
  font-weight: 650;
  font-size: 0.875rem;
}

/* Legacy alert — hidden on product page (engine keeps #variantAlert in DOM) */
#variantAlert {
  display: none !important;
}

.gallery-strip__label {
  word-break: break-word;
  hyphens: auto;
}

/* Hide legacy variant cards; JS keeps them for product-engine */
.product-variants .variant-options {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  border: 0 !important;
  white-space: nowrap !important;
  pointer-events: none;
}

.variant-options.variant-options--proxy {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  border: 0 !important;
  white-space: nowrap !important;
  pointer-events: none;
}

/* Orphan fragment guard */
.product-info > .variant-alert-text {
  display: none !important;
}

.variant-group {
  position: relative;
}

/* —— Variant select —— */
.tvs {
  --tvs-accent: #2f6fdb;
  --tvs-accent-soft: #eef4ff;
  --tvs-border: #cfd8e3;
  --tvs-border-strong: #9eb0c4;
  --tvs-text: #1e293b;
  --tvs-muted: #64748b;
  --tvs-oos: #b45309;
  --tvs-oos-bg: #fff7ed;
  --tvs-radius: 10px;
  position: relative;
  width: 100%;
  max-width: 100%;
  margin-top: 0.2rem;
  font-size: 0.875rem;
  z-index: 30;
}

.tvs__trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 8px 14px 8px 8px;
  box-sizing: border-box;
  border: 1px solid var(--tvs-border);
  border-radius: var(--tvs-radius);
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  color: var(--tvs-text);
  text-align: left;
  cursor: pointer;
  font: inherit;
  line-height: 1.3;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease;
}

.tvs__trigger:not(.has-value) {
  background: #fff;
  border-color: #d1d5db;
  box-shadow: none;
}

.tvs__trigger:not(.has-value) .tvs__thumb--pick {
  border-color: #e5e7eb;
  background: #fff;
}

.tvs__trigger:not(.has-value) .tvs__name.is-placeholder {
  color: #dc2626;
  font-weight: 650;
}

.tvs__trigger:not(.has-value):hover,
.tvs.is-open .tvs__trigger:not(.has-value) {
  border-color: #cbd5e1;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.tvs__trigger.has-value:hover,
.tvs.is-open .tvs__trigger.has-value {
  border-color: var(--tvs-border-strong);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.08);
}

.tvs__trigger:focus {
  outline: none;
  border-color: var(--tvs-accent);
  box-shadow: 0 0 0 3px rgba(47, 111, 219, 0.18);
}

.tvs__trigger.has-value {
  background: #fff;
}

.tvs__trigger.is-oos {
  background: var(--tvs-oos-bg);
  border-color: #fdba74;
}

.tvs__trigger-main {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.tvs__chevron {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  margin-left: 4px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1.5 1.75L6 6.25L10.5 1.75' stroke='%23475569' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    center / 12px 8px no-repeat;
  transition: transform 0.18s ease;
  opacity: 0.85;
}

.tvs.is-open .tvs__chevron {
  transform: rotate(180deg);
}

.tvs__thumb {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f1f5f9;
  overflow: hidden;
  display: block;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6);
}

.tvs__thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.tvs__thumb--pick {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border-color: #e5e7eb;
}

.tvs__thumb--pick img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  padding: 3px;
  box-sizing: border-box;
}

.tvs__thumb--empty {
  background: repeating-linear-gradient(
    -45deg,
    #f8fafc,
    #f8fafc 5px,
    #eef2f7 5px,
    #eef2f7 10px
  );
}

.tvs__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tvs__name {
  color: var(--tvs-text);
  font-weight: 600;
  font-size: 0.8125rem;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tvs__trigger .tvs__name {
  white-space: nowrap;
}

.tvs__name.is-placeholder {
  color: var(--tvs-muted);
  font-weight: 500;
}

.tvs__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
}

.tvs__meta--compact {
  gap: 8px;
}

.tvs__price {
  color: var(--tvs-accent);
  font-weight: 700;
  font-size: 0.875rem;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.tvs__unit {
  color: #64748b;
  font-weight: 500;
  font-size: 0.75rem;
}

.tvs__stock {
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}

.tvs__stock.is-ok {
  color: #15803d;
}

.tvs__stock.is-oos {
  color: var(--tvs-oos);
}

.tvs__list {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  max-height: 320px;
  overflow-y: auto;
  overflow-x: hidden;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: #fff;
  border: 1px solid var(--tvs-border);
  border-radius: 12px;
  box-shadow:
    0 12px 28px rgba(15, 23, 42, 0.12),
    0 2px 6px rgba(15, 23, 42, 0.06);
  z-index: 50;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

.tvs.is-open .tvs__list {
  display: block;
  animation: tvs-pop 0.16s ease-out;
}

@keyframes tvs-pop {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tvs__list > li {
  margin: 0;
  padding: 0;
  list-style: none;
}

.tvs__option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  min-height: 56px;
  padding: 10px 10px;
  box-sizing: border-box;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--tvs-text);
  text-align: left;
  cursor: pointer;
  font: inherit;
  line-height: 1.3;
  position: relative;
  transition: background 0.12s ease;
}

.tvs__option:hover,
.tvs__option:focus {
  background: var(--tvs-accent-soft);
  outline: none;
}

.tvs__option.is-selected {
  background: var(--tvs-accent-soft);
  box-shadow: inset 0 0 0 1px rgba(47, 111, 219, 0.28);
}

.tvs__option.is-selected::after {
  content: "";
  position: absolute;
  top: 12px;
  right: 10px;
  width: 16px;
  height: 16px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Ccircle cx='8' cy='8' r='8' fill='%232f6fdb'/%3E%3Cpath d='M4.8 8.2l2.1 2.1 4.3-4.4' stroke='%23fff' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    center / contain no-repeat;
}

.tvs__option.is-placeholder .tvs__name {
  padding-top: 10px;
}

.tvs__option.is-oos {
  background: #fffaf5;
}

.tvs__option.is-oos:hover,
.tvs__option.is-oos:focus {
  background: #fff1e0;
}

.tvs__option.is-oos .tvs__thumb {
  opacity: 0.55;
  filter: grayscale(0.25);
}

.tvs__option.is-oos .tvs__name {
  color: #57534e;
}

.tvs__option.is-oos .tvs__price {
  color: #a8a29e;
  font-weight: 600;
}

.tvs__option .tvs__name {
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  padding-right: 22px;
}

.tvs__badge {
  flex: 0 0 auto;
  align-self: center;
  margin-left: auto;
  padding: 3px 8px;
  border-radius: 999px;
  background: #ffedd5;
  color: var(--tvs-oos);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.tvs__option.is-selected .tvs__badge {
  margin-right: 22px;
}

@media (max-width: 520px) {
  .tvs__option .tvs__meta {
    flex-direction: column;
    gap: 2px;
  }
  .tvs__thumb {
    flex-basis: 36px;
    width: 36px;
    height: 36px;
  }
}
