﻿/* =========================================================
   Berry theme — responsive enhancements
   Loaded AFTER responsive.css to patch gaps across devices.
   ========================================================= */

/* --- Global safety nets ------------------------------------------------- */
/* Base style: Mobile-First (Full width for small screens) */
.checkout-page .method-list li {
    width: 100%;
    float: none;
    margin-right: 0;
    margin-bottom: 15px;
    padding: 10px 15px;
    background: #fffffd;
    color: #b3012a;
    box-shadow: 0 0 8px #d1d1d1;
    font-size: 1rem;
    list-style: none;
    box-sizing: border-box; /* Ensures padding doesn't break width */
}

/* Tablet View: 2 columns (Optional but recommended) */
@media screen and (min-width: 600px) and (max-width: 1024px) {
    .checkout-page .method-list li {
        width: calc(50% - 10px);
        float: left;
        margin-right: 20px;
    }
    /* Remove margin from every 2nd item */
    .checkout-page .method-list li:nth-child(2n) {
        margin-right: 0;
    }
}

/* Desktop View: 3 columns */
@media screen and (min-width: 1025px) {
    .checkout-page .method-list li {
        width: calc(33.33% - 10px);
        float: left;
        margin-right: 15px;
    }

    /* Remove margin from every 3rd item to prevent wrap-around */
    .checkout-page .method-list li:nth-child(3n) {
        margin-right: 0;
    }
}
html, body {
    max-width: 100%;
    overflow-x: hidden;
}

img, svg, video, iframe, embed, object {
    max-width: 100%;
    height: auto;
}

/* Any generic table becomes horizontally scrollable on small screens */
@media (max-width: 767px) {
    .page-body table:not(.cart):not(.data-table) {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .page-body .data-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* --- Extra-large desktops (>= 1400px) ---------------------------------- */
@media (min-width: 1400px) {
    .master-wrapper-content,
    .header,
    .footer,
    .header-lower,
    .header-upper {
        max-width: 1320px;
        margin-left: auto;
        margin-right: auto;
    }

    .product-grid .item-box {
        width: calc(25% - 20px);
    }

    #anywhere-slider-1 .slider-caption h2 {
        font-size: 56px;
    }
}

/* --- Standard desktop tweaks (992–1199px) ------------------------------ */
@media (min-width: 992px) and (max-width: 1199px) {
    .product-grid .item-box {
        width: calc(33.33% - 20px);
    }

    .header-upper .search-box-text {
        width: 200px;
    }

    .header-logo {
        max-width: 400px;
    }
}

/* --- Tablets (768–991px) ----------------------------------------------- */
@media (min-width: 768px) and (max-width: 991px) {
    .product-grid .item-box {
        width: calc(33.33% - 16px);
    }

    .product-essential .gallery,
    .product-essential .overview {
        width: 100%;
        float: none;
    }

    .product-details-page .product-variant-line {
        display: block;
    }

    .ui-tabs .ui-tabs-nav li {
        display: block;
        width: 100%;
    }

    .header-lower .search-box.store-search-box {
        width: 100%;
        max-width: none;
        min-width: 0;
    }

    .header-lower .search-box-text {
        width: 100%;
    }
}

/* --- Phones (<= 767px) ------------------------------------------------- */
@media (max-width: 767px) {
    /* Header row wraps cleanly */
    .header-upper {
        flex-wrap: wrap;
        justify-content: space-between;
        row-gap: 10px;
        padding: 10px;
    }

    .header-upper .header-links-wrapper {
        flex: 0 0 auto;
    }

    /* Accessible touch targets */
    .header-links a,
    .footer-block a,
    .top-menu a,
    .buttons .button-1,
    .buttons .button-2,
    .add-to-cart-button,
    .add-to-wishlist-button,
    .search-box-button {
        min-height: 44px;
        line-height: 1.3;
        display: inline-flex;
        align-items: center;
    }

    /* Forms – prevent iOS zoom on focus */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="tel"],
    input[type="search"],
    select,
    textarea {
        font-size: 16px;
    }

    /* Breadcrumb wraps */
    .breadcrumb ul,
    .breadcrumb {
        flex-wrap: wrap;
    }

    /* Order summary / totals stack cleanly */
    .order-summary-content .cart-footer {
        display: block;
    }

    .order-summary-content .cart-footer .totals,
    .order-summary-content .cart-footer .cart-collaterals {
        width: 100%;
        margin: 0 0 15px;
    }

    /* Product details: stack picture + info, full-width buttons */
    .product-essential .gallery,
    .product-essential .overview {
        width: 100%;
        float: none;
        margin: 0 0 20px;
    }

    .product-essential .overview-buttons .add-to-cart,
    .product-essential .overview-buttons .add-to-wishlist {
        width: 100%;
    }

    .product-essential .overview-buttons .add-to-cart-button,
    .product-essential .overview-buttons .add-to-wishlist-button {
        width: 100%;
    }

    /* Footer stacks, social icons centered */
    .footer-upper .footer-block {
        width: 100%;
        margin: 0 0 10px;
    }

    .footer-lower .footer-info,
    .footer-lower .footer-disclaimer,
    .footer-lower .footer-powered-by,
    .footer-lower .footer-store-theme,
    .footer-lower .accepted-payment-methods {
        width: 100%;
        text-align: center;
        margin: 5px 0;
    }

    /* Flyout cart fits viewport */
    .flyout-cart {
        width: 100vw;
        max-width: 100vw;
        left: 0;
        right: 0;
    }

    /* Admin bar / theme controls wrap */
    .admin-header-links,
    .header-theme-controls {
        flex-wrap: wrap;
    }
}

/* --- Small phones (<= 480px) ------------------------------------------- */
@media (max-width: 480px) {
    .product-grid .item-box,
    .category-page .product-grid .item-box,
    .sub-category-grid .item-box,
    .manufacturer-grid .item-box,
    .vendor-grid .item-box {
        width: calc(100% - 16px);
        margin: 10px 8px;
    }

    .home-page-product-grid .title,
    .related-products-grid .title,
    .featured-product-grid .title,
    .ocarousel-grid .title {
        font-size: 20px;
    }

    .page-title h1,
    .page-title h2 {
        font-size: 22px;
        line-height: 1.3;
    }
}

/* --- Extra-small phones (<= 360px) ------------------------------------- */
@media (max-width: 360px) {
    .header-logo {
        max-width: 180px;
    }

    .header-upper .header-links li {
        padding: 0 4px;
        font-size: 12px;
    }

    .admin-header-links a {
        font-size: 12px;
    }

    .cart-qty,
    .flyout-cart-qty {
        font-size: 12px;
    }

    .buttons .button-1,
    .buttons .button-2 {
        padding: 8px 10px;
        font-size: 13px;
    }
}

/* --- Landscape phones: tighter vertical rhythm ------------------------- */
@media (max-width: 900px) and (orientation: landscape) {
    .header-upper {
        min-height: 56px;
    }

    .anywhere-slider-bg .owl-item .slider-caption {
        padding-top: 15px;
        padding-bottom: 15px;
    }
}

/* --- Print ------------------------------------------------------------- */
@media print {
    .header, .footer, .header-menu, .flyout-cart, .admin-header-links,
    .menu-toggle, .side-2, .breadcrumb {
        display: none !important;
    }

    .master-wrapper-content,
    .page-body {
        width: 100% !important;
        margin: 0 !important;
    }
}

/* =============================================================
   Toggleable header search box (LTR)
   ≥ 1281px : popup opens to the RIGHT of the icon, aligned with it.
   ≤ 1280px : popup drops as a full-width drawer BELOW the header
              row so the logo and icons stay visible.
              (covers 1280×800, 1024×600, 1024×1366, iPad Mini, phones)
   ============================================================= */

/* Base (state + animation) — applied on every breakpoint */
.search-box.store-search-box {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
    box-sizing: border-box;
    z-index: 1050;

    /* animation */
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
    transition: opacity .2s ease, transform .2s ease;
}

.search-box.store-search-box.open {
    opacity: 1;
    pointer-events: auto;
}

/* Keep [hidden] semantics but allow transition before it actually hides */
.search-box.store-search-box[hidden] {
    display: block;
}
.search-box.store-search-box[hidden]:not(.open) {
    display: none;
}

.search-box.store-search-box .search-box-text {
    width: 100%;
    height: 38px;
    box-sizing: border-box;
    border: 1px solid #dcdcdc;
    border-radius: 3px;
    padding: 0 10px;
    display: block;
}

/* -------------------------------------------------------------
   Desktop (≥ 1281px): side popup next to the icon
   ------------------------------------------------------------- */
@media (min-width: 1281px) {
    .header-upper .header-links li.search-icon-wrapper {
        position: relative;                /* anchor for the side popup */
    }
.search-box .ui-autocomplete{ max-width: calc(18vw - 20px);}
    .search-box.store-search-box {
        position: absolute;
        top: 50%;
        right: auto !important;
        left: 100% !important;             /* open to the right of the icon */
        margin-right: 0 !important;
        margin-left: 8px !important;       /* 8px gap */
        max-width: calc(100vw - 32px);
        padding: 6px 10px;
        white-space: nowrap;
    }

    /* keep the lift active in both closed and open states */
    .search-box.store-search-box,
    .search-box.store-search-box.open {
        transform: translateY(-55%);
    }
}

/* -------------------------------------------------------------
   Tablet / small laptop / mobile (≤ 1280px):
   full-width drawer BELOW the header row
   ------------------------------------------------------------- */
@media (max-width: 1280px) {
    .header-upper {
        position: relative;                /* positioning context = header row */
    }
    .header-upper .header-links-wrapper,
    .header-upper .header-links li.search-icon-wrapper {
        position: static !important;       /* escape the icon's relative box */
    }

    .search-box.store-search-box,
    .search-box.store-search-box.open {
        position: absolute;
        top: 100%;                         /* directly under the header row */
        left: 0 !important;
        right: 0 !important;
        margin: 0 !important;
        transform: none !important;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        padding: 8px 12px;
        white-space: normal;
        border-radius: 0;
    }

    .search-box.store-search-box .search-box-text {
        width: 100%;
    }
}

/* Leave .header-upper .header-links li alone.
   Only force the autocomplete dropdown items to stack. */
.ui-autocomplete .ui-menu-item,
.header-upper .header-links li.ui-menu-item {
    display: block !important;
    width: 100%;
    padding: 0;
}
@media (max-width: 1024px) {
    .header-lower {
        background-color: #b3012a;
    }
}