/* =====================================================================
   SHOP WIDGET POLISH — карточка магазина в правой колонке
   Master ТЗ §8 (расширено по фидбеку): premium-формат как в ТЗ-mockup.
   ---------------------------------------------------------------------
   Этап 5 → 5.1 (полный редизайн под mockup пользователя).
   Шаблон: template/panel/Modules/Plugins/Shop/widget_shop_advertising.tpl

   Структура карточки:
     1. SALE corner badge (если активен sale)
     2. Title наверху (uppercase, multiline)
     3. Sale timer pill (countdown с clock-иконкой)
     4. Image (центрированная)
     5. CTA "Купить за XXX ₽" — full-width gold-gradient
     6. Old price (striked) если sale активен
   ===================================================================== */

/* Контейнер слайдера */
.row.items-push.js-slider {
    margin-bottom: 0;
    position: relative;
}

/* Spacer между Referral и Shop когда они объединены в один grid-item
   через JS post-process (mmoweb.js → combineRightColumnStack). */
.right-column-shop-spacer {
    height: 20px;
}

/* Карточка магазина — premium navy-card */
a.shop-item {
    display: flex !important;
    flex-direction: column;
    background: var(--tbc-bg-card, #252942) !important;
    border: 1px solid var(--tbc-border-default, #2F3454) !important;
    border-radius: var(--tbc-radius-block, 8px) !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25) !important;
    overflow: hidden;
    position: relative;
    padding: 0 !important;
    text-decoration: none !important;
    color: var(--tbc-text-primary, #FFFFFF) !important;
    transition: transform 0.2s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    min-height: auto;
}
a.shop-item:hover {
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.4) !important;
    opacity: 1 !important; /* перебиваем codebase a.block:hover opacity:0.65 */
    /* translateY УБРАН — карточка при подъёме обрезалась сверху
       slick-list'ом (overflow:hidden). Hover-feedback остаётся
       через shadow + image scale(1.04) + CTA shine. Этого
       достаточно — рамка/lift избыточны. */
}

/* Прячем вендорские ribbon-bookmark/warning декорации (мы используем свой
   SALE-badge через .shop-item-sale-badge) */
a.shop-item.ribbon::before,
a.shop-item.ribbon::after {
    display: none !important;
}
a.shop-item.ribbon {
    min-height: auto !important;
}

/* === 1. SALE corner badge (top-right) === */
.shop-item-sale-badge {
    position: absolute;
    top: 14px;
    right: -32px;
    z-index: 3;
    background: linear-gradient(180deg, #E74C3C 0%, #C0392B 100%);
    color: #FFFFFF;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.5px;
    padding: 4px 36px;
    text-transform: uppercase;
    transform: rotate(35deg);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
    pointer-events: none;
}

/* === 2. Title наверху === */
.shop-item-title {
    color: var(--tbc-text-primary, #FFFFFF) !important;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    line-height: 1.3;
    text-align: center;
    padding: 18px 32px 10px;
    text-shadow: none !important;
    /* Сбрасываем кастомные стили old name_kit_custom (DS 737 Exp шрифт) */
    font-family: inherit !important;
}

/* === 3. Sale timer pill === */
.shop-item-timer {
    display: flex;
    justify-content: center;
    margin: 0 auto 8px;
    padding: 0 16px;
}
/* Vendor's $sale.time_ribbon рендерит <div class="ribbon-box">timer - sale %</div>.
   В новом layout он "просто" pill-таймер — отменяем absolute-позиционирование
   и стилизуем под clock-pill из mockup пользователя. */
.shop-item-timer .ribbon-box {
    position: static !important;
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    background: rgba(98, 178, 255, 0.12) !important;
    border: 1px solid rgba(98, 178, 255, 0.30);
    border-radius: 999px;
    padding: 5px 14px !important;
    color: #62B2FF !important;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    line-height: 1.2;
    height: auto !important;
    margin: 0 !important;
}
.shop-item-timer .ribbon-box::before {
    /* Заменяем декоративный border-triangle на FA clock-иконку */
    content: '\f017'; /* fa-clock-o */
    font-family: 'FontAwesome', 'Font Awesome 5 Free', 'Font Awesome 6 Free';
    font-weight: 900;
    position: static !important;
    width: auto !important;
    height: auto !important;
    border: none !important;
    background: none !important;
    color: #62B2FF;
    font-size: 11px;
    line-height: 1;
}
.shop-item-timer .ribbon-box span[data-sale-timer] {
    color: #FFFFFF !important;
    font-weight: 700;
}

/* === 4. Image === */
.shop-item-img-wrap {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px 16px;
    background: transparent !important;
    min-height: 140px;
}
.shop-item-img {
    max-width: 80%;
    max-height: 160px;
    width: auto;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.4));
    transition: transform 0.3s ease;
}
a.shop-item:hover .shop-item-img {
    transform: scale(1.04);
}

/* === 5. CTA "Купить за XXX ₽" === */
.shop-item-cta-wrap {
    padding: 0 16px 16px;
    position: relative;
    text-align: center;
}
.shop-item-cta {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    background: linear-gradient(180deg, #F5A623 0%, #D68813 100%) !important;
    border: 1px solid #F4C66A !important;
    color: #1A1D2E !important;
    font-weight: 800 !important;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 13px;
    padding: 11px 18px;
    border-radius: 6px;
    box-shadow:
        0 2px 8px rgba(214, 136, 19, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
    transition: filter 0.22s ease, box-shadow 0.22s ease, transform 0.18s ease;
    position: relative;
    overflow: hidden;
}
.shop-item-cta-icon {
    font-size: 14px;
    flex-shrink: 0;
}
.shop-item-cta-text {
    line-height: 1.2;
}
a.shop-item:hover .shop-item-cta {
    filter: brightness(1.08);
    box-shadow:
        0 4px 16px rgba(245, 166, 35, 0.55),
        inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
/* Shine sweep уместен для CTA (главное действие) */
.shop-item-cta::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg,
        transparent 30%,
        rgba(255, 255, 255, 0.28) 50%,
        transparent 70%);
    transform: translateX(-110%);
    transition: transform 0.6s ease;
    pointer-events: none;
}
a.shop-item:hover .shop-item-cta::after {
    transform: translateX(110%);
}

/* === 6. Old price (striked) === */
.shop-item-old-price {
    display: block;
    margin-top: 6px;
    color: var(--tbc-text-muted, #5A5F7A);
    font-size: 11px;
    text-align: center;
}
.shop-item-old-price del {
    color: var(--tbc-text-muted, #5A5F7A);
}

/* === Slick navigation: arrows (по бокам) === */
.js-slider .slick-arrow,
.js-slider .shop-slider-arrow {
    position: absolute;
    top: 45%;
    transform: translateY(-50%);
    z-index: 5;
    width: 32px;
    height: 32px;
    padding: 0;
    background: rgba(20, 23, 36, 0.85) !important;
    border: 1px solid var(--tbc-border-default, #2F3454) !important;
    border-radius: 50%;
    color: var(--tbc-text-primary, #FFFFFF) !important;
    cursor: pointer;
    display: flex !important;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    font-size: 0;
}
.js-slider .slick-arrow i,
.js-slider .shop-slider-arrow i {
    font-size: 12px;
    line-height: 1;
}
.js-slider .slick-prev::before,
.js-slider .slick-next::before {
    display: none !important;
}
.js-slider .slick-prev,
.js-slider .shop-slider-arrow-prev {
    left: 12px;
}
.js-slider .slick-next,
.js-slider .shop-slider-arrow-next {
    right: 12px;
}
.js-slider .slick-arrow:hover,
.js-slider .shop-slider-arrow:hover {
    background: rgba(245, 166, 35, 0.20) !important;
    border-color: var(--tbc-accent-cta, #F5A623) !important;
    color: var(--tbc-accent-cta, #F5A623) !important;
}
.js-slider .slick-arrow.slick-disabled,
.js-slider .shop-slider-arrow.slick-disabled {
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
}

/* === Slick dots (снизу) === */
.js-slider .slick-dots {
    display: flex !important;
    justify-content: center;
    gap: 6px;
    margin: 10px 0 0 !important;
    padding: 0 !important;
    list-style: none;
}
.js-slider .slick-dots li {
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
}
.js-slider .slick-dots li button {
    width: 22px;
    height: 3px;
    padding: 0;
    border: none;
    background: var(--tbc-border-default, #2F3454);
    border-radius: 2px;
    font-size: 0;
    cursor: pointer;
    transition: background 0.2s ease, width 0.3s ease;
}
.js-slider .slick-dots li button::before {
    display: none !important;
}
.js-slider .slick-dots li.slick-active button {
    background: var(--tbc-accent-cta, #F5A623);
    width: 32px;
}

@media (prefers-reduced-motion: reduce) {
    a.shop-item,
    a.shop-item:hover,
    a.shop-item:hover .shop-item-img,
    .shop-item-cta,
    .shop-item-cta::after,
    .js-slider .slick-arrow,
    .js-slider .slick-dots li button {
        transition: none !important;
    }
}

/* ========================================================================
   [TBC] Чекбоксы в shop / temporary-store / market — navy-palette override
   Перебивает vendor shop.css:81-129 (белые блоки 32×32 — не вписывались
   в дизайн ЛК). Затрагивает: panel/shop, panel/shop/temporary-store.<id>,
   widget_item.tpl, widget_item_no_auth.tpl.
   ======================================================================== */
#page-container .checkbox__block {
    background: var(--tbc-bg-card, #252942) !important;
    border: 1px solid var(--tbc-border-default, #2F3454) !important;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.35) !important;
    transition: background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

/* Hover на label: подсвечиваем рамку акцентом */
#page-container .checkbox__label:hover .checkbox__block {
    border-color: var(--tbc-accent-cta, #F5A623) !important;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.35),
                0 0 0 1px rgba(245, 166, 35, 0.25) !important;
}

/* Hover-галка: тонкий jpg-серый чтобы видеть, что hover работает */
#page-container .checkbox__label:hover .checkbox__block:after {
    color: var(--tbc-text-secondary, #8B90B0);
    opacity: 0.4;
    transform: scale(1);
}

/* Checked state: заливка акцентом + белая галочка */
#page-container .checkbox__input:checked + .checkbox__block {
    background: var(--tbc-accent-cta, #F5A623) !important;
    border-color: var(--tbc-accent-cta, #F5A623) !important;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.25),
                0 0 8px rgba(245, 166, 35, 0.35) !important;
}
#page-container .checkbox__input:checked + .checkbox__block:after {
    color: #fff !important;
    background-color: transparent !important;
    opacity: 1;
    transform: scale(1);
}

/* Disabled (например, для complect=1 — фиксированные комплекты): зелёный
   как индикатор "уже в наборе", чтобы отличать от обычного checked */
#page-container .checkbox__input:disabled + .checkbox__block {
    background: var(--tbc-accent-success, #3AC569) !important;
    border-color: var(--tbc-accent-success, #3AC569) !important;
    cursor: not-allowed;
    opacity: 0.7;
}
#page-container .checkbox__input:disabled + .checkbox__block:after {
    color: #fff !important;
    background-color: transparent !important;
    opacity: 1;
    transform: scale(1);
}

@media (prefers-reduced-motion: reduce) {
    #page-container .checkbox__block,
    #page-container .checkbox__block:after {
        transition: none !important;
    }
}

/* ========================================================================
   [TBC] Sale badges (-50%) + time ribbon — развинчиваем до яркого, видимого
   акцента. Vendor shop.css:17-29 — мелкие 70%-размера бледные плашки.
   Видны на: заголовке "ЦЕНА" в widget_item, рядом со старой ценой
   (del-strikethrough), внутри карточек товаров shop_list_*.tpl.
   ======================================================================== */
#page-container .badge-sale,
#page-container .badge.badge-sale {
    /* Размер: было 70% — теперь 11px фикс. + крупный padding */
    background: linear-gradient(135deg, #FF3D3D 0%, #E11D1D 100%) !important;
    color: #fff !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    padding: 3px 8px !important;
    border-radius: 4px !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    /* Кровавый glow — теплый красный по периметру */
    box-shadow:
        0 0 0 1px rgba(255, 61, 61, 0.55),
        0 0 12px rgba(255, 61, 61, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.18) !important;
    /* Пульс 2.5s — мягко привлекает внимание не раздражая */
    animation: tbc-sale-pulse 2.4s ease-in-out infinite;
    /* Перебиваем встроенный position: absolute от inline-стиля в widget_item.tpl:57 */
    position: static !important;
}

/* Master Account вариант — фиолетовая палитра, тот же эффект */
#page-container .badge-sale-ma,
#page-container .badge.badge-sale-ma {
    background: linear-gradient(135deg, #B83DFF 0%, #8B1DE1 100%) !important;
    color: #fff !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    padding: 3px 8px !important;
    border-radius: 4px !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow:
        0 0 0 1px rgba(184, 61, 255, 0.55),
        0 0 12px rgba(184, 61, 255, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.18) !important;
    animation: tbc-sale-pulse 2.4s ease-in-out infinite;
    animation-delay: 0.6s; /* фаза смещена чтобы badges не пульсировали в унисон */
    position: static !important;
}

@keyframes tbc-sale-pulse {
    0%, 100% {
        transform: scale(1);
        filter: brightness(1);
    }
    50% {
        transform: scale(1.06);
        filter: brightness(1.18);
    }
}

/* Time-ribbon ("2 Дня 10:14:21 - 50 %") — vendor .ribbon-warning жёлтый
   почти не виден. Делаем градиент огненно-оранжевый + тонкий glow. */
#page-container .ribbon.ribbon-bookmark.ribbon-warning > .ribbon-box,
#page-container .ribbon-warning > .ribbon-box,
#page-container .ribbon-warning::before {
    background: linear-gradient(90deg,
        #FF8A1E 0%,
        #F5A623 55%,
        #FF6B1E 100%) !important;
    color: #fff !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
    font-weight: 700 !important;
    box-shadow:
        0 2px 8px rgba(245, 166, 35, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.25) !important;
}

/* [TBC] Time-ribbon на top:0 (внутри блока, не торчит наружу) + двигаем
   картинку товара вниз margin-top, чтобы ribbon не перекрывал её.
   Альтернативой был top:-18px но юзер хотел держать ribbon внутри блока. */
#page-container .ribbon.ribbon-bookmark.ribbon-left.ribbon-warning .ribbon-box {
    top: 0 !important;
}
/* Картинка товара (shop-img-wrp) — добавляем отступ сверху чтобы ribbon
   не накладывался на верх изображения. 36px = высота ribbon-box (32px) + 4px */
#page-container .ribbon.ribbon-bookmark.ribbon-left.ribbon-warning .shop-img-wrp {
    margin-top: 36px;
}

@media (prefers-reduced-motion: reduce) {
    #page-container .badge-sale,
    #page-container .badge-sale-ma,
    #page-container .badge.badge-sale,
    #page-container .badge.badge-sale-ma {
        animation: none !important;
    }
}
