/* ============================================================
   KOPIGO: halaman pesan (pesan.html)
   Terpisah dari style.css (design system Go Suite).

   Alasan desain:
   - Warna: krem & cokelat diambil dari flyer menu "Coffee Based",
     merah = merah logo KOPIGO dan satu-satunya warna aksi,
     kuning = lingkaran harga di flyer (dipakai untuk penanda jumlah).
   - Font: font sistem, supaya halaman pesan terbuka instan tanpa unduhan.
   - Layout: daftar di HP (satu tangan), dua kolom ala kasir di layar lebar.
   - Bayangan hanya pada elemen yang melayang (bar & panel pesanan).
   ============================================================ */

:root {
    --cream: #faf3e7;
    --paper: #ffffff;
    --ink: #2b1a12;
    --ink-soft: #5c4a40;
    --line: #e6d9c6;
    --red: #e4002b;
    --red-dark: #b80023;
    --yellow: #ffe600;
    --r-sm: 10px;
    --r-md: 16px;
    --bar-h: 64px;
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: 124px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--cream);
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
}

button,
input,
textarea {
    font: inherit;
    color: inherit;
}

a,
button,
label {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
}

:focus-visible {
    outline: 3px solid var(--ink);
    outline-offset: 2px;
}

[hidden] {
    display: none !important;
}

/* ============ Top bar ============ */
.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    height: 60px;
    padding: 0 16px;
    background: var(--cream);
    border-bottom: 1px solid var(--line);
}

.topbar-brand {
    position: relative;
    display: block;
    width: 124px;
    height: 44px;
    overflow: hidden;
    border-radius: var(--r-sm);
}

/* Logo SVG berbentuk persegi (transparan) dengan wordmark di tengah:
   dipotong atas-bawah supaya hanya wordmark yang terlihat */
.topbar-brand img {
    position: absolute;
    left: 0;
    top: 50%;
    width: 124px;
    height: 124px;
    transform: translateY(-50%);
}

.topbar-tag {
    font-size: 13px;
    font-weight: 700;
    line-height: 1.25;
    text-align: right;
}

.topbar-tag span {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--ink-soft);
}

/* ============ Layout ============ */
.layout {
    max-width: 1180px;
    margin: 0 auto;
}

.menu {
    padding: 20px 16px calc(var(--bar-h) + 40px);
}

.intro h1 {
    font-size: 28px;
    line-height: 1.15;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.intro p {
    margin-top: 8px;
    max-width: 44ch;
    color: var(--ink-soft);
}

/* ============ Kategori ============ */
.cats {
    position: sticky;
    top: 60px;
    z-index: 10;
    display: flex;
    gap: 8px;
    margin: 16px -16px 0;
    padding: 10px 16px;
    background: var(--cream);
    overflow-x: auto;
}

.cats a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 14px;
    border: 1.5px solid var(--ink);
    border-radius: var(--r-sm);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.cats a:hover {
    background: var(--ink);
    color: var(--cream);
}

.cats a:active {
    transform: translateY(1px);
}

.cats a span {
    display: inline-grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--yellow);
    color: var(--ink);
    font-size: 12px;
    font-weight: 800;
}

/* ============ Grup & produk ============ */
.group {
    margin-top: 20px;
}

.group-head h2 {
    font-size: 20px;
    font-weight: 800;
}

.group-head p {
    margin-top: 2px;
    font-size: 14px;
    color: var(--ink-soft);
}

.products {
    list-style: none;
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.product {
    display: grid;
    grid-template-columns: 104px 1fr;
    gap: 12px;
    padding: 10px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
}

.product.is-in-cart {
    border-color: var(--ink);
}

.product-photo {
    width: 104px;
    height: 104px;
    object-fit: cover;
    border-radius: var(--r-sm);
    background: var(--line);
}

.product-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.product-name {
    font-size: 16px;
    font-weight: 800;
    line-height: 1.25;
}

.product-desc {
    margin-top: 2px;
    font-size: 13px;
    line-height: 1.4;
    color: var(--ink-soft);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: auto;
    padding-top: 8px;
}

.product-price {
    font-size: 16px;
    font-weight: 800;
}

/* ============ Tombol ============ */
.btn-add {
    min-width: 96px;
    height: 44px;
    padding: 0 16px;
    border: 0;
    border-radius: var(--r-sm);
    background: var(--red);
    color: #ffffff;
    font-weight: 800;
}

.btn-add:hover {
    background: var(--red-dark);
}

.btn-add:active,
.stepper-btn:active,
.btn-send:active {
    transform: translateY(1px);
}

.stepper {
    display: inline-flex;
    align-items: center;
    /* 44px area sentuh di dalam garis tepi */
    box-sizing: content-box;
    height: 44px;
    border: 1.5px solid var(--ink);
    border-radius: var(--r-sm);
    background: var(--paper);
}

.stepper-btn {
    width: 44px;
    height: 100%;
    border: 0;
    background: transparent;
    font-size: 20px;
    font-weight: 700;
    line-height: 1;
    border-radius: var(--r-sm);
}

.stepper-btn:hover {
    background: var(--cream);
}

.stepper-qty {
    min-width: 24px;
    text-align: center;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

/* ============ Footer ============ */
.foot {
    margin-top: 32px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    font-size: 13px;
    color: var(--ink-soft);
}

.foot p+p {
    margin-top: 6px;
}

.foot a {
    display: inline-block;
    padding: 6px 0;
    font-weight: 700;
    color: var(--ink);
}

/* ============ Bar pesanan (HP) ============ */
.cartbar {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    height: var(--bar-h);
    padding: 0 8px 0 16px;
    border: 0;
    border-radius: var(--r-md);
    background: var(--ink);
    color: #ffffff;
    text-align: left;
    box-shadow: 0 8px 24px rgba(43, 26, 18, 0.3);
}

.cartbar-info {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.cartbar-info span {
    font-size: 13px;
    color: #e6d9c6;
}

.cartbar-info strong {
    font-size: 17px;
    font-variant-numeric: tabular-nums;
}

.cartbar-cta {
    display: inline-flex;
    align-items: center;
    height: 48px;
    padding: 0 16px;
    border-radius: var(--r-sm);
    background: var(--yellow);
    color: var(--ink);
    font-weight: 800;
}

.cartbar:hover .cartbar-cta {
    background: #ffffff;
}

/* ============ Panel pesanan ============ */
.backdrop {
    position: fixed;
    inset: 0;
    z-index: 40;
    background: rgba(43, 26, 18, 0.55);
}

.cart {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    display: none;
    flex-direction: column;
    max-height: 92dvh;
    background: var(--paper);
    border-radius: var(--r-md) var(--r-md) 0 0;
    box-shadow: 0 -8px 32px rgba(43, 26, 18, 0.25);
}

.cart.is-open {
    display: flex;
}

.cart-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 8px 12px 16px;
    border-bottom: 1px solid var(--line);
}

.cart-head h2 {
    font-size: 18px;
    font-weight: 800;
}

.cart-close {
    height: 44px;
    padding: 0 12px;
    border: 0;
    border-radius: var(--r-sm);
    background: transparent;
    font-weight: 700;
    text-decoration: underline;
}

.cart-close:hover {
    background: var(--cream);
}

.cart-scroll {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 4px 16px 16px;
}

.cart-empty {
    padding: 32px 8px;
    text-align: center;
    color: var(--ink-soft);
}

.cart-empty-title {
    font-weight: 800;
    color: var(--ink);
}

.cart-items {
    list-style: none;
}

.cart-item {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 4px 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.cart-item-name {
    font-weight: 700;
    line-height: 1.3;
}

.cart-item-sub {
    font-size: 14px;
    color: var(--ink-soft);
    font-variant-numeric: tabular-nums;
}

.cart-item .stepper {
    grid-row: span 2;
}

/* ============ Form ============ */
.order-form {
    display: grid;
    gap: 14px;
    margin-top: 16px;
}

.field label {
    display: block;
    margin-bottom: 4px;
    font-size: 14px;
    font-weight: 700;
}

.optional {
    font-weight: 500;
    color: var(--ink-soft);
}

.field input,
.field textarea {
    display: block;
    width: 100%;
    padding: 12px;
    border: 1.5px solid #8a7768;
    border-radius: var(--r-sm);
    background: var(--paper);
    resize: vertical;
}

.field input {
    height: 48px;
}

.field input:hover,
.field textarea:hover {
    border-color: var(--ink);
}

.field [aria-invalid="true"] {
    border-color: var(--red-dark);
    border-width: 2px;
}

.field-hint:empty {
    display: none;
}

.field-hint,
.field-error {
    margin-top: 4px;
    font-size: 13px;
}

.field-hint {
    color: var(--ink-soft);
}

.field-error {
    color: var(--red-dark);
    font-weight: 700;
}

.field-error::before {
    content: "! ";
}

/* ============ Pilihan lokasi & metode ============ */
.choice {
    border: 0;
    min-width: 0;
}

.choice legend {
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 700;
}

.choice-item {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 52px;
    padding: 8px 12px;
    border: 1.5px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--paper);
}

.choice-item+.choice-item {
    margin-top: 6px;
}

.choice-item:hover {
    border-color: var(--ink);
}

.choice-item:active {
    background: var(--cream);
}

/* Kelas is-selected dipasang lewat JS, supaya tetap jalan di browser tanpa :has() */
.choice-item.is-selected {
    border-color: var(--ink);
    background: var(--cream);
}

.choice-item:focus-within {
    outline: 3px solid var(--ink);
    outline-offset: 2px;
}

.choice-item input {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    accent-color: var(--red);
    cursor: pointer;
}

.choice-item input:focus-visible {
    outline: none;
}

.choice-item strong {
    display: block;
    font-size: 15px;
    line-height: 1.3;
}

.choice-item small {
    display: block;
    font-size: 13px;
    line-height: 1.35;
    color: var(--ink-soft);
}

.choice.is-invalid .choice-item {
    border-color: var(--red-dark);
}

/* ============ Tombol sekunder ============ */
.btn-outline {
    margin-top: 8px;
    min-height: 44px;
    padding: 0 14px;
    border: 1.5px solid var(--ink);
    border-radius: var(--r-sm);
    background: var(--paper);
    font-size: 14px;
    font-weight: 700;
}

.btn-outline:hover {
    background: var(--cream);
}

.btn-outline:active {
    transform: translateY(1px);
}

.btn-outline:disabled {
    border-color: var(--line);
    color: var(--ink-soft);
}

.btn-text {
    min-height: 44px;
    padding: 0 8px;
    border: 0;
    border-radius: var(--r-sm);
    background: transparent;
    font-size: 14px;
    font-weight: 700;
    text-decoration: underline;
}

.btn-text:hover {
    background: var(--cream);
}

.btn-text:active {
    transform: translateY(1px);
}

.btn-danger {
    color: var(--red-dark);
}

.cart-tools {
    display: flex;
    justify-content: flex-end;
    margin: 0 -8px;
}

.clear-confirm {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0 4px;
    font-size: 14px;
}

.bulk-hint {
    margin-top: 4px;
    padding: 2px 12px;
    border: 1.5px dashed var(--ink);
    border-radius: var(--r-sm);
    font-size: 14px;
}

.bulk-hint a {
    display: inline-block;
    padding: 12px 0;
    font-weight: 700;
}

/* ============ Halaman pesanan siap dikirim ============ */
.done {
    max-width: 520px;
    margin: 0 auto;
    padding: 28px 16px 48px;
}

.done h1 {
    font-size: 28px;
    line-height: 1.15;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.done-lead {
    margin-top: 8px;
    color: var(--ink-soft);
}

.done-card {
    margin-top: 20px;
    padding: 16px;
    border: 1.5px solid var(--ink);
    border-radius: var(--r-md);
    background: var(--paper);
}

.done-code {
    display: inline-block;
    padding: 2px 10px;
    border-radius: var(--r-sm);
    background: var(--yellow);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.done-list {
    list-style: none;
    margin-top: 12px;
}

.done-list li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--line);
    font-variant-numeric: tabular-nums;
}

.done-total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-top: 12px;
}

.done-total strong {
    font-size: 22px;
    font-weight: 800;
}

.done-meta {
    margin-top: 12px;
    font-size: 14px;
    color: var(--ink-soft);
}

.done-actions {
    display: grid;
    gap: 10px;
    margin-top: 20px;
}

a.btn-send,
a.btn-outline {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

a.btn-outline {
    margin-top: 0;
    min-height: 52px;
    font-size: 16px;
}

/* ============ Total & kirim ============ */
.cart-foot {
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: var(--paper);
}

.cart-total {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 10px;
}

.cart-total span {
    color: var(--ink-soft);
}

.cart-total strong {
    font-size: 22px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.btn-send {
    display: block;
    width: 100%;
    height: 52px;
    border: 0;
    border-radius: var(--r-sm);
    background: var(--red);
    color: #ffffff;
    font-size: 16px;
    font-weight: 800;
}

.btn-send:hover {
    background: var(--red-dark);
}

.cart-note {
    margin-top: 8px;
    font-size: 12.5px;
    line-height: 1.4;
    color: var(--ink-soft);
    text-align: center;
}

/* ============ HP kecil ============ */
@media (max-width: 359px) {
    .product {
        grid-template-columns: 80px 1fr;
    }

    .product-photo {
        width: 80px;
        height: 80px;
    }

    .topbar-tag {
        font-size: 12px;
    }
}

/* ============ Tablet: produk dua kolom ============ */
@media (min-width: 600px) {
    .products {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============ Layar lebar: dua kolom ala kasir ============ */
@media (min-width: 960px) {
    .layout {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 380px;
        gap: 24px;
        padding: 0 24px;
    }

    .topbar {
        padding: 0 24px;
    }

    .menu {
        padding: 28px 0 48px;
    }

    .intro h1 {
        font-size: 36px;
    }

    .cats {
        margin: 16px 0 0;
        padding: 10px 0;
    }

    .cartbar,
    .backdrop,
    .cart-close {
        display: none !important;
    }

    .cart {
        position: sticky;
        top: 84px;
        z-index: 1;
        display: flex;
        align-self: start;
        max-height: calc(100dvh - 108px);
        margin-top: 28px;
        border: 1.5px solid var(--ink);
        border-radius: var(--r-md);
        box-shadow: none;
    }

    .cart-head {
        padding: 14px 16px;
    }

    .cart-foot {
        border-radius: 0 0 var(--r-md) var(--r-md);
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}
