*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f1117;
  --bg2: #1a1d27;
  --bg3: #22263a;
  --border: #2e3450;
  --text: #e2e8f0;
  --text2: #94a3b8;
  --accent: #6366f1;
  --accent2: #818cf8;
  --sms: #f59e0b;
  --danger: #ef4444;
  --success: #22c55e;
  --radius: 10px;
  --font: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  overflow: hidden;
}

/* ── HEADER ── */
#header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
}

#header h1 { font-size: 15px; font-weight: 700; color: var(--accent2); white-space: nowrap; }

.header-controls {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex: 1;
}

select, input[type="text"] {
  background: var(--bg3); border: 1px solid var(--border); color: var(--text);
  border-radius: 6px; padding: 5px 8px; font-size: 13px; outline: none;
}
select:focus, input[type="text"]:focus { border-color: var(--accent); }

#arama { min-width: 140px; flex: 1; }

.toggle-btn {
  display: flex; align-items: center; gap: 5px; cursor: pointer;
  background: var(--bg3); border: 1px solid var(--border); color: var(--text2);
  border-radius: 6px; padding: 5px 10px; font-size: 12px; transition: all .2s;
  white-space: nowrap;
}
.toggle-btn.aktif { background: var(--accent); border-color: var(--accent); color: #fff; }
.toggle-btn:hover { border-color: var(--accent); }

#sayac { font-size: 12px; color: var(--text2); white-space: nowrap; margin-left: auto; }
#son-zaman { font-size: 11px; color: var(--text2); white-space: nowrap; }

/* ── LAYOUT ── */
#layout { display: flex; flex-direction: column; height: 100vh; }
#mesaj-listesi-wrapper { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }

/* ── MESAJ KARTI ── */
.mesaj-karti {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex; flex-direction: column; gap: 4px;
  animation: slideIn .25s ease-out;
  cursor: default;
  transition: border-color .15s;
}
.mesaj-karti:hover { border-color: var(--accent); }

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.karti-ust {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}

.app-ikon {
  width: 28px; height: 28px; border-radius: 6px;
  background: var(--bg3); display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: var(--accent2); flex-shrink: 0;
  border: 1px solid var(--border);
}

.app-adi { font-weight: 600; font-size: 13px; }

.cihaz-badge {
  font-size: 10px; background: var(--bg3); border: 1px solid var(--border);
  border-radius: 4px; padding: 2px 6px; color: var(--text2);
}

.sms-badge {
  font-size: 10px; background: var(--sms); color: #000;
  border-radius: 4px; padding: 2px 6px; font-weight: 700;
}

.zaman-badge { font-size: 11px; color: var(--text2); margin-left: auto; }

.karti-baslik { font-weight: 700; font-size: 13px; margin-top: 2px; }
.karti-icerik { font-size: 13px; color: var(--text2); line-height: 1.4; }

/* ── LOGIN MODAL ── */
#overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.75);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
#overlay.gizli { display: none; }

#login-modal {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 14px; padding: 32px 28px; width: 320px; max-width: 95vw;
  display: flex; flex-direction: column; gap: 16px;
}

#login-modal h2 { font-size: 16px; color: var(--text); text-align: center; }
#login-modal input {
  width: 100%; padding: 10px 12px; font-size: 14px;
  background: var(--bg3); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; outline: none;
}
#login-modal input:focus { border-color: var(--accent); }

#giris-btn {
  width: 100%; padding: 10px; background: var(--accent); color: #fff;
  border: none; border-radius: 8px; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: opacity .2s;
}
#giris-btn:hover { opacity: .85; }

#giris-hata { font-size: 12px; color: var(--danger); text-align: center; min-height: 16px; }

/* ── BILDIRIM IZIN ── */
#notif-bar {
  background: var(--bg3); border-bottom: 1px solid var(--border);
  padding: 8px 16px; font-size: 12px; color: var(--text2);
  display: flex; align-items: center; gap: 8px;
}
#notif-bar.gizli { display: none; }
#notif-izin-btn {
  background: var(--accent); color: #fff; border: none;
  border-radius: 5px; padding: 4px 10px; font-size: 12px; cursor: pointer;
}

/* ── BOŞLUK MESAJI ── */
#bos-mesaj {
  text-align: center; color: var(--text2); font-size: 14px;
  margin-top: 60px; display: none;
}

/* ── WS DURUM ── */
#ws-durum {
  position: fixed; bottom: 10px; right: 14px;
  font-size: 11px; color: var(--text2); background: var(--bg2);
  border: 1px solid var(--border); border-radius: 5px; padding: 3px 8px;
  pointer-events: none;
}
#ws-durum.bagli { color: var(--success); border-color: var(--success); }
#ws-durum.kopuk { color: var(--danger); border-color: var(--danger); }

/* ── SİL BUTONU ── */
#sil-btn {
  background: transparent; border: 1px solid var(--danger); color: var(--danger);
  border-radius: 6px; padding: 5px 10px; font-size: 12px; cursor: pointer;
  transition: all .2s; white-space: nowrap;
}
#sil-btn:hover { background: var(--danger); color: #fff; }

/* ── SCROLLBAR ── */
#mesaj-listesi-wrapper::-webkit-scrollbar { width: 6px; }
#mesaj-listesi-wrapper::-webkit-scrollbar-track { background: transparent; }
#mesaj-listesi-wrapper::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

@media (max-width: 480px) {
  #header { gap: 6px; }
  #header h1 { font-size: 13px; }
  .mesaj-karti { padding: 10px 10px; }
}
