/* İŞ 339: Kafe self servis kasa ekranı (public/kafe-pos.js). Yalnız .kps altında; market / bakkal Satış ekranını ve restoranı etkilemez.
   Ürün kartı, kategori çipi ve arama kutusu masa menüsünün bileşenleridir (.mz-product / .mz-tab / .mz-search, styles.css + koyu-tema.css). */
.kps { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.kps-menu { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.kps-ust { display: flex; gap: 8px; align-items: center; }
.kps-ara { flex: 1 1 auto; width: auto; max-width: none; }
.kps-araclar { display: flex; gap: 6px; align-items: center; flex: none; }
.kps-araclar:empty { display: none; }
.kps-ikon, .kps-araclar .pk-tus-btn, .kps-araclar button { width: 44px; height: 44px; min-width: 44px; padding: 0; border-radius: 12px; border: 1px solid var(--border-strong, var(--border)); background: var(--surface); color: var(--muted); display: inline-grid; place-items: center; cursor: pointer; font-size: 0.8rem; font-weight: 700; }
.kps-ikon svg { width: 20px; height: 20px; }
.kps-araclar button > span:not(:first-child) { display: none; } /* tuş takımı / kamera yazısı gizli: yalnız simge */
.kps-ikon:hover, .kps-araclar button:hover { color: var(--text); border-color: var(--mz-green, var(--primary)); }
.kps-katlar { overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; -webkit-overflow-scrolling: touch; }
.kps-katlar::-webkit-scrollbar { display: none; }
.kps-katlar .mz-tab { flex: none; white-space: nowrap; min-height: 40px; border-radius: 999px; }
.kps-urunler { grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 14px; }
.kps-urun { cursor: pointer; display: flex; flex-direction: column; }
.kps-urun .mz-product-body { flex: 1 1 auto; }
.kps-urun .mz-product-foot { margin-top: auto; padding-top: 8px; }
.kps-urun .mz-product-img { height: 92px; }
.kps-urun .mz-product-img svg { width: 46px; height: 46px; }
.kps-urun .mz-product-body { padding: 10px 12px 12px; }
.kps-urun .mz-product-body strong { line-height: 1.25; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.kps-urun .mz-product-body small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kps-urun .mz-product-foot { gap: 6px; }
.kps-urun .mz-product-foot b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.kps-urun .mz-product-foot b small { font-size: 0.7em; color: var(--muted); font-weight: 600; }
.kps-urun .mz-add { width: 34px; height: 34px; border-radius: 999px; flex: none; }
.kps-urun .mz-add svg { width: 18px; height: 18px; }
.kps-urun.kps-tukendi { opacity: .55; }
.mz-product-img.kps-sicak { background: #f1e2d3; color: #7a4520; }
.mz-product-img.kps-soguk { background: #d6e8f1; color: #1b5b78; }
.mz-product-img.kps-tatli { background: #f6dde3; color: #8c2f4a; }
.mz-product-img.kps-yemek { background: #dcebe2; color: #2f6b4f; }
.kps-yukleniyor { padding: 20px 4px; }

/* sepet */
.kps-sepet { position: sticky; top: 12px; display: flex; flex-direction: column; gap: 10px; padding: 16px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); box-shadow: 0 6px 22px rgba(16, 40, 36, .06); max-height: calc(100vh - 110px); max-height: calc(100dvh - 110px); }
.kps-sepet-bas { display: flex; align-items: center; gap: 8px; }
.kps-sepet-bas > div { flex: 1 1 auto; min-width: 0; }
.kps-sepet-bas h2 { margin: 0; font-size: 1.15rem; }
.kps-sepet-bas small { color: var(--muted); font-size: 0.82rem; }
.kps-temizle { border: 0; background: none; color: var(--danger, #b42318); font-weight: 600; font-size: 0.85rem; cursor: pointer; padding: 6px 8px; border-radius: 8px; }
.kps-temizle:hover { background: var(--danger-soft, #fde8e6); }
.kps-kapat { display: none; }
.kps-ad { display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; color: var(--muted); }
.kps-ad input { min-height: 40px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-alt, var(--surface)); color: var(--text); font: inherit; font-size: 0.95rem; }
.kps-mesaj { min-height: 0; font-size: 0.85rem; }
.kps-mesaj:empty { display: none; }
.kps-satirlar { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; overflow-y: auto; flex: 1 1 auto; min-height: 120px; }
.kps-satir { display: grid; grid-template-columns: minmax(0, 1fr) auto 76px; grid-template-areas: "ad adim tutar"; gap: 8px; padding: 9px 2px; border-bottom: 1px solid var(--border); align-items: center; }
.kps-satir.yeni { animation: kps-yeni .7s ease; }
@keyframes kps-yeni { from { background: var(--mz-green-soft, #e4f5f1); } to { background: transparent; } }
@media (prefers-reduced-motion: reduce) { .kps-satir.yeni { animation: none; } }
.kps-satir-ad { grid-area: ad; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.kps-satir-ad b { font-size: 0.95rem; overflow-wrap: anywhere; }
.kps-satir-ad small { color: var(--muted); font-size: 0.78rem; line-height: 1.3; overflow-wrap: anywhere; }
.kps-satir-ad .kps-kamp { color: var(--ok-dark, #1f7a5c); }
.kps-satir-tutar { grid-area: tutar; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.kps-adim { grid-area: adim; }
.kps-adim button { width: 30px; height: 30px; }
.kps-adim button svg { width: 16px; height: 16px; }
.kps-adim span { min-width: 24px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.kps-kg { font-weight: 600; font-variant-numeric: tabular-nums; }
.kps-satir:has(.kps-sil) { grid-template-columns: minmax(0, 1fr) auto 76px 30px; grid-template-areas: "ad adim tutar sil"; }
.kps-sil { grid-area: sil; border: 0; background: none; color: var(--muted); width: 34px; height: 34px; border-radius: 8px; cursor: pointer; }
.kps-sil svg { width: 18px; height: 18px; }
.kps-bos { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 28px 8px; color: var(--muted); text-align: center; }
.kps-bos svg { width: 40px; height: 40px; opacity: .6; }
.kps-bos span { font-weight: 700; color: var(--text); }
.kps-bos small { font-size: 0.82rem; }
.kps-alt { display: flex; flex-direction: column; gap: 8px; padding-top: 10px; border-top: 1px solid var(--border); }
.kps-indirim { display: flex; justify-content: space-between; font-size: 0.88rem; color: var(--ok-dark, #1f7a5c); }
.kps-toplam { display: flex; justify-content: space-between; align-items: baseline; }
.kps-toplam span { color: var(--muted); font-weight: 600; }
.kps-toplam b { font-family: var(--font-display, inherit); font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.kps-ode { width: 100%; min-height: 58px; font-size: 1.1rem; border-radius: 14px; }
.kps-perde, .kps-bar { display: none; }

/* tablet dikey: sepet biraz daralır */
@media (max-width: 1023px) and (min-width: 720px) {
  .kps { grid-template-columns: minmax(0, 1fr) 300px; gap: 14px; }
  .kps-urunler { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
  .kps-urun .mz-product-img { height: 76px; }
}

/* telefon: sepet alttan açılan çekmece; altta "Sepeti gör · toplam" çubuğu (alt menünün üstünde) */
@media (max-width: 719px) {
  .kps { grid-template-columns: 1fr; gap: 10px; padding-bottom: 76px; }
  .kps-urunler { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kps-urun .mz-product-img { height: 72px; }
  .kps-urun .mz-product-img svg { width: 38px; height: 38px; }
  .kps-urun .mz-product-body { padding: 8px 10px 10px; }
  .kps-urun .mz-product-body strong { font-size: 0.9rem; }
  .kps-urun .mz-product-foot b { font-size: 1rem; }
  .kps-urun:hover { transform: none; }
  .kps-sepet { position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 70; max-height: 86vh; max-height: 86dvh; border-radius: 20px 20px 0 0; padding: 14px 16px calc(14px + env(safe-area-inset-bottom, 0px)); transform: translateY(105%); transition: transform .22s ease; visibility: hidden; box-shadow: 0 -12px 32px -12px rgba(15, 23, 42, .35); }
  .kps-sepet-acik .kps-sepet { transform: none; visibility: visible; }
  /* klavye açıkken / kısa ekranda "Öde" görünür kalır: çekmece klavyenin üstüne oturur (--kps-klavye, kafe-pos.js visualViewport), içerik kayar, toplam + Öde altta yapışık */
  .kps-sepet { bottom: var(--kps-klavye, 0px); max-height: calc(86dvh - var(--kps-klavye, 0px)); overflow-y: auto; overscroll-behavior: contain; scroll-padding-bottom: 136px; }
  .kps-alt { position: sticky; bottom: calc(-14px - env(safe-area-inset-bottom, 0px)); margin: 0 -16px calc(-14px - env(safe-area-inset-bottom, 0px)); padding: 10px 16px calc(14px + env(safe-area-inset-bottom, 0px)); background: var(--surface); z-index: 2; }
  .kps-kapat { display: inline-grid; width: 40px; height: 40px; min-width: 40px; }
  .kps-perde { display: block; position: fixed; inset: 0; z-index: 69; background: rgba(15, 23, 42, .45); }
  .kps-perde[hidden] { display: none; }
  .kps-bar { display: flex; position: fixed; left: 12px; right: 12px; bottom: calc(var(--yt-bottom-h, 0px) + 10px); z-index: 60; align-items: center; gap: 10px; min-height: 56px; padding: 8px 16px 8px 8px; border: 0; border-radius: 16px; background: var(--mz-green, var(--primary)); color: #fff; font: inherit; font-weight: 700; box-shadow: 0 10px 24px -8px rgba(0, 0, 0, .4); cursor: pointer; }
  .kps-bar[hidden] { display: none; }
  .kps-bar-say { min-width: 38px; height: 38px; padding: 0 8px; border-radius: 12px; background: rgba(255, 255, 255, .2); display: grid; place-items: center; font-variant-numeric: tabular-nums; }
  .kps-bar-yazi { flex: 1 1 auto; text-align: left; }
  .kps-bar b { font-variant-numeric: tabular-nums; font-size: 1.1rem; }
}
@media (max-width: 380px) {
  .kps-urunler { gap: 8px; }
  .kps-urun .mz-add { width: 30px; height: 30px; }
}

/* koyu tema: kart görsel zemini */
:root[data-theme="dark"] .mz-product-img.kps-sicak { background: #3a2a1f !important; color: #f0c9a4; }
:root[data-theme="dark"] .mz-product-img.kps-soguk { background: #1d3340 !important; color: #a9d4ea; }
:root[data-theme="dark"] .mz-product-img.kps-tatli { background: #3a2229 !important; color: #f1b3c4; }
:root[data-theme="dark"] .mz-product-img.kps-yemek { background: #1f3329 !important; color: #a8dcc0; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .mz-product-img.kps-sicak { background: #3a2a1f !important; color: #f0c9a4; }
  :root:not([data-theme="light"]) .mz-product-img.kps-soguk { background: #1d3340 !important; color: #a9d4ea; }
  :root:not([data-theme="light"]) .mz-product-img.kps-tatli { background: #3a2229 !important; color: #f1b3c4; }
  :root:not([data-theme="light"]) .mz-product-img.kps-yemek { background: #1f3329 !important; color: #a8dcc0; }
}
@media print { .kps { display: none !important; } }
