:root {
    --primary-color: #0e273c;
    --accent-color: #33b2d7;
    --bg-light: #f5f8fa;
    --text-color: #333;
    --white: #fff;
    --gray-light: #f8f9fa;
    --sidebar-bg: #f8f9fa;
    --filter-border: #e0e0e0;
    --filter-hover: #f0f0f0;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    font-family: 'Garet', sans-serif;
    background: var(--white);
    color: var(--text-color);
    line-height: 1.6;
    height: auto;
    width: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

body.thai-active {
    font-family: 'Noto Serif Thai', serif;
}

.lang-th {
    font-family: 'Noto Serif Thai', serif;
}

.page-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.hero-header {
    width: 100%;
    background-color: #e2ecef;
    padding: 10px;
    margin-top: 0px;
    margin-bottom: 0px;
    text-align: center;
    color: #164f72;
    height: 100px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-title {
    font-size: 2rem;
    font-weight: bold;
    margin: 0;
}

/* Language switcher */
.lang-switcher {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1002;
    display: flex;
    gap: 5px;
}

.lang-btn {
    padding: 8px 12px;
    background: var(--accent-color);
    color: white;
    border: 1px solid var(--accent-color);
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
}

.lang-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.lang-btn:hover {
    background: var(--primary-color);
}

/* Mobile sidebar toggle button */
.mobile-sidebar-toggle {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 1001;
    width: 40px;
    height: 40px;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 0px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.mobile-sidebar-toggle:hover {
    background: var(--primary-color);
    transform: scale(1.05);
}

.mobile-sidebar-toggle.hide-toggle {
    display: none !important;
}

/* Override for mobile sidebar toggle in header */
.products-header-left .mobile-sidebar-toggle {
    position: static !important;
    width: auto !important;
    height: auto !important;
    background: transparent !important;
    color: var(--text-color) !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    font-size: 1rem !important;
    padding: 0 !important;
    margin-right: 8px !important;
    display: inline-flex !important;
}

.products-header-left .mobile-sidebar-toggle:hover {
    background: transparent !important;
    transform: none !important;
    color: var(--primary-color) !important;
}

.main-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 30px;
    max-width: 1800px;
    margin: 0 auto;
    padding: 0 20px;
    flex: 1;
    min-height: 600px;
    align-items: start;
    width: 100%;
}

.sidebar {
    grid-column: 1;
    width: 300px;
    background: white;
    padding: 0;
    position: relative;
    top: auto;
    align-self: start;
    height: fit-content;
    overflow: visible !important;
    z-index: 10;
    max-height: none !important;
    overflow-y: visible !important;
    overflow-x: visible !important;
}

.sidebar-section,
.sidebar-content {
    overflow: visible !important;
    max-height: none !important;
    overflow-y: visible !important;
    overflow-x: visible !important;
    height: fit-content !important;
}

.sidebar-header {
    background: var(--accent-color);
    color: white;
    padding: 15px 20px;
    font-size: 1.1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: static;
    z-index: 11;
}

.sidebar-content {
    background: white;
    border: 1px solid #e0e0e0;
    width: 100%;
    box-sizing: border-box;
    overflow: visible !important;
    height: fit-content !important;
    max-height: none !important;
}

/* Category Navigation */
.category-list {
    list-style: none;
    width: 100%;
    overflow: visible !important;
    height: fit-content !important;
    max-height: none !important;
}

.category-item {
    border-bottom: 1px solid #f0f0f0;
    position: relative;
    width: 100%;
}

.category-item:last-child {
    border-bottom: none;
}

.category-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    color: var(--text-color);
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    width: 100%;
    box-sizing: border-box;
    margin: 0;
}

.category-link:hover {
    background: var(--bg-light);
    padding-left: 25px;
    padding-right: 20px;
}

.category-arrow {
    font-size: 1.5rem;
    color: #999;
    transition: transform 0.3s ease;
}

.category-item.active .category-arrow {
    transform: rotate(180deg);
}

.drop-content {
    display: none;
    background: white;
    border-top: 1px solid #f0f0f0;
    width: 100%;
    box-sizing: border-box;
    overflow: visible !important;
    height: fit-content !important;
    max-height: none !important;
}

.drop-content a.active-subcategory {
    background: var(--primary-color) !important;
    color: var(--white) !important;
    font-weight: 600 !important;
    padding-left: 45px !important;
}

.drop-content a.active-subcategory:hover {
    background: var(--primary-color) !important;
    color: var(--white) !important;
    padding-left: 45px !important;
}

.category-item.active .drop-content {
    display: block;
}

.drop-content a {
    display: block;
    padding: 15px 20px 15px 40px;
    color: var(--text-color);
    text-decoration: none;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    width: 100%;
    box-sizing: border-box;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.drop-content a:last-child {
    border-bottom: none;
}

.drop-content a:hover {
    background: var(--bg-light);
    padding-left: 45px;
}

.drop-content a.selected,
.drop-content a.active {
    background: var(--primary-color);
    color: var(--white);
    font-weight: 600;
    padding-left: 45px;
}

.featured-product {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.3s ease;
    cursor: pointer;
}

.featured-product:hover {
    background: var(--bg-light);
}

.featured-product:last-child {
    border-bottom: none;
}

.featured-product-image {
    width: 50px;
    height: 50px;
    background: #f5f5f5;
    margin-right: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.featured-product-image img {
    max-width: 40px;
    max-height: 40px;
    object-fit: contain;
}

.featured-product-info h4 {
    font-size: 0.9rem;
    color: var(--primary-color);
    margin-bottom: 3px;
    line-height: 1.3;
    font-weight: 500;
}

.content-area {
    grid-column: 2;
    min-width: 0;
    min-height: 100%;
    width: 100%;
}

.container {
    max-width: none;
    margin: 0;
    padding: 0;
    width: 100%;
}

.section-padding {
    padding: 20px 0 40px 0;
}

.products-section {
    background: var(--white);
    flex: 1;
    min-height: 300px;
    width: 100%;
}

.products-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 5px;
    margin-bottom: 20px;
}

.products-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-label {
    font-weight: 500;
    font-size: 1rem;
    color: var(--text-color);
}

.products-count {
    color: #666;
    font-size: 0.9rem;
}

.sort-options {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sort-label {
    font-size: 0.9rem;
    color: var(--text-color);
    font-weight: 500;
}

.sort-select {
    padding: 8px 12px;
    border: 1px solid var(--filter-border);
    border-radius: 4px;
    background: white;
    color: var(--text-color);
    font-size: 0.9rem;
    cursor: pointer;
    outline: none;
}

.products-grid {
    display: grid;
    gap: 25px;
    align-items: stretch;
    width: 100%;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.product-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: white;
    transition: all 0.3s ease;
    height: auto;
    min-height: 350px;
    border: none;
    border-radius: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.product-info {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    padding: 12px;
    flex-grow: 1;
}

.product-actions {
    margin-top: auto;
    display: flex;
    gap: 8px;
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.product-image {
    position: relative;
    height: 100px;
    overflow: hidden;
    background: var(--gray-light);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 0;
}

.product-image img {
    width: 150px!important;
    height: 150px!important;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.product-card:hover .product-image img {
    transform: scale(1.05);
}

.product-category {
    color: var(--accent-color);
    font-size: 0.8rem;
    font-weight: 500;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.product-title {
    font-size: 1rem;
    color: var(--primary-color);
    margin-bottom: 10px;
    font-weight: 500;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-price {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.current-price {
    font-size: 1rem;
    font-weight: 500;
    color: var(--primary-color);
}

.btn-secondary {
    background: transparent;
    color: var(--primary-color);
    padding: 8px 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.85rem;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    flex: 1;
    border: 1px solid var(--primary-color);
    border-radius: 0;
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: var(--white);
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* DESKTOP GRID BREAKPOINTS */
@media (min-width: 1600px) {
    .products-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    .mobile-sidebar-toggle {
        display: block;
    }
}

@media (min-width: 1200px) and (max-width: 1599px) {
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 900px) and (max-width: 1199px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* TABLET RESPONSIVE */
@media (max-width: 1024px) {
    .mobile-sidebar-toggle {
        display: block;
    }
    .main-layout {
        display: flex;
        flex-direction: column;
        gap: 20px;
        padding: 0 20px;
        max-width: none;
        grid-template-columns: none;
    }

    .sidebar {
        width: 100%;
        position: static;
        overflow: visible;
    }

    .content-area {
        width: 100%;
    }

    .sidebar-header {
        position: static;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 20px;
    }
}

/* MOBILE RESPONSIVE */
@media (max-width: 768px) {
    .mobile-sidebar-toggle {
        display: static;
        margin-top: 10px;
        margin-left: 10px;
    }

    .mobile-sidebar-toggle {
        display: block; /* หรือ block ถ้าไม่ใช้ flex */
    }

    .mobile-sidebar-toggle.hide-toggle {
        display: none !important;
    }

    .products-count{
      margin-top: 13px;
      margin-right: 10px;
    }

    .filter-label{
      margin-bottom: -11px;
    }

    .hero-header {
        padding: 15px 75px;
        min-height: 70px;
    }

    .hero-title {
        font-size: 1.6rem;
    }

    .main-layout {
        display: block;
        padding: 10px 15px;
        gap: 0;
        position: relative;
        grid-template-columns: none;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: -320px;
        width: 320px;
        height: 100vh;
        background: var(--sidebar-bg);
        z-index: 1000;
        transition: left 0.3s ease;
        overflow-y: auto;
        box-shadow: 2px 0 15px rgba(0,0,0,0.2);
    }

    .sidebar.active {
        left: 0;
    }

    .content-area {
        width: 100%;
        margin: 0;
        padding: 0;
    }

    .products-section {
        padding: 0;
        margin-top: 0;
    }

    .products-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 15px;
        margin-bottom: 20px;
        padding: 0;
    }

    .products-header-left {
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .products-header-left .mobile-sidebar-toggle {
        position: static;
        width: auto;
        height: auto;
        background: transparent;
        color: var(--text-color);
        border: none;
        border-radius: 0;
        box-shadow: none;
        font-size: 1rem;
        padding: 0;
        margin-right: 8px;
    }

    .products-header-left .mobile-sidebar-toggle:hover {
        background: transparent;
        transform: none;
        color: var(--primary-color);
    }

    .products-count {
        flex: 1;
        text-align: right;
        font-size: 0.85rem;
    }

    .sort-options {
        justify-content: flex-end;
    }

    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        margin-top: 0;
    }

    .product-card {
        min-height: 350px;
    }

    .product-image {
        height: 140px;
    }

    .product-image img {
        width: 120px;
        height: 120px;
    }

    .product-info {
        padding: 12px;
    }

    .product-title {
        font-size: 0.9rem;
        -webkit-line-clamp: 2;
    }

    .product-category {
        font-size: 0.75rem;
    }

    .current-price {
        font-size: 1rem;
    }

    .btn-secondary {
        font-size: 0.8rem;
        padding: 8px 12px;
    }
}

/* SMALL MOBILE */
@media (max-width: 480px) {
    .main-layout {
        padding: 5px 10px;
    }

    .hero-header {
        padding: 10px 65px;
        min-height: 60px;
    }

    .hero-title {
        font-size: 1.4rem;
    }

    .mobile-sidebar-toggle {
        width: 40px;
        height: 40px;
        left: 10px;
    }
    
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .product-card {
        min-height: 350px;
    }

    .product-image {
        height: 120px;
    }

    .product-image img {
        width: 100px;
        height: 100px;
    }

    .product-info {
        padding: 10px;
    }

    .product-title {
        font-size: 0.85rem;
        margin-bottom: 8px;
    }

    .product-category {
        font-size: 0.7rem;
        margin-bottom: 6px;
    }

    .current-price {
        font-size: 0.9rem;
    }

    .btn-secondary {
        font-size: 0.75rem;
        padding: 6px 10px;
    }

    .products-count {
        font-size: 0.8rem;
    }
}