/* 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;
}

/* Header Styles */
.main-header {
    background-color: #8B0000;
    color: white;
    width: 100%;
    padding: 0;
    margin: 0;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
    background-color: #8B0000;
    color: white;
}

.logo img {
    height: 50px;
    width: auto;
}

.search-bar {
    display: flex;
    flex-grow: 1;
    margin: 0 2rem;
    max-width: 500px;
    background: white;
    border-radius: 25px;
    padding: 0.15rem 0.75rem;
}

.search-input {
    width: 100%;
    padding: 0.2rem;
    border: none;
    outline: none;
    font-size: 0.7rem;
    background: transparent;
    color: #333;
    text-align: center;
}

.search-button {
    background: none;
    border: none;
    color: #8B0000;
    cursor: pointer;
    padding: 0.5rem;
    font-size: 1rem;
}

.header-actions {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.header-actions a {
    color: white;
    font-size: 1.2rem;
    opacity: 0.9;
    transition: opacity 0.2s;
}

.header-actions a:hover {
    opacity: 1;
}

.cart-icon, 
.wishlist-icon, 
.profile-icon, 
.logout-icon {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-decoration: none;
}

.cart-badge, 
.wishlist-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: #8B0000;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 12px;
    font-weight: 600;
    display: none;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

/* Navigation Styles */
.main-nav {
    background: #8B0000;
    padding: 0.5rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.main-nav ul {
    display: flex;
    justify-content: center;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.main-nav a {
    text-decoration: none;
    color: white;
    font-weight: 500;
    padding: 0.5rem 0;
    opacity: 0.9;
    transition: opacity 0.2s;
}

.main-nav a:hover,
.main-nav a.active {
    opacity: 1;
}

/* Page Container */
.page-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Main Content Layout */
.main-content {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 1.5rem;
}

/* Sidebar Filters */
.filters-sidebar {
    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;
    width: 200px;
}

.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 {
    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;
}

.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);
}

.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;
}

.price {
    font-size: 1.1rem;
    font-weight: 700;
    color: #8B0000;
}

/* 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;
    }

    .filters-sidebar {
        position: relative;
        top: 0;
        margin: 0;
        width: 100%;
        max-width: none;
        margin-bottom: 1rem;
        padding: 0.75rem;
    }

    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
        margin: 0;
        padding: 0;
    }

    .cart-badge, .wishlist-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: #8B0000;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 12px;
    font-weight: 600;
    display: none;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

.cart-icon, .wishlist-icon {
    position: relative;
    display: flex;
    align-items: center;
}
    
    .header-content {
        flex-wrap: wrap;
    }
    
    .search-bar {
        order: 3;
        width: 100%;
        max-width: none;
    }
    
    .main-nav ul {
        flex-wrap: wrap;
        gap: 1rem;
    }

    .price-inputs {
        justify-content: space-between;
    }

    .price-input {
        width: calc(50% - 1rem);
    }

    .category-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .category-link {
        border: 1px solid #eee;
        border-radius: 4px;
        padding: 0.5rem;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .products-grid {
        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: #8B0000;
}

.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);
    }
}
