/* =======================================
   1. MOBILE-FIRST DEFAULTS (LAYAR KECIL)
   ======================================= */

body {
    /* Pastikan margin/padding 0 agar konten menempel di tepi layar */
    margin: 0;
    padding: 0 0 70px 0; /* Padding bawah untuk tombol keranjang floating */
    background-color: #f4f4f4;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 16px; 
}

/* Navigasi */
nav {
    background-color: #007bff;
    padding: 10px 0; 
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-around;
}

nav a {
    color: white;
    text-decoration: none;
    padding: 10px 5px; /* Disesuaikan untuk mobile */
    font-size: 0.85em; 
    flex-grow: 1; 
    text-align: center;
}

/* Konten Utama */
#app {
    padding: 15px; /* Padding konten lebih kecil */
    max-width: 100%; 
    margin: 0 auto; 
    min-height: calc(100vh - 70px); 
    background-color: white;
}

/* LIST GERAI */
.list-gerai {
    list-style: none;
    padding: 0;
    display: block; /* Satu kolom di mobile */
}

.card {
    border: 1px solid #ddd;
    padding: 15px;
    margin-bottom: 15px; /* Jarak antar kartu */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.card h3 {
    margin-top: 0;
    color: #007bff;
}

.button {
    display: inline-block;
    background-color: #28a745;
    color: white;
    padding: 8px 12px;
    text-decoration: none;
    border-radius: 4px;
    margin-top: 10px;
    font-size: 0.9em;
}

.button:hover {
    background-color: #1e7e34;
}

/* --- TOMBOL TAMBAH (+) & PRODUK --- */
.product-item {
    border-bottom: 1px solid #eee;
    padding: 15px 0;
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
}

.add-to-cart-btn {
    background-color: #28a745;
    color: #fff;
    border: none;
    border-radius: 50%; 
    width: 35px;
    height: 35px;
    font-size: 1.2em;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    flex-shrink: 0;
    text-align: center;
}

/* --- TOMBOL KERANJANG FLOATING --- */
#cart-container {
    position: fixed;
    bottom: 0; 
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 10px;
    background-color: white; /* Gunakan warna solid untuk visibilitas */
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.2);
}

.cart-button-link {
    text-decoration: none;
    display: block;
}

.cart-button {
    width: 100%;
    border: none;
    padding: 12px;
    border-radius: 8px; /* Disesuaikan dengan desain mobile */
    font-size: 1em;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    cursor: pointer;
	background-color: #28a745; /* Kode warna hijau yang umum */
    color: white; /* Pastikan teks tetap terlihat jelas */
}

/* Jika Anda juga menggunakan ID untuk tombol keranjang mengambang: */
#cart-container button {
    background-color: #28a745;
}

/* =======================================
   2. GAYA HALAMAN KERANJANG & FORMULIR
   ======================================= */

.cart-section {
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 20px;
    background-color: #fff;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px dashed #eee;
}

.cart-item:last-child {
    border-bottom: none;
}

.summary-line {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    margin-top: 10px;
    border-top: 2px solid #ddd;
    font-weight: bold;
}

/* Rangkuman Biaya */
.cart-summary table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.cart-summary td {
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.price-value {
    text-align: right;
    font-weight: 600;
}

.total-row td {
    border-top: 2px solid #333;
    font-size: 1.2em;
}

/* Formulir */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
    font-size: 0.9em;
    color: #555;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box; /* Penting untuk lebar 100% */
    font-size: 1em;
}

/* Radio Buttons (Ongkir/Pembayaran) */
.radio-label {
    display: block;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
    background-color: #fafafa;
}

.radio-label:hover {
    background-color: #f0f0f0;
}

.radio-label input[type="radio"] {
    margin-right: 10px;
}

/* Tombol Checkout */
.checkout-btn {
    width: 100%;
    background-color: #28a745;
    color: white;
    padding: 15px;
    border: none;
    border-radius: 6px;
    font-size: 1.1em;
    cursor: pointer;
    margin-top: 20px;
}

.back-link {
    display: block;
    text-align: center;
    margin-top: 10px;
    color: #4CAF50;
    text-decoration: none;
}

/* =======================================
   3. MEDIA QUERIES (RESPONSIVITAS)
   ======================================= */

/* Tablet dan Layar Menengah (>= 600px) */
@media (min-width: 600px) {
    
    body {
        padding-bottom: 0; /* Hapus padding bawah di non-mobile */
    }
    
    #app {
        max-width: 700px; /* Lebar maksimum untuk tablet */
        margin: 20px auto;
        padding: 20px;
        border-radius: 10px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    }
    
    /* Gerai ditampilkan dalam grid dua kolom */
    .list-gerai {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 15px;
    }
    
    /* Tombol Keranjang Kembali ke kanan bawah (Floating) */
    #cart-container {
        bottom: 20px;
        right: 20px;
        left: unset;
        width: auto; 
        padding: 0;
        background-color: transparent;
        box-shadow: none;
    }
    .cart-button {
        width: auto;
        min-width: 250px;
        border-radius: 30px; /* Bentuk pil di desktop/tablet */
    }
}

/* Desktop dan Layar Besar (>= 1024px) */
@media (min-width: 1024px) {
    
    #app {
        max-width: 960px; /* Lebar lebih besar untuk desktop */
    }

    /* Navigasi */
    nav a {
        font-size: 1em;
    }

    /* Gerai ditampilkan dalam grid tiga kolom */
    .list-gerai {
        grid-template-columns: 1fr 1fr 1fr; 
        gap: 20px;
    }
}

/* ... (Bagian atas body dan nav tetap) ... */

/* --- HEADER DAN JUDUL MIRIP WASADA --- */
.app-header {
    text-align: center;
    padding: 10px 0;
}

.logo-title {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 5px;
}

.logo-icon {
    font-size: 2em;
    color: #4CAF50; /* Warna hijau untuk logo */
    margin-right: 5px;
}

.title-text {
    font-size: 2.2em;
    font-weight: 700;
    letter-spacing: 1px;
}

.subtitle {
    font-size: 0.9em;
    color: #666;
    margin: 0;
}

.links {
    font-size: 0.8em;
    color: #4CAF50;
    margin-top: 5px;
    margin-bottom: 15px;
}


/* --- SEARCH BAR --- */
.search-bar {
    padding: 0 15px 15px;
}

.search-bar input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ccc;
    border-radius: 25px; /* Bentuk pil */
    font-size: 1em;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    box-sizing: border-box;
}

/* --- FILTER BUTTONS (Horizontal Scroll) --- */
.filter-container {
    display: flex;
    overflow-x: auto; /* Mengaktifkan scroll horizontal */
    white-space: nowrap;
    padding: 0 0 15px;
    -webkit-overflow-scrolling: touch; /* Untuk performa mobile */
    scrollbar-width: none; /* Sembunyikan scrollbar Firefox */
}
.filter-container::-webkit-scrollbar {
    display: none; /* Sembunyikan scrollbar Chrome/Safari */
}

.filter-btn {
    flex-shrink: 0; /* Mencegah tombol mengecil */
    padding: 8px 15px;
    margin-right: 10px;
    border: 1px solid;
    border-radius: 20px;
    background-color: white;
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.2s;
}

/* Gaya Hijau (Lokasi) */
.green-filters .filter-btn {
    border-color: #4CAF50;
    color: #4CAF50;
}
.green-filters .filter-btn.active {
    background-color: #4CAF50;
    color: white;
}

/* Gaya Oranye (Jenis Makanan) */
.orange-filters .filter-btn {
    border-color: #FF9800;
    color: #FF9800;
}
.orange-filters .filter-btn.active {
    background-color: #FF9800;
    color: white;
}

/* --- DAFTAR GERAI (CARD STYLE) --- */
.list-gerai-wasada {
    list-style: none;
    padding: 0 15px 15px;
    margin: 0;
}

.gerai-card {
    display: flex;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
    align-items: center;
    cursor: pointer;
}
.gerai-card:last-child {
    border-bottom: none;
}

.card-left img {
    width: 90px;
    height: 90px;
    object-fit: cover;
    border-radius: 8px;
    margin-right: 15px;
}

.card-right {
    flex-grow: 1;
    min-width: 0;
}

.gerai-name {
    margin: 0 0 5px 0;
    font-size: 1.1em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.meta-row, .info-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.8em;
    margin-bottom: 5px;
    color: #666;
}

.meta-lokasi {
    color: #4CAF50;
    font-weight: 600;
}

.meta-rating {
    color: #FFC107;
    font-weight: bold;
}

.meta-hours {
    color: #F44336; /* Warna merah untuk jam buka */
}
.meta-price {
    color: #795548;
    font-weight: 600;
}

/* File: style.css */

.gerai-group {
    border: 2px solid #ddd;
    border-radius: 8px; /* Tambahkan sedikit radius */
    margin-bottom: 25px !important;
}

.total-gerai-row {
    font-weight: bold;
    color: #007bff;
    border-top: 1px dashed #ccc !important;
}

/* File: style.css */
.cancel-btn {
    background-color: #6c757d; /* Abu-abu untuk tombol batal */
    margin-top: 10px;
}
.cancel-btn:hover {
    background-color: #5a6268;
}

/* File: style.css (Tambahan) */

/* Peringatan Konflik */
.conflict-alert {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
}

.conflict-alert .link-btn {
    background: none;
    border: none;
    color: #007bff;
    text-decoration: underline;
    cursor: pointer;
    font-weight: bold;
    padding: 0;
}

/* Kontrol Keranjang pada Daftar Produk */
.cart-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cart-qty {
    background-color: #f97316;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.9em;
    min-width: 20px;
    text-align: center;
	display: none;
}

/* Tombol + yang dinonaktifkan */
.add-to-cart-btn.disabled {
    background-color: #ccc !important;
    cursor: not-allowed;
}

/* Gaya untuk item yang dinonaktifkan karena konflik */
.disabled-item {
    opacity: 0.7;
}

/* File: style.css (Tambahan) */

.cart-item-with-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px dotted #ccc;
}

.item-info {
    display: flex;
    flex-direction: column;
}

.item-info span:first-child {
    font-weight: bold;
}

.quantity-controls {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Menargetkan tombol - dan + di daftar pesanan */
.quantity-controls button {
    background-color: #28a745; /* Kode Hex untuk warna Orange Gelap/Dark Orange */
    color: white;              /* Pastikan teks/simbol di tombol berwarna putih agar kontras */
    border: none;              /* Opsional: hapus border */
    border-radius: 4px;        /* Opsional: sedikit lengkungan */
    padding: 2px 8px;          /* Opsional: sesuaikan padding */
    font-weight: bold;
}

.quantity-controls button:hover {
    background-color: #0056b3;
}

.item-qty {
    padding: 0 10px;
    font-weight: bold;
}

/* --- Modal Styles --- */
.modal {
    display: none; /* Default: Sembunyikan modal */
    position: fixed; /* Tetap di layar saat scrolling */
    z-index: 101; /* Pastikan di atas semua konten */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4); /* Background gelap */
}

.modal-content {
    background-color: #fefefe;
    margin: 15% auto; /* Jarak dari atas dan tengah horizontal */
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 400px;
    border-radius: 10px;
    position: relative;
    text-align: center;
}

.close-button {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-button:hover,
.close-button:focus {
    color: #000;
    text-decoration: none;
}

.modal-body h3 {
    color: #28a745;
    margin-bottom: 10px;
}

.modal-close-btn {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 20px;
}

.modal-close-btn:hover {
    background-color: #0056b3;
}



/* CSS untuk kartu pilihan wilayah */
.shipping-options-container {
    display: flex;
    flex-direction: column;
    gap: 10px; /* Jarak antar kartu */
    margin-top: 10px;
}

.shipping-option-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    background-color: #f9f9f9;
    transition: all 0.2s;
    /* Ini memastikan teks panjang terbungkus */
    width: 100%;
}

.shipping-option-card:hover {
    border-color: #007bff;
    background-color: #eaf5ff;
}

.shipping-option-card.selected {
    border-color: #28a745; /* Border Hijau */
    background-color: #e6ffed; /* Background Hijau Muda */
    box-shadow: 0 0 5px rgba(40, 167, 69, 0.5);
    font-weight: bold;
}

.option-text {
    flex-grow: 1;
    margin-right: 15px;
    /* Memastikan teks bisa wrap */
    word-wrap: break-word; 
    overflow-wrap: break-word;
}

.wilayah-detail-text {
    display: block; /* Memaksa daftar wilayah di baris baru */
    font-size: 0.85em;
    color: #6c757d;
    margin-top: 5px;
}

.option-rate {
    font-weight: bold;
    color: #007bff;
    white-space: nowrap; /* Jangan wrap untuk harga */
}

Dengan perubahan pada `renderKeranjang()` dan CSS di atas, teks wilayah yang panjang kini akan **terbungkus dengan rapi** di dalam kartu, sehingga tidak menyebabkan *horizontal scroll* pada perangkat *mobile*.

/* Gaya untuk Pilihan Kartu Wilayah */
.wilayah-options-container {
    display: grid;
    grid-template-columns: 1fr 1fr; /* 2 kolom */
    gap: 10px;
    margin-top: 10px;
}

.wilayah-options-container input[type="radio"] {
    display: none; /* Sembunyikan input radio asli */
}

.wilayah-option-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    
    padding: 10px 10px;
    border: 2px solid #ced4da; /* Border abu-abu */
    border-radius: 8px;
    background-color: #f8f9fa;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.wilayah-option-card span:first-child {
    font-weight: 600;
    margin-bottom: 5px;
}

.wilayah-tier {
    font-size: 0.8em;
    color: #6c757d;
}

/* GAYA KETIKA KARTU DIPILIH (Active State) */
.wilayah-options-container input[type="radio"]:checked + .wilayah-option-card {
    border-color: #198754; /* Border Hijau/Biru Aksen */
    background-color: #e9f5ee; /* Background lebih terang */
    box-shadow: 0 0 5px rgba(25, 135, 84, 0.3);
}

/* =======================================
    GAYA KHUSUS PEMILIHAN WILAYAH (Card/Radio)
    ======================================= */

.wilayah-options-container {
    margin-top: 10px;
    gap: 8px; /* Jarak antar tombol */
}


/* =======================================
    GAYA KHUSUS PEMILIHAN WILAYAH (Card/Radio)
    ======================================= */

.wilayah-options-container {
    margin-top: 10px;
    gap: 8px; /* Jarak antar tombol */
}

/* 1. Pengaturan untuk Pilihan Wilayah (3 Tombol Baru) */
.wilayah-options-container.single-vendor-options {
    display: grid;
    /* Default: 1 kolom penuh di mobile */
    grid-template-columns: 1fr;
    gap: 10px;
}

/* Tablet ke atas (>= 600px) */
@media (min-width: 600px) {
    .wilayah-options-container.single-vendor-options {
        /* Di layar lebih besar, tata dalam 3 kolom */
        grid-template-columns: 1fr;
    }
    
    .wilayah-options-container.single-vendor-options .wilayah-option-card {
        height: 100%; /* Pastikan tingginya sama */
    }
}

/* 2. Pengaturan untuk Tier Lain (Luar Sumedang Kota) */
.tier-2-single {
    display: grid;
    /* Selalu 1 kolom penuh */
    grid-template-columns: 1fr; 
}

/* ... (Kode CSS lainnya tetap sama) ... */

/* HAPUS MEDIA QUERY INI, KARENA SUDAH DIUBAH DI ATAS
@media (min-width: 600px) {
    .tier-1-grid {
        grid-template-columns: 1fr 1fr 1fr; 
    }
}
*/

input, textarea {
    font-family: inherit;
}

input::placeholder,
textarea::placeholder {
    font-family: inherit;
    color: #999; /* opsional */
}

/* Gaya untuk modal-backdrop (Overlay Penuh) */
.modal-backdrop {
    /* Menentukan posisi di seluruh viewport */
    position: fixed; 
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Memberi warna latar belakang transparan gelap */
    background-color: rgba(0, 0, 0, 0.5); 
    /* Memastikan selalu di atas (angka harus lebih tinggi dari semua elemen lain) */
    z-index: 100; 
    /* Mengatur konten di tengah */
    display: flex;
    justify-content: center;
    align-items: center;
    /* Mulai tersembunyi */
    display: none; 
}

/* Gaya untuk modal-content (Kotak di Tengah) */
.modal-content {
    background: white;
    padding: 20px;
    border-radius: 8px;
    /* Lebar maksimum agar responsif */
    max-width: 400px; 
    width: 90%;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Aturan untuk pesan tebal yang saya buat di JS sebelumnya */
#modal-pesan strong {
    font-weight: bold;
}


/* Gaya untuk Tombol Single-Button Wilayah */
.wilayah-option-card.single-button-layout {
    /* Mengubah tata letak agar harga di atas dan detail di bawah */
    flex-direction: column;
    justify-content: center;
    align-items: flex-start; /* Teks rata kiri */
    min-height: 20px; /* Tinggi minimum agar semua info terlihat */
    text-align: left; /* Pastikan teks rata kiri */
}

/* Gaya untuk Harga/Tarif Ongkir */
.wilayah-option-card.single-button-layout span:first-child {
    font-weight: 700;
    font-size: 1.1em;
    color: #007bff; /* Warna biru untuk harga */
}

/* Gaya untuk Detail Wilayah */
.wilayah-option-card.single-button-layout .wilayah-tier {
    font-size: 0.85em;
    color: #6c757d;
    font-weight: 400;
    margin-top: 5px;
}

/* Gaya khusus untuk Multi-Vendor */
.wilayah-option-card.multi-vendor-card {
    border-color: #dc3545 !important; /* Border Merah untuk NEGO */
    background-color: #f8d7da !important;
}
/* style.css */



