/* --- Reset & Variabel Dasar --- */
:root {
    --primary-color: #16a34a;
    --primary-hover: #15803d;
    --bg-color: #f9fafb;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
    --card-bg: #ffffff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
}

/* --- Navbar --- */
.navbar {
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 50;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
}

.search-bar {
    flex: 1;
    max-width: 500px;
    margin: 0 2rem;
}

.search-bar input {
    width: 100%;
    padding: 0.6rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    outline: none;
}

.search-bar input:focus {
    border-color: var(--primary-color);
}

.cart-btn {
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-main);
}

.badge {
    position: absolute;
    top: -5px;
    right: -10px;
    background-color: #ef4444;
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 50%;
}

/* --- Layout Utama --- */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* --- Banner --- */
.hero-banner {
    background: linear-gradient(rgba(22, 163, 74, 0.8), rgba(22, 163, 74, 0.8)), url('https://images.unsplash.com/photo-1542838132-92c53300491e?auto=format&fit=crop&q=80');
    background-size: cover;
    background-position: center;
    color: white;
    padding: 3rem 2rem;
    border-radius: 12px;
    margin-bottom: 2.5rem;
}

.hero-banner h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

/* --- Kategori --- */
.categories {
    margin-bottom: 2.5rem;
}

.category-list {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 5px;
}

.cat-btn {
    padding: 0.5rem 1.2rem;
    border: 1px solid var(--border-color);
    background-color: var(--card-bg);
    border-radius: 20px;
    cursor: pointer;
    white-space: nowrap;
}

.cat-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* --- Katalog Produk (CSS Grid) --- */
.products h2 {
    margin-bottom: 1rem;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
}

.product-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.product-img {
    width: 100%;
    height: 160px;
    object-fit: cover;
}

.product-info {
    padding: 1rem;
}

.product-cat {
    font-size: 0.7rem;
    color: var(--primary-color);
    text-transform: uppercase;
    font-weight: bold;
}

.product-title {
    font-size: 1rem;
    margin: 0.3rem 0;
    color: var(--text-main);
}

.product-price {
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 1rem;
}

.add-to-cart-btn {
    width: 100%;
    padding: 0.6rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
}

.add-to-cart-btn:hover {
    background-color: var(--primary-hover);
}

/* --- Sidebar Keranjang --- */
.overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 90;
    display: none;
}

.sidebar {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: 100%;
    max-width: 380px;
    background-color: var(--card-bg);
    z-index: 100;
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 15px rgba(0,0,0,0.1);
}

.sidebar.active {
    transform: translateX(0);
}

.overlay.active {
    display: block;
}

.sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: var(--text-muted);
}

.sidebar-content {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
}

.empty-cart {
    text-align: center;
    color: var(--text-muted);
    margin-top: 2rem;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
}

.cart-total-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    font-weight: bold;
}

.checkout-btn {
    display: block;
    width: 100%;
    padding: 0.8rem;
    background-color: var(--primary-color);
    color: white;
    text-align: center;
    text-decoration: none;
    border-radius: 6px;
    font-weight: bold;
}

/* Responsif untuk Mobile */
@media (max-width: 768px) {
    .search-bar { display: none; } /* Sembunyikan pencarian di navbar pada layar kecil */
    .product-grid { grid-template-columns: repeat(2, 1fr); }
    .hero-banner h1 { font-size: 1.5rem; }
}