:root {
    /* Theme colors - customizable via CSS variables */
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #10b981;
    --danger-color: #ef4444;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --border-color: #e5e7eb;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
}

* {
    margin: 0;
    /* padding: 0; */
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-secondary);
}

a {
    text-decoration: none;
    color: inherit;
}


/* Header Navigation Bar */
.main-header {
    background: var(--bg-primary);
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
}

.header-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1400px;
    margin: 0 auto;
    padding: 12px 20px;
    gap: 20px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 30px;
}

.header-logo {
    display: flex;
    align-items: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    white-space: nowrap;
}

.header-logo img {
    height: 40px;
    width: auto;
    margin-right: 10px;
}

.header-nav-links {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-nav-links a {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.2s;
}

.header-nav-links a:hover {
    background: var(--bg-secondary);
    color: var(--primary-color);
}

/* Category Dropdown Menu */
.nav-dropdown {
    position: relative;
}

/* Shop by Brand — active filter heading on the product listing */
.brand-listing-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 16px;
}

.nav-dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}

.dropdown-arrow {
    font-size: 0.7rem;
    transition: transform 0.2s;
}

.nav-dropdown:hover .dropdown-arrow {
    transform: rotate(180deg);
}

.nav-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s ease;
    z-index: 1000;
}

.nav-dropdown:hover .nav-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Mega Menu Styles */
.mega-menu-list {
    list-style: none;
    padding: 8px 0;
    margin: 0;
}

.mega-menu-item {
    position: relative;
}

.mega-menu-item > a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    color: var(--text-primary);
    font-size: 0.9rem;
    text-decoration: none;
    transition: all 0.15s;
    border-radius: 0;
}

.mega-menu-item > a:hover {
    background: var(--bg-secondary);
    color: var(--primary-color);
}

.mega-menu-item .arrow {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Submenu */
.mega-menu-submenu {
    position: absolute;
    left: 100%;
    top: 0;
    min-width: 200px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    list-style: none;
    padding: 8px 0;
    margin: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateX(10px);
    transition: all 0.2s ease;
}

.mega-menu-item:hover > .mega-menu-submenu {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

/* Level indicators */
.mega-menu-submenu.level-1 {
    border-left: 3px solid var(--primary-color);
}

.mega-menu-submenu.level-2 {
    border-left: 3px solid #10b981;
}

.header-center {
    flex: 1;
    max-width: 600px;
}

.header-search {
    position: relative;
    width: 100%;
}

.header-search input {
    width: 100%;
    padding: 10px 45px 10px 15px;
    font-size: 0.95rem;
    border: 2px solid var(--border-color);
    border-radius: 25px;
    outline: none;
    transition: all 0.3s;
    background: var(--bg-secondary);
}

.header-search input:focus {
    border-color: var(--primary-color);
    background: var(--bg-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.header-search-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 1.2rem;
    pointer-events: none;
}

/* Search Results Dropdown */
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-top: 8px;
    max-height: 400px;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    display: none;
}

.search-results.show {
    display: block;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
    cursor: pointer;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: var(--bg-secondary);
}

.search-result-image {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}

.search-result-icon {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: 6px;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.search-result-content {
    flex: 1;
    min-width: 0;
}

.search-result-title {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-result-type {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.search-result-price {
    font-weight: 600;
    color: var(--primary-color);
    margin-top: 4px;
}

.search-loading,
.search-no-results {
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
}

.search-loading {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-icon-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.2s;
    position: relative;
    color: var(--text-primary);
}

.header-icon-link:hover {
    background: var(--bg-secondary);
    color: var(--primary-color);
}

.header-icon-link i,
.header-icon-link span.icon {
    font-size: 1.5rem;
}

.header-icon-link .icon-label {
    font-size: 0.75rem;
    font-weight: 500;
}

.header-icon-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--danger-color);
    color: white;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

.header-user-menu {
    position: relative;
}

.header-user-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.2s;
    cursor: pointer;
    border: 1px solid var(--border-color);
}

.header-user-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--primary-color);
}

.header-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.header-user-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.header-user-name {
    font-size: 0.9rem;
    font-weight: 500;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Mobile Menu Toggle */
.header-mobile-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
    padding: 8px;
    z-index: 1002;
}

.header-mobile-toggle span {
    width: 24px;
    height: 3px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all 0.3s;
}

.header-mobile-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.header-mobile-toggle.active span:nth-child(2) {
    opacity: 0;
}

.header-mobile-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* Mobile Side Menu */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.mobile-menu-overlay.active {
    display: block;
}

.mobile-side-menu {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100vh;
    background: var(--bg-primary);
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transition: left 0.3s ease;
    overflow-y: auto;
}

.mobile-side-menu.active {
    left: 0;
}

.mobile-menu-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color);
}

.mobile-menu-links {
    display: flex;
    flex-direction: column;
    padding: 10px 0;
}

.mobile-menu-links a {
    padding: 15px 20px;
    color: var(--text-primary);
    font-size: 1rem;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
}

.mobile-menu-links a:hover {
    background: var(--bg-secondary);
    color: var(--primary-color);
}

/* Mobile Category Section */
.mobile-category-section {
    border-bottom: 1px solid var(--border-color);
}

.mobile-category-toggle {
    padding: 15px 20px;
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}

.mobile-category-toggle:hover {
    background: var(--bg-secondary);
}

.mobile-category-list {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

.mobile-category-list a {
    display: block;
    padding: 12px 20px 12px 30px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    text-decoration: none;
    transition: all 0.2s;
}

.mobile-category-list a:hover {
    background: rgba(0,0,0,0.05);
    color: var(--primary-color);
}

/* Mobile Search Toggle */
.mobile-search-toggle {
    display: none;
    padding: 8px;
    cursor: pointer;
    font-size: 1.3rem;
}

.header-center.mobile-search-active {
    display: block !important;
}

/* Responsive Header */
@media (max-width: 1024px) {
    .header-nav-links {
        display: none;
    }
    
    .header-center {
        max-width: 400px;
    }
}

@media (max-width: 768px) {
    .header-nav {
        flex-wrap: nowrap;
        padding: 10px 15px;
        position: relative;
    }
    
    .header-left {
        gap: 10px;
        flex: 1;
    }
    
    .header-logo {
        font-size: 1.2rem;
    }
    
    .header-logo img {
        height: 32px;
    }
    
    .header-nav-links {
        display: none !important;
    }
    
    .header-center {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        padding: 60px 15px 15px;
        background: var(--bg-primary);
        z-index: 998;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
    
    .header-center.mobile-search-active {
        display: block;
    }
    
    .header-search {
        width: 100%;
    }
    
    .search-results {
        position: fixed;
        left: 15px;
        right: 15px;
        top: 120px;
        width: calc(100% - 30px);
        max-width: none;
    }
    
    .header-right {
        gap: 5px;
        flex-shrink: 0;
    }
    
    .header-icon-link .icon-label {
        display: none;
    }
    
    .header-icon-link {
        padding: 8px;
    }
    
    .header-user-name {
        display: none;
    }
    
    .header-mobile-toggle {
        display: flex;
    }
    
    .mobile-search-toggle {
        display: block;
    }
}

@media (max-width: 480px) {
    .header-search input {
        padding: 10px 40px 10px 12px;
        font-size: 0.9rem;
    }
    
    .header-icon-link i,
    .header-icon-link span.icon {
        font-size: 1.3rem;
    }
    
    .mobile-side-menu {
        width: 260px;
        left: -260px;
    }
}

/* Container */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header Section */
.store-header {
    background: var(--bg-primary);
    padding: 30px 20px;
    text-align: center;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.store-header h1 {
    font-size: 2rem;
    margin-bottom: 10px;
    color: var(--primary-color);
}

.store-tagline {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 20px;
}

.store-logo {
    max-width: 200px;
    height: auto;
}

/* Banner Carousel */
.carousel-container {
    position: relative;
    max-width: 1200px;
    margin: 0 auto 40px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.carousel-slide {
    display: none;
}

.carousel-slide img {
    width: 100%;
    height: 450px;
    object-fit: cover;
}

.carousel-prev,
.carousel-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.5);
    color: white;
    padding: 15px;
    text-decoration: none;
    cursor: pointer;
    z-index: 10;
    border-radius: 4px;
    transition: background 0.3s;
}

.carousel-prev:hover,
.carousel-next:hover {
    background: rgba(0,0,0,0.8);
}

.carousel-prev { left: 20px; }
.carousel-next { right: 20px; }

/* Grid System */
.grid {
    display: grid;
    gap: 24px;
    margin: 30px 0;
}

.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}
.grid-5 {
    grid-template-columns: repeat(5, 1fr);
}


.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-6 {
    grid-template-columns: repeat(6, 1fr);
}

/* Section Headers */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 40px 0 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-color);
}

.section-header h2 {
    font-size: 1.75rem;
    color: var(--text-primary);
}

.view-more {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.3s;
}

.view-more:hover {
    color: var(--primary-hover);
}

/* Category Card */
.category-card {
    background: var(--bg-primary);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 16px;
    border: 1px solid var(--border-color);
}

.category-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-4px);
}

.category-card-img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 12px;
}

.category-card-body {
    padding: 0;
    width: 100%;
}

.category-card-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Product Card */
.product-card {
    background: var(--bg-primary);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    position: relative;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    box-shadow: 0 8px 16px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}

.product-image-wrapper {
    position: relative;
    overflow: hidden;
    background: #fafafa;
    padding: 16px;
}

.product-image {
    width: 100%;
    height: 240px;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.product-card:hover .product-image {
    transform: scale(1.05);
}

.product-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: var(--danger-color);
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    z-index: 2;
}

.product-card:hover .product-badge {
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.8);
    transform: scale(1.05);
}

.product-vendor {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255,255,255,0.9);
    color: var(--text-secondary);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
}

.product-body {
    padding: 16px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.product-title {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.5;
    min-height: 2.85em;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.product-card-rating {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 6px;
}

.product-card-stars {
    color: #f5a623;
    font-size: 0.85rem;
    letter-spacing: 1px;
}

.product-card-stars .star-half {
    display: inline-block;
    width: 0.5em;
    overflow: hidden;
    vertical-align: top;
}

.product-card-rating-text {
    font-size: 0.75rem;
    color: var(--text-secondary, #666);
}

.product-price-wrapper {
    margin-top: auto;
}

.product-price {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 8px;
}

.price-current {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.price-original {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-decoration: line-through;
    font-weight: 400;
}

.product-variants {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.variant-option {
    font-size: 0.75rem;
    padding: 4px 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.variant-option:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.product-stock {
    font-size: 0.8rem;
    color: var(--secondary-color);
    font-weight: 500;
    margin-top: 8px;
}

.product-image-wrapper .product-stock {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--secondary-color);
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    z-index: 2;
    margin-top: 0;
}

.product-stock.out-of-stock {
    color: var(--danger-color);
}

.product-image-wrapper .product-stock.out-of-stock {
    background: var(--danger-color);
    color: white;
}

.product-stock.low-stock {
    color: #f59e0b;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .grid-4 {
        grid-template-columns: repeat(3, 1fr);
    }

    .grid-6 {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid-6 {
        grid-template-columns: repeat(3, 1fr);
    }

    .carousel-slide img {
        height: 250px;
    }

    .store-header h1 {
        font-size: 1.5rem;
    }

    .section-header h2 {
        font-size: 1.4rem;
    }

    .product-image {
        height: 220px;
    }
}

@media (max-width: 480px) {
    .grid-4,
    .grid-2 {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .container {
        padding: 0 12px;
    }

    .product-image {
        height: 180px;
    }

    .carousel-prev,
    .carousel-next {
        padding: 10px;
        font-size: 1.2rem;
    }
}
