/* ==========================================================================
   Responsive Styles
   Mobile-First Approach
   ========================================================================== */

/* -------------------------
   Base Mobile Styles (< 576px)
   Already in main components - these are overrides
   ------------------------- */

/* Body lock when mobile menu is open */
body.mobile-menu-open {
    overflow: hidden;
}

/* Typography adjustments for small screens */
@media (max-width: 575px) {
    h1 {
        font-size: var(--text-3xl);
    }

    h2 {
        font-size: var(--text-2xl);
    }

    h3 {
        font-size: var(--text-xl);
    }
}

/* -------------------------
   Small Tablets (≥ 576px)
   ------------------------- */

@media (min-width: 576px) {
    /* Typography adjustments */
    h1 {
        font-size: var(--text-4xl);
    }
}

/* -------------------------
   Tablets (≥ 768px)
   ------------------------- */

@media (min-width: 768px) {
    /* Two column layouts */
    .grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* -------------------------
   Small Laptops (≥ 992px)
   ------------------------- */

@media (min-width: 992px) {
    /* Show desktop navigation */
    .site-header__nav {
        display: flex;
    }

    .site-header__icons {
        display: flex;
    }

    .site-header__toggle {
        display: none;
    }

    /* Three column layouts */
    .grid-3 {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* -------------------------
   Small Desktops / 720p Monitors (992px - 1199px)
   ------------------------- */

@media (min-width: 992px) and (max-width: 1199px) {
    /* Three column layouts maintained */
    .grid-3 {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Reduce section spacing */
    .section--products,
    .section--testimonials,
    .section--sales {
        padding: var(--space-12) 0;
    }
}

/* -------------------------
   Desktops (≥ 1200px)
   ------------------------- */

@media (min-width: 1200px) {
    /* Four column layouts */
    .grid-4 {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* -------------------------
   Large Desktops (≥ 1400px)
   ------------------------- */

@media (min-width: 1400px) {
    /* Additional large screen adjustments */
}

/* -------------------------
   Full Design Width (≥ 1920px)
   ------------------------- */

@media (min-width: 1920px) {
    /* Max-width containers centered */
    .container--full {
        max-width: var(--container-max);
        margin-left: auto;
        margin-right: auto;
    }
}

/* ==========================================================================
   Component-Specific Responsive Overrides
   ========================================================================== */

/* -------------------------
   Header Responsive
   ------------------------- */

@media (max-width: 991px) {
    .site-header__inner {
        padding: 0 var(--space-4);
    }

    .site-logo__text {
        font-size: var(--text-xl);
    }

    .site-logo__tagline {
        font-size: var(--text-xs);
    }
}

/* -------------------------
   Footer Responsive
   ------------------------- */

@media (max-width: 767px) {
    .footer-main {
        padding: var(--space-10) var(--space-4);
    }

    .footer-main__inner {
        gap: var(--space-8);
    }

    .footer-logo__text {
        font-size: var(--text-2xl);
    }

    .footer-logo__tagline {
        font-size: var(--text-base);
        width: auto;
    }

    .footer-cta {
        max-width: 100%;
    }

    .footer-bottom {
        padding: var(--space-4);
    }
}

/* -------------------------
   Homepage Responsive
   ------------------------- */

@media (max-width: 991px) {
    /* Hero section */
    .hero {
        padding: var(--space-10) 0;
    }

    .hero__title {
        font-size: var(--text-3xl);
    }

    .hero__subtitle {
        font-size: var(--text-lg);
    }

    /* Category cards stack on mobile */
    .category-cards {
        flex-direction: column;
    }

    .category-card {
        width: 100%;
    }

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

@media (max-width: 575px) {
    /* Products grid - 1 column on very small screens */
    .products-grid--home {
        grid-template-columns: 1fr;
    }

    /* Testimonials - single column on mobile */
    .testimonials-page {
        grid-template-columns: 1fr;
    }
}

/* -------------------------
   Shop Page Responsive
   ------------------------- */

@media (max-width: 991px) {
    .shop-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-4);
    }

    .shop-filters {
        width: 100%;
        flex-wrap: wrap;
    }
}

@media (max-width: 767px) {
    /* 2 products per row */
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-3);
    }

    .product-card__image {
        height: auto;
        aspect-ratio: 1;
    }

    .product-card__title {
        font-size: var(--text-base);
    }

    .product-card__price {
        font-size: var(--text-base);
    }
}

@media (max-width: 400px) {
    /* Single column on very small screens */
    .products-grid {
        grid-template-columns: 1fr;
    }
}

/* -------------------------
   Cart Page Responsive
   ------------------------- */

@media (max-width: 991px) {
    .cart-layout {
        flex-direction: column;
    }

    .cart-table-wrapper {
        width: 100%;
    }

    .cart-totals {
        width: 100%;
    }
}

@media (max-width: 767px) {
    /* Simplified cart table for mobile */
    .cart-table {
        display: block;
    }

    .cart-table thead {
        display: none;
    }

    .cart-table tbody {
        display: flex;
        flex-direction: column;
        gap: var(--space-4);
    }

    .cart-table tr {
        display: grid;
        grid-template-columns: 80px 1fr;
        grid-template-rows: auto auto auto;
        gap: var(--space-2) var(--space-4);
        padding: var(--space-4);
        border: 1px solid var(--color-border-light);
        border-radius: var(--radius-md);
    }

    .cart-table .cart-item__image {
        grid-row: 1 / 4;
    }

    .cart-table .cart-item__name {
        grid-column: 2;
    }

    .cart-table .cart-item__price,
    .cart-table .cart-item__quantity,
    .cart-table .cart-item__subtotal {
        grid-column: 2;
    }

    .cart-table .cart-item__remove {
        position: absolute;
        top: var(--space-2);
        right: var(--space-2);
    }
}

/* -------------------------
   Buttons Responsive
   ------------------------- */

@media (max-width: 575px) {
    .btn {
        padding: var(--space-3) var(--space-6);
        font-size: var(--text-base);
    }

    .btn--large {
        padding: var(--space-4) var(--space-8);
    }
}

/* -------------------------
   Page Header Responsive
   ------------------------- */

@media (max-width: 767px) {
    .page-header {
        padding: var(--space-10) 0;
    }

    .page-title {
        font-size: var(--text-3xl);
    }
}

/* -------------------------
   Form Elements Responsive
   ------------------------- */

@media (max-width: 575px) {
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    input[type="password"],
    textarea,
    select {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* -------------------------
   Utility Classes Responsive
   ------------------------- */

/* Hide on mobile */
@media (max-width: 767px) {
    .hide-mobile {
        display: none !important;
    }
}

/* Hide on desktop */
@media (min-width: 768px) {
    .hide-desktop {
        display: none !important;
    }
}

/* Text alignment responsive */
@media (max-width: 767px) {
    .text-center-mobile {
        text-align: center;
    }

    .text-left-mobile {
        text-align: left;
    }
}

/* Spacing responsive */
@media (max-width: 767px) {
    .mb-mobile-4 {
        margin-bottom: var(--space-4);
    }

    .mb-mobile-8 {
        margin-bottom: var(--space-8);
    }

    .pt-mobile-4 {
        padding-top: var(--space-4);
    }

    .pb-mobile-4 {
        padding-bottom: var(--space-4);
    }
}
