/*
 * Product Collection Tabs widget — all rules scoped under .hg-collection-tabs so this file can
 * never leak into or be affected by other components. Uses the theme's own --primary-color
 * custom property (set from Theme Options) instead of a hard-coded brand color, so the widget
 * always matches whatever accent color the site is currently configured with.
 */

.hg-collection-tabs {
    padding-top: 30px;
    padding-bottom: 30px;
}

.hg-collection-tabs__heading {
    margin-bottom: 24px;
}

.hg-collection-tabs__box {
    border: 1px solid rgba(1, 15, 28, 0.1);
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
}

/* Tab bar can hold more tabs than fit (4 collections already crowds a 1440px box; more added
   later would overflow further) with only a mouse-wheel/trackpad/touch drag to reach the rest —
   no visible affordance on desktop. Reusing the same circular chevron button already used for
   the product slider (.hg-collection-tabs__arrow) for the tab row itself, wired up in
   hg-collection-tabs.js to scroll .hg-collection-tabs__nav left/right and hide at each end. */
.hg-collection-tabs__nav-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
    border-bottom: 1px solid rgba(1, 15, 28, 0.1);
    padding: 0 8px;
}

.hg-collection-tabs__nav-arrow {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid rgba(1, 15, 28, 0.12);
    border-radius: 50%;
    background: #fff;
    color: rgba(1, 15, 28, 0.7);
    cursor: pointer;
    transition: opacity 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.hg-collection-tabs__nav-arrow:hover {
    color: var(--primary-color, #0989ff);
    border-color: var(--primary-color, #0989ff);
}

.hg-collection-tabs__nav-arrow.is-hidden {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
}

.hg-collection-tabs__nav {
    display: flex;
    flex: 1 1 auto;
    flex-wrap: nowrap;
    overflow-x: auto;
    list-style: none;
    margin: 0;
    padding: 0;
    scrollbar-width: none;
}

.hg-collection-tabs__nav::-webkit-scrollbar {
    display: none;
}

.hg-collection-tabs__tab-item {
    flex: 0 0 auto;
}

/* Bigger, bolder tabs with a clear active-state highlight + icon — the original 15px/600-weight
   flat-underline tabs read as too quiet next to the rest of the (now much denser) homepage;
   this widget's tabs are the primary navigation for its whole product set, so they need to be
   the most prominent element in the box, not blend into body text. */
.hg-collection-tabs__tab {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    border: none;
    background: transparent;
    padding: 18px 24px;
    font-size: 18px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: rgba(1, 15, 28, 0.6);
    cursor: pointer;
    border-bottom: 4px solid transparent;
    transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.hg-collection-tabs__tab:hover {
    color: var(--primary-color, #0989ff);
}

.hg-collection-tabs__tab.is-active {
    color: var(--primary-color, #0989ff);
    border-bottom-color: var(--primary-color, #0989ff);
    background-color: rgba(9, 137, 255, 0.1);
}

/* Icon marking which tab's products are currently on screen — a filled circle-check reads
   clearly as "this one is selected" without needing an icon font/sprite just for this widget. */
.hg-collection-tabs__tab.is-active::before {
    content: '';
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    margin-right: 8px;
    background-color: var(--primary-color, #0989ff);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M9 12l2 2 4-4'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M9 12l2 2 4-4'/%3E%3C/svg%3E") center / contain no-repeat;
}

.hg-collection-tabs__content {
    padding: 20px;
}

.hg-collection-tabs__pane {
    display: none;
}

.hg-collection-tabs__pane.is-active {
    display: block;
}

.hg-collection-tabs__slider-wrapper {
    position: relative;
}

.hg-collection-tabs__slider {
    overflow: hidden;
}

.hg-collection-tabs__slider .swiper-wrapper {
    align-items: stretch;
}

.hg-collection-tabs__card {
    height: auto;
}

/* Grid mode (rows > 1 in admin) — static grid, no carousel/arrows. Column count comes from an
   inline `grid-template-columns` (set from the admin's "items per row" field, any number), gap
   matches the carousel's own card spacing so both modes feel like the same component. */
.hg-collection-tabs__items--grid {
    display: grid;
    gap: 12px;
}

.hg-collection-tabs__pane.is-loading .hg-collection-tabs__items--grid {
    visibility: hidden;
}

@media (max-width: 1199px) {
    .hg-collection-tabs__items--grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

/* 2 columns all the way down to the narrowest phone — matches the rest of the site's own
   product grid, which uses Bootstrap's unprefixed `row-cols-2` (applies from 0px up) as its
   mobile default everywhere else (shop listing, homepage tabs). Kept as ONE breakpoint instead
   of stepping down further so this widget's mobile card size/layout stays consistent with
   every other product widget on the site rather than introducing a one-off pattern. */
@media (max-width: 767px) {
    .hg-collection-tabs__items--grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px;
    }
}

.hg-collection-tabs__arrow {
    position: absolute;
    top: 50%;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin-top: -18px;
    border: 1px solid rgba(1, 15, 28, 0.12);
    border-radius: 50%;
    background: #fff;
    color: rgba(1, 15, 28, 0.7);
    cursor: pointer;
    transition: opacity 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.hg-collection-tabs__arrow:hover {
    color: var(--primary-color, #0989ff);
    border-color: var(--primary-color, #0989ff);
}

.hg-collection-tabs__arrow--prev {
    left: -10px;
}

.hg-collection-tabs__arrow--next {
    right: -10px;
}

.hg-collection-tabs__arrow.swiper-button-disabled {
    opacity: 0;
    pointer-events: none;
}

.hg-collection-tabs__loading {
    display: none;
    align-items: center;
    justify-content: center;
    min-height: 120px;
}

.hg-collection-tabs__pane.is-loading .hg-collection-tabs__loading {
    display: flex;
}

.hg-collection-tabs__pane.is-loading .hg-collection-tabs__slider {
    visibility: hidden;
}

.hg-collection-tabs__spinner {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(1, 15, 28, 0.12);
    border-top-color: var(--primary-color, #0989ff);
    border-radius: 50%;
    animation: hg-collection-tabs-spin 0.7s linear infinite;
}

@keyframes hg-collection-tabs-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 767px) {
    .hg-collection-tabs__content {
        padding: 14px;
    }

    .hg-collection-tabs__tab {
        padding: 14px 16px;
        font-size: 16px;
    }

    .hg-collection-tabs__tab.is-active::before {
        width: 15px;
        height: 15px;
        margin-right: 6px;
    }

    .hg-collection-tabs__arrow {
        display: none;
    }

    .hg-collection-tabs__nav-wrapper {
        padding: 0 4px;
    }

    .hg-collection-tabs__nav-arrow {
        width: 28px;
        height: 28px;
    }
}
