/* Amazon Category Mobile Responsive Styles */
/* Mobile-first responsive design for Amazon-style category pages */

/* Base Mobile Styles (320px and up) */
@media (max-width: 767px) {

    /* Layout Adjustments */
    .amazon-category-container {
        padding: 8px;
        gap: 12px;
    }

    .category-layout {
        display: flex;
        flex-direction: column;
        gap: 16px;
    }

    .main-content .container-fluid {
        padding: 0 8px;
    }

    .amazon-category-breadcrumb {
        padding: 8px 12px;
        font-size: 12px;
        margin-bottom: 8px;
    }

    .amazon-category-breadcrumb a {
        padding: 4px 6px;
    }

    /* Mobile Filter Toggle */
    .mobile-filter-toggle {
        display: flex;
        align-items: center;
        justify-content: end;
        gap: 8px;
        width: 100%;
        padding: 12px 16px;
        background: #fff;
        border: none;
        border-radius: 8px;
        font-size: 14px;
        font-weight: 600;
        color: #0f1111;
        cursor: pointer;
        margin-bottom: 12px;
        transition: all 0.2s ease;
    }

    .mobile-filter-toggle:hover {
        background-color: #f7f8f8;
        border-color: #c7c7c7;
    }

    .mobile-filter-toggle svg {
        width: 18px;
        height: 18px;
        fill: currentColor;
    }

    /* Hide desktop filter sidebar */
    .filter-sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 85%;
        max-width: 320px;
        height: 100vh;
        background: #fff;
        z-index: 1000;
        overflow-y: auto;
        transition: left 0.3s ease;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }

    .filter-sidebar.active {
        left: 0;
    }

    /* Mobile Filter Header */
    .amazon-category-mobile-filter-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 16px 20px;
        background: #fff;
        border-bottom: 1px solid #e7e7e7;
        position: sticky;
        top: -80px;
        z-index: 10;
    }

    .amazon-category-mobile-filter-title {
        font-size: 18px;
        font-weight: 600;
        color: #0f1111;
        margin: 0;
    }

    .amazon-category-mobile-filter-close {
        background: none;
        border: none;
        padding: 8px;
        cursor: pointer;
        border-radius: 50%;
        transition: background-color 0.2s ease;
    }

    .amazon-category-mobile-filter-close:hover {
        background-color: #f0f0f0;
    }

    .amazon-category-mobile-filter-close svg {
        width: 24px;
        height: 24px;
        fill: #565959;
    }

    /* Filter Overlay */
    .mobile-filter-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .mobile-filter-overlay.active {
        display: block;
        opacity: 1;
    }

    /* Prevent body scroll when sidebar is open */
    body.sidebar-open {
        overflow: hidden;
    }

    /* Main Content Area */
    .products-section {
        width: 100%;
        padding: 0;
    }

    .category-header {
        margin-bottom: 0px;
        padding: 0px;
    }

    select#sortSelect {
        text-align: end;
        border: 0;
    }

    button#mobileFilterToggle {
        width: auto;
    }

    .sort-select:focus {
        outline: none;
        box-shadow: none !important;
    }

    aside#filterSidebar {
        padding-top: 0px;
    }

    .category-info {
        margin-bottom: 12px;
    }

    .category-title {
        font-size: 24px;
        margin-bottom: 8px;
    }

    .category-description {
        font-size: 14px;
        color: #565959;
        line-height: 1.4;
    }

    .amazon-category-main {
        width: 100%;
    }

    /* Results Toolbar */
    .amazon-category-results-toolbar {
        flex-direction: column;
        gap: 12px;
        padding: 12px;
        background: #f7f8f8;
        border-radius: 8px;
        margin-bottom: 12px;
    }

    .amazon-category-results-info {
        order: 2;
        text-align: center;
    }

    .amazon-category-results-count {
        font-size: 13px;
    }

    .amazon-category-sort-controls {
        order: 1;
        justify-content: center;
    }

    .amazon-category-sort-select {
        width: 100%;
        max-width: 200px;
        padding: 10px 12px;
        font-size: 14px;
    }

    /* Products Grid */
    .amazon-category-products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        padding: 0;
    }

    /* Product Cards */
    .amazon-category-product-card {
        padding: 8px;
        border-radius: 6px;
    }

    .amazon-category-product-image {
        height: 120px;
        margin-bottom: 6px;
    }

    .amazon-category-product-image img {
        border-radius: 4px;
    }

    .amazon-category-product-brand {
        font-size: 10px;
        margin-bottom: 2px;
    }

    .amazon-category-product-name {
        font-size: 12px;
        line-height: 1.3;
        margin-bottom: 4px;
        -webkit-line-clamp: 2;
    }

    .amazon-category-product-rating {
        margin-bottom: 4px;
    }

    .amazon-category-rating-stars {
        gap: 1px;
    }

    .amazon-category-rating-stars .star {
        font-size: 10px;
    }

    .amazon-category-rating-count {
        font-size: 10px;
    }

    .amazon-category-product-price {
        margin-bottom: 6px;
    }

    .amazon-category-price-current {
        font-size: 14px;
    }

    .amazon-category-price-original {
        font-size: 11px;
    }

    .amazon-category-price-discount {
        font-size: 10px;
        padding: 1px 4px;
    }

    .amazon-category-product-delivery {
        font-size: 10px;
        margin-bottom: 6px;
    }

    .amazon-category-product-actions {
        gap: 4px;
    }

    .amazon-category-action-btn {
        padding: 6px;
        border-radius: 4px;
    }

    .amazon-category-action-btn svg {
        width: 14px;
        height: 14px;
    }

    .amazon-category-add-to-cart {
        padding: 8px 12px;
        font-size: 12px;
        border-radius: 6px;
    }

    /* Active Filters */
    .amazon-category-active-filters {
        padding: 8px 12px;
        margin-bottom: 12px;
    }

    .amazon-category-active-filters-header {
        margin-bottom: 8px;
    }

    .amazon-category-active-filters-label {
        font-size: 12px;
    }

    .amazon-category-clear-all-active {
        font-size: 11px;
        padding: 2px 6px;
    }

    .amazon-category-active-filters-list {
        gap: 6px;
    }

    .amazon-category-active-filter-item {
        font-size: 11px;
        padding: 4px 8px;
        border-radius: 16px;
    }

    /* Pagination */
    .amazon-category-pagination {
        padding: 12px;
        text-align: center;
    }

    .amazon-category-load-more {
        width: 100%;
        padding: 12px 16px;
        font-size: 14px;
    }

    /* Loading Spinner */
    .amazon-category-loading-spinner {
        padding: 20px;
    }

    .amazon-category-spinner {
        width: 32px;
        height: 32px;
    }

    /* No Products */
    .amazon-category-no-products {
        padding: 20px 12px;
        text-align: center;
    }

    .amazon-category-no-products h3 {
        font-size: 16px;
        margin-bottom: 8px;
    }

    .amazon-category-no-products p {
        font-size: 13px;
        margin-bottom: 12px;
    }

    .amazon-category-clear-filters-btn {
        padding: 10px 16px;
        font-size: 13px;
    }
}

/* Small Mobile Devices (320px - 480px) */
@media (max-width: 480px) {
    .amazon-category-container {
        padding: 4px;
        gap: 8px;
    }

    /* Single Column Product Grid */
    .amazon-category-products-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .amazon-category-product-card {
        display: flex;
        gap: 12px;
        padding: 12px;
    }

    .amazon-category-product-image {
        width: 80px;
        height: 80px;
        flex-shrink: 0;
        margin-bottom: 0;
    }

    .amazon-category-product-content {
        flex: 1;
        display: flex;
        flex-direction: column;
    }

    .amazon-category-product-name {
        font-size: 13px;
        -webkit-line-clamp: 3;
        margin-bottom: 6px;
    }

    .amazon-category-product-actions {
        margin-top: auto;
        justify-content: flex-end;
    }

    /* Filter Sections */
    .filter-section {
        margin-bottom: 16px;
        padding-bottom: 50px;
    }

    .filter-section-title {
        font-size: 14px;
    }

    /* Price Filter Adjustments */
    .price-inputs {
        flex-direction: column;
        gap: 8px;
    }

    .price-separator {
        text-align: center;
        margin: 0;
    }

    .price-quick-filters {
        gap: 4px;
    }

    .price-quick-btn {
        padding: 8px 10px;
        font-size: 12px;
    }

    /* Brand List */
    .brand-list {
        max-height: 150px;
    }

    /* Mobile Filter Actions */
    .mobile-filter-actions {
        padding: 12px 16px;
        margin: 0 -16px;
    }

    .apply-filters-btn {
        padding: 14px 16px;
        font-size: 15px;
    }
}

/* Tablet Portrait (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    .amazon-category-container {
        padding: 12px;
        gap: 16px;
    }

    /* Show sidebar but make it collapsible */
    .amazon-category-sidebar {
        width: 280px;
    }

    .amazon-category-main {
        flex: 1;
    }

    /* 3 column grid for tablets */
    .amazon-category-products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }

    .amazon-category-product-card {
        padding: 12px;
    }

    .amazon-category-product-image {
        height: 160px;
    }

    .amazon-category-product-name {
        font-size: 13px;
        -webkit-line-clamp: 2;
    }

    /* Hide mobile filter toggle */
    .amazon-category-mobile-filter-toggle {
        display: none;
    }
}

/* Landscape Mobile (480px - 767px) */
@media (min-width: 481px) and (max-width: 767px) {

    /* 3 column grid for landscape mobile */
    .amazon-category-products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .amazon-category-product-card {
        padding: 8px;
    }

    .amazon-category-product-image {
        height: 100px;
    }

    .amazon-category-product-name {
        font-size: 11px;
        -webkit-line-clamp: 2;
    }

    .amazon-category-price-current {
        font-size: 12px;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {

    /* Larger touch targets */
    .filter-section-header {
        padding: 12px 8px;
        margin: 0 -8px;
    }

    .filter-checkbox-label {
        padding: 8px 4px;
        margin: 0 -4px;
    }

    .rating-filter-label {
        padding: 10px 4px;
        margin: 0 -4px;
    }

    .amazon-category-action-btn {
        min-width: 44px;
        min-height: 44px;
    }

    .clear-all-filters,
    .clear-all-active,
    .show-more-brands {
        padding: 8px 12px;
        min-height: 44px;
    }

    /* Remove hover effects on touch devices */
    .amazon-category-product-card:hover {
        transform: none;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }

    .filter-checkbox-label:hover,
    .rating-filter-label:hover,
    .filter-section-header:hover {
        background-color: transparent;
    }
}

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

    .amazon-category-spinner {
        border-width: 3px;
    }
}

/* Dark Mode Support for Mobile */
@media (prefers-color-scheme: dark) {
    @media (max-width: 767px) {
        .amazon-category-mobile-filter-toggle {
            background: #1a1a1a;
            border-color: #333;
            color: #fff;
        }

        .amazon-category-mobile-filter-header {
            background: #ffffff;
            border-bottom-color: #333;
            color: black;
        }

        .amazon-category-mobile-filter-title {
            color: #000000;
        }

        .amazon-category-filter-overlay {
            background: rgba(0, 0, 0, 0.8);
        }

        .amazon-category-results-toolbar {
            background: #1a1a1a;
        }
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .amazon-category-sidebar {
        transition: none;
    }

    .amazon-category-filter-overlay {
        transition: none;
    }

    .amazon-category-product-card {
        transition: none;
    }

    .amazon-category-action-btn {
        transition: none;
    }
}


@media (max-width: 768px) {
    .mobile-filter-actions {

        bottom: 60px !important;


    }

    .filter-section-content .price-inputs {
        display: none;
    }

}



/* Print Styles */
@media print {

    .amazon-category-mobile-filter-toggle,
    .amazon-category-sidebar,
    .amazon-category-filter-overlay,
    .amazon-category-product-actions,
    .amazon-category-pagination {
        display: none !important;
    }

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

    .amazon-category-product-card {
        border: 1px solid #ccc;
        break-inside: avoid;
    }
}

/* Accessibility Improvements for Mobile */
@media (max-width: 767px) {

    /* Focus indicators */
    .amazon-category-mobile-filter-toggle:focus {
        outline: 2px solid #007185;
        outline-offset: 2px;
    }

    .amazon-category-mobile-filter-close:focus {
        outline: 2px solid #007185;
        outline-offset: 2px;
    }

    /* Screen reader improvements */
    .amazon-category-mobile-filter-toggle[aria-expanded="true"] {
        background-color: #e3f2fd;
        border-color: #007185;
    }

    /* Skip link for mobile */
    .amazon-category-skip-to-products {
        position: absolute;
        top: -40px;
        left: 6px;
        background: #007185;
        color: white;
        padding: 8px;
        text-decoration: none;
        border-radius: 4px;
        z-index: 1001;
        transition: top 0.3s;
    }

    .amazon-category-skip-to-products:focus {
        top: 6px;
    }
}