/* Etal24 marketplace polish: compact header, readable mega menu, calm product cards */
:root {
    --warm: #f3eee6;
    --warm-light: #faf7f2;
}
@media (min-width: 761px) {
    .header-inner { min-height: 74px; gap: clamp(9px, 1.15vw, 16px); }
    .header-scrim { inset: 74px 0 0; }
}
.site-header {
    background: #fffdfa;
    box-shadow: 0 4px 18px rgba(32, 34, 40, .06);
}
.category-toggle {
    padding-inline: 9px;
    border-radius: 9px;
    transition: color .16s ease, background .16s ease;
}
.category-toggle[aria-expanded="true"] {
    color: var(--brand);
    background: var(--warm-light);
}
.search-form {
    min-height: 48px;
    border-color: #d9dce2;
}
.search-form:focus-within {
    border-color: rgba(245, 30, 38, .48);
    box-shadow: 0 0 0 3px rgba(245, 30, 38, .09);
}
.search-submit {
    color: var(--brand);
    background: #fff4f0;
}
.search-submit:hover {
    background: #ffebe7;
}
.voice-search:hover {
    background: var(--warm-light);
}
.header-actions { gap: 3px; }
.header-action { border-radius: 9px; }
.language-picker { position: relative; }
.language-picker .sr-only,
.sr-only {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}
/* Language picker controls are styled in storefront.css. */
.category-menu {
    border-color: #e7e3dc;
    border-radius: 14px;
    box-shadow: 0 24px 60px rgba(28, 31, 38, .20);
}
.category-list { background: #fcfaf6; }
.category-menu-row { gap: 0; }
.category-menu-item {
    min-height: 42px;
    border-radius: 8px;
    font-size: 13px;
}
.category-menu-item:hover, .category-menu-item.is-active { background: #fff0ed; }
.category-panels { padding: 22px 28px 26px; }
.category-panel-heading h2 { font-size: 18px; }
.mega-grid { column-gap: 28px; row-gap: 20px; }
.mega-group > a {
    padding-block: 2px;
    font-size: 14px;
    line-height: 1.45;
}
.category-panel .menu-empty {
    min-height: 112px;
    display: flex;
    align-items: center;
    margin-top: 16px;
    padding: 18px 20px;
    border: 1px dashed #e5ded3;
    border-radius: 10px;
    background: #fcfaf6;
}
.header-scrim {
    background: rgba(246, 246, 247, .90);
    backdrop-filter: blur(8px);
}
.product-card {
    border-color: #e5e5e8;
    border-radius: 14px;
    box-shadow: 0 2px 10px rgba(32, 34, 40, .025);
}
.product-card:hover {
    box-shadow: 0 14px 34px rgba(32, 34, 40, .10);
    transform: translateY(-3px);
}
.product-card-media {
    background: linear-gradient(180deg, #fff 0%, #fdfbf8 100%);
}
.product-card-media img { transition: transform .22s ease; }
.product-card:hover .product-card-media img { transform: scale(1.025); }
.product-card-body { padding: 15px 16px 16px; }
.product-card h3 { font-weight: 650; }
@media (max-width: 760px) {
    .header-actions { gap: 0; }
    .category-panels { padding: 14px; }
    .mega-grid { column-gap: 16px; }
    .product-card-body { padding: 11px; }
}
@media (max-width: 380px) {
    .header-inner { gap: 5px; }
}


/* Retail product cards: clear prices and a consistent quick cart action */
.product-card { display: flex; flex-direction: column; }
.product-card-body { display: flex; flex: 1; flex-direction: column; }
.product-card-bottom { align-items: stretch; flex-direction: column; gap: 10px; margin-top: auto; }
.product-price-stack { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.product-card-cart-form { margin: 0; }
.product-card-cart-button { width: 100%; min-height: 42px; }
.product-card-cart-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.product-card-cart-button--disabled { border-color: var(--line); color: var(--muted); background: #f0f1f3; cursor: not-allowed; }
.product-card-cart-button--disabled:hover { border-color: var(--line); background: #f0f1f3; transform: none; }
@media (max-width: 760px) {
    .product-card-bottom { gap: 8px; padding-top: 10px; }
    .product-card-cart-button { min-height: 40px; padding-inline: 10px; font-size: 13px; }
}

/* Keep quick cart controls readable inside narrow product cards */
.product-card-cart-form { width: 100%; }
.product-card-cart-button { display: flex; width: 100%; justify-content: center; white-space: nowrap; }
.product-card-cart-button svg { flex: 0 0 18px; fill: none !important; stroke: #fff !important; }

/* Search results: let one matching product use the available mobile width. */
@media (max-width: 760px) {
    .search-results-page .product-grid--single {
        grid-template-columns: minmax(0, 1fr) !important;
    }
    .search-results-page .product-grid--single > .product-card {
        grid-column: 1 / -1 !important;
        width: 100%;
        max-width: none;
    }
}


/* Category list cards use the full results column, even when only one item matches. */
.category-results .product-grid.product-grid--list {
    width: 100%;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
}
.category-results .product-grid.product-grid--list > .product-card {
    grid-column: 1 / -1;
    width: 100%;
    max-width: none;
    min-width: 0;
    justify-self: stretch;
    grid-template-columns: minmax(180px, 220px) minmax(0, 1fr);
}
.category-results .product-grid.product-grid--list .product-card-body {
    min-width: 0;
}
.category-results .product-grid.product-grid--list .product-card-bottom {
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
}
.category-results .product-grid.product-grid--list .product-price-stack {
    justify-content: flex-start;
}
.category-results .product-grid.product-grid--list .product-card-cart-form {
    width: min(220px, 40%);
    flex: 0 0 min(220px, 40%);
}
@media (max-width: 760px) {
    .category-results .product-grid.product-grid--list > .product-card {
        grid-template-columns: minmax(112px, 140px) minmax(0, 1fr);
    }
    .category-results .product-grid.product-grid--list .product-card-media {
        min-height: 188px;
    }
    .category-results .product-grid.product-grid--list .product-card-body {
        padding: 14px 12px;
    }
    .category-results .product-grid.product-grid--list .product-card-bottom {
        flex-direction: column;
        align-items: stretch;
    }
    .category-results .product-grid.product-grid--list .product-card-cart-form {
        width: 100%;
        flex: 0 0 auto;
    }
}
@media (max-width: 390px) {
    .category-results .product-grid.product-grid--list > .product-card {
        grid-template-columns: minmax(92px, 112px) minmax(0, 1fr);
    }
    .category-results .product-grid.product-grid--list .product-card-media {
        min-height: 172px;
    }
    .category-results .product-grid.product-grid--list .product-card-body {
        padding: 12px 10px;
    }
}

/* Compact commerce actions while keeping mobile controls comfortably tappable. */
.button { min-height: 40px; padding: 9px 16px; }
.product-card-cart-button { min-height: 40px; }
.emag-add-to-cart .button, .emag-unavailable-button, .cart-summary > .button { min-height: 42px; }
@media (max-width: 760px) {
    .category-menu { max-height: calc(100dvh - 78px); overflow-y: auto; overscroll-behavior: contain; }
    .category-list { max-height: none; overflow: visible; }
    .category-panels { overflow: visible; }
    .category-menu-promo { display: none !important; }
    .mega-group-children { gap: 2px; padding-left: 12px; }
    .mega-category-link { min-height: 40px; display: flex; align-items: center; }
    .button { min-height: 40px; padding: 9px 14px; }
    .product-card-cart-button { min-height: 40px; }
}

.mega-group-children { display: grid; align-content: start; gap: 4px; padding-left: 10px; border-left: 1px solid #e8e4de; }
.mega-group > h3 { margin: 0; font-size: 14px; line-height: 1.4; }
.mega-group > .mega-group-children { margin-top: 5px; }
.mega-category-link { display: block; padding: 5px 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.mega-category-link:hover { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 760px) {
    .mega-group-children { padding-left: 12px; }
    .mega-category-link { min-height: 40px; display: flex; align-items: center; padding-block: 8px; }
}

/* Category menu finishing: desktop mega menu and mobile drill-down screen. */
.category-menu-back { display: none; }
.category-menu-row .category-menu-item { transition: color .14s ease, background-color .14s ease; }
.category-panel { min-height: 390px; }
.category-menu-promo { min-height: 390px; }
.category-panel-heading [data-category-panel-title]:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; border-radius: 2px; }

@media (min-width: 761px) {
    .category-menu {
        width: min(1220px, calc(100vw - 48px));
        grid-template-columns: minmax(230px, 270px) minmax(0, 1fr);
        border-radius: 14px;
    }
    .category-list { padding: 14px; }
    .category-menu-item { min-height: 45px; }
    .category-menu-item.is-active { box-shadow: inset 3px 0 var(--brand); font-weight: 680; }
    .category-panels { min-height: 420px; }
    .category-panel { min-height: 372px; }
    .category-menu-promo { min-height: 390px; }
    .category-menu-back { display: none !important; }
}

@media (max-width: 760px) {
    .category-menu {
        display: block;
        max-height: calc(100dvh - 74px);
        border-radius: 12px;
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
        box-shadow: 0 18px 48px rgba(28, 31, 38, .20);
    }
    .category-menu:not(.has-active-panel) .category-panels { display: none; }
    .category-menu.has-active-panel .category-list { display: none; }
    .category-menu.has-active-panel .category-panels {
        display: block;
        padding: 12px 16px 16px;
    }
    .category-menu-back {
        width: 100%;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: flex-start;
        gap: 9px;
        margin: 0 0 9px;
        padding: 6px 2px;
        border: 0;
        border-bottom: 1px solid var(--line);
        border-radius: 0;
        color: var(--ink);
        background: transparent;
        font: inherit;
        font-size: 14px;
        font-weight: 650;
        text-align: left;
        cursor: pointer;
    }
    .category-menu-back svg {
        width: 20px;
        height: 20px;
        flex: 0 0 auto;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.8;
        stroke-linecap: round;
        stroke-linejoin: round;
    }
    .category-menu-back:hover,
    .category-menu-back:focus-visible { color: var(--brand); }
    .category-menu-back:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
    .category-panel { min-height: 0; }
    .category-panel-heading { align-items: center; padding-bottom: 12px; }
    .category-panel-heading h2 { font-size: 19px; line-height: 1.25; }
    .category-panel-heading > .text-link { display: none; }
    .category-panel .mega-grid,
    .category-panel .mega-brand-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 8px;
        padding-top: 10px;
    }
    .category-panel .mega-group { gap: 2px; }
    .category-panel .mega-group-children {
        display: grid;
        gap: 2px;
        padding: 2px 0 2px 12px;
        border-left: 1px solid var(--line);
    }
    .category-panel .mega-category-link,
    .category-panel .mega-group > a {
        min-height: 44px;
        display: flex;
        align-items: center;
        padding: 9px 10px;
        border-bottom: 1px solid #eeece8;
        border-radius: 6px;
        color: var(--ink);
        font-size: 14px;
        line-height: 1.35;
        text-decoration: none;
    }
    .category-panel .mega-category-link:hover,
    .category-panel .mega-group > a:hover { color: var(--brand); background: #fff3f1; }
    .category-panel .mega-group h3 { margin: 10px 0 4px; font-size: 14px; }
    .category-panel .mega-brand-grid .mega-group { gap: 0; }
}


/* Etal24 menu layout: fixed desktop panel, full-height mobile drill-down and eMAG-style close control. */
.category-toggle .category-toggle-icon { flex: 0 0 21px; }
.category-toggle .category-toggle-icon--close { display: none; }
.category-toggle[aria-expanded="true"] .category-toggle-icon--menu { display: none; }
.category-toggle[aria-expanded="true"] .category-toggle-icon--close { display: block; }
.category-toggle[aria-expanded="true"] > span { display: none; }

@media (min-width: 761px) {
    .category-menu {
        height: min(420px, calc(100dvh - 105px));
        max-height: min(420px, calc(100dvh - 105px));
        min-height: 0;
        grid-template-rows: minmax(0, 1fr);
        overflow: hidden;
    }
    .category-list {
        height: 100%;
        min-height: 0;
        max-height: none;
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
    }
    .category-panels {
        display: grid;
        grid-template-rows: minmax(0, 1fr);
        height: 100%;
        min-height: 0;
        overflow: hidden;
    }
    .category-panels > .category-menu-promo,
    .category-panels > .category-panel {
        height: 100%;
        min-height: 0;
        max-height: 100%;
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
    }
    #categoryToggle[aria-expanded="true"] {
        width: 40px;
        min-width: 40px;
        padding-inline: 8px;
    }
}

@media (max-width: 760px) {
    .category-menu:not([hidden]) {
        position: fixed;
        inset: 62px 0 0;
        display: flex;
        flex-direction: column;
        width: 100%;
        height: auto;
        min-height: 0;
        max-height: none;
        transform: none;
        grid-template-columns: minmax(0, 1fr);
        border-radius: 0 0 14px 14px;
        overflow: hidden;
        overscroll-behavior: contain;
    }
    .category-menu:not(.has-active-panel) .category-list {
        display: flex;
        flex: 1 1 auto;
        width: 100%;
        min-height: 0;
        max-height: none;
        overflow-x: hidden;
        overflow-y: auto;
        border-bottom: 0;
    }
    .category-menu.has-active-panel .category-list { display: none; }
    .category-menu:not(.has-active-panel) .category-panels { display: none; }
    .category-menu.has-active-panel .category-panels {
        display: block;
        flex: 1 1 auto;
        min-height: 0;
        height: auto;
        max-height: none;
        overflow-x: hidden;
        overflow-y: auto;
        padding: 12px 16px 16px;
    }
    .category-menu.has-active-panel .category-panels > .category-panel:not([hidden]) {
        min-height: 100%;
    }
    .category-menu-promo { display: none !important; }
}


/* Mobile header: reserve a real column for search so it cannot collide with the brand. */
@media (max-width: 760px) {
    .header-inner { grid-template-columns: minmax(0, 1fr) 34px auto; gap: 6px; }
    .brand-group { min-width: 0; gap: 4px; }
    #categoryToggle { flex: 0 0 34px; width: 34px; min-width: 34px; height: 36px; min-height: 36px; padding: 6px; }
    .category-toggle svg { width: 20px; height: 20px; }
    .brand { min-width: 0; gap: 3px; }
    .brand-mark { width: 28px; height: 28px; }
    .brand-word { font-size: 21px; letter-spacing: -1.2px; }
    .search-wrap { width: 34px; min-width: 34px; justify-self: center; }
    .mobile-search-toggle { width: 34px; min-width: 34px; height: 36px; min-height: 36px; padding: 0; }
    .mobile-search-toggle svg { width: 20px; height: 20px; }
    .header-actions { min-width: 0; gap: 0; }
    .language-picker { flex: 0 0 32px; }
    .language-picker-trigger,
    .header-actions > .header-action {
        box-sizing: border-box; flex: 0 0 32px; width: 32px; min-width: 32px;
        height: 36px; min-height: 36px; padding: 4px;
    }
    .header-actions > .header-action svg { width: 18px; height: 18px; }
    .cart-count, .favorite-count {
        top: 0; right: -1px; min-width: 15px; height: 15px; padding-inline: 3px; font-size: 9px;
    }
}
@media (max-width: 380px) {
    .header-inner { grid-template-columns: minmax(0, 1fr) 30px auto; gap: 4px; min-height: 62px; }
    .brand-group { gap: 3px; }
    #categoryToggle { flex-basis: 30px; width: 30px; min-width: 30px; padding: 5px; }
    .category-toggle svg { width: 19px; height: 19px; }
    .brand { gap: 3px; }
    .brand-mark { width: 22px; height: 22px; }
    .brand-word { font-size: 18px; letter-spacing: -1px; }
    .search-wrap, .mobile-search-toggle { width: 30px; min-width: 30px; }
    .mobile-search-toggle { height: 34px; min-height: 34px; }
    .header-actions > .header-action, .language-picker, .language-picker-trigger {
        flex-basis: 30px; width: 30px; min-width: 30px;
    }
    .header-actions > .header-action { padding: 3px; }
}

/* Compact browsing history rail inspired by Etal24's catalog patterns. */
.recently-viewed-products[hidden] { display: none !important; }
.recently-viewed-products.content-section {
    margin: 28px auto 34px;
    padding-block: 0;
}
.recently-viewed-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}
.recently-viewed-heading h2 {
    margin: 0;
    color: var(--ink, #252830);
    font-size: clamp(18px, 2vw, 23px);
    line-height: 1.25;
}
.recently-viewed-clear {
    border: 0;
    padding: 7px 0;
    color: #687080;
    background: transparent;
    font: inherit;
    font-size: 13px;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}
.recently-viewed-clear:hover { color: var(--brand, #f51e26); }
.recently-viewed-clear:disabled { opacity: .6; cursor: wait; }
.recently-viewed-rail {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    padding: 2px 2px 9px;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}
.recently-viewed-thumb {
    display: grid;
    flex: 0 0 76px;
    width: 76px;
    height: 76px;
    place-items: center;
    overflow: hidden;
    border: 1px solid #e1e4e9;
    border-radius: 5px;
    background: #fff;
    scroll-snap-align: start;
}
.recently-viewed-thumb:hover,
.recently-viewed-thumb:focus-visible {
    border-color: var(--brand, #f51e26);
    outline: none;
    box-shadow: 0 0 0 2px rgba(245, 30, 38, .12);
}
.recently-viewed-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.recently-viewed-thumb-fallback {
    color: #727987;
    font-size: 12px;
}
@media (max-width: 760px) {
    .recently-viewed-products.content-section { margin-block: 22px 26px; }
    .recently-viewed-heading { margin-bottom: 9px; gap: 10px; }
    .recently-viewed-heading h2 { font-size: 18px; }
    .recently-viewed-clear { font-size: 12px; }
    .recently-viewed-rail { gap: 7px; padding-bottom: 8px; }
    .recently-viewed-thumb {
        flex-basis: 68px;
        width: 68px;
        height: 68px;
    }
}


/* Dock the sticky add-to-cart bar at the bottom with compact, refined controls. */
.sticky-product-buy {
    position: fixed !important;
    top: auto !important;
    bottom: 0 !important;
    inset-inline: 0;
    border-top: 1px solid var(--line);
    border-bottom: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-shadow: 0 -5px 18px rgba(30, 34, 42, .10);
}
.sticky-product-buy__inner {
    min-height: 64px;
    gap: 14px;
    padding-block: 7px;
}
.sticky-product-buy__identity { gap: 10px; }
.sticky-product-buy__identity img { width: 40px; height: 40px; flex-basis: 40px; }
.sticky-product-buy__identity strong { font-size: 12.5px; }
.sticky-product-buy__prices > strong { font-size: 18px; }
.sticky-product-buy__inner > .button {
    min-width: 154px;
    min-height: 40px;
    padding: 8px 13px;
    font-size: 13px;
    font-weight: 650;
    border-radius: 7px;
}
@media (max-width: 700px) {
    .sticky-product-buy__inner {
        width: calc(100% - 24px);
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 2px 10px;
        min-height: 62px;
        padding-block: 6px;
    }
    .sticky-product-buy__identity { gap: 9px; }
    .sticky-product-buy__identity img { width: 34px; height: 34px; flex-basis: 34px; }
    .sticky-product-buy__identity strong { font-size: 11.5px; line-height: 1.25; }
    .sticky-product-buy__prices { gap: 7px; padding-left: 43px; }
    .sticky-product-buy__prices > strong { font-size: 15px; line-height: 1.15; }
    .sticky-product-buy__prices .product-old-price { font-size: 10px; }
    .sticky-product-buy__prices .product-discount-badge { min-height: 19px; padding: 2px 6px; font-size: 10px !important; }
    .sticky-product-buy__inner > .button {
        min-width: 118px;
        min-height: 38px;
        padding: 7px 9px;
        font-size: 12px;
        gap: 6px;
    }
}
@media (max-width: 380px) {
    .sticky-product-buy__inner { width: calc(100% - 20px); }
    .sticky-product-buy__identity img { display: none; }
    .sticky-product-buy__prices { padding-left: 0; }
    .sticky-product-buy__inner > .button { min-width: 108px; font-size: 11.5px; }
}
