﻿
/* Category Header */
.category-header {
    position: sticky;
    top: 0;
    z-index: 60;
    background: #f9f7f4;
    border-bottom: 1px solid rgba(0, 0, 0, 0.12);
}

.category-header-inner {
    width: 100%;
    padding: 0.45rem 1.25rem;
    display: flex;
    align-items: center;
    background-color:ghostwhite;
    gap: 1.5rem;
    min-width: 0;
}

.category-header-name {
    flex: 0 0 auto;
    font-size: 1.15rem;
    font-weight: 950;
    color: #111827;
    white-space: nowrap;
    text-decoration: none;
    letter-spacing: -0.01em;
}

    .category-header-name:hover {
        color: #111827;
    }

.category-header-nav {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.15rem;
}

    .category-header-nav::-webkit-scrollbar {
        height: 6px;
    }

    .category-header-nav::-webkit-scrollbar-thumb {
        background: rgba(0, 0, 0, 0.18);
        border-radius: 999px;
    }

.category-header-link {
    flex: 0 0 auto;
    font-weight: 800;
    font-size: 0.92rem;
    padding: 0.35rem 0.55rem;
    border-radius: 10px;
    border: 1px solid transparent;
    white-space: nowrap;
    opacity: 0.95;
    color: #111827;
    text-decoration: none;
    transition: background 120ms ease, border-color 120ms ease, opacity 120ms ease;
}

    .category-header-link:hover {
        background: rgba(0, 0, 0, 0.06);
        border-color: rgba(0, 0, 0, 0.12);
        opacity: 1;
        color: #111827;
    }

    .category-header-link.active {
        background: rgba(0, 0, 0, 0.08);
        border-color: rgba(0, 0, 0, 0.15);
        opacity: 1;
        color: #111827;
    }

/* Main Content */
.main-container {
    max-width: 1500px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    gap: 2rem;
}

/* Sidebar Filters */
.sidebar {
    width: 280px;
    flex-shrink: 0;
}

.filter-section {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.filter-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.filter-group {
    margin-bottom: 1.5rem;
}

    .filter-group:last-child {
        margin-bottom: 0;
    }

.filter-group-title {
    font-weight: 600;
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
    color: var(--text-light);
}

.filter-option {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: var(--transition);
}

    .filter-option:hover {
        color: var(--secondary-color);
    }

    .filter-option input {
        margin-right: 0.5rem;
        cursor: pointer;
    }

    .filter-option label {
        cursor: pointer;
        font-size: 0.9rem;
    }

.price-range {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.price-input {
    width: 80px;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.9rem;
}

.apply-filters-btn {
    width: 100%;
    padding: 0.75rem;
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 1rem;
}

    .apply-filters-btn:hover {
        background-color: #e88900;
    }

/* Products Section */
.products-section {
    flex: 1;
}

.active-subcategory-heading {
    font-weight: 900;
    font-size: 1.35rem;
    margin: 0 0 1rem;
    letter-spacing: -0.01em;
    color: #111827;
}

.products-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
}

.results-count {
    font-size: 0.95rem;
    color: var(--text-light);
}

.sort-dropdown {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: white;
    cursor: pointer;
    font-size: 0.9rem;
    outline: none;
}

/* Product Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
}

.level2-section {
    margin-bottom: 2rem;
}

.level2-section + .level2-section {
    padding-top: 2rem;
    border-top: 1px solid rgba(226, 232, 240, 0.9);
}

.level2-section-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2rem;
}

.level2-category-block {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.level2-category-title {
    font-weight: 900;
    font-size: 1.05rem;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem;
}

.level2-category-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: rgba(15, 23, 42, 0.65);
}

.level2-products-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.5rem;
}

/* Subcategory Grid */
.subcategory-grid-section {
    margin-bottom: 1.5rem;
}

.subcategory-grid-heading {
    font-weight: 900;
    font-size: 1.25rem;
    margin-bottom: 0.85rem;
    letter-spacing: -0.01em;
}

.subcategory-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1rem;
}

.subcategory-grid-card {
    text-decoration: none;
    color: inherit;
    max-width:125px;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: transform 160ms ease;
}

    .subcategory-grid-card:hover {
        transform: translateY(-3px);
    }

.subcategory-grid-img-wrap {
    width: 100%;
    max-width: 125px;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    background: #e8f5e9;
    border: 1px solid #d1d5db;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .subcategory-grid-img-wrap img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

.subcategory-grid-placeholder {
    font-size: 2.5rem;
    color: rgba(17, 24, 39, 0.18);
    font-weight: 900;
}

.subcategory-grid-label {
    margin-top: 0.55rem;
    font-weight: 700;
    font-size: 0.88rem;
    text-align: center;
    line-height: 1.3;
}

@media (max-width: 768px) {
    .subcategory-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.75rem;
    }

    .level2-section-grid {
        grid-template-columns: 1fr;
    }

    .level2-products-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .subcategory-grid-label {
        font-size: 0.78rem;
    }

@media (max-width: 480px) {
    .level2-products-grid {
        grid-template-columns: 1fr;
    }
}
}

.product-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    cursor: pointer;
    position: relative;
}

    .product-card:hover {
        transform: translateY(-4px);
        box-shadow: var(--shadow-lg);
    }

.product-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--secondary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    z-index: 1;
}

.product-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    background: #f8fafc;
    transition: var(--transition);
}

.product-card:hover .product-image {
    transform: scale(1.05);
}

.product-info {
    padding: 1rem;
}

.product-title {
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
    color: #0f1111;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.product-rating {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.stars {
    color: #ffa500;
    font-size: 0.9rem;
}

.rating-count {
    color: var(--text-light);
    font-size: 0.85rem;
}

.product-price {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.current-price {
    font-size: 1.25rem;
    font-weight: 600;
    color: #b12704;
}

.original-price {
    font-size: 0.9rem;
    color: var(--text-light);
    text-decoration: line-through;
}

.discount {
    color: #b12704;
    font-size: 0.85rem;
    font-weight: 600;
}

.prime-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: #00a8e1;
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.add-to-cart {
    width: 100%;
    padding: 0.75rem;
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
}

    .add-to-cart:hover {
        background-color: #232f3e;
    }

/* Infinite Scroll Sentinel */
.scroll-sentinel {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2.5rem 0;
    grid-column: 1 / -1;
}

.scroll-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top-color: #111827;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.scroll-end {
    text-align: center;
    padding: 2rem 0 1rem;
    font-size: 0.9rem;
    color: rgba(15, 23, 42, 0.45);
    font-weight: 600;
    grid-column: 1 / -1;
}

/* Quick View Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

    .modal.active {
        display: flex;
    }

.modal-content {
    background: white;
    border-radius: 8px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: white;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    z-index: 1;
}

.modal-body {
    display: flex;
    padding: 2rem;
    gap: 2rem;
}

.modal-image {
    flex: 1;
    max-width: 400px;
}

    .modal-image img {
        width: 100%;
        border-radius: 8px;
    }

.modal-info {
    flex: 1;
}

.modal-title {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.modal-price {
    font-size: 1.75rem;
    color: #b12704;
    font-weight: 600;
    margin-bottom: 1rem;
}

.modal-description {
    color: var(--text-light);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.modal-actions {
    display: flex;
    gap: 1rem;
}

.btn-primary {
    flex: 1;
    padding: 1rem;
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1rem;
}

    .btn-primary:hover {
        background-color: #e88900;
    }

.btn-secondary {
    flex: 1;
    padding: 1rem;
    background-color: white;
    color: var(--accent-color);
    border: 2px solid var(--accent-color);
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1rem;
}

    .btn-secondary:hover {
        background-color: var(--accent-color);
        color: white;
    }

/* Responsive Design */
@media (max-width: 1024px) {
    .main-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
    }

    .filter-section {
        display: flex;
        flex-wrap: wrap;
        gap: 1rem;
    }

    .filter-group {
        flex: 1;
        min-width: 200px;
    }
}

@media (max-width: 768px) {
    .category-header {
        display: none;
    }

    .header-content {
        flex-direction: column;
        gap: 1rem;
    }

    .search-bar {
        width: 100%;
    }

    .category-header-inner {
        gap: 1rem;
        padding: 0.45rem 0.75rem;
    }

    .category-header-name {
        font-size: 1rem;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 1rem;
    }

    .modal-body {
        flex-direction: column;
    }
}

/* Loading Animation */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }

    100% {
        background-position: 1000px 0;
    }
}

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
}
