/* Deefter — Ekran klavyesi (EkranKlavye) · stil dosyası. TEK ortak dosya: Market, Restoran / Cafe, Muhasebe, Deefter Hesap.
 * Eşi: assets/js/ekran-klavye.js (bağımsız; Bootstrap / core.js gerektirmez). Sınıf öneki ek- (AdGuard'a takılmaz: "ad" parçası yok).
 * Tema: <html data-bs-theme="dark|light"> (core.js) → JS, kök öğeye data-tema yazar; renkler --ek-* değişkenleridir ve --ad-primary / --ad-on-primary'yi izler.
 * Özgüllük notu: dokunmatik.css `:where(html[data-dk] button) { min-width: 44px; min-height: 44px }` verir (özgüllük 0); burada her tuşun min-width'i açıkça 0'dır. */

.ek-koku {
  display: contents;
  --ek-yuklu: 1;
  /* açık tema */
  --ek-zemin: #e6e9f0;
  --ek-sinir: #cdd3df;
  --ek-tus: #ffffff;
  --ek-tus-sinir: rgba(20, 26, 42, .09);
  --ek-tus-golge: rgba(20, 26, 42, .26);
  --ek-ozel: #c9d0de;
  --ek-yazi: #141a2a;
  --ek-soluk: #5d6578;
  --ek-vurgu: var(--ad-primary, #c8005a);
  --ek-vurgu-yazi: var(--ad-on-primary, #ffffff);
  --ek-golge: 0 -10px 40px rgba(16, 24, 40, .20);
  --ek-golge-yuzen: 0 22px 64px rgba(16, 24, 40, .34);
  --ek-cam: rgba(255, 255, 255, .80);
  --ek-cam-sinir: rgba(20, 26, 42, .16);
  --ek-cam-yazi: #3b4356;
  --ek-yazi-font: var(--ad-font, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);
}
.ek-koku[data-tema="dark"] {
  --ek-zemin: #131822;
  --ek-sinir: #262d3c;
  --ek-tus: #2a3246;
  --ek-tus-sinir: rgba(255, 255, 255, .06);
  --ek-tus-golge: rgba(0, 0, 0, .55);
  --ek-ozel: #1b2130;
  --ek-yazi: #e9ecf3;
  --ek-soluk: #9aa3b6;
  --ek-vurgu: var(--ad-primary, #ff4d97);
  --ek-vurgu-yazi: var(--ad-on-primary, #500724);
  --ek-golge: 0 -10px 40px rgba(0, 0, 0, .5);
  --ek-golge-yuzen: 0 22px 64px rgba(0, 0, 0, .65);
  --ek-cam: rgba(28, 34, 48, .78);
  --ek-cam-sinir: rgba(255, 255, 255, .16);
  --ek-cam-yazi: #c3c9d6;
}

/* ---------------------------------------------------------------- panel */
.ek-panel {
  --ek-h: 52px;            /* harf tuşu yüksekliği (boyut: küçük 44 / orta 52 / büyük 60) */
  --ek-nh: 64px;           /* sayı tuşu yüksekliği */
  --ek-gen: 900px;
  --ek-bosluk: 5px;
  position: fixed; z-index: 1960; left: 50%; bottom: 0;
  box-sizing: border-box; width: min(var(--ek-gen), 96vw); max-height: 100vh;
  padding: 4px 8px calc(8px + env(safe-area-inset-bottom, 0px));
  transform: translate(calc(-50% + var(--ek-dx, 0px)), var(--ek-dy, 0px));
  background: var(--ek-zemin); color: var(--ek-yazi);
  border: 1px solid var(--ek-sinir); border-bottom-width: 0; border-radius: 18px 18px 0 0;
  box-shadow: var(--ek-golge);
  font-family: var(--ek-yazi-font); font-size: 16px; line-height: 1.2;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: none; overscroll-behavior: contain;
  -webkit-tap-highlight-color: transparent; text-align: left;
}
.ek-panel[hidden] { display: none !important; }
.ek-panel[data-boyut="kucuk"] { --ek-h: 44px; --ek-nh: 56px; --ek-gen: 760px; --ek-bosluk: 4px; }
.ek-panel[data-boyut="orta"]  { --ek-h: 52px; --ek-nh: 64px; --ek-gen: 900px; }
.ek-panel[data-boyut="buyuk"] { --ek-h: 60px; --ek-nh: 72px; --ek-gen: 1040px; --ek-bosluk: 6px; }
.ek-panel[data-duzen="sayi"] { --ek-gen: 400px; }
.ek-panel[data-duzen="sayi"][data-boyut="kucuk"] { --ek-gen: 340px; }
.ek-panel[data-duzen="sayi"][data-boyut="buyuk"] { --ek-gen: 460px; }
.ek-panel[data-konum="yuzen"] { bottom: 16px; border-radius: 20px; border-bottom-width: 1px; box-shadow: var(--ek-golge-yuzen); }
.ek-panel.ek-gorun { animation: ek-gir .18s ease-out both; }
@keyframes ek-gir { from { translate: 0 18px; } to { translate: 0 0; } }

/* telefon / dar ekran: alta yapışık, tam genişlik (sayı takımı yalnız dar ekranda tam genişlik) */
@media (max-width: 768px) {
  .ek-panel { left: 0; width: 100vw; transform: none; bottom: 0; border-radius: 16px 16px 0 0; border-bottom-width: 0; box-shadow: var(--ek-golge); }
  .ek-panel[data-konum="yuzen"] { bottom: 0; border-radius: 16px 16px 0 0; box-shadow: var(--ek-golge); }
  .ek-panel[data-duzen="sayi"] { left: 50%; width: min(100vw, 480px); transform: translateX(-50%); }
}
/* kısa ekran (yatay telefon): tuşlar en küçük boyuta iner (hâlâ ≥ 44 px) */
@media (max-height: 520px) {
  .ek-panel { --ek-h: 44px; --ek-nh: 48px; --ek-bosluk: 4px; }
  .ek-panel[data-boyut="kucuk"], .ek-panel[data-boyut="orta"], .ek-panel[data-boyut="buyuk"] { --ek-h: 44px; --ek-nh: 48px; --ek-bosluk: 4px; }
  .ek-ust { min-height: 44px; }
}

/* ---------------------------------------------------------------- üst çubuk */
.ek-ust { display: flex; align-items: center; gap: 2px; min-height: 44px; padding: 0 0 2px; }
.ek-arac {
  appearance: none; -webkit-appearance: none; margin: 0; border: 0; background: transparent; color: var(--ek-yazi);
  height: 44px; min-width: 44px; min-height: 44px; padding: 0 10px; border-radius: 12px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: 600 .8rem/1 var(--ek-yazi-font); text-transform: none; letter-spacing: 0;
}
.ek-arac svg { width: 20px; height: 20px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ek-arac .ek-yaz { display: none; }
@media (min-width: 560px) { .ek-arac .ek-yaz { display: inline; } }
.ek-arac:hover, .ek-arac.ek-bas { background: var(--ek-ozel); }
.ek-arac:focus-visible, .ek-tus:focus-visible, .ek-dugme:focus-visible, .ek-menu button:focus-visible { outline: 3px solid var(--ek-vurgu); outline-offset: 2px; }
.ek-arac[data-t="kapat"] { margin-left: 2px; }
.ek-tutac {
  flex: 1 1 auto; min-width: 0; padding: 0 8px; text-align: center; color: var(--ek-soluk);
  font: 600 .8rem/1.2 var(--ek-yazi-font); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ek-tutac.ek-uyari { color: var(--ek-vurgu); animation: ek-titre .32s ease-in-out; }
.ek-panel[data-konum="yuzen"] .ek-tutac { cursor: grab; }
.ek-panel.ek-suruklenen .ek-tutac { cursor: grabbing; }
@keyframes ek-titre { 0%, 100% { translate: 0 0; } 25% { translate: -4px 0; } 75% { translate: 4px 0; } }
@media (min-width: 769px) { .ek-panel[data-konum="yuzen"] .ek-ust::before { content: ""; position: absolute; left: 50%; top: 5px; width: 36px; height: 4px; margin-left: -18px; border-radius: 4px; background: var(--ek-sinir); } }
.ek-ust { position: relative; }

/* ---------------------------------------------------------------- tuşlar */
.ek-govde { display: flex; flex-direction: column; gap: var(--ek-bosluk); }
.ek-satir { display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); grid-auto-rows: var(--ek-h); gap: var(--ek-bosluk); }
.ek-sayi { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: repeat(4, var(--ek-nh)); gap: var(--ek-bosluk); }
.ek-bos { pointer-events: none; }

.ek-tus {
  appearance: none; -webkit-appearance: none; box-sizing: border-box; margin: 0; padding: 0; border: 0;
  min-width: 0; min-height: var(--ek-h); height: 100%; width: 100%;
  border-radius: calc(var(--ek-h) * .2); background: var(--ek-tus); color: var(--ek-yazi);
  font: 500 calc(var(--ek-h) * .4)/1 var(--ek-yazi-font); text-transform: none; letter-spacing: 0; text-align: center;
  box-shadow: 0 1px 0 var(--ek-tus-golge), inset 0 0 0 1px var(--ek-tus-sinir);
  display: flex; align-items: center; justify-content: center; gap: .4em; cursor: pointer; position: relative;
  transition: background-color .08s ease, transform .06s ease, box-shadow .08s ease;
}
.ek-sayi .ek-tus { min-height: var(--ek-nh); border-radius: calc(var(--ek-nh) * .2); font-size: calc(var(--ek-nh) * .42); font-weight: 500; }
.ek-tus svg { width: calc(var(--ek-h) * .46); height: calc(var(--ek-h) * .46); flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.ek-sayi .ek-tus svg { width: calc(var(--ek-nh) * .4); height: calc(var(--ek-nh) * .4); }
.ek-tus[data-t="shift"], .ek-tus[data-t="sil"], .ek-tus[data-t="sembol"], .ek-tus[data-t="harf"], .ek-tus[data-t="sol"], .ek-tus[data-t="sag"] { background: var(--ek-ozel); }
.ek-tus[data-t="sembol"], .ek-tus[data-t="harf"] { font-size: calc(var(--ek-h) * .3); font-weight: 700; letter-spacing: .01em; }
.ek-tus[data-t="bosluk"] { font-size: calc(var(--ek-h) * .27); font-weight: 600; color: var(--ek-soluk); }
.ek-tus[data-t="enter"] { background: var(--ek-vurgu); color: var(--ek-vurgu-yazi); box-shadow: 0 1px 0 var(--ek-tus-golge); font-size: calc(var(--ek-h) * .3); font-weight: 700; }
.ek-sayi .ek-tus[data-t="enter"] { flex-direction: column; gap: .2em; font-size: calc(var(--ek-nh) * .26); }
.ek-sayi .ek-tus[data-t="enter"] svg { width: calc(var(--ek-nh) * .46); height: calc(var(--ek-nh) * .46); }
.ek-panel[data-duzen="harf"] .ek-tus[data-t="enter"].ek-yazili svg { display: none; }
.ek-tus[data-t="shift"] svg { fill: transparent; }
.ek-tus[data-t="shift"][data-durum="1"] { background: var(--ek-yazi); color: var(--ek-tus); }
.ek-tus[data-t="shift"][data-durum="1"] svg { fill: currentColor; }
.ek-tus[data-t="shift"][data-durum="2"] { background: var(--ek-vurgu); color: var(--ek-vurgu-yazi); }
.ek-tus[data-t="shift"][data-durum="2"] svg { fill: currentColor; }
.ek-tus[data-t="shift"][data-durum="2"]::after { content: ""; position: absolute; left: 50%; bottom: 7%; width: 28%; height: 3px; margin-left: -14%; border-radius: 3px; background: currentColor; }
.ek-tus:hover { filter: brightness(.97); }
.ek-koku[data-tema="dark"] .ek-tus:hover { filter: brightness(1.12); }
.ek-tus.ek-bas { transform: scale(.95); filter: brightness(.88); box-shadow: inset 0 0 0 1px var(--ek-tus-sinir); }
.ek-koku[data-tema="dark"] .ek-tus.ek-bas { filter: brightness(1.35); }

/* tuş önizleme balonu (yalnız dar ekran) */
.ek-onizle {
  position: fixed; z-index: 1980; left: 0; top: 0; display: none; place-items: center; pointer-events: none;
  min-width: 46px; height: 56px; padding: 0 12px; border-radius: 12px; box-sizing: border-box;
  background: var(--ek-tus); color: var(--ek-yazi); font: 500 1.8rem/1 var(--ek-yazi-font);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .35), inset 0 0 0 1px var(--ek-tus-sinir);
}
.ek-onizle.ek-gor { display: grid; }
@media (min-width: 769px) { .ek-onizle { display: none !important; } }

/* ---------------------------------------------------------------- uçan düğme */
.ek-dugme {
  position: fixed; z-index: 1950; box-sizing: border-box; width: 44px; height: 44px; min-width: 44px; min-height: 44px; margin: 0; padding: 0;
  border-radius: 50%; border: 1px solid var(--ek-cam-sinir); background: var(--ek-cam); color: var(--ek-cam-yazi);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  display: grid; place-items: center; cursor: pointer; opacity: .5; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .12); -webkit-tap-highlight-color: transparent;
  transition: opacity .2s ease, box-shadow .2s ease;
}
.ek-dugme[hidden] { display: none !important; }
.ek-dugme svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.ek-dugme:hover, .ek-dugme:focus-visible, .ek-dugme.ek-surukle { opacity: .95; }
.ek-dugme[aria-expanded="true"] { opacity: .8; color: var(--ek-vurgu); border-color: var(--ek-vurgu); }
.ek-dugme.ek-surukle { box-shadow: 0 8px 26px rgba(0, 0, 0, .3); }
.ek-dugme[data-kose="sag-alt"] { right: max(14px, env(safe-area-inset-right, 0px)); bottom: calc(var(--ek-alt, 14px) + env(safe-area-inset-bottom, 0px)); }
.ek-dugme[data-kose="sol-alt"] { left: max(14px, env(safe-area-inset-left, 0px)); bottom: calc(var(--ek-alt, 14px) + env(safe-area-inset-bottom, 0px)); }
.ek-dugme[data-kose="sag-ust"] { right: max(14px, env(safe-area-inset-right, 0px)); top: calc(var(--ad-top-h, 0px) + 12px); }
.ek-dugme[data-kose="sol-ust"] { left: max(14px, env(safe-area-inset-left, 0px)); top: calc(var(--ad-top-h, 0px) + 12px); }

/* görünmez şerit: yukari.js'in [data-yuzen] taramasında düğmenin yerini "dolu" gösterir (tıklanmaz, görünmez) */
.ek-yer { position: fixed; right: 0; bottom: 0; width: 64px; height: 0; z-index: 1; pointer-events: none; background: transparent; }

/* ---------------------------------------------------------------- ayar menüsü (düğmeye uzun basış / araç çubuğundaki ayar tuşu) */
.ek-menu {
  position: fixed; z-index: 1970; box-sizing: border-box; width: min(304px, calc(100vw - 16px)); padding: 8px;
  border-radius: 16px; background: var(--ek-zemin); color: var(--ek-yazi); border: 1px solid var(--ek-sinir); box-shadow: var(--ek-golge-yuzen);
  font: 500 .86rem/1.3 var(--ek-yazi-font); -webkit-user-select: none; user-select: none; touch-action: manipulation;
}
.ek-menu[hidden] { display: none !important; }
.ek-menu button { appearance: none; -webkit-appearance: none; font: inherit; color: inherit; text-transform: none; letter-spacing: 0; margin: 0; cursor: pointer; }
.ek-menu-satir {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; box-sizing: border-box;
  min-height: 44px; padding: 6px 10px; border: 0; border-radius: 10px; background: transparent; text-align: left; font-weight: 600;
}
.ek-menu-satir:hover { background: var(--ek-ozel); }
.ek-anahtar { position: relative; flex: 0 0 auto; width: 42px; height: 24px; border-radius: 24px; background: var(--ek-ozel); box-shadow: inset 0 0 0 1px var(--ek-sinir); transition: background-color .15s ease; }
.ek-anahtar::after { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--ek-soluk); transition: transform .15s ease, background-color .15s ease; }
.ek-menu-satir[aria-checked="true"] .ek-anahtar { background: var(--ek-vurgu); box-shadow: none; }
.ek-menu-satir[aria-checked="true"] .ek-anahtar::after { transform: translateX(18px); background: var(--ek-vurgu-yazi); }
.ek-menu-grup { padding: 4px 10px 6px; }
.ek-menu-baslik { display: block; margin: 4px 0 6px; font-size: .74rem; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; color: var(--ek-soluk); }
.ek-seg { display: flex; gap: 3px; padding: 3px; border-radius: 12px; background: var(--ek-ozel); }
.ek-seg button { flex: 1 1 0; min-width: 0; min-height: 44px; padding: 0 6px; border: 0; border-radius: 9px; background: transparent; font-weight: 600; font-size: .82rem; color: var(--ek-yazi); }
.ek-seg button[aria-checked="true"] { background: var(--ek-tus); box-shadow: 0 1px 0 var(--ek-tus-golge), inset 0 0 0 1px var(--ek-tus-sinir); }
.ek-menu-not { margin: 2px 10px 6px; font-size: .74rem; color: var(--ek-soluk); }

/* ---------------------------------------------------------------- sayfa uyumu (klavye açıkken) */
/* alt boşluk: alan klavyenin altında kalmasın (--ek-yuk = klavyenin kapladığı yükseklik, JS yazar) */
body.ek-acik { padding-bottom: var(--ek-yuk, 0px); }
body.ek-acik .modal.show, body.ek-acik .offcanvas.show:not(.offcanvas-bottom) { padding-bottom: var(--ek-yuk, 0px); }
/* belge kaydırması: html/body yüksekliği sabitse padding kayma alanını büyütmez → JS gerektiğinde ek-belge ekler (sayfa sonuna klavye kadar boşluk) */
body.ek-acik.ek-belge::after { content: ""; display: block; height: var(--ek-yuk, 0px); }
/* sağ alttaki bildirimler düğmenin / klavyenin üstüne taşınır (yukari.js [data-yuzen] işaretiyle kendi payını hesaplar) */
body.ek-sag-dolu .sm-toasts { bottom: calc(var(--ek-sag-yuk, 0px) + 10px); }

@media (prefers-reduced-motion: reduce) {
  .ek-panel.ek-gorun, .ek-tutac.ek-uyari { animation: none; }
  .ek-tus, .ek-dugme, .ek-anahtar, .ek-anahtar::after { transition: none; }
}
@media print { .ek-koku { display: none !important; } body.ek-acik { padding-bottom: 0; } }
