/* ===== SavanMall Design System ===== */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Lao:wght@300;400;500;600;700;800&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #2563EB;
    --primary-dark: #1D4ED8;
    --primary-light: #DBEAFE;
    --accent: #F59E0B;
    --accent-dark: #D97706;
    --success: #10B981;
    --danger: #EF4444;
    --warning: #F59E0B;
    --info: #06B6D4;
    --dark: #0F172A;
    --gray-900: #1E293B;
    --gray-800: #334155;
    --gray-700: #475569;
    --gray-600: #64748B;
    --gray-500: #94A3B8;
    --gray-400: #CBD5E1;
    --gray-300: #E2E8F0;
    --gray-200: #F1F5F9;
    --gray-100: #F8FAFC;
    --white: #FFFFFF;
    --font-lao: 'Noto Sans Lao', 'Inter', sans-serif;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
    --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -2px rgba(0,0,0,.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,.1), 0 8px 10px -6px rgba(0,0,0,.1);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    --transition: all .3s cubic-bezier(.4,0,.2,1);
    --header-h: 70px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-lao);
    background: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.7;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-dark); }

img { max-width: 100%; height: auto; display: block; }

/* ===== HEADER ===== */
.site-header {
    background: var(--white);
    box-shadow: var(--shadow);
    position: -webkit-sticky;
    position: sticky;
    top: -1px;
    z-index: 1000;
    border-bottom: 3px solid var(--primary);
}

.header-top {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 6px 0;
    font-size: 13px;
}

.header-top a { color: rgba(255,255,255,.9); }
.header-top a:hover { color: white; }

.header-main {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 12px 0;
    min-height: var(--header-h);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 24px;
    font-weight: 800;
    color: var(--primary);
    flex-shrink: 0;
}

.logo span { color: var(--accent); }

/* Search Bar */
.search-box {
    flex: 1;
    max-width: 900px;
    margin: 0 20px;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 12px 50px 12px 20px;
    border: 2px solid var(--gray-300);
    border-radius: var(--radius-full);
    font-family: var(--font-lao);
    font-size: 15px;
    transition: var(--transition);
    background: var(--gray-100);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--white);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.search-box button {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--primary);
    color: white;
    border: none;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.search-box button:hover { background: var(--primary-dark); transform: translateY(-50%) scale(1.05); }

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.header-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-family: var(--font-lao);
    font-size: 14px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    position: relative;
}

.btn-cart {
    background: var(--gray-100);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

.btn-cart:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }

.cart-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--danger);
    color: white;
    font-size: 11px;
    font-weight: 700;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Navigation */
.nav-bar {
    background: var(--gray-900);
    padding: 0;
    position: relative;
}

.nav-list {
    display: flex;
    list-style: none;
    gap: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.nav-list::-webkit-scrollbar { display: none; }

.nav-list a {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 16px;
    color: var(--gray-400);
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    transition: var(--transition);
    border-bottom: 2px solid transparent;
}

.nav-list a:hover, .nav-list a.active {
    color: white;
    background: rgba(255,255,255,.05);
    border-bottom-color: var(--accent);
}

/* Mobile Menu Overlay */
.nav-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,.5);
    backdrop-filter: blur(4px);
    z-index: 2000;
    opacity: 0;
    transition: opacity .3s ease;
}
.nav-overlay.active {
    display: block;
    opacity: 1;
}

/* Mobile Drawer Header */
.nav-bar-header {
    display: none;
}

/* Desktop: hide hamburger */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 26px;
    cursor: pointer;
    color: var(--gray-700);
    padding: 4px;
    line-height: 1;
}

.d-desktop-none { display: none; }

/* ===== CONTAINER ===== */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== HERO / BANNER ===== */
.hero {
    background: linear-gradient(-45deg, var(--primary), #6366F1, #8B5CF6, #3B82F6);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    color: white;
    padding: 60px 0 70px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.hero::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0IiBoZWlnaHQ9IjQiPgo8cmVjdCB3aWR0aD0iNCIgaGVpZ2h0PSI0IiBmaWxsPSIjZmZmIiBmaWxsLW9wYWNpdHk9IjAuMDUiLz4KPC9zdmc+') repeat;
    pointer-events: none;
}

.hero h1 { font-size: clamp(28px, 6vw, 48px); font-weight: 800; margin-bottom: 12px; position: relative; letter-spacing: -0.5px; }
.hero h1 span { color: #FDE68A; text-shadow: 0 2px 10px rgba(245, 158, 11, 0.3); }
.hero p { font-size: clamp(16px, 3vw, 18px); opacity: .9; position: relative; margin-bottom: 30px; font-weight: 300; }

.hero .search-box {
    max-width: 550px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
    background: rgba(255, 255, 255, 0.1);
    padding: 6px;
    border-radius: 9999px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 10px 30px -10px rgba(0,0,0,0.2);
}

.hero .search-box input {
    background: var(--white) !important;
    border: none !important;
    box-shadow: none !important;
    padding: 14px 50px 14px 24px;
    font-size: 16px;
}

.hero .search-box button {
    width: 42px; height: 42px;
    right: 12px;
}

/* ===== CATEGORY GRID ===== */
.section { padding: 50px 0; }
.section-title {
    font-size: 24px;
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 28px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-title::after {
    content: '';
    flex: 1;
    height: 3px;
    background: linear-gradient(to right, var(--primary-light), transparent);
    border-radius: 3px;
}

.cat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.cat-card {
    background: var(--white);
    border-radius: 16px;
    padding: 24px 16px;
    text-align: center;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid var(--gray-200);
    cursor: pointer;
    text-decoration: none;
    color: var(--gray-700);
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.02);
}

.cat-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 25px -5px rgba(37,99,235,0.1), 0 8px 10px -6px rgba(37,99,235,0.05);
    border-color: var(--primary-light);
}

.cat-card .icon { 
    font-size: 42px; 
    margin-bottom: 12px;
    background: linear-gradient(135deg, var(--primary), var(--info));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
    transition: var(--transition);
}

.cat-card:hover .icon { transform: scale(1.1); }

.cat-card .name { font-size: 15px; font-weight: 700; margin-bottom: 6px; color: var(--dark); }
.cat-card .count { font-size: 13px; color: var(--gray-500); font-weight: 500; }

/* "View All" category card */
.cat-card-more {
    background: linear-gradient(135deg, var(--primary-light), #EDE9FE);
    border-color: var(--primary);
    border-style: dashed;
}
.cat-card-more .icon { color: var(--primary); }
.cat-card-more .name { color: var(--primary); font-weight: 700; }
.cat-card-more:hover {
    background: var(--primary);
    border-style: solid;
}
.cat-card-more:hover .icon,
.cat-card-more:hover .name,
.cat-card-more:hover .count { color: white; }

/* ===== PRODUCT GRID ===== */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 24px;
}

.product-card {
    background: var(--white);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    border: 1px solid rgba(0,0,0,0.04);
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.02);
}

.product-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.05), 0 10px 10px -5px rgba(0,0,0,0.02);
    border-color: rgba(37,99,235,0.1);
}

.product-card .img-wrap {
    display: block;
    position: relative;
    padding-top: 100%;
    background: var(--gray-100);
    overflow: hidden;
}

.product-card .img-wrap img {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.product-card:hover .img-wrap img { transform: scale(1.08); }

.product-card .badge-sale {
    position: absolute;
    top: 12px;
    left: 12px;
    background: linear-gradient(135deg, var(--danger), #BE123C);
    color: white;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    box-shadow: 0 4px 6px -1px rgba(239, 68, 68, 0.3);
    z-index: 2;
}

.product-card .badge-new {
    position: absolute;
    top: 12px;
    right: 12px;
    background: linear-gradient(135deg, var(--success), #059669);
    color: white;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.3);
    z-index: 2;
}

.product-card .info { 
    padding: 16px; 
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}
.product-card .cat-name { font-size: 12px; color: var(--gray-500); margin-bottom: 6px; font-weight: 500; }
.product-card .title {
    font-size: 15px;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 12px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card .title a { color: inherit; transition: color 0.2s; }
.product-card .title a:hover { color: var(--primary); }

.product-card .price-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: auto;
}

.product-card .price {
    font-size: 18px;
    font-weight: 700;
    color: var(--danger);
}

.product-card .old-price {
    font-size: 14px;
    color: var(--gray-500);
    text-decoration: line-through;
}

.product-card .btn-add-cart {
    display: block;
    width: calc(100% - 32px);
    margin: 8px 16px 16px;
    padding: 10px;
    text-align: center;
    background: linear-gradient(135deg, var(--primary), var(--info));
    color: white;
    border: none;
    border-radius: 12px;
    font-family: var(--font-lao);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2);
}

.product-card .btn-add-cart:hover { 
    transform: translateY(-2px); 
    box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.3); 
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-lao);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); color: white; transform: translateY(-1px); }
.btn-accent { background: var(--accent); color: var(--dark); }
.btn-accent:hover { background: var(--accent-dark); }
.btn-outline { background: transparent; color: var(--primary); border: 2px solid var(--primary); }
.btn-outline:hover { background: var(--primary); color: white; }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-lg { padding: 14px 32px; font-size: 16px; }

/* ===== FOOTER ===== */
.site-footer {
    background: var(--dark);
    color: var(--gray-400);
    padding: 40px 0 0;
    margin-top: 60px;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--gray-800);
}

.footer-col h3 { color: white; font-size: 16px; margin-bottom: 14px; }
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 8px; }
.footer-col a { color: var(--gray-500); font-size: 14px; }
.footer-col a:hover { color: var(--accent); }

.footer-bottom {
    text-align: center;
    padding: 20px 0;
    font-size: 13px;
    color: var(--gray-600);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .header-main { flex-wrap: wrap; gap: 10px; }
    .search-box { order: 4; max-width: 100%; flex-basis: 100%; margin: 0; }
    .hero { padding: 30px 0; }
    .hero h1 { font-size: 24px; }
    .cat-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
    .cat-card { padding: 16px 10px; }
    .cat-card .icon { font-size: 28px; }
    .product-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .product-card .price { font-size: 15px; }
    .container { padding: 0 12px; }
    .header-top { display: none; }
    .d-mobile-none { display: none !important; }
    .d-desktop-none { display: flex; }

    /* Hamburger Button */
    .menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 48px;
        height: 48px;
        margin: 0 0 0 5px;
        order: 3;
        position: relative;
        z-index: 10;
        font-size: 32px;
    }

    .header-main { 
        flex-wrap: wrap; 
        gap: 10px; 
        justify-content: space-between;
        align-items: center;
    }
    
    .logo {
        position: static;
        transform: none;
        margin: 0;
        margin-right: auto;
        order: 1;
    }
    
    .header-actions {
        margin: 0;
        order: 2;
    }
    .nav-bar {
        position: fixed;
        top: 0;
        left: -280px;
        width: 280px;
        height: 100vh;
        z-index: 2001;
        overflow-y: auto;
        transition: left .3s cubic-bezier(.4,0,.2,1);
        flex-direction: column;
        box-shadow: none;
    }
    .nav-bar.open {
        left: 0;
        box-shadow: 4px 0 20px rgba(0,0,0,.3);
    }

    /* Drawer Header */
    .nav-bar-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 16px 20px;
        border-bottom: 1px solid var(--gray-800);
    }
    .nav-bar-title {
        color: white;
        font-weight: 700;
        font-size: 16px;
        display: flex;
        align-items: center;
        gap: 8px;
    }
    .nav-close {
        background: none;
        border: none;
        color: var(--gray-400);
        font-size: 20px;
        cursor: pointer;
        padding: 4px;
        transition: var(--transition);
    }
    .nav-close:hover { color: white; }

    /* Nav list vertical */
    .nav-bar .container { padding: 0; }
    .nav-list {
        flex-direction: column;
        overflow-x: visible;
    }
    .nav-list a {
        padding: 14px 20px;
        font-size: 15px;
        border-bottom: none;
        border-left: 3px solid transparent;
    }
    .nav-list a:hover, .nav-list a.active {
        background: rgba(255,255,255,.08);
        border-left-color: var(--accent);
        border-bottom-color: transparent;
    }
    .nav-list li + li {
        border-top: 1px solid rgba(255,255,255,.05);
    }
}

@media (max-width: 480px) {
    .cat-grid { grid-template-columns: repeat(3, 1fr); }
    .product-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .product-card .info { padding: 10px; }
    .product-card .title { font-size: 13px; }
    .product-card .btn-add-cart { margin: 6px 10px 10px; padding: 6px; font-size: 12px; }
}

/* ===== UTILITIES ===== */
.text-center { text-align: center; }
.text-muted { color: var(--gray-500); }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.flex { display: flex; } .flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 8px; } .gap-2 { gap: 16px; }
.d-mobile-none { display: initial; }

/* Mobile menu toggle */
.menu-toggle { display: none; background: none; border: none; font-size: 24px; cursor: pointer; color: var(--gray-700); }
@media (max-width: 768px) { .menu-toggle { display: block; } }

/* Hide number spin buttons globally and align numbers/prices */
input[type=number]::-webkit-inner-spin-button, 
input[type=number]::-webkit-outer-spin-button { 
    -webkit-appearance: none; 
    margin: 0; 
}
input[type=number],
input[name*="qty"] {
    -moz-appearance: textfield;
    text-align: center;
}
input[name*="price"] {
    text-align: right;
}
