/* EPOS.QR — masadaki QR'dan açılan müşteri menüsü. Mobil-öncelikli, tek dosya.
   / guest-facing QR menu, mobile-first single stylesheet.
   Marka paleti: kırmızı #e21e21, altın #edd405, lacivert #0e1726 */

:root {
    --brand: #e21e21;
    --gold: #edd405;
    --navy: #0e1726;
    --text: #1f2a3a;
    --muted: #8a94a6;
    --border: #e6e9ef;
    --bg: #f4f5f7;
    --card: #ffffff;
    --ok: #2e8b3d;
    --bar-h: 62px;
}

* { box-sizing: border-box; }

html, body { width: 100%; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-text-size-adjust: 100%;
}

img { max-width: 100%; }

/* ---------- üst bar: logo ORTADA, araçlar sağda / top bar with a centered logo ---------- */
.qr-topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; justify-content: center;
    padding: 10px 14px; background: var(--brand);
}

.qr-logo { height: 32px; }

.qr-tools { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); display: flex; gap: 8px; }
.qr-tools button {
    width: 38px; height: 38px; border-radius: 50%; border: 0;
    background: rgba(255,255,255,.18); color: #fff; font-size: 15px; cursor: pointer;
}
.qr-tools button:active { background: rgba(255,255,255,.32); }

/* şerit: marka·şube | masa / info strip */
.qr-table {
    position: sticky; top: 52px; z-index: 19;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    background: var(--navy); color: #fff; padding: 9px 16px; font-size: 14px;
}
.qr-table .brand { opacity: .9; }
.qr-table .t { color: var(--gold); font-weight: 700; }

/* ---------- yuvarlak kategori şeridi / round category strip ---------- */
.qr-cats {
    position: sticky; top: 92px; z-index: 18;
    display: flex; gap: 14px; overflow-x: auto; padding: 12px 14px 10px;
    background: var(--bg); scrollbar-width: none;
    justify-content: safe center;   /* sığdığında ORTALI, taştığında baştan başlar / centered, never clipped */
}
.qr-cats::-webkit-scrollbar { display: none; }

.qr-cat {
    flex: 0 0 auto; width: 78px; border: 0; background: transparent; padding: 0; cursor: pointer;
    display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.qr-cat .ring {
    width: 70px; height: 70px; border-radius: 50%; padding: 3px;
    border: 2px solid var(--brand); background: #fff;
    display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.qr-cat .ring img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.qr-cat .ring i { font-size: 24px; color: var(--brand); }
.qr-cat .lbl { font-size: 12px; line-height: 1.15; color: var(--text); text-align: center; }
.qr-cat.active .ring { border-color: var(--navy); }
.qr-cat.active .lbl { color: var(--brand); font-weight: 700; }

/* ---------- içerik: TAM GENİŞLİK / full-width content ---------- */
.qr-body { width: 100%; }
.qr-main { width: 100%; padding: 4px 14px calc(var(--bar-h) + 26px); }

.qr-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 18px; }
.qr-empty { text-align: center; padding: 48px 18px; }
.qr-empty i { font-size: 46px; color: var(--brand); }
.qr-empty h1 { margin: 14px 0 6px; font-size: 22px; }
.qr-empty p { margin: 0; color: var(--muted); font-size: 15px; }

/* arama katmanı (büyüteçle açılır) / search overlay */
.qr-searchbox {
    position: fixed; top: 52px; left: 0; right: 0; z-index: 25; display: none;
    align-items: center; gap: 10px; background: #fff; padding: 10px 14px; border-bottom: 1px solid var(--border);
}
.qr-searchbox.open { display: flex; }
.qr-searchbox i { color: var(--muted); }
.qr-searchbox input { flex: 1 1 auto; border: 0; outline: 0; font-size: 16px; color: var(--text); background: transparent; }
.qr-searchbox button { border: 0; background: transparent; color: var(--muted); font-size: 18px; }

/* kategori bölümü / category section */
.qr-sec { margin: 18px 0 6px; }
.qr-sec h2 { font-size: 17px; margin: 0 0 8px; color: var(--navy); }
.qr-group { font-size: 13px; color: var(--muted); margin: 12px 0 6px; text-transform: uppercase; letter-spacing: .4px; }

/* ürün kartı / product card */
.qr-prod {
    display: flex; align-items: center; gap: 12px; background: var(--card);
    border: 1px solid var(--border); border-radius: 12px; padding: 10px; margin-bottom: 8px; cursor: pointer;
}
.qr-prod img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; flex: 0 0 auto; }
.qr-prod .ph { width: 64px; height: 64px; border-radius: 10px; background: #f0f1f4; display: flex; align-items: center; justify-content: center; color: #c8ccd4; flex: 0 0 auto; }
.qr-prod .info { flex: 1 1 auto; min-width: 0; }
.qr-prod .name { font-size: 15px; font-weight: 600; }
.qr-prod .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.qr-prod .price { font-size: 15px; font-weight: 700; color: var(--brand); white-space: nowrap; }
.qr-prod .add { width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: #fff; border: 0; font-size: 17px; flex: 0 0 auto; }

/* Ürün ızgarası: KENDİLİĞİNDEN responsive (media-query YOK) — sütun sayısını tarayıcı
   auto-fill ile hesaplar; yüzde+margin hesabı taşıp tek sütuna düşemez.
   / self-responsive product grid: auto-fill decides the column count, so percentage+margin
     rounding can never collapse it back to a single column */
.qr-sec {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 8px;
    align-items: start;
}
.qr-sec h2, .qr-sec .qr-group { grid-column: 1 / -1; margin-bottom: 0; }
.qr-sec .qr-prod { margin-bottom: 0; }

/* ---------- alt bar / bottom bar ---------- */
.qr-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    display: flex; background: var(--navy);
    padding-bottom: env(safe-area-inset-bottom, 0);
}
.qr-bar button {
    flex: 1 1 0; border: 0; background: transparent; color: #fff; height: var(--bar-h);
    font-size: 13px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
}
.qr-bar button i { font-size: 17px; }
.qr-bar button.primary { background: var(--brand); }
.qr-bar .badge { background: var(--gold); color: var(--navy); border-radius: 10px; padding: 0 6px; font-size: 11px; font-weight: 700; margin-left: 5px; }

/* ---------- alttan açılan sayfa / bottom sheet ---------- */
.qr-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 40; display: none; }
.qr-backdrop.open { display: block; }

.qr-sheet {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; background: var(--bg);
    border-radius: 16px 16px 0 0; max-height: 88vh; display: none; flex-direction: column;
    max-width: 760px; margin: 0 auto;
}
.qr-sheet.open { display: flex; }
.qr-sheet .head {
    display: flex; align-items: center; gap: 10px; padding: 14px 16px;
    background: var(--brand); color: #fff; border-radius: 16px 16px 0 0;
}
.qr-sheet .head h3 { margin: 0; font-size: 16px; flex: 1 1 auto; }
.qr-sheet .head button { background: transparent; border: 0; color: #fff; font-size: 20px; }
.qr-sheet .body { padding: 14px 16px; overflow-y: auto; }
.qr-sheet .foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0)); border-top: 1px solid var(--border); background: #fff; }

/* tüm kategoriler listesi / all-categories list */
.qr-catlist { display: flex; flex-direction: column; gap: 8px; }
.qr-catrow {
    display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid var(--border);
    border-radius: 12px; padding: 8px 12px; font-size: 15px; text-align: left; cursor: pointer;
}
.qr-catrow img, .qr-catrow .ph {
    flex: 0 0 42px; width: 42px; height: 42px; border-radius: 50%; object-fit: cover;
    background: #f0f1f4; display: flex; align-items: center; justify-content: center; color: var(--brand);
}
/* ⚠️ nth-of-type KULLANMA: resim yokken ikon <span class="ph"> ilk span olur ve esneyip
   elips gibi yayılırdı / target the title by class, not position */
.qr-catrow .t { flex: 1 1 auto; min-width: 0; }
.qr-catrow .n { color: var(--muted); font-size: 13px; }

.qr-btn {
    width: 100%; height: 50px; border: 0; border-radius: 10px; font-size: 16px; font-weight: 600;
    background: var(--brand); color: #fff;
}
.qr-btn.ghost { background: #fff; color: var(--text); border: 1px solid var(--border); }
.qr-btn:disabled { opacity: .5; }

/* seçenekler / choices */
.qr-choice { margin-bottom: 14px; }
.qr-choice h4 { margin: 0 0 6px; font-size: 15px; }
.qr-choice .req { font-size: 12px; color: var(--brand); margin-left: 6px; }
.qr-opt {
    display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--border);
    border-radius: 10px; padding: 10px 12px; margin-bottom: 6px; font-size: 14px; cursor: pointer;
}
.qr-opt.sel { border-color: var(--brand); background: #fff5f5; }
.qr-opt .p { margin-left: auto; color: var(--brand); font-weight: 600; }
.qr-nested { margin-left: 16px; border-left: 2px solid var(--border); padding-left: 10px; }

.qr-qty { display: flex; align-items: center; gap: 14px; justify-content: center; margin: 14px 0; }
.qr-qty button { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--border); background: #fff; font-size: 20px; }
.qr-qty span { font-size: 20px; font-weight: 700; min-width: 30px; text-align: center; }

textarea.qr-note { width: 100%; border: 1px solid var(--border); border-radius: 10px; padding: 10px; font-size: 14px; font-family: inherit; }

/* sepet satırı / cart line */
.qr-line { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--border); }
.qr-line .q { font-weight: 700; color: var(--brand); }
.qr-line .n { flex: 1 1 auto; }
.qr-line .opts { font-size: 12px; color: var(--muted); white-space: pre-line; }
.qr-line .t { font-weight: 600; }
.qr-line .del { border: 0; background: transparent; color: var(--muted); font-size: 16px; }

.qr-total { display: flex; justify-content: space-between; font-size: 18px; font-weight: 700; margin: 12px 0; }

/* sipariş durumu / order status */
.qr-order { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin-bottom: 10px; }
.qr-order .top { display: flex; align-items: center; gap: 8px; }
.qr-order .when { color: var(--muted); font-size: 12px; margin-left: auto; }
.qr-order .items { font-size: 13px; color: var(--muted); margin-top: 6px; white-space: pre-line; }
.qr-status { padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 700; color: #fff; background: var(--muted); }
.qr-status.s0 { background: #e59a3c; }
.qr-status.s1 { background: #8a94a6; }
.qr-status.s2 { background: #5b8def; }
.qr-status.s3 { background: var(--ok); }
.qr-status.s4 { background: var(--navy); }
.qr-status.s8, .qr-status.s9 { background: #e11e28; }

.qr-note-box { background: #fff8e1; border: 1px solid #f2e2a8; border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px; }

/* toast */
.qr-toast {
    position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--bar-h) + 18px);
    background: #333; color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 14px; z-index: 60;
    opacity: 0; pointer-events: none; transition: opacity .2s;
}
.qr-toast.show { opacity: 1; }

/* alt bilgi / footer */
.qr-foot { text-align: center; color: var(--muted); font-size: 12px; padding: 16px 12px 0; }
