/* ====================================================================
 * Kancbazar.ua — Release 8 (RESTORED 27.04.2026)
 * Блок 3 вкладок на головній: РОЗПРОДАЖ / ХІТИ / НОВИНКИ.
 * Карусель товарів через CSS scroll-snap (без jQuery slick).
 * ====================================================================
 */

/* Ховаємо старі баннери "Гарантія/Швидка/Доступні" (.sc-advantages в темі) */
.oct-top-tabs-active .sc-advantages {
    display: none !important;
}

.oct-top-tabs {
    background: #fff;
    border-radius: 8px;
    padding: 20px 16px 24px;
    margin: 24px 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
@media (min-width: 768px) {
    .oct-top-tabs { padding: 24px 24px 32px; }
}

.oct-top-tabs__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    border-bottom: 1px solid #efefef;
    margin-bottom: 18px;
    padding-bottom: 0;
}
.oct-top-tabs__nav {
    display: flex;
    gap: 24px;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.oct-top-tabs__nav::-webkit-scrollbar { display: none; }
.oct-top-tabs__btn {
    background: transparent;
    border: 0;
    padding: 8px 0 14px;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #555;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
    margin-bottom: -1px;
    white-space: nowrap;
    flex-shrink: 0;
}
.oct-top-tabs__btn:hover { color: #d32f2f; }
.oct-top-tabs__btn.is-active {
    color: #1c1c28;
    border-bottom-color: #d32f2f;
}
@media (max-width: 480px) {
    .oct-top-tabs__nav { gap: 14px; }
    .oct-top-tabs__btn { font-size: 12px; letter-spacing: 0.3px; padding: 8px 0 12px; }
    .oct-top-tabs__viewall { font-size: 12px; }
}
@media (max-width: 360px) {
    .oct-top-tabs__nav { gap: 10px; }
    .oct-top-tabs__btn { font-size: 11px; }
}
.oct-top-tabs__viewall {
    color: #d32f2f;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}
.oct-top-tabs__viewall:hover {
    color: #b71c1c;
    text-decoration: underline;
}

.oct-top-tabs__carousel-wrap {
    position: relative;
    margin: 0 -8px;
}
.oct-top-tabs__carousel {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    padding: 8px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}
.oct-top-tabs__carousel::-webkit-scrollbar { height: 6px; }
.oct-top-tabs__carousel::-webkit-scrollbar-track { background: #f5f5f5; }
.oct-top-tabs__carousel::-webkit-scrollbar-thumb { background: #d32f2f; border-radius: 3px; }

.oct-top-tabs__item {
    flex: 0 0 calc(50% - 8px);
    scroll-snap-align: start;
    background: #fff;
    border: 1px solid #efefef;
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}
.oct-top-tabs__item:hover { box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08); }
@media (min-width: 576px) { .oct-top-tabs__item { flex: 0 0 calc(33.333% - 11px); } }
@media (min-width: 768px) { .oct-top-tabs__item { flex: 0 0 calc(25% - 12px); } }

.oct-top-tabs__badges {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    padding: 8px 8px 0;
    min-height: 26px;
}
.oct-top-tabs__badge {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    padding: 3px 7px;
    border-radius: 3px;
    line-height: 1.4;
    white-space: nowrap;
}
.oct-top-tabs__badge--sale  { background: #ff5722; color: #fff; }
.oct-top-tabs__badge--school{ background: #2563eb; color: #fff; }

.oct-top-tabs__img {
    display: block;
    margin: 8px auto 12px;
    max-width: 100%;
    height: 160px;
    object-fit: contain;
    padding: 8px;
}
@media (min-width: 768px) { .oct-top-tabs__img { height: 200px; } }

.oct-top-tabs__title {
    font-size: 13px;
    color: #1c1c28;
    text-decoration: none;
    padding: 0 12px 8px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 35px;
    flex-grow: 1;
}
.oct-top-tabs__title:hover { color: #d32f2f; text-decoration: none; }

.oct-top-tabs__rating { padding: 0 12px 4px; color: #888; font-size: 12px; }

.oct-top-tabs__price-row {
    padding: 0 12px 12px;
    display: flex;
    align-items: baseline;
    gap: 8px;
}
.oct-top-tabs__price-old { font-size: 12px; color: #888; text-decoration: line-through; }
.oct-top-tabs__price-new { font-size: 16px; font-weight: 800; color: #d32f2f; }

/* R15: бейдж "продано X шт" в вкладке ХІТИ (зелёный pill как на референсе) */
.oct-top-tabs__sold {
    margin: 0 12px 12px;
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    padding: 3px 10px;
    background: #e8f5e9;
    color: #2e7d32;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}

.oct-top-tabs__arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid #ddd;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
    font-size: 18px;
    transition: all 0.15s;
}
.oct-top-tabs__arrow:hover { background: #d32f2f; color: #fff; border-color: #d32f2f; }
.oct-top-tabs__arrow--prev { left: -18px; }
.oct-top-tabs__arrow--next { right: -18px; }
@media (max-width: 768px) { .oct-top-tabs__arrow { display: none; } }

.oct-top-tabs__loader {
    text-align: center;
    padding: 60px 20px;
    color: #888;
    font-size: 14px;
}
.oct-top-tabs__loader::before {
    content: "";
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid #eee;
    border-top-color: #d32f2f;
    border-radius: 50%;
    animation: octSpin 0.8s linear infinite;
    vertical-align: middle;
    margin-right: 12px;
}
@keyframes octSpin { to { transform: rotate(360deg); } }

.oct-top-tabs__empty { text-align: center; padding: 40px 20px; color: #888; }
