/*
 * Варианты Gamma-товаров в категории.
 * Стили вынесены из JS, чтобы не было прыжков после загрузки страницы.
 */

.product-layout .sc-module-cart-btn,
.product-layout .sc-category-cart-btn {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.sc-category-variants-wrap {
    width: 100%;
}

.sc-category-variants-toggle {
    width: 100%;
    border: 0;
    border-radius: 8px;
    padding: 8px 10px;
    background: #6f42c1;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.sc-category-variants-toggle:hover {
    background: #8055d6;
}

.sc-category-variants-list {
    display: none !important;
}

/* SC: первый плиточный вид — варианты поверх следующих товаров */
.product-layout:not(.col-12) {
    overflow: visible !important;
    position: relative;
}

.product-layout:not(.col-12) .sc-category-variants-wrap {
    position: relative;
    z-index: 10;
}

.product-layout:not(.col-12) .sc-category-variants-list {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 8px);
    z-index: 999;
    max-height: 430px;
    overflow-y: auto;
    display: grid !important;
    gap: 8px;
    padding: 8px;
    border: 1px solid #e7e7e7;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 12px 30px rgba(0,0,0,.16);
}

.product-layout:not(.col-12) .sc-category-variants-list[hidden] {
    display: none !important;
}

.product-layout:not(.col-12) .sc-category-variants-wrap.is-open {
    z-index: 50;
}

/* Блок под строкой пока оставляем только для последующих режимов, но не для первого вида */
  .sc-category-variants-row {
      width: 100%;
      grid-column: 1 / -1;
      margin: 0;
      padding: 0 14px;
      border: 1px solid #eadff7;
      border-radius: 12px;
      background: #fff;
      box-shadow: 0 8px 22px rgba(0,0,0,.08);
      position: relative;
      z-index: 20;
      overflow: hidden;
      opacity: 0;
      max-height: 0;
      transform: translateY(-8px);
      transition: max-height .28s ease, opacity .22s ease, transform .22s ease, padding .22s ease, margin .22s ease;
  }

  .sc-category-variants-row.is-open {
      margin: -4px 0 14px 0;
      padding: 14px;
      opacity: 1;
      max-height: 720px;
      transform: translateY(0);
  }

.sc-category-variants-row-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.sc-category-variants-row-title {
    font-size: 15px;
    font-weight: 700;
    color: #222;
}

.sc-category-variants-row-close {
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 50%;
    background: #f2edf7;
    color: #6f42c1;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.sc-category-variants-row-body {
    max-height: 430px;
    overflow-y: auto;
    padding-right: 4px;
}

.sc-category-variants-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 10px;
}

.sc-category-variant-card {
    display: flex;
    gap: 10px;
    min-height: 82px;
    padding: 9px;
    border: 1px solid #eee;
    border-radius: 10px;
    background: #fff;
}

.sc-category-variant-img img {
    width: 58px;
    height: 58px;
    object-fit: contain;
    border-radius: 8px;
}

.sc-category-variant-info {
    flex: 1;
    min-width: 0;
}

.sc-category-variant-name {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #333;
    text-decoration: none;
    line-height: 1.25;
    margin-bottom: 3px;
}

.sc-category-variant-price {
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 6px;
    color: #666;
}

.sc-category-variant-qty {
    display: inline-flex;
    align-items: center;
    border-radius: 8px;
    background: #f5f5f5;
    overflow: hidden;
}

.sc-category-variant-qty button {
    width: 30px;
    height: 28px;
    border: 0;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
    color: #333;
    cursor: pointer;
}

.sc-category-variant-qty input {
    width: 34px;
    height: 28px;
    border: 0;
    background: transparent;
    text-align: center;
    font-size: 13px;
}

.sc-category-variants-row-loading,
.sc-category-variants-row-empty {
    padding: 14px;
    color: #666;
    font-size: 14px;
}
