/* ═══════════════════════════════════════════════════════════════
   AYTAÇ SOHBET MODÜLÜ v1 (Faz 1) — WhatsApp davranış klonu
   Ayrı dosya: index.html'e dokunmadan güncellenebilir.
   Tema: gece (varsayılan) + [data-theme="day"] gündüz.
   ═══════════════════════════════════════════════════════════════ */

:root{
  --wz-mine: #005c4b;          /* benim balonum (WhatsApp koyu yeşili) */
  --wz-mine-text: #e9fef7;
  --wz-their: #202c33;
  --wz-their-text: #e9edef;
  --wz-wall: #0b141a;          /* duvar kağıdı zemin */
  --wz-accent: #00a884;        /* WhatsApp yeşili (aksiyon) */
  --wz-chip: #182229;
  --wz-badge: #00a884;
  --wz-tick: #53bdeb;
}
[data-theme="day"]{
  --wz-mine: #d9fdd3;
  --wz-mine-text: #111b21;
  --wz-their: #ffffff;
  --wz-their-text: #111b21;
  --wz-wall: #efeae2;
  --wz-chip: #ffffff;
}

/* ── DÜZELTME: tema düğmesi alt sekme çubuğunun üstüne çıksın ── */
body.has-tabbar .theme-toggle{
  bottom: calc(88px + env(safe-area-inset-bottom, 0px)) !important;
}
/* Sohbet odası açıkken tema düğmesi gizlensin (balonların üstüne binmesin) */
body.wz-in-room .theme-toggle{ display:none !important; }

/* ── KÖK ── */
#ch-root{ display:flex; flex-direction:column; min-height:60vh; }
.wz-view{ display:none; flex-direction:column; }
.wz-view.on{ display:flex; }

/* ── TAM EKRAN İSKELET (pro çözüm: sabit piksel hesabı YOK) ──
   Oda / kişiler / bilgi ekranları görünür olunca ekranı tamamen kaplar:
   başlık sabit üstte, orta bölüm kalan alanı doldurup yalnız kendisi kayar,
   yazma çubuğu sabit altta. Çentik/tuş payları cihazın kendisinden (env),
   klavye açılınca alan kendiliğinden daralır (dvh + Android adjustResize). */
#wz-room.on, #wz-contacts.on, #wz-info.on{
  position:fixed; inset:0; z-index:8900; background:var(--bg);
  height:100dvh; max-height:100dvh;
  padding:calc(env(safe-area-inset-top,0px) + 6px) 10px 0;
  overflow:hidden;
}
#wz-contacts.on, #wz-info.on{ overflow-y:auto; padding-bottom:calc(20px + env(safe-area-inset-bottom,0px)); }
#wz-room.on{ display:flex; flex-direction:column; }
#wz-room .wz-room-top{ flex:none; }
#wz-room .vc-slot{ flex:none; }
#wz-room #wz-emoji-panel{ flex:none; }
#wz-room .wz-composer{ flex:none; }
/* tam ekranda alt sekme çubuğu gizlenir (WhatsApp davranışı) */
body.wz-in-room #tabbar-d, body.wz-in-room #tabbar-s{ display:none !important; }
body.wz-in-room .theme-toggle{ display:none !important; }
/* Masaüstü (Electron): pencere başlık çubuğu payı */
html.desktop-shell #wz-room.on, html.desktop-shell #wz-contacts.on, html.desktop-shell #wz-info.on{
  padding-top:48px;
}
html.desktop-shell #wz-room.on{ padding-left:max(10px, calc(50vw - 340px)); padding-right:max(10px, calc(50vw - 340px)); }

/* ── ÜST BAR ── */
.wz-top{ display:flex; align-items:center; gap:10px; padding:4px 2px 10px; }
.wz-top .ttl{ font-size:19px; font-weight:800; flex:1; }
.wz-ic{ width:38px; height:38px; border-radius:50%; border:none; background:transparent;
  color:var(--text); font-size:18px; cursor:pointer; display:flex; align-items:center;
  justify-content:center; flex:none; }
.wz-ic:active{ background:var(--bg3); }
.wz-back{ font-size:22px; }

/* ── ARAMA KUTUSU ── */
.wz-search{ display:flex; align-items:center; gap:8px; background:var(--bg2);
  border:1px solid var(--border); border-radius:22px; padding:8px 14px; margin-bottom:10px; }
.wz-search input{ flex:1; background:transparent; border:none !important; outline:none;
  color:var(--text); font-size:13.5px; padding:0 !important; margin:0; box-shadow:none !important; }
.wz-search .lens{ color:var(--text-muted); font-size:14px; flex:none; }

/* ── SEKME (Sohbetler | Aramalar) ── */
.wz-tabs{ display:flex; gap:8px; margin-bottom:10px; }
.wz-tab{ flex:1; text-align:center; padding:8px 0; border-radius:18px; font-size:13px;
  font-weight:700; color:var(--text-muted); background:var(--bg2); border:1px solid var(--border);
  cursor:pointer; user-select:none; }
.wz-tab.on{ background:rgba(0,168,132,.16); color:var(--wz-accent); border-color:rgba(0,168,132,.4); }

/* ── SOHBET LİSTESİ SATIRI ── */
.wz-row{ display:flex; align-items:center; gap:12px; padding:10px 8px; border-radius:12px;
  cursor:pointer; user-select:none; -webkit-user-select:none; }
.wz-row:active{ background:var(--bg2); }
.wz-av{ width:48px; height:48px; border-radius:50%; background:var(--bg3); color:var(--text);
  display:flex; align-items:center; justify-content:center; font-size:19px; font-weight:800;
  flex:none; overflow:hidden; }
.wz-av.dm{ background:linear-gradient(135deg,#3B82F6,#1d4ed8); color:#fff; }
.wz-av.grp{ background:linear-gradient(135deg,var(--primary),var(--primary-dark)); color:#fff; }
.wz-av.pub{ background:rgba(var(--primary-rgb),.15); color:var(--primary); }
.wz-row .mid{ flex:1; min-width:0; }
.wz-row .r1{ display:flex; align-items:baseline; gap:6px; }
.wz-row .nm{ font-weight:700; font-size:14.5px; white-space:nowrap; overflow:hidden;
  text-overflow:ellipsis; flex:1; }
.wz-row .tm{ font-size:11px; color:var(--text-dim); flex:none; }
.wz-row .tm.unr{ color:var(--wz-badge); font-weight:800; }
.wz-row .r2{ display:flex; align-items:center; gap:6px; margin-top:2px; }
.wz-row .prev{ font-size:12.5px; color:var(--text-muted); white-space:nowrap; overflow:hidden;
  text-overflow:ellipsis; flex:1; }
.wz-row .prev.unr{ color:var(--text); font-weight:600; }
.wz-row .flags{ flex:none; display:flex; align-items:center; gap:4px; font-size:12px;
  color:var(--text-dim); }
.wz-unread{ min-width:20px; height:20px; border-radius:10px; background:var(--wz-badge);
  color:#fff; font-size:11px; font-weight:800; display:flex; align-items:center;
  justify-content:center; padding:0 6px; flex:none; }
.wz-sep{ height:1px; background:var(--border); margin:0 8px 0 68px; opacity:.6; }

/* ── FAB ── */
.wz-fab{ position:fixed; right:16px; bottom:calc(88px + env(safe-area-inset-bottom,0px));
  width:54px; height:54px; border-radius:16px; background:var(--wz-accent); color:#fff;
  border:none; font-size:24px; box-shadow:0 6px 18px rgba(0,0,0,.35); cursor:pointer; z-index:8600; }
.wz-fab:active{ transform:scale(.94); }

/* ── ALT AKSİYON SAYFASI (action sheet) ── */
.wz-sheet-wrap{ position:fixed; inset:0; background:rgba(0,0,0,.55); z-index:9600; display:none;
  align-items:flex-end; justify-content:center; }
.wz-sheet-wrap.on{ display:flex; }
.wz-sheet{ background:var(--bg2); border:1px solid var(--border); border-radius:18px 18px 0 0;
  width:100%; max-width:520px; padding:10px 12px calc(16px + env(safe-area-inset-bottom,0px));
  animation:wzUp .18s ease; }
@keyframes wzUp{ from{ transform:translateY(40px); opacity:0 } to{ transform:none; opacity:1 } }
.wz-sheet .grab{ width:38px; height:4px; border-radius:2px; background:var(--border2);
  margin:2px auto 10px; }
.wz-sh-it{ display:flex; align-items:center; gap:12px; padding:13px 10px; border-radius:12px;
  cursor:pointer; font-size:14.5px; font-weight:600; }
.wz-sh-it:active{ background:var(--bg3); }
.wz-sh-it .ico{ width:34px; height:34px; border-radius:50%; background:var(--bg3); display:flex;
  align-items:center; justify-content:center; font-size:16px; flex:none; }
.wz-sh-it.danger{ color:#f87171; }

/* ── ODA ── */
#wz-room{ position:relative; }
.wz-room-top{ display:flex; align-items:center; gap:8px; padding:6px 2px 8px;
  border-bottom:1px solid var(--border); margin-bottom:6px; }
.wz-room-top .who{ flex:1; min-width:0; cursor:pointer; }
.wz-room-top .who .nm{ font-weight:800; font-size:14.5px; white-space:nowrap; overflow:hidden;
  text-overflow:ellipsis; }
.wz-room-top .who .sb{ font-size:11px; color:var(--text-muted); white-space:nowrap;
  overflow:hidden; text-overflow:ellipsis; }
.wz-msgs{ flex:1 1 auto; min-height:0; overflow-y:auto; border-radius:12px;
  background:var(--wz-wall);
  background-image:radial-gradient(rgba(255,255,255,.035) 1px, transparent 1.2px);
  background-size:22px 22px; padding:10px 10px 6px; }
[data-theme="day"] .wz-msgs{ background-image:radial-gradient(rgba(0,0,0,.04) 1px, transparent 1.2px); }
.wz-day{ text-align:center; margin:10px 0 8px; }
.wz-day span{ background:var(--wz-chip); color:var(--text-muted); font-size:11px; font-weight:700;
  padding:4px 12px; border-radius:10px; box-shadow:0 1px 2px rgba(0,0,0,.2); }
.wz-mrow{ display:flex; margin:2px 0; }
.wz-mrow.mine{ justify-content:flex-end; }
.wz-bub{ max-width:80%; padding:6px 9px 5px; border-radius:10px; font-size:13.5px;
  line-height:1.35; position:relative; box-shadow:0 1px 1px rgba(0,0,0,.25);
  word-wrap:break-word; overflow-wrap:break-word; }
.wz-mrow.mine .wz-bub{ background:var(--wz-mine); color:var(--wz-mine-text);
  border-radius:10px 10px 3px 10px; }
.wz-mrow:not(.mine) .wz-bub{ background:var(--wz-their); color:var(--wz-their-text);
  border-radius:10px 10px 10px 3px; }
.wz-bub .snd{ font-size:11.5px; font-weight:800; margin-bottom:2px; }
.wz-bub .meta{ float:right; margin:6px 0 -2px 8px; font-size:10px; opacity:.65;
  display:flex; align-items:center; gap:3px; white-space:nowrap; }
.wz-bub .meta .tick{ font-size:11px; }
.wz-bub .meta .tick.sent{ color:var(--wz-tick); }
.wz-bub img.att{ max-width:230px; width:100%; border-radius:8px; display:block; margin-bottom:4px; cursor:pointer; }
.wz-bub img.emoji{ width:1.25em; height:1.25em; vertical-align:-0.25em; margin:0 .04em; }
#ch-root img.emoji, .wz-sheet img.emoji, #call-screen img.emoji{ width:1.2em; height:1.2em;
  vertical-align:-0.24em; margin:0 .04em; display:inline-block; }
.wz-bub.pending{ opacity:.75; }
.wz-bub.failed{ outline:1.5px solid #f87171; }
.wz-older{ display:block; margin:0 auto 8px; background:var(--wz-chip); color:var(--text-muted);
  border:none; font-size:11.5px; font-weight:700; padding:6px 14px; border-radius:12px; cursor:pointer; }

/* sesli mesaj */
.wz-audio{ display:flex; align-items:center; gap:8px; min-width:170px; padding:2px 0; }
.wz-audio button{ width:34px; height:34px; border-radius:50%; border:none; background:rgba(255,255,255,.12);
  color:inherit; font-size:14px; cursor:pointer; flex:none; }
[data-theme="day"] .wz-audio button{ background:rgba(0,0,0,.08); }
.wz-wave{ display:flex; align-items:center; gap:2px; flex:1; height:20px; }
.wz-wave span{ width:3px; border-radius:2px; background:currentColor; opacity:.5; }

/* ── YAZMA ÇUBUĞU ── */
.wz-composer{ display:flex; gap:6px; align-items:flex-end;
  padding:8px 0 calc(8px + env(safe-area-inset-bottom,0px)); background:var(--bg); }
.wz-inputwrap{ flex:1; display:flex; align-items:center; gap:4px; background:var(--bg2);
  border:1px solid var(--border); border-radius:24px; padding:4px 6px 4px 4px; min-width:0; }
.wz-inputwrap input{ flex:1; background:transparent; border:none !important; outline:none;
  color:var(--text); font-size:14px; padding:8px 4px !important; margin:0; min-width:0;
  box-shadow:none !important; }
.wz-cbtn{ width:40px; height:40px; border-radius:50%; border:none; background:transparent;
  color:var(--text-muted); font-size:19px; cursor:pointer; flex:none; display:flex;
  align-items:center; justify-content:center; }
.wz-cbtn:active{ background:var(--bg3); }
.wz-send{ width:46px; height:46px; border-radius:50%; border:none; background:var(--wz-accent);
  color:#fff; font-size:19px; cursor:pointer; flex:none; box-shadow:0 2px 8px rgba(0,0,0,.3); }
.wz-send:active{ transform:scale(.93); }
.wz-send.rec-live{ background:#e11d48; animation:recpulse 1.1s ease infinite; }
.wz-lock{ text-align:center; font-size:12.5px; color:var(--text-muted); padding:12px;
  background:var(--bg2); border:1px solid var(--border); border-radius:12px; }
.wz-recchip{ display:none; align-items:center; gap:8px; color:#f87171; font-size:12.5px;
  font-weight:700; padding:0 8px; }
.wz-recchip.on{ display:flex; }
.wz-recchip .dot{ width:9px; height:9px; border-radius:50%; background:#e11d48;
  animation:recpulse 1.1s ease infinite; }

/* emoji panel */
#wz-emoji-panel{ display:none; height:300px; margin-top:6px; }
#wz-emoji-panel.on{ display:block; }
#wz-emoji-panel emoji-picker{ width:100%; height:100%; --background:var(--bg2);
  --border-color:var(--border); --input-border-color:var(--border);
  --input-font-color:var(--text); --outline-color:var(--wz-accent); border-radius:12px; }

/* ── KİŞİLER ── */
.wz-cta{ display:flex; align-items:center; gap:12px; padding:11px 8px; border-radius:12px;
  cursor:pointer; font-weight:700; font-size:14px; color:var(--wz-accent); }
.wz-cta .ico{ width:44px; height:44px; border-radius:50%; background:rgba(0,168,132,.14);
  display:flex; align-items:center; justify-content:center; font-size:18px; flex:none; }
.wz-cta:active{ background:var(--bg2); }
.wz-secttl{ font-size:11.5px; font-weight:800; color:var(--text-dim); text-transform:uppercase;
  letter-spacing:.4px; padding:12px 8px 6px; }
.wz-invbtn{ flex:none; font-size:12px; font-weight:800; color:var(--wz-accent);
  border:1px solid rgba(0,168,132,.45); border-radius:14px; padding:5px 12px; background:transparent;
  cursor:pointer; }

/* ── BİLGİ SAYFASI ── */
.wz-info-hero{ display:flex; flex-direction:column; align-items:center; padding:18px 0 14px; }
.wz-info-hero .wz-av{ width:84px; height:84px; font-size:32px; }
.wz-info-hero .nm{ font-size:18px; font-weight:800; margin-top:10px; display:flex;
  align-items:center; gap:8px; }
.wz-info-hero .sb{ font-size:12.5px; color:var(--text-muted); margin-top:3px; }
.wz-info-card{ background:var(--bg2); border:1px solid var(--border); border-radius:14px;
  padding:4px 6px; margin-bottom:12px; }
.wz-set{ display:flex; align-items:center; gap:12px; padding:12px 10px; font-size:14px;
  cursor:pointer; border-radius:10px; }
.wz-set:active{ background:var(--bg3); }
.wz-set .ico{ width:30px; text-align:center; font-size:16px; flex:none; }
.wz-set .lbl{ flex:1; font-weight:600; }
.wz-set .val{ font-size:12px; color:var(--text-muted); }
.wz-set.danger{ color:#f87171; }
.wz-toggle{ width:42px; height:24px; border-radius:12px; background:var(--bg3);
  border:1px solid var(--border2); position:relative; flex:none; transition:background .15s; }
.wz-toggle::after{ content:''; position:absolute; top:2px; left:2px; width:18px; height:18px;
  border-radius:50%; background:#fff; transition:left .15s; box-shadow:0 1px 3px rgba(0,0,0,.3); }
.wz-toggle.on{ background:var(--wz-accent); }
.wz-toggle.on::after{ left:20px; }
.wz-mem{ display:flex; align-items:center; gap:11px; padding:9px 10px; border-radius:10px; cursor:pointer; }
.wz-mem:active{ background:var(--bg3); }
.wz-mem .wz-av{ width:40px; height:40px; font-size:15px; }
.wz-mem .nm{ flex:1; font-size:13.5px; font-weight:600; min-width:0; white-space:nowrap;
  overflow:hidden; text-overflow:ellipsis; }
.wz-crown{ font-size:11px; font-weight:800; color:#fbbf24; background:rgba(251,191,36,.12);
  border:1px solid rgba(251,191,36,.35); padding:2px 8px; border-radius:10px; flex:none; }

/* ── ARAMALAR SEKMESİ ── */
.wz-call-dir{ font-size:12px; font-weight:800; }
.wz-call-dir.out{ color:#4ade80; }
.wz-call-dir.in{ color:#60a5fa; }
.wz-call-dir.miss{ color:#f87171; }

/* ── GÖRÜŞME EKRANI (yeniden yapı: Windows'ta sığmama düzeltildi) ── */
#call-screen{ align-items:center; }
.cs-shell{ width:100%; max-width:560px; height:100%; display:flex; flex-direction:column;
  margin:0 auto; }
.cs-top{ display:flex; align-items:center; gap:8px; padding:12px 14px; flex:none; }
.cs-min{ width:42px; height:42px; border-radius:50%; border:1px solid rgba(255,255,255,.22);
  background:rgba(255,255,255,.08); color:#fff; font-size:18px; cursor:pointer; flex:none;
  display:flex; align-items:center; justify-content:center; }
.cs-mid{ flex:1; text-align:center; min-width:0; }
.cs-mid #cs-title{ color:#fff; font-weight:800; font-size:16px; white-space:nowrap;
  overflow:hidden; text-overflow:ellipsis; }
.cs-mid #cs-timer{ color:#4ade80; font-size:12px; font-weight:700; margin-top:2px; }
#cs-body{ flex:1; display:flex; flex-direction:column; justify-content:center;
  padding:0 20px; overflow-y:auto; }
.cs-foot{ display:flex; justify-content:center; gap:22px; align-items:center;
  padding:18px 0 calc(26px + env(safe-area-inset-bottom,0px)); flex:none; }
.cs-lbl{ display:flex; flex-direction:column; align-items:center; gap:6px; color:#cbd0d6;
  font-size:11px; font-weight:600; }
#cs-invite{ display:none; position:absolute; inset:0; background:rgba(8,10,14,.96); z-index:5;
  padding:16px; flex-direction:column; }
#cs-invite.on{ display:flex; }
#cs-invite .hd{ display:flex; align-items:center; gap:10px; color:#fff; font-weight:800;
  font-size:15px; margin-bottom:12px; }
#cs-inv-results{ flex:1; overflow-y:auto; margin-top:10px; }
#cs-inv-results .wz-row .nm{ color:#fff; }

/* küçük ekran ince ayar */
@media (max-width:420px){
  .wz-bub{ max-width:86%; }
}
/* Masaüstü görüşme ekranı: başlık çubuğu payı (Küçült/＋ kesilmesin) */
html.desktop-shell .cs-top{ margin-top:42px; }
