/* ==================================
   SHOP PAGE - COMPLETE RESPONSIVE
   Fixed: Footer loop, Performance, Cards Responsive, Grid Layout
   ================================== */

.shop-page {
    padding: 40px 0 80px;
    min-height: 60vh;
}

/* Shop Header */
.shop-header {
    text-align: center;
    margin-bottom: 40px;
}

.shop-header h1 {
    font-size: 42px;
    color: var(--murad-dark);
    margin-bottom: 10px;
}

.shop-header p {
    font-size: 18px;
    color: #666;
}

/* Shop Layout */
.shop-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 40px;
    align-items: start;
}

/* ===========================
   FILTERS SIDEBAR
   =========================== */
.filters-sidebar {
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    position: sticky;
    top: 100px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.filters-header {
    padding: 20px;
    background: linear-gradient(135deg, var(--murad-primary), var(--murad-accent));
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.filters-header h3 {
    margin: 0;
    font-size: 18px;
    color: #fff;
}

.filters-close {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
}

.filter-group {
    padding: 20px;
    border-bottom: 1px solid #f0f0f0;
}

.filter-group:last-child {
    border-bottom: none;
}

.filter-group h4 {
    font-size: 15px;
    color: var(--murad-dark);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.filter-group h4 i {
    color: var(--murad-primary);
    font-size: 16px;
}

/* Price Filter */
.price-inputs {
    display: flex;
    gap: 10px;
    align-items: center;
}

.price-inputs input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
}

.price-inputs input:focus {
    outline: none;
    border-color: var(--murad-primary);
}

.price-inputs span {
    color: #999;
    font-weight: 600;
}

/* Categories List */
.categories-list {
    max-height: 250px;
    overflow-y: auto;
}

.categories-list::-webkit-scrollbar {
    width: 6px;
}

.categories-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.categories-list::-webkit-scrollbar-thumb {
    background: var(--murad-primary);
    border-radius: 10px;
}

.filter-checkbox {
    display: flex;
    align-items: center;
    padding: 10px 0;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-checkbox:hover {
    color: var(--murad-primary);
}

.filter-checkbox input {
    margin-left: 10px;
    cursor: pointer;
    width: 18px;
    height: 18px;
}

.filter-checkbox span {
    font-size: 14px;
}

/* Filter Switch */
.filter-switch {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 10px 0;
}

.filter-switch input[type="checkbox"] {
    position: absolute;
    opacity: 0;
}

.switch-slider {
    width: 50px;
    height: 26px;
    background: #ccc;
    border-radius: 13px;
    position: relative;
    transition: all 0.3s;
}

.switch-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: all 0.3s;
}

.filter-switch input:checked + .switch-slider {
    background: var(--murad-primary);
}

.filter-switch input:checked + .switch-slider::before {
    transform: translateX(24px);
}

.switch-label {
    font-size: 14px;
}

/* Filter Actions */
.filter-actions {
    padding: 20px;
    display: flex;
    gap: 10px;
    background: #f8f9fa;
}

.filter-actions button {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.filter-actions .btn-primary {
    background: var(--murad-primary);
    color: #fff;
}

.filter-actions .btn-primary:hover {
    background: var(--murad-accent);
}

.filter-actions .btn-secondary {
    background: #fff;
    color: var(--murad-dark);
    border: 2px solid #e0e0e0;
}

.filter-actions .btn-secondary:hover {
    border-color: var(--murad-dark);
}

/* ===========================
   TOOLBAR
   =========================== */
.shop-toolbar {
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.results-info {
    font-weight: 600;
    color: var(--murad-dark);
}

.toolbar-controls select {
    padding: 10px 15px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    background: #fff;
}

/* ===========================
   PRODUCTS - FIXED GRID
   =========================== */
.products-container {
    min-height: 400px;
    width: 100%;
}

.woocommerce ul.products {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 30px !important;
    list-style: none !important;
    padding: 0 !important;
    margin: 0 0 40px 0 !important;
    width: 100% !important;
}

/* تنظيف أي floats من WooCommerce */
.woocommerce ul.products::before,
.woocommerce ul.products::after {
    display: none !important;
}

.woocommerce ul.products li.product {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s;
    margin: 0 !important;
    width: 100% !important;
    float: none !important;
    display: flex !important;
    flex-direction: column !important;
}

.woocommerce ul.products li.product:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.woocommerce ul.products li.product img {
    width: 100%;
    height: 320px;
    object-fit: cover;
    display: block;
}

.woocommerce ul.products li.product .woocommerce-loop-product__title {
    font-size: 17px;
    padding: 20px 20px 10px;
    margin: 0;
    line-height: 1.4;
}

.woocommerce ul.products li.product .price {
    padding: 0 20px 20px;
    font-size: 20px;
    font-weight: 700;
    color: var(--murad-primary);
    margin: 0;
}

.woocommerce ul.products li.product .button {
    display: block;
    width: calc(100% - 40px);
    margin: 0 20px 20px;
    padding: 12px;
    background: var(--murad-primary);
    color: #fff;
    text-align: center;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
}

.woocommerce ul.products li.product .button:hover {
    background: var(--murad-accent);
}

/* Loading State */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    font-size: 18px;
    color: var(--murad-primary);
}

.loading i {
    margin-left: 10px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* No Products */
.no-products-found {
    text-align: center;
    padding: 80px 20px;
}

.no-products-found i {
    font-size: 48px;
    color: #ccc;
    margin-bottom: 15px;
}

.no-products-found h3 {
    font-size: 22px;
    color: var(--murad-dark);
    margin-bottom: 10px;
}

.no-products-found p {
    color: #666;
}

/* ===========================
   MOBILE FILTER BUTTON
   =========================== */
.mobile-filter-btn {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--murad-primary);
    color: #fff;
    border: none;
    padding: 15px 25px;
    border-radius: 30px;
    box-shadow: 0 5px 20px rgba(230, 126, 34, 0.4);
    cursor: pointer;
    z-index: 999;
    font-weight: 600;
    font-size: 15px;
    align-items: center;
    gap: 8px;
}

.mobile-filter-btn:active {
    transform: scale(0.95);
}

.mobile-filter-btn i {
    font-size: 16px;
}

.filter-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
}

.filter-overlay.show {
    display: block;
}

/* ===========================
   RESPONSIVE
   =========================== */

/* شاشات كبيرة جداً - 4 أعمدة */
@media (min-width: 1400px) {
    .woocommerce ul.products {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 35px !important;
    }
    
    .woocommerce ul.products li.product img {
        height: 350px;
    }
}

/* شاشات كبيرة */
@media (min-width: 1200px) and (max-width: 1399px) {
    .woocommerce ul.products li.product img {
        height: 300px;
    }
}

/* Tablet: 769px - 1024px */
@media (max-width: 1024px) {
    .shop-layout {
        grid-template-columns: 250px 1fr;
        gap: 30px;
    }
    
    .woocommerce ul.products {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 25px !important;
    }
    
    .woocommerce ul.products li.product img {
        height: 280px;
    }
}

/* Mobile & Small Tablets: max 768px */
@media (max-width: 768px) {
    .shop-page {
        padding: 30px 0 60px;
    }
    
    .shop-header h1 {
        font-size: 32px;
    }
    
    .shop-header p {
        font-size: 16px;
    }
    
    /* Single column layout */
    .shop-layout {
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    /* Hide sidebar, show via mobile button */
    .filters-sidebar {
        position: fixed;
        right: -100%;
        top: 0;
        height: 100vh;
        width: 320px;
        max-width: 85vw;
        z-index: 9999;
        transition: right 0.3s ease;
        border-radius: 0;
        max-height: 100vh;
    }
    
    .filters-sidebar.show {
        right: 0;
    }
    
    .filters-close {
        display: block;
    }
    
    /* Show mobile button */
    .mobile-filter-btn {
        display: flex;
    }
    
    /* Products: 2 columns */
    .woocommerce ul.products {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 15px !important;
    }
    
    .woocommerce ul.products li.product img {
        height: 200px;
    }
    
    .woocommerce ul.products li.product .woocommerce-loop-product__title {
        font-size: 15px;
        padding: 15px 15px 10px;
    }
    
    .woocommerce ul.products li.product .price {
        font-size: 18px;
        padding: 0 15px 15px;
    }
    
    .woocommerce ul.products li.product .button {
        width: calc(100% - 30px);
        margin: 0 15px 15px;
        padding: 10px;
        font-size: 14px;
    }
    
    .shop-toolbar {
        flex-direction: column;
        gap: 15px;
    }
    
    .toolbar-controls {
        width: 100%;
    }
    
    .toolbar-controls select {
        width: 100%;
    }
}

/* Small Mobile: max 480px */
@media (max-width: 480px) {
    .shop-header h1 {
        font-size: 28px;
    }
    
    /* Single column products */
    .woocommerce ul.products {
        grid-template-columns: 1fr !important;
    }
    
    .woocommerce ul.products li.product img {
        height: 250px;
    }
    
    .filters-sidebar {
        width: 100%;
        max-width: 100%;
    }
    
    .mobile-filter-btn {
        padding: 12px 20px;
        font-size: 14px;
    }
}

/* Prevent body scroll when filters open */
body.no-scroll {
    overflow: hidden;
}