/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Montserrat', sans-serif;
}

body {
    background-color: #f8f9fa;
    color: #333;
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

/* Search-bar */
.search-wrapper {
    z-index: 200;
    width: 100%;
    display: flex;
    justify-content: flex-end;
    padding: 0 20px 10px 0;
}

.search {
    width: 320px;
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 999px;
    padding: 6px;
    box-shadow: 0 6px 18px rgba(15,20,30,0.06);
    border: 1px solid rgba(16,24,40,0.06);
    transition: box-shadow .15s ease, transform .08s ease;
}

.search:focus-within {
    box-shadow: 0 10px 30px rgba(15,20,30,0.12);
    transform: translateY(-1px);
}

.search input {
    border: none;
    outline: none;
    padding: 10px 12px 10px 16px;
    font-size: 14px;
    background: transparent;
    width: 260px;
    max-width: 40vw;
}

.search input::placeholder { color: #9aa3b2; }

.search button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    border: none;
    background: transparent;
    cursor: pointer;
}

@media (max-width: 480px) {
    .search {
        width: 220px;
    }
}

/* Page Container */
.page-container {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 2rem;
}

/* Main Content Layout */
.main-content {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 1.5rem;
    margin-top: 25px;
}

.products-grid {
    opacity: 1;
    transition: opacity 0.3s ease;
}

.product-card {
    cursor: pointer;
    transition: transform 0.2s ease;
}

.product-card:hover {
    transform: translateY(-5px);
}

/* Sidebar Filters */
.filters-sidebar {
    display: grid;
    background: white;
    border-radius: 8px;
    padding: 1rem;
    height: fit-content;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    position: sticky;
    top: 1rem;
    margin-left: 0;
    z-index: 100;
}

.filter-section {
    margin-bottom: 1rem;
}

.filter-section:last-child {
    margin-bottom: 0;
}

.filter-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #333;
    padding-left: 0.25rem;
}

/* Price Filter Styles */
.price-inputs {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-bottom: 1rem;
}

.price-input {
    width: 85px;
    padding: 0.35rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.85rem;
    text-align: left;
    color: #333;
}

.price-slider-container {
    padding: 0.75rem 0.25rem;
    position: relative;
}

.price-slider {
    height: 4px;
    position: relative;
    background: #ddd;
    border-radius: 4px;
}

.slider-track {
    height: 4px;
    position: absolute;
    background: #8B0000;
    border-radius: 4px;
    top: 0;
    bottom: 0;
}

.range-min, .range-max {
    position: absolute;
    width: calc(100% + 16px);
    height: 4px;
    background: none;
    pointer-events: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    left: -8px;
    top: 0;
}

input[type="range"]::-webkit-slider-thumb {
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: #8B0000;
    cursor: pointer;
    -webkit-appearance: none;
    pointer-events: auto;
    margin-top: -6px;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

input[type="range"]::-moz-range-thumb {
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: #8B0000;
    cursor: pointer;
    -moz-appearance: none;
    pointer-events: auto;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Category List */
.category-list {
    list-style: none;
}

.category-link {
    color: #666;
    text-decoration: none;
    padding: 0.35rem 0.25rem;
    display: block;
    transition: color 0.2s;
    font-size: 0.85rem;
    border-bottom: 1px solid #eee;
}

.category-link:last-child {
    border-bottom: none;
}

.category-link:hover,
.category-link.active {
    color: #8B0000;
}

/* Products Section */
.products-section {
    min-height: 500px;
}

/* Product Grid */
/* .products-grid { lama punya
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    transition: opacity 0.3s ease;
    padding-left: 0.5rem;
    position: relative;
    z-index: 1;
    margin-left: 0.5rem;
} */

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.5rem;
    transition: opacity 0.3s ease;
    padding-left: 0.5rem;
    position: relative;
    z-index: 1;
    margin-left: 0.5rem;
}


.product-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 260px;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.product-image-container {
    position: relative;
    padding-top: 100%;
    background: #f8f9fa;
    overflow: hidden;
}

.product-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.product-card:hover .product-image {
    transform: scale(1.05);
}

.product-info {
    padding: 1rem;
}

.brand {
    font-size: 0.875rem;
    color: #666;
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

/* .product-name {
    font-size: 0.95rem;
    color: #333;
    line-height: 1.4;
    margin-bottom: 0.75rem;
    height: 2.8em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
} */

.product-name {
    font-size: 0.95rem;
    color: #333;
    line-height: 1.4;
    margin-bottom: 0.75rem;
    height: 2.8em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.price {
    font-size: 1.1rem;
    font-weight: 700;
    color: #ed0018;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 992px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}


/* No Results Message */
.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.no-results p {
    color: #666;
    font-size: 1.1rem;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.product-card, .no-results {
    animation: fadeIn 0.5s ease forwards;
    cursor: pointer;
}

/* Product Modal Styles */
.product-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    overflow-y: auto;
}

.modal-content {
    position: relative;
    background-color: white;
    margin: 2rem auto;
    max-width: 900px;
    width: 90%;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.close-modal {
    position: absolute;
    right: 1rem;
    top: 1rem;
    font-size: 2rem;
    color: #666;
    cursor: pointer;
    z-index: 1;
}

.close-modal:hover {
    color: #333;
}

.modal-product-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    padding: 2rem;
}

.modal-product-image {
    position: relative;
    padding-top: 100%;
    background: #f8f9fa;
    border-radius: 8px;
    overflow: hidden;
}

.modal-product-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.modal-product-info {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.modal-product-brand {
    font-size: 1rem;
    color: #666;
    text-transform: uppercase;
    font-weight: 600;
}

.modal-product-name {
    font-size: 1.5rem;
    color: #333;
    margin: 0;
}

.modal-product-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: #ed0018;
}

.modal-product-description {
    margin-top: 1rem;
}

.modal-product-description h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.modal-product-description ul {
    list-style: none;
    padding: 0;
}

.modal-product-description li {
    padding: 0.5rem 0;
    color: #666;
    border-bottom: 1px solid #eee;
}

.modal-product-actions {
    margin-top: auto;
    display: flex;
    gap: 1rem;
    align-items: center;
}

.quantity-selector {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.quantity-btn {
    background: none;
    border: none;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 1.2rem;
    color: #666;
}

.quantity-btn:hover {
    color: #333;
}

.quantity-input {
    width: 50px;
    text-align: center;
    border: none;
    border-left: 1px solid #ddd;
    border-right: 1px solid #ddd;
    padding: 0.5rem;
}

.add-to-cart-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background-color: #8B0000;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.add-to-cart-btn:hover {
    background-color: #6a0000;
}

@media (max-width: 768px) {
    .modal-product-details {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        margin: 1rem;
        width: calc(100% - 2rem);
    }
}

@media (max-width: 480px) {

    /* Page padding */
    .page-container {
        padding: 1rem;
    }

    /* Search bar */
    .search-wrapper {
        justify-content: right;
        padding: 0;
        margin-bottom: 1rem;
    }

    .search {
        width: 100%;
        max-width: 100%;
        padding: 4px 8px;
    }

    .search input {
        width: 100%;
        font-size: 13px;
    }

    .search button {
        width: 36px;
        height: 36px;
    }

    /* Main layout → stacked vertically */
    .main-content {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

    /* Filters sidebar becomes collapsible panel */
    .filters-sidebar {
        position: relative;
        top: 0;
        box-shadow: none;
        border-radius: 6px;
        padding: 0.75rem;
    }

    .filter-section {
        margin-bottom: 1rem;
    }

    .filter-title {
        font-size: 0.95rem;
    }

    .price-inputs {
        gap: 0.5rem;
    }

    .price-input {
        width: 100%;
        flex: 1;
    }

    /* Category links: grid layout for compact look */
    .category-list {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .category-link {
        border: 1px solid #eee;
        border-radius: 4px;
        padding: 0.3rem 0.5rem;
        font-size: 0.8rem;
    }

    /* Products grid: two product per row */
    .products-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
        padding: 0;
        margin: 0;
    }

    /* Product card: slightly smaller padding */
    .product-card {
        max-width: 100%;
        border-radius: 6px;
    }

    .product-info {
        padding: 0.75rem;
    }

    .brand {
        font-size: 0.75rem;
    }

    .product-name {
        font-size: 0.75rem;
        line-height: 1.3;
        margin-bottom: 0.5rem;
    }

    .price {
        font-size: 0.7rem;
    }

    /* No-results message */
    .no-results {
        padding: 2rem 1rem;
        font-size: 0.9rem;
    }

    /* Modal tweaks for mobile */
    .modal-content {
        width: 95%;
        margin: 1rem auto;
        border-radius: 6px;
    }

    .modal-product-details {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 1rem;
    }

    .modal-product-name {
        font-size: 1.2rem;
    }

    .modal-product-price {
        font-size: 1.2rem;
    }

    .add-to-cart-btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }

    /* Quantity input smaller */
    .quantity-selector {
        font-size: 0.9rem;
    }
}