/* ========================================
   SHOP PAGE STYLES - MOBILE FIRST
   ======================================== */

/* Shop Page Container */
.shop-page {
    padding: 30px 0 60px;
    background: #f8f9fa;
    min-height: 100vh;
}

/* ========================================
   SHOP HEADER
   ======================================== */

.shop-header {
    background: white;
    padding: 25px 20px;
    border-radius: 12px;
    margin-bottom: 25px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.shop-header-content {
    margin-bottom: 15px;
}

.shop-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.shop-subtitle {
    color: #666;
    font-size: 0.95rem;
}

/* Mobile Filter Toggle */
.mobile-filter-toggle {
    width: 100%;
    padding: 14px 20px;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.mobile-filter-toggle:active {
    transform: scale(0.98);
}

.mobile-filter-toggle i {
    font-size: 18px;
}

.active-filters-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ff4444;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
}

/* ========================================
   SHOP LAYOUT
   ======================================== */

.shop-content {
    display: flex;
    gap: 30px;
    position: relative;
}

/* ========================================
   SIDEBAR FILTERS - MOBILE FIRST
   ======================================== */

.shop-sidebar {
    position: fixed;
    left: -100%;
    top: 0;
    width: 90%;
    max-width: 350px;
    height: 100vh;
    background: white;
    z-index: 10002; /* Above header and overlay when active */
    overflow-y: auto;
    transition: left 0.3s ease;
    box-shadow: 2px 0 15px rgba(0,0,0,0.1);
    padding-bottom: 80px;
}

.shop-sidebar.active {
    left: 0;
}

/* Mobile Filter Header */
.mobile-filter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
}

.mobile-filter-header h3 {
    font-size: 1.3rem;
    color: var(--primary-color);
    margin: 0;
}

.mobile-filter-close {
    width: 36px;
    height: 36px;
    border: none;
    background: #f8f9fa;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    color: var(--primary-color);
}

/* Filter Sections */
.filter-section {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.filter-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 15px;
}

/* Search Box */
.search-box {
    display: flex;
    gap: 10px;
}

.search-input {
    flex: 1;
    padding: 12px;
    border: 2px solid #e0e0e0;
    font-size: 15px;
    transition: border-color 0.3s;
    width: 80%;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-color);
}

.search-btn {
    width: 20%;
    background: var(--accent-color);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 18px;
    transition: background 0.3s;
}

.search-btn:active {
    background: var(--primary-color);
}

/* Filter Options */
.filter-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.filter-checkbox {
    display: flex;
    align-items: center;
    cursor: pointer;
    position: relative;
    padding-left: 35px;
    user-select: none;
    font-size: 15px;
    color: #333;
}

.filter-checkbox input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.checkmark {
    position: absolute;
    left: 0;
    height: 22px;
    width: 22px;
    background-color: white;
    border: 2px solid #ddd;
    transition: all 0.3s;
}

.filter-checkbox:hover .checkmark {
    border-color: var(--accent-color);
}

.filter-checkbox input:checked ~ .checkmark {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 6px;
    top: 2px;
    width: 6px;
    height: 11px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.filter-checkbox input:checked ~ .checkmark:after {
    display: block;
}

/* Price Range */
.price-range-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.price-input {
    flex: 1;
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
}

.price-input:focus {
    outline: none;
    border-color: var(--accent-color);
}

.price-separator {
    color: #999;
    font-weight: 600;
}

.btn-apply-price {
    width: 100%;
    padding: 12px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-apply-price:active {
    background: var(--accent-color);
}

/* Filter Actions */
.filter-actions {
    padding: 20px;
    display: flex;
    gap: 12px;
    position: sticky;
    bottom: 0;
    background: white;
    border-top: 1px solid #e0e0e0;
}

.btn-clear-filters,
.btn-apply-mobile {
    flex: 1;
    padding: 14px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-clear-filters {
    background: #f8f9fa;
    color: var(--primary-color);
    border: 2px solid #e0e0e0;
}

.btn-apply-mobile {
    background: var(--accent-color);
    color: white;
    display: none; /* Show only on mobile when filters active */
}

/* ========================================
   MAIN PRODUCTS AREA
   ======================================== */

.shop-main {
    flex: 1;
    width: 100%;
}

/* Toolbar */
.shop-toolbar {
    background: white;
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.toolbar-left {
    flex: 1;
    min-width: 200px;
}

.products-count {
    font-size: 14px;
    color: #666;
    margin: 0;
}

.products-count span {
    font-weight: 600;
    color: var(--primary-color);
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Sort Dropdown */
.sort-select {
    padding: 10px 35px 10px 15px;
    border: 2px solid #e0e0e0;
    font-size: 14px;
    background: white;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

/* View Toggle */
.view-toggle {
    display: none; /* Hidden on mobile, show on desktop */
    gap: 5px;
}

.view-btn {
    width: 38px;
    height: 38px;
    border: 2px solid #e0e0e0;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #666;
    transition: all 0.3s;
}

.view-btn.active {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

/* Active Filters Display */
.active-filters {
    background: white;
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.active-filters h4 {
    font-size: 14px;
    color: #666;
    margin: 0 10px 0 0;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #f0f0f0;
    border-radius: 20px;
    font-size: 13px;
    color: var(--primary-color);
}

.filter-chip i {
    cursor: pointer;
    color: #999;
    font-size: 12px;
}

/* ========================================
   PRODUCTS GRID
   ======================================== */

.products-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

/* Loading State */
.loading-products {
    grid-column: 1;
    text-align: center;
    padding: 60px 20px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* No Products */
.no-products {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 12px;
}

.no-products i {
    font-size: 60px;
    color: #ddd;
    margin-bottom: 20px;
}

.no-products h3 {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.no-products p {
    color: #666;
    margin-bottom: 25px;
}
.btn-clear-filters {
    background: var(--accent-color);
    width: auto;
    padding: 10px 25px;
    align-self: flex-start;
    color: white;
    border: none;
    border-radius: 0px;
}

.btn-clear-filters:hover {
    background: var(--primary-color);
}


/* ========================================
   PAGINATION
   ======================================== */

.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.page-btn {
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border: 2px solid #e0e0e0;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    color: var(--primary-color);
    transition: all 0.3s;
}

.page-btn:active {
    transform: scale(0.95);
}

.page-btn.active {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========================================
   RESPONSIVE - TABLET (768px+)
   ======================================== */

@media (min-width: 768px) {
    .shop-page {
        padding: 40px 0 80px;
    }
    
    .shop-header {
        padding: 30px 25px;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .shop-header-content {
        margin-bottom: 0;
    }
    
    .shop-title {
        font-size: 2.2rem;
    }
    
    .mobile-filter-toggle {
        width: auto;
        padding: 12px 25px;
    }
    
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .view-toggle {
        display: flex;
    }
    
    .sort-select {
        min-width: 200px;
    }
}

/* ========================================
   RESPONSIVE - DESKTOP (1024px+)
   ======================================== */

@media (min-width: 1024px) {
    /* Hide mobile filter toggle */
    .mobile-filter-toggle {
        display: none;
    }
    
    /* Show sidebar as static column */
    .shop-sidebar {
        position: static;
        width: 280px;
        height: auto;
        flex-shrink: 0;
        border-radius: 12px;
        overflow: visible;
        padding-bottom: 0;
        box-shadow: 0 2px 10px rgba(0,0,0,0.08);
        z-index: 1; /* Reset z-index for desktop - should not overlap header */
    }
    
    .mobile-filter-header {
        display: none;
    }
    
    .filter-actions {
        position: static;
    }
    
    .btn-apply-mobile {
        display: none;
    }
    
    .products-grid {
        grid-template-columns: repeat(3, 1fr); /* Changed from 4 to 3 */
        gap: 20px;
    }
    
    .shop-toolbar {
        padding: 20px 25px;
    }
}

/* ========================================
   RESPONSIVE - LARGE DESKTOP (1280px+)
   ======================================== */

@media (min-width: 1280px) {
    .shop-sidebar {
        width: 300px;
    }
    
    .products-grid {
        grid-template-columns: repeat(3, 1fr); /* Keep 3 columns even on large screens */
    }
}

/* ========================================
   MOBILE ACCESSIBILITY
   ======================================== */

/* Larger touch targets on mobile */
@media (max-width: 767px) {
    .filter-checkbox {
        padding: 8px 0 8px 35px;
    }
    
    .btn-clear-filters,
    .btn-apply-mobile {
        padding: 16px 20px;
        font-size: 16px;
    }
    
    /* Show apply button when filters are open */
    .shop-sidebar.active .btn-apply-mobile {
        display: block;
    }
}

/* Dark overlay when filters open on mobile */
.shop-sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0,0,0,0.5);
    z-index: 10001; /* Above header, below sidebar */
    display: none;
}

.shop-sidebar-overlay.active {
    display: block;
}