/*
 * Customer storefront — responsive & UX (mobile → 4K TV)
 */

/* ---- Fluid media & CMS content ---- */
img, video, svg {
    max-width: 100%;
    height: auto;
}

.product-introduction img,
.product-introduction iframe,
.product-introduction table {
    max-width: 100%;
}

/* ---- Touch targets ---- */
@media (max-width: 991.98px) {
    .btn-sm {
        min-height: 2.25rem;
        padding: 0.35rem 0.65rem;
    }

    .navbar-item,
    .header-cart-link,
    .btn-menu,
    .offcanvas-header .btn-close {
        min-width: 2.75rem;
        min-height: 2.75rem;
    }
}

/* ---- Header & search (narrow / PWA window) ---- */
@media (max-width: 767.98px) {
    /* Brand + user/theme on one row; search full-width below. */
    .top-header-row {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas:
            "brand actions"
            "search search";
        gap: 0.65rem 0.5rem;
        align-items: center;
    }

    .header-brand-row {
        grid-area: brand;
        width: auto;
        max-width: 100%;
        min-width: 0;
        justify-content: flex-start;
        gap: 0.55rem;
    }

    .header-brand-row .header-menu-toggle {
        order: 0;
        flex-shrink: 0;
    }

    .header-brand-row .header-brand-link {
        order: 1;
        min-width: 0;
        max-width: 100%;
    }

    .header-brand-title {
        max-width: min(42vw, 8.5rem);
    }

    .search-wrapper {
        grid-area: search;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        margin-inline: 0 !important;
        margin-top: 0 !important;
        height: 2.75rem;
    }

    .search-submit-btn {
        padding: 0.4rem 0.75rem;
        font-size: 0.78rem;
    }

    .header-actions {
        grid-area: actions;
        display: flex !important;
        width: auto;
        max-width: 100%;
        margin-top: 0 !important;
        justify-content: flex-end;
        align-items: center;
        gap: 0.35rem;
        position: relative;
        z-index: 2;
    }

    .header-actions .header-user-menu {
        padding-inline: 0 !important;
    }

    /* Keep search + actions usable while sticky compact hides desktop nav */
    .store-header.is-compact .search-wrapper {
        height: 2.5rem;
    }

    .store-header.is-compact .top-nav {
        display: none;
    }

    .header-panel-backdrop {
        /* base styles live in style.css — keep mobile-only tweaks here if needed */
    }

    .top-nav .container-xxl > .row > .col-md-7,
    .top-nav .container-xxl > .row > .col-md-5 {
        width: 100%;
    }

    .header-panel-sheet-handle {
        width: 2rem;
        height: 0.22rem;
        border-radius: 999px;
        background: #cbd5e1;
        margin: 0.3rem auto 0.4rem;
    }
}

@media (min-width: 768px) {
    .header-panel-ported:not(.header-panel-sheet) {
        width: 20rem !important;
        max-width: min(20rem, calc(100vw - 1.5rem)) !important;
        max-height: none !important;
        overflow: hidden !important;
    }

    .header-panel-ported.header-cart-dropdown:not(.header-panel-sheet) {
        max-height: none !important;
    }

    /* desktop dropdowns: no body scroll lock needed for tiny panels */
    body.header-panel-open:not(.header-panel-sheet-mode) {
        overflow: visible;
        padding-inline-end: 0;
        touch-action: auto;
    }

    .header-panel-backdrop.is-visible {
        background: rgba(15, 23, 42, 0.12);
    }
}

/* ---- Owl carousel nav (touch-friendly) ---- */
@media (max-width: 575.98px) {
    .header-cart-dropdown.header-panel-sheet .header-cart-dropdown__head {
        flex-wrap: wrap;
        align-items: flex-start;
    }

    .header-cart-dropdown.header-panel-sheet .header-cart-dropdown-body-item {
        grid-template-columns: 2.75rem minmax(0, 1fr) auto;
        gap: 0.55rem;
        padding: 0.65rem 0.75rem;
    }

    .header-cart-dropdown.header-panel-sheet .header-cart-item__media {
        width: 2.75rem;
        height: 2.75rem;
    }

    .header-cart-dropdown.header-panel-sheet .header-cart-item__meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .header-cart-dropdown.header-panel-sheet .header-cart-dropdown-footer {
        flex-wrap: wrap;
    }

    .header-cart-dropdown.header-panel-sheet .header-cart-checkout-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 767.98px) {
    .light-owl-nav .owl-nav,
    .dark-owl-nav .owl-nav {
        display: none;
    }
}

/* ---- Product listing filter sidebar ---- */
.products-filter-toggle {
    display: none;
}

@media (max-width: 991.98px) {
    .products-filter-toggle,
    .catalog-mobile-filter-btn {
        display: inline-flex;
        align-items: center;
        gap: 0.35rem;
    }

    #main-body-two-col #sidebar {
        display: none;
        margin-bottom: 1rem;
    }

    #main-body-two-col.filter-open #sidebar {
        display: block;
    }

    #main-body-two-col.filter-open #main-body {
        display: none;
    }
}

/* ---- Product page ---- */
@media (max-width: 767.98px) {
    .product-features table tr td:first-of-type {
        width: 40% !important;
        min-width: 0;
    }

    .stick {
        position: static !important;
        width: 100% !important;
        overflow-x: auto;
        white-space: nowrap;
    }
}

/* ---- Cart ---- */
@media (max-width: 767.98px) {
    .cart-img {
        width: 5rem !important;
        height: 5rem !important;
        margin: 0 0 0 1rem !important;
    }

    .cart-number-up,
    .cart-number-down {
        min-width: 2.25rem;
        min-height: 2.25rem;
    }
}

/* ---- Profile / orders ---- */
@media (max-width: 767.98px) {
    .profile-sidebar-nav {
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .order-filter-bar {
        flex-wrap: wrap !important;
        gap: 0.35rem;
    }
}

/* ---- Footer ---- */
@media (max-width: 575.98px) {
    .footer-benefits .col {
        flex: 0 0 50%;
        max-width: 50%;
    }

    .store-footer__trust-item {
        padding: 0.7rem 0.75rem;
    }
}

/* ---- Tablet tweaks ---- */
@media (min-width: 768px) and (max-width: 991.98px) {
    .main-product-wrapper .col-md-3 {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

/* ---- Large desktop & TV ---- */
@media (min-width: 1400px) {
    .container-xxl {
        max-width: 1320px;
    }
}

@media (min-width: 1920px) {
    .container-xxl {
        max-width: 1600px;
    }

    body {
        font-size: 1.05rem;
    }
}

@media (min-width: 2560px) {
    .container-xxl {
        max-width: 1800px;
    }
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
