/* --- VARIABEL & RESET --- */
:root {
    --primary: #007bff;
    --primary-dark: #0056b3;
    --text-dark: #1a1a2e;
    --text-gray: #71717a;
    --bg-gray: #f8f9fa;
    --white: #ffffff;
    --border: #e2e8f0;
    --shadow: 0 4px 20px rgba(0,0,0,0.06);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
    overflow-x: hidden;
    max-width: 100%;
    font-family: 'Poppins', sans-serif;
    background: var(--bg-gray);
    color: var(--text-dark);
    line-height: 1.6;
}
body { font-family: 'Poppins', sans-serif; background: var(--bg-gray); color: var(--text-dark); line-height: 1.6; }
a { text-decoration: none; color: inherit; }

/* --- NAVBAR (FIX UTAMA) --- */
.navbar {
    background: var(--white);
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.04);
    position: sticky;
    top: 0;
    z-index: 100;
}

/* KUNCI: Flexbox Space Between agar Logo di Kiri, Tombol di Kanan */
.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between; 
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-dark);
}
.logo img { height: 40px; width: auto; }

.back-link {
    color: var(--primary);
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: gap 0.3s;
    padding: 0.5rem 1rem;
    border-radius: 8px;
}
.back-link:hover {
    gap: 0.8rem; /* Efek geser saat hover */
    background: #f0f8ff;
}

/* --- LAYOUT UTAMA --- */
.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
}
.page-header { margin-bottom: 2rem; }
.page-header h1 {
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.page-header p { color: var(--text-gray); }

/* --- GRID KERANJANG --- */
.cart-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 2rem;
    align-items: start;
}

/* --- ITEM KERANJANG --- */
.cart-items {
    background: var(--white);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}
.cart-item {
    display: grid;
    grid-template-columns: 100px 1fr auto;
    gap: 1.5rem;
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--border);
    align-items: center;
}
.cart-item:last-child { border-bottom: none; }

.item-image { width: 100px; height: 80px; border-radius: 12px; overflow: hidden; background: #eee; }
.item-image img { width: 100%; height: 100%; object-fit: cover; }
.item-details h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    max-width: 100%;
}
.item-meta { display: flex; gap: 1rem; font-size: 0.85rem; color: var(--text-gray); margin-bottom: 0.75rem; }
.item-price-unit { color: var(--primary); font-weight: 600; }

.quantity-control { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.qty-btn { width: 32px; height: 32px; background: #f1f5f9; border: none; cursor: pointer; font-weight: 600; transition: 0.2s; }
.qty-btn:hover { background: #e2e8f0; }
.qty-input { width: 40px; height: 32px; text-align: center; border: none; font-weight: 600; font-family: inherit; }

.item-actions { text-align: right; display: flex; flex-direction: column; gap: 0.5rem; align-items: flex-end; }
.price-main { font-size: 1.1rem; font-weight: 800; color: var(--text-dark); }
.remove-btn { background: none; border: none; color: var(--text-gray); cursor: pointer; font-size: 0.85rem; transition: 0.3s; }
.remove-btn:hover { color: #dc3545; }

/* --- RINGKASAN PESANAN (PREMIUM) --- */
.cart-summary { position: sticky; top: 100px; }
.summary-card {
    background: var(--white);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 10px 40px rgba(0,0,0,0.08);
    border: 1px solid rgba(0,0,0,0.02);
}
.summary-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 2px solid #f1f5f9; color: var(--text-dark); }

.summary-row { display: flex; justify-content: space-between; margin-bottom: 1rem; font-size: 0.95rem; color: var(--text-gray); }
.summary-row.total {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 2px dashed #e2e8f0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-dark);
}
.summary-row.total .total-amount { font-size: 1.4rem; color: var(--primary); }

.checkout-btn {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    margin-top: 1.5rem;
    box-shadow: 0 8px 20px rgba(0,123,255,0.3);
    transition: all 0.3s;
}
.checkout-btn:hover { transform: translateY(-2px); box-shadow: 0 12px 25px rgba(0,123,255,0.4); }
.secure-note { text-align: center; margin-top: 1rem; font-size: 0.8rem; color: #94a3b8; display: flex; align-items: center; justify-content: center; gap: 0.4rem; }

/* --- EMPTY STATE --- */
.empty-state { text-align: center; padding: 4rem 2rem; background: var(--white); border-radius: 16px; box-shadow: var(--shadow); }
.empty-icon { font-size: 4rem; color: #cbd5e1; margin-bottom: 1rem; }
.btn-explore { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.8rem 1.5rem; background: var(--primary); color: white; border-radius: 8px; font-weight: 600; margin-top: 1.5rem; transition: 0.3s; }
.btn-explore:hover { background: var(--primary-dark); }

/* --- RESPONSIVE --- */
html, body {
    overflow-x: hidden;
    max-width: 100%;
}

@media (max-width: 900px) {
    .cart-layout { grid-template-columns: 1fr; }
    .cart-summary { position: static; margin-top: 2rem; }
}

@media (max-width: 768px) {
    .navbar { padding: 0.75rem 0; }
    .nav-container { padding: 0 1rem; }
    .logo img { height: 32px; }
    .logo span { font-size: 0.85rem; }
    .back-link { font-size: 0.85rem; padding: 0.4rem 0.6rem; white-space: nowrap; }

    .container { padding: 0 1rem; margin: 1rem auto; overflow-x: hidden; }
    .page-header h1 { font-size: 1.3rem; }
    .page-header p { font-size: 0.85rem; }

    .cart-items { padding: 1rem; overflow-x: hidden; }
    .cart-item {
        grid-template-columns: 75px 1fr;
        gap: 0.75rem;
        padding: 1rem 0;
        overflow-x: hidden;
    }
    .item-image { width: 75px; height: 65px; }
    .item-details { overflow: hidden; min-width: 0; }
    .item-details h3 {
        font-size: 0.9rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
        word-break: break-word;
    }
    .item-meta { flex-direction: column; gap: 0.2rem; font-size: 0.8rem; }
    .item-actions {
        grid-column: 1 / -1;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        margin-top: 0.5rem;
        padding-top: 0.5rem;
        border-top: 1px solid #f1f5f9;
        width: 100%;
    }
    .price-main { font-size: 0.95rem; }

    .summary-card { padding: 1.25rem; overflow-x: hidden; }
    .summary-title { font-size: 1rem; }
    .summary-row { font-size: 0.9rem; }
    .summary-row.total .total-amount { font-size: 1.1rem; }
    .voucher-row { flex-wrap: nowrap; }
    .voucher-input { min-width: 0; font-size: 0.85rem; }
    .voucher-btn { flex-shrink: 0; font-size: 0.85rem; padding: 0.7rem 1rem; }
    .checkout-btn { font-size: 0.9rem; padding: 0.85rem; width: 100%; }
}

@media (max-width: 480px) {
    .logo span { display: none; }
    .item-image { width: 65px; height: 55px; }
    .item-details h3 { font-size: 0.82rem; }
}