/* ==========================================================================
   Demo Three — responsive.css
   Loaded after home.css / shop.css / product-details.css on every page.
   Sections: tokens → base & utilities → shared components → header
             → home → shop → product detail
   ========================================================================== */

:root {
    --rs-accent: var(--mvs-primary);
    --rs-text: #1a1a1a;
    --rs-border: #e8e9ea;
    --rs-gutter: 50px;
}

@media (max-width: 1199.98px) { :root { --rs-gutter: 30px; } }
@media (max-width: 767.98px)  { :root { --rs-gutter: 20px; } }
@media (max-width: 575.98px)  { :root { --rs-gutter: 16px; } }

/* ==========================================================================
   HOW TO USE (for new pages)
   --------------------------------------------------------------------------
   1. Load this file LAST in <head>:   <link rel="stylesheet" href="responsive.css">
      and before </body>:              <script src="responsive.js"></script>
   2. Breakpoints (desktop-first, max-width):
        xxl ≤ 1399px | xl ≤ 1199px | lg ≤ 991px (tablet, mobile menu kicks in)
        md ≤ 767px   | sm ≤ 575px  | xs ≤ 379px
   3. Mobile menu: copy the header markup from any page of this template
      (.mobile-menu-toggle button, .site-nav#site-nav, .mobile-nav-head,
      .nav-overlay). Submenus become tap-to-open accordions automatically.
   4. Shop-style sidebar: add .filter-drawer#shop-filters to the <aside>,
      a .filter-toggle button, a .filter-close button inside the aside and a
      .filter-overlay after it (see shop.html).
   5. Utility classes below (.rs-grid, .hide-md-down, .table-responsive ...)
      let new sections become responsive without writing new media queries.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Base safety net
   -------------------------------------------------------------------------- */
html {
    -webkit-text-size-adjust: 100%;
}

body {
    overflow-x: hidden;
}

img,
svg,
video,
canvas,
iframe {
    max-width: 100%;
}

input,
select,
textarea,
button {
    max-width: 100%;
}

body.nav-open,
body.filters-open {
    overflow: hidden;
}

/* --------------------------------------------------------------------------
   2. Reusable utilities (for new pages)
   -------------------------------------------------------------------------- */
.rs-container {
    width: 100%;
    max-width: var(--rs-container, 1400px);
    margin: 0 auto;
    padding: 0 var(--rs-gutter);
}

/* Auto grid: <div class="rs-grid rs-cols-4"> → 4 / 3 / 2 / 1 columns */
.rs-grid {
    display: grid;
    gap: var(--rs-gap, 24px);
    grid-template-columns: repeat(var(--rs-cols, 4), minmax(0, 1fr));
}

.rs-cols-2 { --rs-cols: 2; }
.rs-cols-3 { --rs-cols: 3; }
.rs-cols-4 { --rs-cols: 4; }
.rs-cols-5 { --rs-cols: 5; }
.rs-cols-6 { --rs-cols: 6; }

/* Fluid auto-fill grid: <div class="rs-grid-auto" style="--rs-min: 220px"> */
.rs-grid-auto {
    display: grid;
    gap: var(--rs-gap, 24px);
    grid-template-columns: repeat(auto-fill, minmax(min(var(--rs-min, 240px), 100%), 1fr));
}

/* Flex row that stacks on small screens */
.rs-row {
    display: flex;
    gap: var(--rs-gap, 24px);
    flex-wrap: wrap;
}

.rs-row > * {
    flex: 1 1 0;
    min-width: 0;
}

.rs-img {
    display: block;
    width: 100%;
    height: auto;
}

.rs-scroll-x,
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-responsive > table {
    min-width: 560px;
}

.show-lg-down,
.show-md-down,
.show-sm-down {
    display: none !important;
}

/* --------------------------------------------------------------------------
   3. Shared components (hidden on desktop)
   -------------------------------------------------------------------------- */
.mobile-menu-toggle,
.mobile-nav-head,
.filter-toggle,
.filter-close {
    display: none;
}

.mobile-menu-toggle {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border: 1px solid var(--rs-border);
    border-radius: 8px;
    background: #fff;
    color: var(--rs-text);
    font-size: 18px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.mobile-menu-toggle:hover {
    color: var(--rs-accent);
    border-color: var(--rs-accent);
}

.mobile-nav-head {
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--rs-border);
    background: #fff;
}

.mobile-nav-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--rs-text);
}

.mobile-nav-title span {
    color: var(--rs-accent);
}

.mobile-nav-close,
.filter-close {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: #f2f2f2;
    color: var(--rs-text);
    font-size: 16px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.mobile-nav-close:hover,
.filter-close:hover {
    background: var(--rs-accent);
    color: #fff;
}

/* Only shown inside the mobile drawer (see the 991px breakpoint) */
.filter-close {
    display: none;
}

.filter-toggle {
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border: 1px solid var(--rs-accent);
    border-radius: 8px;
    background: #fff;
    color: var(--rs-accent);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-toggle:hover {
    background: var(--rs-accent);
    color: #fff;
}

.nav-overlay,
.filter-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 999;
}

/* ==========================================================================
   4. Generic breakpoints
   ========================================================================== */
@media (max-width: 1199.98px) {
    .rs-cols-5,
    .rs-cols-6 { --rs-cols: 4; }
}

@media (max-width: 991.98px) {
    .hide-lg-down { display: none !important; }
    .show-lg-down { display: revert !important; }

    .rs-cols-4,
    .rs-cols-5,
    .rs-cols-6 { --rs-cols: 3; }

    /* Mobile menu toggle + drawer */
    .mobile-menu-toggle {
        display: inline-flex;
    }

    .mobile-nav-head {
        display: flex;
    }

    .site-nav {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(320px, 86vw);
        max-width: none;
        margin: 0;
        padding: 0;
        background: #fff;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
        transform: translateX(-105%);
        transition: transform 0.35s ease;
        overflow-y: auto;
        overscroll-behavior: contain;
        z-index: 1000;
        display: block;
    }

    body.nav-open .site-nav {
        transform: translateX(0);
    }

    body.nav-open .nav-overlay,
    body.filters-open .filter-overlay {
        opacity: 1;
        visibility: visible;
    }

    /* Filter sidebar → off-canvas drawer */
    .filter-toggle {
        display: inline-flex;
    }

    .filter-close {
        display: inline-flex;
        position: absolute;
        top: 14px;
        right: 14px;
    }

    .filter-drawer {
        position: fixed !important;
        top: 0 !important;
        left: 0;
        bottom: 0;
        width: min(320px, 86vw);
        height: auto !important;
        margin: 0 !important;
        padding-top: 60px !important;
        border-radius: 0 !important;
        overflow-y: auto;
        overscroll-behavior: contain;
        transform: translateX(-105%);
        transition: transform 0.35s ease;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
        z-index: 1000;
    }

    body.filters-open .filter-drawer {
        transform: translateX(0);
    }
}

@media (max-width: 767.98px) {
    .hide-md-down { display: none !important; }
    .show-md-down { display: revert !important; }

    .rs-cols-3,
    .rs-cols-4,
    .rs-cols-5,
    .rs-cols-6 { --rs-cols: 2; }

    .rs-row {
        flex-direction: column;
    }
}

@media (max-width: 575.98px) {
    .hide-sm-down { display: none !important; }
    .show-sm-down { display: revert !important; }

    .rs-grid {
        --rs-gap: 16px;
    }

    .rs-grid.rs-sm-1 { --rs-cols: 1; }
}

@media (max-width: 379.98px) {
    .rs-cols-2,
    .rs-cols-3,
    .rs-cols-4,
    .rs-cols-5,
    .rs-cols-6 { --rs-cols: 1; }
}

/* ==========================================================================
   5. Header (all pages)
   ========================================================================== */
.header-container,
.section-container,
.footer-container {
    padding-left: var(--rs-gutter);
    padding-right: var(--rs-gutter);
}

.navbar-container {
    padding-left: var(--rs-gutter);
    padding-right: var(--rs-gutter);
}

/* Desktop: keep menu labels on one line (8 items incl. Multi-Vendor) */
@media (min-width: 992px) {
    .menu-link {
        white-space: nowrap;
    }
}

@media (min-width: 1200px) and (max-width: 1399.98px) {
    .navbar-container {
        gap: 24px;
    }

    .search-bar {
        width: 260px;
    }

    .menu-items {
        gap: 2px;
    }

    .menu-link {
        padding: 8px 11px;
    }
}

@media (max-width: 1199.98px) {
    .header-container,
    .navbar-container {
        gap: 24px;
    }

    .search-bar {
        width: 220px;
    }

    .menu-items {
        gap: 2px;
    }

    .menu-link {
        padding: 8px 9px;
        font-size: 13px;
    }
}

@media (max-width: 991.98px) {
    .top-banner {
        padding: 8px 16px;
        font-size: 12px;
    }

    /* [☰] [logo] ....... [shop info] [icons] */
    .header {
        padding: 14px 0;
    }

    .header-container {
        flex-direction: row;
        gap: 14px;
    }

    .mobile-menu-toggle {
        order: 1;
    }

    .header-left {
        order: 2;
        flex: 1 1 auto;
        min-width: 0;
    }

    .header-middle {
        order: 3;
        flex: 0 1 auto;
        padding: 0;
        text-align: right;
    }

    .shop-time,
    .shop-phone {
        justify-content: flex-end;
        font-size: 12px;
    }

    .header-right {
        order: 4;
        width: auto;
        justify-content: flex-end;
    }

    .icon-group {
        gap: 12px;
    }

    /* Green bar keeps only the search; menu moves to the drawer */
    .navbar-container {
        flex-direction: row;
        padding-top: 10px;
        padding-bottom: 10px;
    }

    .search-bar {
        flex: 1;
        width: 100%;
    }

    .menu-items.site-nav {
        display: block;
        width: min(320px, 86vw);
        gap: 0;
        text-align: left;
        list-style: none;
    }

    .site-nav .menu-link {
        justify-content: space-between;
        padding: 14px 20px;
        border-radius: 0;
        border-bottom: 1px solid #eee;
        color: #1a1a1a;
        font-size: 15px;
    }

    .site-nav .menu-link i {
        color: inherit;
    }

    .site-nav .menu-link:hover {
        background: var(--mvs-primary-soft);
        color: var(--mvs-primary);
    }

    .site-nav .menu-link:hover i {
        transform: none;
    }

    .site-nav .is-open > .menu-link i {
        transform: rotate(180deg);
    }

    .site-nav .dropdown-menu {
        display: none;
        position: static;
        min-width: 0;
        max-height: none;
        margin: 0;
        padding: 0 0 8px;
        border: none;
        border-radius: 0;
        background: #f8f9fa;
        box-shadow: none;
        opacity: 1;
        visibility: visible;
        transform: none;
    }

    .site-nav .is-open > .dropdown-menu {
        display: block;
    }

    .site-nav .dropdown-link {
        padding-left: 36px;
    }
}

@media (max-width: 767.98px) {
    /* Shop info drops to its own full-width row under logo + icons */
    .header-container {
        flex-wrap: wrap;
        row-gap: 12px;
    }

    .header-middle {
        order: 5;
        flex: 1 1 100%;
        padding: 10px 0 0;
        border-top: 1px solid rgba(0, 0, 0, 0.08);
        text-align: center;
    }

    .shop-info {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 4px 18px;
    }

    .shop-time,
    .shop-phone {
        justify-content: center;
        gap: 6px;
        font-size: 12px;
    }

    .logo {
        font-size: 19px;
    }

    .logo i {
        font-size: 22px;
    }

    .icon-link {
        width: 36px;
        height: 36px;
        font-size: 15px;
    }

    .badge {
        width: 19px;
        height: 19px;
        font-size: 10px;
        top: -6px;
        right: -6px;
    }
}

@media (max-width: 575.98px) {
    .top-banner {
        font-size: 11px;
        line-height: 1.4;
    }

    .header-container {
        gap: 10px;
    }

    .icon-group {
        gap: 10px;
    }

    .logo {
        gap: 8px;
        font-size: 17px;
    }
}

@media (max-width: 379.98px) {
    .logo i {
        display: none;
    }
}

/* ==========================================================================
   6. Home page
   ========================================================================== */
@media (max-width: 1199.98px) {
    .carousel-slide {
        gap: 40px;
        padding: 0 var(--rs-gutter);
    }

    .carousel-controls {
        padding: 0 var(--rs-gutter);
    }

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

@media (max-width: 991.98px) {
    .carousel-section {
        padding: 48px 0;
    }

    .carousel-slide {
        gap: 32px;
    }

    .image-placeholder {
        height: 340px;
    }

    .slide-title {
        font-size: 30px;
    }

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

    .trending-grid,
    .sale-items {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

    .newsletter-form {
        flex-direction: row;
    }

    .newsletter-form .btn-primary {
        width: auto;
    }

    .footer-content {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 767.98px) {
    /* Carousel: stacked, text first then image */
    .carousel-section {
        padding: 40px 0;
    }

    .carousel-slide .carousel-content {
        order: 1;
        width: 100%;
    }

    .carousel-slide:nth-child(n) .carousel-image {
        order: 2;
        width: 100%;
    }

    .slide-text {
        text-align: center;
    }

    .slide-description {
        margin-left: auto;
        margin-right: auto;
    }

    .slide-features {
        align-items: center;
    }

    .image-placeholder {
        height: 260px;
        max-width: 100%;
        margin: 0 auto;
    }


    .carousel-controls {
        margin-top: 32px;
    }

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

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

    /* Banner cards stay horizontal until phones */
    .banner-card {
        flex-direction: row;
        text-align: left;
        padding: 20px;
    }

    .footer-content {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 575.98px) {
    .slide-title {
        font-size: 24px;
    }

    .slide-subtitle {
        font-size: 15px;
    }

    .slide-features {
        gap: 8px;
        margin-bottom: 22px;
    }

    .carousel-slide .btn {
        padding: 12px 28px;
        font-size: 14px;
    }

    .image-placeholder {
        height: 200px;
    }


    .featured-menu,
    .popular-categories,
    .trending-items,
    .flash-sale,
    .newsletter {
        padding: 40px 0;
    }

    .section-header h2,
    .sale-header h2 {
        font-size: 22px;
    }

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

    .category-icon {
        font-size: 38px;
    }

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

    .menu-image {
        height: 180px;
    }

    .menu-info {
        padding: 18px;
    }

    .trending-grid,
    .sale-items {
        gap: 12px;
    }

    .trending-image {
        height: 140px;
    }

    .sale-image {
        height: 120px;
    }

    .banner-card {
        flex-direction: column;
        text-align: center;
    }

    .newsletter h2 {
        font-size: 22px;
    }

    .newsletter-form {
        flex-direction: column;
    }

    .newsletter-form .btn-primary {
        width: 100%;
    }

    .footer {
        padding-top: 20px;
    }

    .footer-content {
        grid-template-columns: minmax(0, 1fr);
        padding: 32px 0;
    }
}

@media (max-width: 379.98px) {
    .trending-grid,
    .sale-items {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* ==========================================================================
   7. Shop page
   ========================================================================== */
@media (max-width: 1199.98px) {
    .shop-container {
        grid-template-columns: 240px 1fr;
        gap: 28px;
    }

    .shop-toolbar {
        flex-direction: row;
        align-items: center;
    }

    .toolbar-right {
        width: auto;
    }
}

@media (max-width: 991.98px) {
    .shop-container {
        grid-template-columns: minmax(0, 1fr);
    }

    .shop-sidebar.filter-drawer {
        padding: 60px 22px 22px !important;
        border: none;
        background: #fff;
    }

    .shop-toolbar {
        flex-wrap: wrap;
        gap: 12px;
    }

    .toolbar-left {
        flex: 1 1 auto;
    }

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

@media (max-width: 767.98px) {
    .shop-section {
        padding: 40px 0;
    }

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

    .pagination {
        flex-wrap: wrap;
    }
}

@media (max-width: 575.98px) {
    .toolbar-left {
        order: 3;
        flex: 0 0 100%;
    }

    .toolbar-right {
        margin-left: auto;
    }

    .toolbar-right label {
        display: none;
    }

    .products-wrapper .products-grid {
        gap: 12px;
    }

    .products-wrapper .product-image {
        height: 140px;
    }

    .products-wrapper .product-info {
        padding: 12px;
    }

    .products-wrapper .product-footer {
        flex-wrap: wrap;
    }
}

@media (max-width: 379.98px) {
    .products-wrapper .products-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* ==========================================================================
   8. Product detail page
   ========================================================================== */
@media (max-width: 1199.98px) {
    .product-detail-wrapper {
        grid-template-columns: 1fr 1fr;
        gap: 40px;
    }

    .main-image {
        height: 440px;
    }

    .product-title {
        font-size: 30px;
    }
}

@media (max-width: 991.98px) {
    .product-detail-section {
        padding: 40px 0;
    }

    .product-detail-wrapper {
        grid-template-columns: minmax(0, 1fr);
        gap: 32px;
    }

    .main-image {
        height: 400px;
    }

    .review-summary {
        grid-template-columns: minmax(0, 1fr);
    }

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

@media (max-width: 767.98px) {
    .main-image {
        height: 320px;
    }

    /* [quantity] / [add to cart ........][♥] */
    .product-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .action-buttons {
        flex-direction: row;
        min-width: 0;
    }

    .btn-large {
        width: auto;
    }

    .btn-wishlist {
        width: 52px;
        height: auto;
        min-height: 52px;
        flex: 0 0 52px;
        border-radius: 50%;
    }

    .tabs-header {
        overflow-x: auto;
        scrollbar-width: none;
    }

    .tabs-header::-webkit-scrollbar {
        display: none;
    }

    .tab-btn {
        flex-shrink: 0;
    }
}

@media (max-width: 575.98px) {
    .main-image {
        height: 260px;
    }

    .main-image i {
        font-size: 70px;
    }

    .product-title {
        font-size: 24px;
    }

    .price {
        font-size: 28px;
    }

    .detail-label {
        min-width: 100px;
    }

    .btn-large {
        padding: 14px 18px;
        font-size: 15px;
    }

    .btn-wishlist {
        border-radius: 12px;
    }

    .product-additional {
        flex-wrap: wrap;
        gap: 10px;
    }

    .tabs-content {
        padding: 18px;
    }

    .tab-content h3 {
        font-size: 20px;
    }

    .score-number {
        font-size: 44px;
    }

    .related-products-grid {
        gap: 12px;
    }
}

@media (max-width: 379.98px) {
    .related-products-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}
