:root {
  --bg: #0b141a;
  --panel: #111b21;
  --panel2: #202c33;
  --accent: #00a884;
  --accent2: #005c4b;
  --text: #e9edef;
  --muted: #8696a0;
  --bubble-mine: #005c4b;
  --bubble-theirs: #202c33;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}
.hidden { display: none !important; }

/* ---------------- giriş ---------------- */
.auth-screen {
  height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 0%, #0d2b26, var(--bg));
}
.auth-card {
  width: 340px; max-width: 90vw; background: var(--panel);
  padding: 36px 28px; border-radius: 16px; box-shadow: 0 12px 40px rgba(0,0,0,.5);
  text-align: center;
}
.logo { display: flex; align-items: center; justify-content: center; gap: 11px; margin-bottom: 8px; }
.logo-mark { width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
  box-shadow: 0 6px 16px -6px rgba(10,143,95,.6); }
.logo .wordmark { font-size: 27px; font-weight: 800; letter-spacing: -0.03em; color: var(--text); }
.tagline { color: var(--muted); font-size: 13px; margin-bottom: 24px; line-height: 1.5; }
.auth-card input {
  width: 100%; padding: 13px 14px; margin-bottom: 12px; border: none;
  border-radius: 10px; background: var(--panel2); color: var(--text); font-size: 15px;
}
.auth-card input:focus { outline: 2px solid var(--accent); }
.auth-buttons { display: flex; gap: 10px; margin-top: 8px; }
.auth-card button {
  flex: 1; padding: 13px; border: none; border-radius: 10px; cursor: pointer;
  font-size: 15px; font-weight: 600; background: var(--accent); color: #04231d;
}
.auth-card button.secondary { background: var(--panel2); color: var(--text); }
.auth-error { color: #f15c6d; font-size: 13px; min-height: 18px; margin-bottom: 4px; }
#stepPhone button, #stepCode button { width: 100%; padding: 13px; border: none; border-radius: 10px;
  cursor: pointer; font-size: 15px; font-weight: 600; background: var(--accent); color: #04231d; margin-top: 4px; }
.code-info { color: var(--accent); font-size: 13px; line-height: 1.6; margin-bottom: 14px; white-space: pre-line; }
.qr-login { display: flex; justify-content: center; margin: 14px 0; }
.qr-login img { width: 220px; height: 220px; background: #fff; border-radius: 12px; padding: 8px; }
.linky { background: none !important; color: var(--muted) !important; font-weight: 400 !important;
  font-size: 13px !important; margin-top: 10px !important; }

/* ---------------- ana ---------------- */
.app { display: flex; height: 100vh; }
.sidebar {
  width: 320px; min-width: 260px; background: var(--panel);
  border-right: 1px solid #0a0f13; display: flex; flex-direction: column;
}
.sidebar-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; background: var(--panel2);
}
.me { font-weight: 600; }
.icon-btn { background: none; border: none; color: var(--muted); font-size: 18px; cursor: pointer; }
.contacts { flex: 1; overflow-y: auto; }
.empty { color: var(--muted); text-align: center; padding: 40px 20px; font-size: 14px; line-height: 1.6; }

.contact {
  display: flex; gap: 12px; align-items: center; padding: 12px 16px;
  cursor: pointer; border-bottom: 1px solid #0a0f13;
}
.contact:hover, .contact.active { background: var(--panel2); }
.avatar {
  width: 42px; height: 42px; border-radius: 50%; background: var(--accent2);
  display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0;
}
.contact-body { flex: 1; min-width: 0; }
.contact-top { display: flex; justify-content: space-between; align-items: center; }
.contact-name { font-weight: 600; }
.contact-last { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #3b4a54; }
.dot.on { background: var(--accent); }

.chat { flex: 1; display: flex; flex-direction: column; background: #0b141a; }
.chat-head {
  padding: 14px 20px; background: var(--panel2); display: flex; align-items: baseline; gap: 12px;
}
.peer-status { color: var(--accent); font-size: 12px; }
.messages {
  flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 4px;
  background-image: linear-gradient(rgba(11,20,26,.94), rgba(11,20,26,.94));
}
.bubble {
  max-width: 65%; padding: 7px 11px 5px; border-radius: 8px; position: relative;
  font-size: 14px; line-height: 1.4; word-wrap: break-word;
}
.bubble.mine { align-self: flex-end; background: var(--bubble-mine); }
.bubble.theirs { align-self: flex-start; background: var(--bubble-theirs); }
.bubble .time { display: block; text-align: right; font-size: 10px; color: var(--muted); margin-top: 2px; }

.composer { display: flex; gap: 10px; padding: 12px 16px; background: var(--panel2); }
.composer input {
  flex: 1; padding: 12px 16px; border: none; border-radius: 22px;
  background: var(--panel); color: var(--text); font-size: 15px;
}
.composer input:focus { outline: none; }
.composer button {
  width: 46px; border: none; border-radius: 50%; background: var(--accent);
  color: #04231d; font-size: 18px; cursor: pointer;
}
.composer button:disabled { opacity: .4; cursor: default; }

/* ---------------- sohbet başlığı / aksiyonlar ---------------- */
.chat-head { align-items: center; }
.chat-head-info { display: flex; flex-direction: column; flex: 1; }
.chat-actions { display: flex; gap: 6px; }
.chat-actions .icon-btn { font-size: 18px; }
.back-btn { display: none; font-size: 26px; margin-right: 6px; }
.placeholder { margin: auto; text-align: center; color: var(--muted); line-height: 1.8; font-size: 15px; }

/* ---------------- medya ---------------- */
.media-box { min-width: 120px; }
.media-box[data-loading] { color: var(--muted); font-size: 13px; }
.media-img { max-width: 260px; max-height: 320px; border-radius: 8px; display: block; }
.media-dl { color: var(--text); text-decoration: none; display: inline-flex; gap: 6px; align-items: center; }
.media-size { color: var(--muted); font-size: 11px; }

/* ---------------- modal (güvenlik numarası) ---------------- */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex;
  align-items: center; justify-content: center; z-index: 50; }
.modal-card { background: var(--panel); padding: 28px; border-radius: 16px; width: 380px;
  max-width: 92vw; text-align: center; }
.modal-card h3 { margin-bottom: 12px; }
.modal-note { color: var(--muted); font-size: 13px; line-height: 1.6; margin-bottom: 18px; }
.safety-number { font-family: "SF Mono", Menlo, monospace; font-size: 18px; letter-spacing: 1px;
  background: var(--panel2); padding: 16px; border-radius: 10px; word-spacing: 4px; line-height: 1.7;
  color: var(--accent); margin-bottom: 18px; }
.modal-btn { background: var(--accent); color: #04231d; border: none; padding: 11px 28px;
  border-radius: 10px; font-weight: 600; cursor: pointer; }
.modal-btn.secondary { background: var(--panel2); color: var(--text); }
.modal-actions { display: flex; gap: 10px; justify-content: center; margin-top: 6px; }
.modal-card input { width: 100%; padding: 12px 14px; margin-bottom: 12px; border: none;
  border-radius: 10px; background: var(--panel2); color: var(--text); font-size: 15px; }
.member-list { max-height: 240px; overflow-y: auto; text-align: left; margin-bottom: 16px; }
.member-item { display: flex; align-items: center; gap: 10px; padding: 9px 6px; cursor: pointer;
  border-bottom: 1px solid var(--panel2); }
.member-item input { width: auto; margin: 0; }
.head-actions { display: flex; gap: 4px; }
.head-actions .icon-btn { font-size: 20px; }
.group-avatar { background: #3b4a54; }
.bubble-sender { display: block; font-size: 12px; font-weight: 600; color: var(--accent); margin-bottom: 2px; }

/* okundu tikleri */
.tick { margin-left: 4px; font-size: 11px; color: var(--muted); }
.tick.read { color: #53bdeb; }             /* mavi tik = okundu */

/* kişi listesi: saat + okunmamış rozeti */
.contact-top { gap: 6px; }
.c-time { margin-left: auto; font-size: 11px; color: var(--muted); white-space: nowrap; }
.contact-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.unread { background: var(--accent); color: #04231d; font-size: 11px; font-weight: 700;
  min-width: 19px; height: 19px; border-radius: 10px; display: inline-flex; align-items: center;
  justify-content: center; padding: 0 5px; flex-shrink: 0; }

/* numarayla sohbet başlat */
.new-chat-row { padding: 8px 12px; background: var(--panel); border-bottom: 1px solid #0a0f13; }
.new-chat-row input { width: 100%; padding: 9px 12px; border: none; border-radius: 8px;
  background: var(--panel2); color: var(--text); font-size: 14px; }
.new-chat-row input:focus { outline: 1px solid var(--accent); }

/* sesli mesaj */
.media-audio { width: 240px; max-width: 60vw; height: 40px; }

/* yanıtla / alıntı */
.reply-bar { display: flex; align-items: center; gap: 10px; padding: 8px 16px;
  background: var(--panel2); border-left: 3px solid var(--accent); }
.reply-bar-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#replyBarName { color: var(--accent); font-size: 12px; font-weight: 600; }
#replyBarText { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reply-quote { border-left: 3px solid var(--accent); background: rgba(0,0,0,.18); border-radius: 5px;
  padding: 4px 8px; margin-bottom: 4px; font-size: 13px; }
.rq-name { display: block; color: var(--accent); font-weight: 600; font-size: 12px; }
.rq-text { color: var(--muted); }

/* silinmiş */
.bubble.deleted .text { font-style: italic; color: var(--muted); }

/* tepkiler */
.reactions { display: flex; gap: 4px; margin-top: 3px; }
.react-chip { background: rgba(0,0,0,.28); border-radius: 10px; padding: 1px 6px; font-size: 12px; }

/* baloncuk araç çubuğu (hover) */
.bubble { position: relative; }
.msg-tools { position: absolute; top: -12px; display: none; gap: 2px; background: var(--panel);
  border-radius: 16px; padding: 2px 4px; box-shadow: 0 2px 8px rgba(0,0,0,.4); z-index: 5; }
.bubble.mine .msg-tools { right: 0; }
.bubble.theirs .msg-tools { left: 0; }
.bubble:hover .msg-tools { display: flex; }
.msg-tools button { background: none; border: none; cursor: pointer; font-size: 15px; padding: 2px 4px; }
.emoji-row { position: absolute; top: -40px; left: 0; display: flex; gap: 2px; background: var(--panel);
  border-radius: 18px; padding: 4px 6px; box-shadow: 0 2px 10px rgba(0,0,0,.5); }
.emoji-row.hidden { display: none; }
.emoji-pick { font-size: 18px !important; }

/* avatar fotoğrafı */
.av-img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.avatar { overflow: hidden; }

/* etiketler */
.fwd-label { font-size: 11px; color: var(--muted); font-style: italic; margin-bottom: 2px; }
.edited { font-size: 10px; color: var(--muted); font-style: italic; margin-right: 4px; }
.starred { margin-right: 3px; }
.me { cursor: pointer; }

/* ilet listesi */
.fwd-item { display: flex; align-items: center; gap: 10px; padding: 9px 6px; cursor: pointer;
  border-bottom: 1px solid var(--panel2); }
.fwd-item:hover { background: var(--panel2); }
.fwd-item .avatar { width: 36px; height: 36px; font-size: 15px; }

/* profil penceresi */
.profile-avatar-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 16px; }
.profile-avatar { width: 90px; height: 90px; border-radius: 50%; background: var(--accent2);
  display: flex; align-items: center; justify-content: center; font-size: 36px; font-weight: 700; overflow: hidden; }
.modal-card input { text-align: left; }

/* grup üye satırı */
#groupMemberList .member-item { justify-content: space-between; }
.rm-member { background: none; border: 1px solid #f15c6d; color: #f15c6d; border-radius: 6px;
  padding: 2px 8px; font-size: 12px; cursor: pointer; }

/* ekleme menüsü */
.attach-menu { position: absolute; bottom: 74px; left: 12px; background: var(--panel);
  border-radius: 12px; box-shadow: 0 4px 16px rgba(0,0,0,.5); z-index: 20; overflow: hidden; }
.attach-menu button { display: block; width: 100%; text-align: left; background: none; border: none;
  color: var(--text); padding: 12px 20px; font-size: 15px; cursor: pointer; }
.attach-menu button:hover { background: var(--panel2); }
.sticker-picker { position: absolute; bottom: 74px; left: 12px; right: 12px; max-width: 420px;
  background: var(--panel); border-radius: 12px; padding: 10px; display: grid;
  grid-template-columns: repeat(8, 1fr); gap: 4px; box-shadow: 0 4px 16px rgba(0,0,0,.5); z-index: 20; }
.sticker-item { background: none; border: none; font-size: 26px; cursor: pointer; padding: 4px; border-radius: 8px; }
.sticker-item:hover { background: var(--panel2); }

/* çıkartma baloncuğu */
.sticker-bubble { background: none !important; padding: 0 !important; }
.sticker { font-size: 64px; line-height: 1; }

/* anket */
.poll { min-width: 220px; }
.poll-q { font-weight: 600; margin-bottom: 8px; }
.poll-opt { position: relative; background: rgba(0,0,0,.2); border-radius: 8px; padding: 8px 10px;
  margin-bottom: 5px; cursor: pointer; display: flex; justify-content: space-between; overflow: hidden; }
.poll-bar { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(0,168,132,.35); z-index: 0; }
.poll-otext, .poll-count { position: relative; z-index: 1; }
.poll-opt.voted { outline: 1px solid var(--accent); }
.poll-total { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* konum */
.location { display: block; background: rgba(0,0,0,.2); border-radius: 8px; padding: 10px 12px;
  color: var(--text); text-decoration: none; min-width: 180px; }
.loc-live { color: #f15c6d; font-size: 12px; }
.loc-open { color: var(--accent); font-size: 13px; }

/* tek-görüntülük */
.vo-btn { background: rgba(0,0,0,.25); border: 1px solid var(--muted); color: var(--text);
  padding: 8px 12px; border-radius: 8px; cursor: pointer; }
.vo-done { color: var(--muted); font-style: italic; }
.vo-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.95); z-index: 70; display: flex;
  flex-direction: column; align-items: center; justify-content: center; gap: 20px; }
.vo-content img, .vo-content video { max-width: 90vw; max-height: 80vh; border-radius: 8px; }
.vo-close { background: var(--panel2); color: var(--text); border: none; padding: 12px 24px;
  border-radius: 24px; cursor: pointer; }

/* kaybolan / profil ekstra */
.disap { margin-right: 3px; }
.disap-opts { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.disap-opts .modal-btn { width: 100%; }
.modal-sep { border: none; border-top: 1px solid var(--panel2); margin: 16px 0; }
.profile-extra { display: flex; flex-direction: column; gap: 8px; }
.profile-extra .modal-btn { width: 100%; }
.poll-opt-in { width: 100%; }

/* durum / hikâye */
.status-compose { margin-bottom: 16px; }
.status-bgs { display: flex; gap: 8px; margin: 10px 0; }
.status-bg { width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.status-bg.sel { border-color: #fff; }
.status-ring { box-shadow: 0 0 0 2px var(--accent); }
.status-row { cursor: pointer; }
.story-bars { position: absolute; top: 14px; left: 14px; right: 14px; display: flex; gap: 4px; }
.story-bar { flex: 1; height: 3px; border-radius: 2px; background: rgba(255,255,255,.3); }
.story-bar.on { background: #fff; }
.story-name { position: absolute; top: 30px; left: 16px; color: #fff; font-weight: 600; }
.story-content { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.story-content img { max-width: 92vw; max-height: 80vh; border-radius: 8px; }
.story-text { width: 380px; max-width: 90vw; min-height: 220px; border-radius: 12px; color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 24px; text-align: center; padding: 30px; }

/* kanallar */
.channel-create { display: flex; gap: 8px; margin-bottom: 14px; }
.channel-create input { flex: 1; }
.channel-create .modal-btn { width: auto; white-space: nowrap; }
.channel-row { cursor: pointer; }
.channel-posts { max-height: 300px; overflow-y: auto; margin-bottom: 12px; text-align: left; }
.ch-post { background: var(--panel2); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; }
.ch-post img { max-width: 100%; border-radius: 6px; }
.ch-time { display: block; font-size: 11px; color: var(--muted); margin-top: 4px; }
.channel-post-box { display: flex; gap: 8px; margin-bottom: 12px; }
.channel-post-box input { flex: 1; }
.channel-post-box .modal-btn { width: auto; }

/* grup araması ızgarası */
.gcall-grid { position: absolute; inset: 0; display: grid; gap: 4px; padding: 4px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); align-content: center; }
.gc-tile { position: relative; background: #000; border-radius: 8px; overflow: hidden; min-height: 180px; }
.gc-tile video { width: 100%; height: 100%; object-fit: cover; }
.gc-label { position: absolute; bottom: 6px; left: 8px; color: #fff; font-size: 13px;
  text-shadow: 0 1px 3px #000; }
.gcall-incoming { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 80;
  background: var(--panel); padding: 14px 20px; border-radius: 14px; box-shadow: 0 4px 20px rgba(0,0,0,.6);
  display: flex; gap: 12px; align-items: center; }
.gcall-incoming .call-btn { padding: 8px 18px; font-size: 14px; }

/* aydınlık tema */
:root[data-theme="light"] {
  --bg: #eae6df; --panel: #ffffff; --panel2: #f0f2f5; --text: #111b21; --muted: #667781;
  --bubble-mine: #d9fdd3; --bubble-theirs: #ffffff;
}
:root[data-theme="light"] .bubble.mine { color: #111b21; }
:root[data-theme="light"] .bubble.theirs { color: #111b21; box-shadow: 0 1px 1px rgba(0,0,0,.1); }
:root[data-theme="light"] .messages { background-image: linear-gradient(rgba(234,230,223,.9), rgba(234,230,223,.9)); }

/* sohbet içi arama */
.search-bar { display: flex; gap: 8px; padding: 8px 16px; background: var(--panel2); align-items: center; }
.search-bar input { flex: 1; padding: 8px 12px; border: none; border-radius: 8px; background: var(--panel); color: var(--text); }

/* sohbet menüsü */
.chat-menu { position: absolute; top: 52px; right: 12px; background: var(--panel); border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,.5); z-index: 25; overflow: hidden; min-width: 190px; }
.chat-menu button { display: block; width: 100%; text-align: left; background: none; border: none;
  color: var(--text); padding: 11px 16px; font-size: 14px; cursor: pointer; }
.chat-menu button:hover { background: var(--panel2); }

/* duvar kağıdı */
.wallpaper-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.wall-item { height: 60px; border-radius: 8px; border: 1px solid var(--panel2); cursor: pointer;
  color: var(--muted); font-size: 12px; }

/* ayar satırı + QR + zamanlı */
.setting-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 2px;
  color: var(--text); font-size: 14px; cursor: pointer; }
.setting-row input { width: auto; }
.qr-wrap { display: flex; justify-content: center; margin-bottom: 12px; }
.qr-wrap img { width: 220px; height: 220px; background: #fff; border-radius: 8px; }
#scheduleTime { color: var(--text); }
.archive-toggle { padding: 12px 16px; color: var(--accent); cursor: pointer; font-size: 14px;
  border-bottom: 1px solid #0a0f13; }
.unblock { border-color: var(--accent); color: var(--accent); }

/* ses dalga formu */
.voice-msg { display: flex; flex-direction: column; gap: 4px; min-width: 200px; }
.waveform { display: flex; align-items: center; gap: 2px; height: 30px; }
.waveform span { flex: 1; background: var(--accent); border-radius: 2px; opacity: .7; min-width: 2px; }

/* çeviri */
.translated { margin-top: 4px; padding-top: 4px; border-top: 1px dashed var(--muted); font-size: 13px; color: var(--muted); }
#voiceBtn.recording { color: #f15c6d; animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* ---------------- arama ---------------- */
.call-overlay { position: fixed; inset: 0; background: #04231d; z-index: 60;
  display: flex; align-items: center; justify-content: center; }
.remote-video { width: 100%; height: 100%; object-fit: cover; background: #000; }
.local-video { position: absolute; top: 20px; right: 20px; width: 130px; height: 180px;
  object-fit: cover; border-radius: 12px; border: 2px solid var(--accent); background: #000; }
.call-status { position: absolute; top: 40%; left: 0; right: 0; text-align: center;
  font-size: 18px; color: #fff; text-shadow: 0 1px 4px #000; }
.call-controls { position: absolute; bottom: 40px; left: 0; right: 0; display: flex;
  gap: 20px; justify-content: center; }
.call-btn { border: none; padding: 16px 34px; border-radius: 40px; font-size: 16px;
  font-weight: 700; cursor: pointer; color: #fff; }
.call-btn.accept { background: var(--accent); color: #04231d; }
.call-btn.hangup { background: #f15c6d; }

@media (max-width: 640px) {
  .sidebar { width: 100%; position: absolute; z-index: 2; height: 100%; }
  .app:not(.chat-open) .chat { display: none; }
  .app.chat-open .sidebar { display: none; }
  .back-btn { display: block; }
}
