/* ============================================
   AliExpress Shop Theme - Responsive Styles
   ============================================ */

/* Large Desktop (1200px+) */
@media (max-width: 1400px) {
    .container {
        max-width: 1200px;
    }

    .hero-grid {
        grid-template-columns: 220px 1fr 260px;
    }

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

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

/* Desktop (992px - 1199px) */
@media (max-width: 1199px) {
    .container {
        max-width: 960px;
    }

    .hero-grid {
        grid-template-columns: 200px 1fr;
    }

    .hero-deals {
        display: none;
    }

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

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

    .shop-layout {
        grid-template-columns: 240px 1fr;
    }
}

/* Tablet (768px - 991px) */
@media (max-width: 991px) {
    .container {
        max-width: 720px;
    }

    .header-inner {
        flex-wrap: wrap;
        height: auto;
        padding: 12px 0;
        gap: 16px;
    }

    .header-search {
        order: 3;
        max-width: 100%;
        width: 100%;
    }

    .hero-grid {
        grid-template-columns: 1fr;
    }

    .hero-sidebar {
        display: none;
    }

    .banner-slider {
        height: 300px;
    }

    .products-carousel {
        -webkit-overflow-scrolling: touch;
    }

    .products-carousel .product-card {
        width: 220px;
        flex: 0 0 220px;
    }

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

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

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

    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
    }

    .newsletter-inner {
        flex-direction: column;
        text-align: center;
    }

    .newsletter-form {
        max-width: 100%;
    }

    .shop-layout {
        grid-template-columns: 1fr;
    }

    .shop-sidebar {
        display: none;
    }

    .nav-inner {
        gap: 12px;
    }

    .primary-menu {
        display: none;
    }

    .mega-menu {
        width: 100%;
        left: 0;
    }

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

/* Mobile (576px - 767px) */
@media (max-width: 767px) {
    .container {
        padding: 0 16px;
    }

    .top-bar {
        display: none;
    }

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

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

    .header-actions {
        gap: 12px;
    }

    .action-item span {
        display: none;
    }

    .main-navigation {
        display: none;
    }

    .banner-slider {
        height: 250px;
    }

    .banner-content {
        padding: 24px;
    }

    .banner-title {
        font-size: var(--font-size-xl);
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

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

    /* Grid cards flex to their column; carousel cards MUST keep a fixed
       width or the flex row sizes each card to its image's intrinsic
       dimensions — which is what made mobile carousel images all
       different sizes. Scope width:auto to grids only. */
    .products-grid .product-card {
        width: auto;
    }

    .products-carousel {
        gap: 12px;
        scroll-padding-left: 16px;
    }

    .products-carousel .product-card {
        width: 180px;
        flex: 0 0 180px;
    }

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

    .section-title {
        font-size: var(--font-size-lg);
    }

    .promo-banner {
        padding: 40px 24px;
    }

    .promo-content h2 {
        font-size: var(--font-size-xl);
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .payment-methods {
        flex-direction: column;
        gap: 12px;
    }

    .footer-bottom {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }

    .single-product-wrapper,
    .product-tabs-wrapper,
    .related-products-section {
        padding: 24px;
    }

    .shop-toolbar {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .error-title {
        font-size: 80px;
    }

    .carousel-nav {
        display: none;
    }
}

/* Small Mobile (below 576px) */
@media (max-width: 575px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .products-carousel {
        gap: 8px;
    }

    .products-carousel .product-card {
        width: 160px;
        flex: 0 0 160px;
    }

    .product-card {
        border-radius: 6px;
    }

    .product-info {
        padding: 12px;
    }

    .product-title {
        font-size: var(--font-size-sm);
    }

    .sale-price {
        font-size: var(--font-size-md);
    }

    .btn-add-cart {
        padding: 8px 12px;
        font-size: var(--font-size-sm);
    }

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

    .category-card {
        padding: 16px;
    }

    .category-image {
        width: 60px;
        height: 60px;
    }

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

    .btn-subscribe {
        width: 100%;
    }

    .countdown-timer {
        gap: 4px;
    }

    .timer-value {
        font-size: var(--font-size-xl);
        padding: 6px 8px;
        min-width: 40px;
    }

    .banner-slider {
        height: 200px;
    }

    .banner-content {
        padding: 16px;
    }

    .banner-title {
        font-size: var(--font-size-lg);
    }

    .btn-banner {
        padding: 8px 20px;
        font-size: var(--font-size-sm);
    }

    .feature-item {
        padding: 12px;
    }

    .feature-icon {
        font-size: 24px;
        width: 40px;
        height: 40px;
    }

    .feature-text h4 {
        font-size: var(--font-size-sm);
    }

    .feature-text p {
        font-size: var(--font-size-sm);
    }

    .promo-banner {
        padding: 30px 16px;
    }

    .promo-content h2 {
        font-size: var(--font-size-lg);
    }

    .promo-content p {
        font-size: var(--font-size-base);
    }

    .btn-promo {
        padding: 12px 28px;
        font-size: var(--font-size-sm);
    }

    .section-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .woocommerce-breadcrumb {
        padding: 12px 16px;
        font-size: var(--font-size-sm);
    }

    .shop-content .page-title {
        font-size: var(--font-size-lg);
    }

    .single-product-wrapper,
    .product-tabs-wrapper,
    .related-products-section {
        padding: 16px;
    }

    .error-title {
        font-size: 60px;
    }

    .error-content h2 {
        font-size: var(--font-size-lg);
    }

    .error-content p {
        font-size: var(--font-size-sm);
    }

    .btn-primary {
        padding: 12px 24px;
        font-size: var(--font-size-sm);
    }
}

/* Touch Device Optimizations */
@media (hover: none) {
    .product-card:hover {
        transform: none;
    }

    .product-card:hover .product-image img {
        transform: none;
    }

    .category-card:hover {
        transform: none;
    }

    .btn-add-cart:hover,
    .btn-wishlist:hover,
    .btn-banner:hover,
    .btn-deals:hover,
    .btn-promo:hover,
    .btn-primary:hover,
    .btn-subscribe:hover,
    .btn-view-details:hover {
        transform: none;
    }
}

/* High DPI / Retina Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .product-image img,
    .banner-slide img,
    .category-image img {
        image-rendering: -webkit-optimize-contrast;
    }
}

/* Print Styles */
@media print {
    .top-bar,
    .site-header,
    .main-navigation,
    .footer-newsletter,
    .site-footer,
    .hero-section,
    .features-bar,
    .flash-deals-section,
    .categories-section,
    .promo-banner-section,
    .recently-viewed-section,
    .shop-sidebar,
    .product-actions,
    .carousel-nav,
    .btn-add-cart,
    .btn-wishlist,
    .btn-banner,
    .btn-deals,
    .btn-promo,
    .btn-primary,
    .btn-subscribe,
    .btn-view-details,
    .view-all,
    .flash-deals-link,
    .categories-toggle,
    .social-links,
    .payment-methods,
    .footer-bottom-links {
        display: none !important;
    }

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

    .product-card {
        box-shadow: none;
        border: 1px solid #ddd;
    }

    body {
        background: white;
    }

    a {
        text-decoration: none;
        color: black;
    }
}
