/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 16px;
    color: #1a1a1a;
    background-color: #fff;
}

body {
    min-height: 100vh;
    padding-bottom: 80px; /* Space for bottom nav */
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    font-family: inherit;
    cursor: pointer;
}

/* ===== HEADER & SEARCH ===== */
.header {
    padding: 12px 16px;
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 100;
}

.search-container {
    display: flex;
    align-items: center;
    background: #f5f5f5;
    border-radius: 12px;
    padding: 12px 16px;
    gap: 10px;
}

.search-icon {
    color: #666;
    flex-shrink: 0;
}

.search-input {
    border: none;
    background: transparent;
    font-size: 16px;
    width: 100%;
    outline: none;
}

.search-input::placeholder {
    color: #999;
}

/* ===== HERO BANNER ===== */
.hero {
    margin: 0 16px 24px;
    height: 180px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(0,0,0,0.4), rgba(0,0,0,0.2)),
                url('../assets/images/hero-bread.jpg') center/cover no-repeat;
    background-color: #8B7355; /* Fallback color */
    display: flex;
    align-items: flex-end;
    padding: 20px;
}

.hero-content h1 {
    color: #fff;
    font-size: 28px;
    font-weight: 600;
    line-height: 1.2;
}

/* ===== PRODUCTS SECTION ===== */
.products-section {
    padding: 0 16px;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.section-header h2 {
    font-size: 20px;
    font-weight: 600;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.loading-text {
    grid-column: 1 / -1;
    text-align: center;
    color: #666;
    padding: 40px 0;
}

/* ===== PRODUCT CARD ===== */
.product-card {
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.product-card:active {
    transform: scale(0.98);
}

.product-image {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 12px;
    background-color: #f0f0f0;
}

.product-info {
    padding: 10px 0;
}

.product-bakery {
    font-size: 12px;
    color: #666;
    margin-bottom: 2px;
}

.product-name {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
}

.product-price {
    font-size: 14px;
    font-weight: 600;
}

.product-card.out-of-stock .product-image {
    opacity: 0.5;
}

.out-of-stock-badge {
    font-size: 12px;
    color: #cc0000;
    font-weight: 500;
}

/* ===== BOTTOM NAVIGATION ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    display: flex;
    justify-content: center;
    gap: 60px;
    padding: 16px 0 24px;
    border-top: 1px solid #eee;
}

.nav-item {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    transition: color 0.2s ease;
}

.nav-item.active {
    color: #1a1a1a;
}

.cart-icon-container {
    position: relative;
}

.cart-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #1a1a1a;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
}

.cart-badge:empty,
.cart-badge[data-count="0"] {
    display: none;
}

/* ===== BUTTONS ===== */
.btn {
    display: block;
    width: 100%;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 30px;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.btn-primary {
    background: #1a1a1a;
    color: #fff;
}

.btn-primary:active {
    background: #333;
    transform: scale(0.98);
}

/* ===== RESPONSIVE - TABLET & DESKTOP ===== */
@media (min-width: 600px) {
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    body {
        max-width: 600px;
        margin: 0 auto;
        box-shadow: 0 0 20px rgba(0,0,0,0.1);
    }
    
    .bottom-nav {
        max-width: 600px;
        left: 50%;
        transform: translateX(-50%);
    }
}

@media (min-width: 900px) {
    body {
        max-width: 500px;
    }
    
    .bottom-nav {
        max-width: 500px;
    }
}

/* ===== PRODUCT CARD ADD BUTTON ===== */
.product-card {
    position: relative;
}

.add-to-cart-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #fff;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
}

.add-to-cart-btn:hover {
    transform: scale(1.1);
    background: #f5f5f5;
}

.add-to-cart-btn:active {
    transform: scale(0.95);
}

.add-to-cart-btn svg {
    width: 18px;
    height: 18px;
    color: #1a1a1a;
}

.product-card.out-of-stock .add-to-cart-btn {
    display: none;
}

/* ===== PRODUCT IMAGE CONTAINER ===== */
.product-image-container {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
}

.product-image-container .product-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* ===== STOCK COUNT ===== */
.stock-count {
    font-size: 11px;
    font-weight: 400;
    color: #666;
}

/* ===== SECONDARY BUTTON ===== */
.btn-secondary {
    background: #fff;
    color: #1a1a1a;
    border: 2px solid #1a1a1a;
}

.btn-secondary:active {
    background: #f5f5f5;
}

/* ===== POPULAR SECTION ===== */
.popular-section {
    margin-bottom: 8px;
}

.popular-section .section-header h2 {
    font-size: 18px;
}

.products-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.products-scroll::-webkit-scrollbar {
    display: none;
}

.products-scroll .product-card {
    flex: 0 0 140px;
    scroll-snap-align: start;
}

.products-scroll .product-image-container {
    height: 140px;
}

.popular-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: #ff5722;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 12px;
}