/* Metzler Scrolling Shop styles. Minimal critical layout - dedi z Blocksy + WC. */

.metzler-scroll-shop {
    padding: 0 0 4rem;
}

/* =========================================================================
   Search bar + autocomplete dropdown
   - Sticky pri vrchu (vyssie z-index ako kategoriovy panel)
   - Dropdown: linearny zoznam, dense rows s thumbnails
   ========================================================================= */

.metzler-scroll-search {
    position: sticky;
    top: 0;
    z-index: 60;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid #e6e6e6;
    padding: .85rem 1rem;
}

.metzler-scroll-search__form {
    max-width: 720px;
    margin: 0 auto;
    position: relative;
}

.metzler-scroll-search__label {
    display: flex;
    align-items: center;
    gap: .5rem;
    background: #f4f4f4;
    border: 1px solid transparent;
    border-radius: 999px;
    padding: .55rem 1rem;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.metzler-scroll-search__label:focus-within {
    background: #fff;
    border-color: #1a1a1a;
}

.metzler-scroll-search__icon {
    flex-shrink: 0;
    color: #777;
}

.metzler-scroll-search__label input[type="search"] {
    flex: 1 1 auto;
    background: transparent;
    border: 0;
    outline: none;
    font-size: 1rem;
    color: #1a1a1a;
    padding: 0;
    min-width: 0;
}

.metzler-scroll-search__label input[type="search"]::-webkit-search-decoration,
.metzler-scroll-search__label input[type="search"]::-webkit-search-cancel-button,
.metzler-scroll-search__label input[type="search"]::-webkit-search-results-button,
.metzler-scroll-search__label input[type="search"]::-webkit-search-results-decoration {
    display: none;
}

.metzler-scroll-search__clear {
    background: transparent;
    border: 0;
    color: #777;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 .25rem;
    flex-shrink: 0;
}

.metzler-scroll-search__clear:hover {
    color: #1a1a1a;
}

/* Dropdown */
.metzler-scroll-search__suggest {
    position: absolute;
    top: calc(100% + .5rem);
    left: 0;
    right: 0;
    max-height: 70vh;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
    z-index: 70;
}

.metzler-scroll-search__suggest.is-loading {
    opacity: 0.7;
}

.metzler-scroll-search__section {
    padding: .25rem 0;
}

.metzler-scroll-search__section + .metzler-scroll-search__section {
    border-top: 1px solid #f0f0f0;
}

/* SKU sekcia — vyzdvihnutie ze ide o presny SKU match (numericky vstup). */
.metzler-scroll-search__section--sku {
    background: #fffbe6;
}
.metzler-scroll-search__section--sku .metzler-scroll-search__section-title {
    color: #8a6d00;
}
.metzler-scroll-search__sku-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    color: #8a6d00;
    background: #fff3bf;
    padding: 1px 6px;
    border-radius: 3px;
    margin-top: 2px;
}

.metzler-scroll-search__section-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #888;
    padding: .5rem 1rem .25rem;
}

.metzler-scroll-search__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.metzler-scroll-search__item {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .5rem 1rem;
    text-decoration: none;
    color: #1a1a1a;
    transition: background 0.1s ease;
}

.metzler-scroll-search__item:hover {
    background: #f5f5f5;
}

.metzler-scroll-search__item img,
.metzler-scroll-search__placeholder {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: cover;
    background: #f4f4f4;
    flex-shrink: 0;
}

.metzler-scroll-search__name {
    flex: 1 1 auto;
    font-size: 0.875rem;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.metzler-scroll-search__count {
    font-size: 0.75rem;
    color: #888;
    background: #f0f0f0;
    padding: .15rem .5rem;
    border-radius: 999px;
    flex-shrink: 0;
}

.metzler-scroll-search__meta {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    flex: 1 1 auto;
    overflow: hidden;
}

.metzler-scroll-search__price {
    font-size: 0.8rem;
    color: #555;
    font-weight: 600;
}

.metzler-scroll-search__all {
    display: block;
    text-align: center;
    padding: .65rem 1rem;
    background: #1a1a1a;
    color: #fff;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
    border-radius: 0 0 11px 11px;
    transition: background 0.15s ease;
}

.metzler-scroll-search__all:hover {
    background: #444;
    color: #fff;
}

.metzler-scroll-search__empty {
    padding: 2rem 1rem;
    text-align: center;
    color: #888;
    font-size: 0.875rem;
}

/* Mobile: search dropdown full-width */
@media (max-width: 480px) {
    .metzler-scroll-search {
        padding: .65rem .5rem;
    }
    .metzler-scroll-search__suggest {
        max-height: 75vh;
    }
}

/* =========================================================================
   Active filters bar - zobrazi aktualne filtre (search, category) ako chips
   s X tlacitkom. Klik na X = remove ten filter. "Vymazat vsetko" = reset.
   ========================================================================= */

.metzler-scroll-filters {
    background: #fffbe6;
    border-bottom: 1px solid #f1e4a3;
    padding: .65rem 1rem;
}

.metzler-scroll-filters__inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
}

.metzler-scroll-filters__label {
    font-size: 0.8rem;
    color: #555;
    font-weight: 500;
}

.metzler-scroll-filters__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
}

.metzler-scroll-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .25rem .5rem .25rem .65rem;
    background: #fff;
    border: 1px solid #d1bd5b;
    border-radius: 999px;
    font-size: 0.8rem;
    color: #1a1a1a;
    text-decoration: none;
    transition: background 0.15s ease;
}

.metzler-scroll-filter-chip:hover {
    background: #fff8d4;
}

.metzler-scroll-filter-chip__x {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.08);
    color: #555;
    font-size: 0.95rem;
    line-height: 1;
}

.metzler-scroll-filter-chip:hover .metzler-scroll-filter-chip__x {
    background: rgba(0, 0, 0, 0.15);
}

.metzler-scroll-filters__clear-all {
    margin-left: auto;
    font-size: 0.8rem;
    color: #1a1a1a;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.metzler-scroll-filters__clear-all:hover {
    color: #c33;
}

/* =========================================================================
   Category panel (pills mode)
   - Sticky bar nad obsahom shopu
   - Horizontalne scrollovatelny strip pre mobile
   - Active pill: tmavy fill
   ========================================================================= */

.metzler-cat-panel {
    background: #fff;
    border-bottom: 1px solid #e6e6e6;
    padding: 0;
    margin: 0 0 1.5rem;
    z-index: 50;
}

.metzler-cat-panel.is-sticky {
    position: sticky;
    /* top je dynamicky - search bar je nad nim, pillsbar pod nim */
    top: 56px;
    backdrop-filter: blur(8px);
    background: rgba(255, 255, 255, 0.95);
}

/* Mobile: pills su menej dolezite, schovaj ich (search staci ako filter UX) */
@media (max-width: 600px) {
    .metzler-cat-panel {
        display: none;
    }
}

.metzler-cat-panel__inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: .75rem 1rem;
}

.metzler-cat-panel__pills {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    padding: 0;
    margin: 0;
    list-style: none;
}

/* Mobile - vodorovne scrollovatelny strip */
@media (max-width: 768px) {
    .metzler-cat-panel__pills {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        padding-bottom: .25rem;
    }
    .metzler-cat-panel__pills::-webkit-scrollbar {
        height: 3px;
    }
    .metzler-cat-panel__pills > li {
        scroll-snap-align: start;
        flex-shrink: 0;
    }
}

.metzler-cat-panel__pills--sub {
    margin-top: .5rem;
}

.metzler-cat-pill {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .45rem .85rem;
    background: #f4f4f4;
    color: #333;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.metzler-cat-pill:hover {
    background: #e8e8e8;
    color: #1a1a1a;
}

.metzler-cat-pill.is-active {
    background: #1a1a1a;
    color: #fff;
    border-color: #1a1a1a;
}

.metzler-cat-pill.is-active:hover {
    background: #333;
}

.metzler-cat-pill--sub {
    background: transparent;
    border-color: #e0e0e0;
    color: #555;
    font-size: 0.825rem;
    padding: .35rem .75rem;
}

.metzler-cat-pill--sub:hover {
    border-color: #b0b0b0;
    background: #f8f8f8;
    color: #1a1a1a;
}

.metzler-cat-pill--sub.is-active {
    background: #444;
    border-color: #444;
    color: #fff;
}

.metzler-cat-pill__count {
    background: rgba(0, 0, 0, 0.08);
    color: inherit;
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
    font-weight: 600;
    line-height: 1.2;
    opacity: 0.8;
}

.metzler-cat-pill.is-active .metzler-cat-pill__count {
    background: rgba(255, 255, 255, 0.2);
}

.metzler-scroll-shop__header {
    margin-bottom: 1.5rem;
}

.metzler-scroll-shop__header .entry-title {
    margin: 0 0 .25rem;
}

.metzler-scroll-shop__count {
    margin: 0;
    color: var(--theme-text-color, #666);
    font-size: 0.95rem;
}

/* =========================================================================
   Product grid + card design
   - 3 stlpce na desktope, 2 na tablete/mobile, 4 na velkom desktope
   - karty maju konzistentnu vysku (flex column + image aspect ratio)
   - velke jemne zaoblene obrazky (radius 14px, aspect 1:1)
   - menši tmavý nazov (#222, line-clamp 2 riadky)
   - tenky decentny ramcek + jemny shadow on hover
   ========================================================================= */

.metzler-scroll-shop__grid {
    margin: 0 0 1.5rem;
    list-style: none;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.75rem;
}

/* === Skeleton placeholder cards (vlnia sa kym JS fetch dorazi) === */
/* Rovnaka struktura+rozmery ako .product card aby nebol layout shift (CLS).
 * Shimmer cez animated linear-gradient na sub-elementoch. */
@keyframes metzler-skeleton-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.metzler-scroll-shop__grid > li.metzler-skeleton {
    width: auto;
    margin: 0;
    position: relative;
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #ececec;
    border-radius: 14px;
    overflow: hidden;
    padding: 0;
    list-style: none;
    pointer-events: none;             /* user nemoze klikat kym sa loaduje */
}
.metzler-skeleton__image,
.metzler-skeleton__line {
    background: linear-gradient(
        90deg,
        #f0f0f0 0%,
        #f8f8f8 40%,
        #ffffff 50%,
        #f8f8f8 60%,
        #f0f0f0 100%
    );
    background-size: 200% 100%;
    animation: metzler-skeleton-shimmer 1.4s ease-in-out infinite;
}
.metzler-skeleton__image {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 14px 14px 0 0;
}
.metzler-skeleton__body {
    padding: 0.85rem 1rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
.metzler-skeleton__line {
    height: 14px;
    border-radius: 4px;
}
.metzler-skeleton__line--title { width: 85%; }
.metzler-skeleton__line--title-2 { width: 60%; }
.metzler-skeleton__line--price { width: 35%; height: 18px; margin-top: 0.3rem; }
.metzler-skeleton__line--button {
    width: 100%;
    height: 40px;
    border-radius: 8px;
    margin-top: 0.5rem;
}

/* Respect prefers-reduced-motion - skeleton bez animacie */
@media (prefers-reduced-motion: reduce) {
    .metzler-skeleton__image,
    .metzler-skeleton__line {
        animation: none;
        background: #f0f0f0;
    }
}

@media (min-width: 1400px) {
    .metzler-scroll-shop__grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .metzler-scroll-shop__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .metzler-scroll-shop__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: .75rem;
    }
}

/* Product card - jednotny "container" wrapper */
.metzler-scroll-shop__grid > li.product {
    width: auto;
    margin: 0;
    float: none;
    clear: none;
    position: relative;
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #e6e6e6;
    border-radius: 14px;
    overflow: hidden;
    transition: box-shadow 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
    padding: 0 !important;
    list-style: none;
}

.metzler-scroll-shop__grid > li.product:hover {
    border-color: #d0d0d0;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

/* Product link wrapper (cely klikatelny region) */
.metzler-scroll-shop__grid > li.product > a.woocommerce-LoopProduct-link,
.metzler-scroll-shop__grid > li.product > a.woocommerce-loop-product__link {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    padding: 0;
    color: inherit;
    text-decoration: none;
    flex: 1 0 auto;
}

/* Image - vela priestoru, jemne zaoblena, aspect 1:1 (alebo 4:5 pre vyssie) */
.metzler-scroll-shop__grid > li.product img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 14px 14px 0 0;
    background: #f6f6f6;
    margin: 0;
}

/* Title - mensi, takmer cierny, 2 riadkov max (truncate) */
.metzler-scroll-shop__grid > li.product .woocommerce-loop-product__title,
.metzler-scroll-shop__grid > li.product h2,
.metzler-scroll-shop__grid > li.product h3 {
    margin: .85rem 1rem 0;
    padding: 0;
    color: #1a1a1a;
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: calc(0.95rem * 1.35 * 2);
}

/* Price */
.metzler-scroll-shop__grid > li.product .price {
    margin: .35rem 1rem .25rem;
    font-size: 1rem;
    font-weight: 600;
    color: #1a1a1a;
}

.metzler-scroll-shop__grid > li.product .price del {
    color: #999;
    font-weight: 400;
    margin-right: .35rem;
}

.metzler-scroll-shop__grid > li.product .price ins {
    text-decoration: none;
}

/* Add-to-cart button skryty - karty su iba "browseable", klik vedie na
   product detail kde si user moze pridat do kosika cez WC default UI. */
.metzler-scroll-shop__grid > li.product .add_to_cart_button,
.metzler-scroll-shop__grid > li.product .button.product_type_simple,
.metzler-scroll-shop__grid > li.product .button.product_type_variable,
.metzler-scroll-shop__grid > li.product .button.product_type_grouped,
.metzler-scroll-shop__grid > li.product .button.product_type_external,
.metzler-scroll-shop__grid > li.product .added_to_cart,
.metzler-scroll-shop__grid > li.product .screen-reader-text {
    display: none !important;
}

/* Spodny padding na karte (kompenzacia za skryty button) */
.metzler-scroll-shop__grid > li.product .price {
    margin-bottom: 1rem;
}

/* Sale badge ("Akcia" / "Sale") - rohovy badge */
.metzler-scroll-shop__grid > li.product .onsale {
    position: absolute;
    top: .75rem;
    left: .75rem;
    z-index: 2;
    background: #c33;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    padding: .2rem .5rem;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 0;
    min-height: auto;
    min-width: auto;
    line-height: 1.3;
}

/* Stars rating - jemnejsi font, menej kontrastu */
.metzler-scroll-shop__grid > li.product .star-rating {
    margin: .25rem 1rem 0;
    font-size: 0.8rem;
}

/* Sentinel je neviditeľný marker pre IntersectionObserver. */
.metzler-scroll-shop__sentinel {
    height: 1px;
    margin-top: 0;
    pointer-events: none;
}

/* Status panel: loading / error / end - aria-live pre screen readers. */
.metzler-scroll-shop__status {
    text-align: center;
    padding: 2rem 1rem;
    min-height: 4rem;
}

.metzler-scroll-shop__loading,
.metzler-scroll-shop__error,
.metzler-scroll-shop__end {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .75rem;
    color: var(--theme-text-color, #555);
    font-size: 0.95rem;
}

/* DOLEZITE: HTML `hidden` atribut musi prebiť custom `display: flex` -
   bez tohto by spinner + error ostavali viditeľné permanentně.
   Pravidlo platí pre vsetky stavy v status panel-i. */
.metzler-scroll-shop__loading[hidden],
.metzler-scroll-shop__error[hidden],
.metzler-scroll-shop__end[hidden] {
    display: none !important;
}

/* Spinner - cisty CSS, ziadny obrazok. */
.metzler-scroll-shop__loading .spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(0, 0, 0, 0.12);
    border-top-color: var(--theme-palette-color-1, #2872fa);
    border-radius: 50%;
    animation: metzler-scroll-spin 0.7s linear infinite;
}

@keyframes metzler-scroll-spin {
    to { transform: rotate(360deg); }
}

.metzler-scroll-shop__error .label {
    color: #c33;
    margin: 0;
}

.metzler-scroll-shop__retry {
    cursor: pointer;
    padding: .5rem 1rem;
    background: var(--theme-palette-color-1, #2872fa);
    color: #fff;
    border: 0;
    border-radius: 4px;
    font-size: 0.9rem;
}

.metzler-scroll-shop__retry:hover {
    opacity: 0.9;
}

.metzler-scroll-shop__end .label {
    margin: 0;
    opacity: 0.7;
}

.metzler-scroll-shop__empty {
    padding: 3rem 1rem;
    text-align: center;
    color: var(--theme-text-color, #888);
}

/* Mobile tweaks */
@media (max-width: 768px) {
    .metzler-scroll-shop {
        padding: 1rem 0 3rem;
    }
}
