/* FILE: public/css/store/responsive.css */

/* =========================================================
   GLOBAL STOREFRONT RESPONSIVE FOUNDATION
   Safe global rules only. No page-specific redesign here.
========================================================= */

/* Prevent flex/grid overflow across the storefront */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    width: 100%;
    overflow-x: hidden;
}

body {
    width: 100%;
    overflow-x: hidden;
}

/* Media safety */
img,
video,
iframe,
svg {
    max-width: 100%;
}

img,
video {
    height: auto;
}

/* Text overflow safety */
p,
h1,
h2,
h3,
h4,
h5,
h6,
span,
a,
li,
td,
th {
    overflow-wrap: anywhere;
}

/* Grid/flex child overflow protection */
.container,
.page-surface,
.main-content,
.product-card,
.cart-panel,
.cart-summary,
.sf-panel,
.sf-summary,
.sf-checkout-form,
.sf-checkout-summary {
    min-width: 0;
}

/* Global container normalization */
.container {
    width: 100%;
    max-width: 1200px;
    margin-inline: auto;
    padding-inline: 20px;
}

/* Global page surface safety */
.page-surface {
    width: calc(100% - 32px);
    max-width: 1200px;
}

/* Buttons should never overflow mobile screens */
button,
.btn,
.sf-btn,
.pharma-btn-primary,
.sf-btn-primary,
[type="submit"],
[type="button"] {
    max-width: 100%;
    white-space: normal;
}

/* Forms */
input,
select,
textarea {
    max-width: 100%;
    min-width: 0;
}

/* Tables: allow horizontal scroll instead of breaking page */
table {
    max-width: 100%;
}

.table-responsive,
.responsive-table {
    width: 100%;
    overflow-x: auto;
}

/* =========================================================
   TABLET
========================================================= */

@media (max-width: 1024px) {
    .container {
        max-width: 100%;
        padding-inline: 18px;
    }

    .products-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .page-surface {
        margin-block: 28px;
        padding: 24px;
    }

    .big-search {
        width: 320px;
    }
}

/* =========================================================
   MOBILE
========================================================= */
@media (max-width: 768px) {
    .container {
        padding-inline: 14px;
    }

    .page-surface {
        width: calc(100% - 24px);
        margin-block: 20px;
        padding: 18px;
        border-radius: 16px;
    }
    .big-search {
    width: 100%;
    max-width: 100%;
}

.big-search form,
.big-search-inner {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 10px;
}
.big-search form,
.big-search-inner {
    background: #ffffff;
    border-radius: 16px;
    padding: 6px;
}

.big-search input {
    width: 100%;
    height: 46px;

    background: #ffffff;

    border: none;
    outline: none;

    border-radius: 14px;

    padding-inline: 16px;

    font-size: 15px;
    color: #111827;
}

.big-search button {
    width: 46px;
    height: 46px;
    min-width: 46px;
    flex: 0 0 46px;

    background: #ffffff !important;
    color: #111827;

    border: none;
    outline: none;

    border-radius: 14px;

    display: flex;
    align-items: center;
    justify-content: center;

    box-shadow: none;
}

/* =========================================================
   MOBILE HEADER REBUILD
========================================================= */

.header-glass {
    padding: 10px 0;
}

.header-flex {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.logo {
    flex: 1 1 100%;
    text-align: center;
}

.nav {
    width: 100%;
    order: 3;

    display: flex;
    align-items: center;
    gap: 18px;

    overflow-x: auto;
    white-space: nowrap;

    padding-bottom: 6px;
}

.nav::-webkit-scrollbar {
    height: 4px;
}

.nav a {
    flex: 0 0 auto;
    font-size: 14px;
}

.big-search {
    width: 100%;
    order: 4;
}

.big-search form,
.big-search-inner {
    width: 100%;
}

.header-actions {
    margin-left: auto;
    gap: 12px;
}

    .header-flex {
        flex-wrap: wrap;
        gap: 14px;
    }

    .logo {
        flex: 1 1 auto;
        min-width: 0;
    }

    .logo img {
        max-height: 44px;
        width: auto;
    }

    .nav {
        order: 3;
        width: 100%;
        display: flex;
        gap: 12px;
        overflow-x: auto;
        padding-bottom: 4px;
        scrollbar-width: thin;
    }

    .nav a {
        flex: 0 0 auto;
        font-size: 14px;
    }

    .header-actions {
        flex: 0 0 auto;
        gap: 10px;
    }

    .big-search {
        order: 4;
        width: 100%;
        flex: 1 1 100%;
    }

    .products-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.product-card {
    width: 100%;
    min-width: 0;
    padding: 12px;
    border-radius: 18px;
}

.product-image {
    aspect-ratio: 1 / 1;
    max-height: 180px;
    object-fit: contain;
}

.product-card h3,
.product-card h4,
.product-title {
    margin-top: 10px;
    margin-bottom: 8px;
    font-size: 15px;
    line-height: 1.35;
}

.product-card .price,
.product-price {
    font-size: 16px;
    margin-bottom: 10px;
}

.product-card .btn,
.product-card button {
    min-height: 42px;
    padding: 10px 14px;
}

.product-card h3,
.product-card h4,
.product-title {
    font-size: 15px;
    line-height: 1.4;
}

.product-card .price,
.product-price {
    font-size: 18px;
}

.product-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
}

    .page-header,
    .page-header h1 {
        font-size: clamp(24px, 7vw, 32px);
    }

    .row {
        flex-direction: column;
    }

    [class*="col-"] {
        width: 100%;
        max-width: 100%;
    }
}


/* =========================================================
   SMALL MOBILE
========================================================= */

@media (max-width: 480px) {
    .container {
        padding-inline: 12px;
    }

    .page-surface {
        width: calc(100% - 16px);
        padding: 14px;
        border-radius: 14px;
    }

    .nav {
        gap: 14px;
    }

    .products-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .product-card {
        padding: 12px;
    }

    .product-card h3,
    .product-card h4,
    .product-title {
        font-size: 14px;
    }

    .product-card .price,
    .product-price {
        font-size: 16px;
    }

    .product-image {
        height: auto;
        min-height: 120px;
    }

    .header-glass {
        padding: 8px 0;
    }

    .header-flex {
        align-items: center;
    }

    .big-search button {
        min-width: 38px;
        min-height: 38px;
    }

    .cart,
    .user {
        font-size: 17px;
    }

    .btn,
    .sf-btn,
    .pharma-btn-primary,
    .sf-btn-primary,
    button[type="submit"] {
        width: 100%;
        justify-content: center;
        text-align: center;
    }
}
