/* ================================================
   SAGMART — Comprehensive Responsive CSS (v2.0)
   Mobile-first & cross-device optimization
   ================================================ */

/* ------------------------------------------------
   1. Large Desktop (1440px+)
   ------------------------------------------------ */
@media (min-width: 1440px) {
    :root {
        --container-padding: 3rem;
    }
    .hero-heading {
        font-size: 4rem;
    }
    .page-container {
        max-width: 1320px;
        margin: 0 auto;
    }
}

/* ------------------------------------------------
   2. Desktop (1200px - 1439px)
   ------------------------------------------------ */
@media (max-width: 1439px) {
    .hero-float-badge--customers {
        right: -10px;
    }
    .hero-float-badge--rating {
        left: -10px;
    }
}

/* ------------------------------------------------
   3. Tablet Landscape / Small Desktop (992px - 1199px)
   ------------------------------------------------ */
@media (max-width: 1199px) {
    .primary-menu .menu-item > a {
        padding: 8px 10px;
        font-size: 13px;
    }
    .products-grid--5 {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    .sustainability-grid {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
    }
    .yt-cards-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    .hero-inner {
        gap: 2rem;
    }
    .hero-heading {
        font-size: 2.75rem;
    }
}

/* ------------------------------------------------
   4. Tablet Portrait (768px - 991px)
   ------------------------------------------------ */
@media (max-width: 991px) {
    :root {
        --container-padding: 1.5rem;
        --space-20: 3.5rem;
        --space-16: 3rem;
    }

    /* Header & Nav */
    .header-nav {
        display: none !important;
    }
    .mobile-menu-toggle {
        display: flex !important;
    }
    .header-logo {
        width: auto;
        max-width: 155px;
    }
    .header-logo img,
    .header-logo .custom-logo,
    .header-logo-img {
        max-height: 38px;
        max-width: 150px;
    }

    /* Hero Section */
    .hero-inner {
        flex-direction: column-reverse;
        text-align: center;
        padding: 2rem 0;
        gap: 1.5rem;
    }
    .hero-content {
        align-items: center;
        max-width: 100%;
        text-align: center;
    }
    .hero-image-wrap {
        width: 100%;
        max-width: 360px;
        margin: 0 auto;
    }
    .hero-heading {
        font-size: 2.25rem;
    }
    .hero-description {
        font-size: 1rem;
        max-width: 500px;
        margin-left: auto;
        margin-right: auto;
    }
    .hero-actions {
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    .hero-float-badge {
        display: none;
    }
    .hero-trust-badges {
        justify-content: center;
        flex-wrap: wrap;
    }

    /* Sustainability */
    .sustainability-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    .sustainability-image-col {
        order: -1;
    }
    .sustainability-image {
        max-height: 320px;
        object-fit: cover;
        width: 100%;
    }
    .sustainability-content-col {
        text-align: center;
    }

    /* Products Grid */
    .products-grid--5 {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: var(--space-4) !important;
    }

    /* Promo Cards */
    .promo-cards-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem;
    }

    /* Stats Grid */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-6);
    }

    /* Footer */
    .footer-main {
        grid-template-columns: 1fr 1fr;
        gap: var(--space-8);
    }
    .footer-brand {
        grid-column: 1 / -1;
    }
    .footer-newsletter {
        grid-column: 1 / -1;
    }

    /* Final CTA */
    .cta-image-wrap {
        margin: 0;
        width: 100%;
        border-radius: 0;
    }
    .cta-image {
        border-radius: 0;
        height: 280px;
    }
    .cta-content-wrap {
        padding: 2.5rem 1rem;
    }
    .cta-heading {
        font-size: 1.75rem !important;
    }

    /* Video & Reels Section */
    .reels-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    .reels-nav-arrows {
        align-self: flex-end;
    }
    .reel-card {
        min-width: 180px;
    }

    .yt-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    .yt-cards-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem;
    }
    .yt-subscribe-btn span {
        display: none;
    }

    /* About & Contact Pages */
    .about-grid {
        grid-template-columns: 1fr !important;
    }
    .values-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    .contact-layout {
        grid-template-columns: 1fr !important;
    }
    .contact-info-boxes {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    .about-tagline {
        font-size: 1.75rem !important;
    }

    /* Shop Page */
    .shop-layout {
        flex-direction: column;
    }
    .shop-sidebar {
        width: 100%;
        margin-bottom: 2rem;
    }

    /* Cart & Checkout */
    .woocommerce-cart .woocommerce {
        display: flex;
        flex-direction: column;
        gap: 2rem;
    }
    .woocommerce-cart-form {
        width: 100% !important;
    }
    .cart-collaterals {
        width: 100% !important;
    }
    .woocommerce-checkout #customer_details {
        grid-template-columns: 1fr;
    }
}

/* ------------------------------------------------
   5. Mobile Standard (under 768px)
   ------------------------------------------------ */
@media (max-width: 767px) {
    :root {
        --container-padding: 1rem;
        --space-20: 2.5rem;
        --space-16: 2rem;
        --space-12: 1.75rem;
        --space-10: 1.5rem;
    }

    /* Announcement Bar */
    .announcement-bar {
        font-size: 11px;
        padding: 6px 0;
    }

    /* Site Header */
    .site-header {
        padding: 0.75rem 0;
    }
    .header-logo .site-wordmark {
        font-size: 1.4rem;
    }

    /* Hero */
    .hero-heading {
        font-size: 1.85rem;
        line-height: 1.2;
    }
    .hero-slider-section {
        min-height: auto;
        padding-bottom: 2rem;
    }
    .hero-image-wrap {
        max-width: 280px;
    }
    .btn-lg {
        padding: 10px 18px;
        font-size: 0.875rem;
    }

    /* Section Headers */
    .section-title {
        font-size: 1.5rem;
    }
    .section-pad {
        padding: var(--space-10) 0;
    }
    .section-subtitle {
        font-size: 0.85rem;
    }

    /* Promo Grid */
    .promo-cards-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }
    .promo-card-inner {
        min-height: 220px;
    }
    .promo-card-heading {
        font-size: 1.25rem;
    }

    /* Products Grid */
    .products-grid--5 {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.65rem !important;
    }
    .product-card-info {
        padding: 0.75rem !important;
    }
    .product-card-title {
        font-size: 0.85rem !important;
        white-space: normal;
    }
    .product-card-price {
        font-size: 0.95rem !important;
    }
    .product-card-atc {
        font-size: 0.75rem !important;
        padding: 8px 10px !important;
    }

    /* Reels Carousel */
    .reel-card {
        min-width: 155px;
    }
    .reel-title {
        font-size: 0.8rem;
    }
    .reel-product-pill {
        padding: 5px 8px;
    }
    .product-tag-title {
        font-size: 0.7rem;
    }
    .product-tag-price {
        font-size: 0.7rem;
    }
    .section-view-more-btn {
        font-size: 0.78rem;
        padding: 8px 14px;
    }

    /* YouTube Videos */
    .yt-cards-grid {
        grid-template-columns: 1fr !important;
        gap: 1.25rem;
    }
    .yt-video-title {
        font-size: 0.9rem;
    }

    /* About Us & Contact */
    .values-grid {
        grid-template-columns: 1fr !important;
    }
    .about-tagline {
        font-size: 1.45rem !important;
    }
    .about-lead {
        font-size: 0.95rem !important;
    }
    .about-col {
        padding: 1.25rem !important;
    }
    .contact-info-boxes {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    .contact-box {
        padding: 1.25rem !important;
    }
    .contact-info {
        padding: 1.25rem !important;
    }

    /* Stats Grid */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem;
    }
    .stat-number {
        font-size: 1.75rem !important;
    }
    .stat-label {
        font-size: 0.8rem !important;
    }

    /* Footer */
    .footer-main {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    .footer-links-cols {
        grid-template-columns: 1fr 1fr;
        gap: 1.5rem;
    }
    .footer-bottom {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    /* Cart Page Mobile Table */
    .woocommerce-cart-form table.shop_table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .woocommerce-cart-form table.shop_table thead {
        display: none;
    }
    .woocommerce-cart-form table.shop_table tbody tr.cart_item {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        padding: 1rem 0;
        border-bottom: 1px solid var(--color-border);
        gap: 0.5rem;
        position: relative;
    }
    .woocommerce-cart-form table.shop_table td {
        display: inline-flex;
        border: none !important;
        padding: 4px 6px;
    }
    .woocommerce-cart-form table.shop_table td.product-remove {
        position: absolute;
        top: 0.5rem;
        right: 0;
    }
    .woocommerce-cart-form table.shop_table td.product-thumbnail img {
        width: 65px;
        height: 65px;
        object-fit: cover;
        border-radius: 8px;
    }
    .woocommerce-cart-form table.shop_table td.product-name {
        flex: 1 1 50%;
        font-weight: 600;
        font-size: 0.9rem;
    }
    .woocommerce-cart-form table.shop_table td.product-price,
    .woocommerce-cart-form table.shop_table td.product-quantity,
    .woocommerce-cart-form table.shop_table td.product-subtotal {
        font-size: 0.85rem;
    }

    /* Modals */
    .sagmart-modal-container {
        width: 95vw !important;
        max-height: 90vh;
        border-radius: var(--radius-lg);
    }
    .sagmart-modal-container.is-reel-modal {
        width: 90vw !important;
        height: 80vh !important;
    }
}

/* ------------------------------------------------
   6. Extra Small Mobile (under 390px)
   ------------------------------------------------ */
@media (max-width: 390px) {
    .header-container {
        gap: 0.5rem;
    }
    .header-actions {
        gap: 2px;
    }
    .header-action-btn {
        width: 34px;
        height: 34px;
    }
    .site-wordmark {
        font-size: 1.2rem;
    }
    .hero-heading {
        font-size: 1.6rem;
    }
    .products-grid--5 {
        gap: 0.45rem !important;
    }
    .product-card-title {
        font-size: 0.78rem !important;
    }
    .product-card-atc {
        font-size: 0.7rem !important;
        padding: 6px 8px !important;
    }
    .reel-card {
        min-width: 140px;
    }
    .stats-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ------------------------------------------------
   7. Accessibility, Focus, Print & Motion
   ------------------------------------------------ */
*:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
    border-radius: 4px;
}

.skip-link {
    position: absolute;
    top: -100px;
    left: var(--space-4);
    z-index: 9999;
    background: var(--color-accent);
    color: white;
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: var(--font-weight-semibold);
    text-decoration: none;
    transition: top 200ms ease;
}
.skip-link:focus {
    top: var(--space-4);
}

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

@media print {
    .site-header, .announcement-bar, .hero-float-badge,
    .mobile-menu-overlay, .mobile-menu-toggle, .header-search-bar,
    .category-scroll-btn, .product-card-wishlist, .footer-social,
    .footer-newsletter, .cta-stats-bar {
        display: none !important;
    }
    body {
        font-size: 12pt;
        color: black;
        background: white;
    }
}

/* Loading state for ATC */
.product-card-atc.loading {
    opacity: 0.7;
    pointer-events: none;
    position: relative;
}
.product-card-atc.loading::after {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* WooCommerce notices */
.woocommerce-store-notice, .demo_store {
    background: var(--color-accent) !important;
    font-family: var(--font-primary) !important;
}

/* Custom scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--color-bg-alt);
}
::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--color-muted);
}
