:root {
    --primary: #e53935;
    --secondary: #121212;
    --accent: #ff3300;
    --card-bg: #0a0a0c;
    --bg-light: #050505;
    --shadow-sm: 4px 4px 0px rgba(229, 57, 53, 0.4);
    --shadow-md: 6px 6px 0px rgba(229, 57, 53, 0.6);
    --shadow-lg: 12px 12px 0px rgba(229, 57, 53, 1);
    --radius: 0px;
    --transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --font: 'Sarabun', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --text-dark: #ffffff;
    --text-light: #888888;
    --border-light: #2a2a2a;
    --success: #00ff66;
    --warning: #ffb700;
    --danger: #ff1100;
    --info: #00eeff;
}

/* ==== BASE STYLES ==== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font);
    background: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ==== ACCESSIBILITY ==== */
.sr-only {
    position: absolute;
    left: -10000px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 4px;
}

@media (prefers-contrast: high) {

    .product-card,
    .sub-category-card,
    .main-cat-btn,
    .brand-showcase-btn,
    .brand-btn,
    .cart-item {
        border: 2px solid;
    }
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ==== HEADER ==== */
header {
    background: var(--card-bg);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 2px solid var(--border-light);
}

.main-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
}

.logo img {
    height: 50px;
    width: auto;
}

.header-center {
    display: flex;
    align-items: center;
    gap: 30px;
    flex: 1;
    justify-content: center;
}

.main-menu {
    display: flex;
    list-style: none;
    gap: 25px;
}

.main-menu a {
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 600;
    padding: 8px 16px;
    border-radius: var(--radius);
    transition: var(--transition);
}

.main-menu a:hover,
.main-menu a:focus {
    background: var(--primary);
    color: white;
}

.main-menu a[aria-current="page"] {
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow-sm);
}

.search-container input {
    padding: 10px 15px;
    border: 2px solid var(--border-light);
    background: var(--bg-light);
    color: var(--text-dark);
    border-radius: 25px;
    width: 250px;
    font-family: var(--font);
    font-size: 0.9rem;
    transition: var(--transition);
}

.search-container input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(229, 57, 53, 0.1);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.cart-indicator {
    position: relative;
    text-decoration: none;
    font-size: 1.5rem;
    padding: 8px;
    border-radius: var(--radius);
    transition: var(--transition);
    border: 2px solid transparent;
}

.cart-indicator:hover,
.cart-indicator:focus {
    border-color: var(--primary);
    background: var(--bg-light);
}

#cart-count-products {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    display: none;
    align-items: center;
    justify-content: center;
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
}

.mobile-menu-toggle:hover,
.mobile-menu-toggle:focus {
    background: #fdecec;
}

/* ==== SECTIONS ==== */
.main-categories-section,
.quick-filter-section,
.product-showcase,
.brand-showcase-section,
.filters-section,
.related-products-section {
    background: var(--card-bg);
    padding: 40px 30px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    margin-bottom: 40px;
    border: 1px solid var(--border-light);
}

.section-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--secondary);
    margin-bottom: 30px;
    text-align: center;
}

/* ==== GRIDS ==== */
.product-grid,
.brand-showcase-grid,
.related-products-grid,
.main-categories-grid {
    display: grid;
    gap: 25px;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.product-grid,
.related-products-grid {
    grid-template-columns: repeat(4, 1fr);
}

/* ==== MAIN CATEGORY BUTTONS ==== */
.main-cat-btn {
    background: var(--card-bg);
    border: 2px solid var(--border-light);
    border-radius: var(--radius);
    padding: 20px;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-dark);
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.main-cat-btn:hover,
.main-cat-btn:focus {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translate(-4px, -4px);
    box-shadow: var(--shadow-md);
}

/* ==== BRAND SHOWCASE ==== */
.brand-showcase-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    background: var(--card-bg);
    border: 2px solid var(--border-light);
    border-radius: var(--radius);
    padding: 20px;
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 600;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.brand-showcase-btn:hover,
.brand-showcase-btn:focus {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translate(-4px, -4px);
    box-shadow: var(--shadow-md);
}

.brand-icon {
    font-size: 2rem;
}

/* ==== CARD STYLES ==== */
.product-card,
.sub-category-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 2px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    text-decoration: none;
    color: inherit;
}

.product-card:hover,
.sub-category-card:hover {
    transform: translate(-4px, -4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.product-image-container,
.sub-category-image-container {
    width: 100%;
    height: 320px;
    padding: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--secondary);
    position: relative;
    overflow: hidden;
}

.product-image-container::after,
.sub-category-image-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(229, 57, 53, 0.2), transparent);
    transition: left 0.8s;
}

.product-card:hover .product-image-container::after,
.sub-category-card:hover .sub-category-image-container::after {
    left: 100%;
}

.product-image-container img,
.sub-category-image-container img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    transition: transform 0.4s ease;
    border-radius: 8px;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15));
}

.product-card:hover .product-image-container img,
.sub-category-card:hover .sub-category-image-container img {
    transform: scale(1.08) rotate(1deg);
}

.product-info-wrapper,
.sub-category-info {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    position: relative;
    z-index: 2;
    text-align: center;
    justify-content: center;
}

.sub-category-info {
    border-top: 1px solid var(--border-light);
}

.product-name,
.sub-category-name {
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text-dark);
}

.product-name {
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding: 0 5px;
}

.product-price {
    color: var(--primary);
    font-size: 1.4rem;
    font-weight: 700;
    text-shadow: 1px 1px 2px rgba(229, 57, 53, 0.1);
}

.product-sold {
    font-size: 0.8rem;
    color: var(--text-light);
    background: var(--bg-light);
    padding: 4px 8px;
    border-radius: 12px;
    font-weight: 500;
}

.product-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    gap: 10px;
    padding: 0 5px;
}

.product-actions-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.product-status {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 6px 10px;
    border-radius: 20px;
    color: white;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    box-shadow: var(--shadow-sm);
}

.status-instock {
    background: var(--success);
    color: #000;
}

.status-out {
    background: var(--danger);
}

.status-preorder {
    background: var(--warning);
    color: #000;
}

.status-coming {
    background: var(--info);
    color: #000;
}

.action-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    transition: var(--transition);
    background: var(--bg-light);
    border: 2px solid var(--border-light);
    cursor: pointer;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.action-icon::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: var(--primary);
    border-radius: 50%;
    transition: all 0.3s ease;
    transform: translate(-50%, -50%);
}

.action-icon:hover,
.action-icon:focus {
    transform: scale(1.15) rotate(8deg);
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.action-icon:hover::before {
    width: 100%;
    height: 100%;
}

.action-icon img {
    width: 18px;
    height: 18px;
    transition: var(--transition);
    position: relative;
    z-index: 2;
    filter: brightness(0.8);
}

.action-icon:hover img {
    filter: brightness(1) invert(1);
}

.cart-btn {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-color: var(--primary);
    color: white;
}

.cart-btn:hover,
.cart-btn:focus {
    background: linear-gradient(135deg, var(--accent), var(--primary));
    transform: scale(1.2) rotate(-8deg);
}

.cart-btn svg {
    width: 18px;
    height: 18px;
    fill: white;
}

/* ==== PRODUCTS PAGE ==== */
.products-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 30px;
}

.sidebar {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 2px solid var(--border-light);
    height: fit-content;
}

.sidebar-header {
    background: var(--primary);
    color: white;
    padding: 15px 20px;
    font-weight: 700;
    font-size: 1.1rem;
    text-align: center;
}

.category-main {
    border-bottom: 2px solid var(--border-light);
}

.category-header {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    transition: var(--transition);
    font-weight: 600;
    text-decoration: none;
    color: var(--text-dark);
    width: 100%;
    background: none;
    border: none;
    font-family: var(--font);
    font-size: 1rem;
}

.category-header:hover,
.category-header:focus {
    background: var(--primary);
    color: white;
}

.category-header.active {
    background: var(--primary);
    color: white;
}

.category-header .icon {
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.category-header.active .icon {
    transform: rotate(90deg);
}

.subcategory-list {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.subcategory-list.active {
    max-height: 500px;
}

.subcategory-item {
    display: block;
    padding: 12px 20px 12px 35px;
    text-decoration: none;
    color: var(--text-light);
    border-top: 1px solid var(--border-light);
    transition: var(--transition);
    cursor: pointer;
}

.subcategory-item:hover,
.subcategory-item:focus {
    background: var(--primary);
    color: white;
}

.subcategory-item.active,
.subcategory-item[aria-current="page"] {
    font-weight: 700;
    color: white;
    background: var(--primary);
}

.sort-section {
    margin-bottom: 25px;
    align-items: center;
}

.results-count {
    color: #666;
    font-size: 0.9rem;
    font-weight: 500;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.brand-btn {
    padding: 8px 16px;
    border: 2px solid var(--border-light);
    background: var(--card-bg);
    color: var(--text-dark);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
    font-family: var(--font);
}

.brand-btn:hover,
.brand-btn:focus {
    border-color: var(--primary);
    color: white;
    background: var(--primary);
}

.brand-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.search-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-group label {
    margin-bottom: 5px;
    font-weight: 600;
    font-size: 0.9rem;
}

.filter-input {
    padding: 10px 12px;
    border: 2px solid var(--border-light);
    background: var(--bg-light);
    color: var(--text-dark);
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 0.9rem;
    transition: var(--transition);
}

.filter-input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(229, 57, 53, 0.2);
}

.clear-filters-btn {
    padding: 10px 16px;
    background: #444;
    color: white;
    border: 2px solid #444;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
    font-size: 0.9rem;
    font-family: var(--font);
}

.clear-filters-btn:hover,
.clear-filters-btn:focus {
    background: var(--primary);
    border-color: var(--primary);
}

/* ==== BREADCRUMB ==== */
#breadcrumb {
    margin-bottom: 20px;
    font-size: 0.9rem;
}

#breadcrumb a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

#breadcrumb a:hover {
    text-decoration: underline;
}

/* ==== LOAD MORE ==== */
.btn-continue-shopping {
    display: inline-block;
    padding: 14px 40px;
    background: var(--primary);
    color: white;
    border: 2px solid var(--primary);
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font);
    box-shadow: var(--shadow-sm);
}

.btn-continue-shopping:hover {
    transform: translate(-4px, -4px);
    box-shadow: var(--shadow-md);
    background: var(--accent);
    border-color: var(--accent);
}

.btn-continue-shopping:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ==== FOOTER ==== */
footer {
    background: var(--secondary);
    color: white;
    text-align: center;
    padding: 20px;
    margin-top: 40px;
}

footer a {
    color: #ffa726;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* ==== LOADING SKELETON ==== */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 8px;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.skeleton-card {
    height: 400px;
    border-radius: var(--radius);
}

/* ==== RESPONSIVE ==== */
@media (max-width: 1024px) {
    .products-container {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: none;
        /* We will use a toggle button to show it on mobile/tablet */
    }

    .sidebar.mobile-active {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 80%;
        max-width: 320px;
        z-index: 2000;
        background: var(--card-bg);
        overflow-y: auto;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
        animation: slideInLeft 0.3s ease forwards;
        border-radius: 0;
    }

    .product-grid,
    .related-products-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
    }

    to {
        transform: translateX(0);
    }
}

/* Sidebar overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1500;
    backdrop-filter: blur(2px);
}

.sidebar-overlay.active {
    display: block;
}

@media (max-width: 768px) {
    .header-center {
        display: none;
    }

    .header-center.active {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 80px;
        left: 0;
        right: 0;
        background: white;
        box-shadow: var(--shadow-md);
        padding: 20px;
        z-index: 999;
    }

    .main-menu {
        flex-direction: column;
        gap: 10px;
    }

    .search-container input {
        width: 100%;
    }

    .mobile-menu-toggle {
        display: block;
    }

    /* Change to 2 columns for tablet/mobile */
    .product-grid,
    .related-products-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 15px;
    }

    .product-image-container,
    .sub-category-image-container {
        height: 180px;
        padding: 15px;
    }

    .product-name {
        font-size: 1rem;
        margin-bottom: 10px;
    }

    .product-price {
        font-size: 1.2rem;
    }

    .section-title {
        font-size: 1.4rem;
    }

    .filters-section {
        padding: 20px 15px;
    }

    .search-filters {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .brand-showcase-grid,
    .main-categories-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .product-image-container {
        height: 140px;
        padding: 10px;
    }

    .product-info-wrapper {
        padding: 12px;
    }

    .product-name {
        font-size: 0.95rem;
    }

    .product-price {
        font-size: 1.1rem;
    }

    .product-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .product-actions-left {
        justify-content: space-between;
        width: 100%;
    }

    .cart-btn {
        width: 100%;
        border-radius: 8px;
    }
}