/* Asistan — tek, profesyonel tema.
 * Sakin bir iletişim/asistan ürünü: açık zemin, indigo vurgu (zekâyı ima eder),
 * yumuşak gölgeler, net tipografi. */

:root {
  --bg:          #f3f4f8;
  --surface:     #ffffff;
  --surface-2:   #f7f8fb;
  --surface-3:   #eef0f5;
  --border:      #e5e7ef;
  --border-2:    #d6dae4;
  --text:        #1a2030;
  --text-dim:    #697086;
  --text-faint:  #98a0b2;
  --accent:      #4f46e5;
  --accent-2:    #7c6cf0;
  --accent-soft: #edecfe;
  --accent-ring: rgba(79, 70, 229, 0.18);
  --ok:          #129c6b;
  --warn:        #e08a1e;
  --danger:      #dc2f34;
  --bubble-in:   #ffffff;
  --bubble-out:  #ecebfe;
  --grad:        linear-gradient(135deg, #6d5cf5 0%, #4f46e5 100%);
  --shadow-sm:   0 1px 2px rgba(20, 28, 60, 0.06);
  --shadow-md:   0 4px 16px rgba(20, 28, 60, 0.08);
  --shadow-lg:   0 24px 60px rgba(20, 28, 60, 0.20);
  --r:           12px;
  --r-sm:        9px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.muted, .dim { color: var(--text-dim); }
.small { font-size: 12.5px; }
a { color: var(--accent); }
::selection { background: var(--accent-soft); }

/* Terminal döneminden kalan öğeleri gizle (tek tema) */
.crt, .boot, .gate-logo, #input-cursor, .cursor-blink,
#btn-theme, .prompt, .cmd-echo, .search-prefix { display: none !important; }

/* --------------------------------- Üst bar -------------------------------- */

.statusbar, .topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 18px;
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex: none;
}

.seg { display: flex; align-items: center; gap: 7px; padding: 0; border: none; font-size: 13px; color: var(--text-dim); }
.seg-path { display: none; }

/* Marka */
.seg-host, .brand {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  letter-spacing: -0.01em;
  background: none;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 9px;
}
.seg-host::before, .brand::before {
  content: "";
  width: 26px; height: 26px;
  border-radius: 8px;
  background: var(--grad);
  box-shadow: var(--shadow-sm);
  flex: none;
}

/* Gizlilik rozeti */
.seg-mode {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ok);
  background: rgba(18, 156, 107, 0.10);
  padding: 5px 10px;
  border-radius: 999px;
  cursor: help;
  letter-spacing: 0;
  text-transform: none;
}

.seg-fill { flex: 1; }

.seg-conn { font-size: 12.5px; color: var(--text-faint); }
.seg-conn::before { content: "●"; margin-right: 5px; color: var(--text-faint); font-size: 9px; }
.seg-conn.open { color: var(--ok); }
.seg-conn.open::before { color: var(--ok); }
.seg-conn.closed { color: var(--danger); }
.seg-clock { font-size: 12.5px; color: var(--text-faint); font-variant-numeric: tabular-nums; }

.seg-switch { font-size: 12.5px; color: var(--text-dim); cursor: pointer; gap: 6px; }
.seg-switch input { accent-color: var(--accent); }

/* Üst bar butonları / linkler */
.seg-btn {
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  background: none;
  border: none;
  padding: 7px 11px;
  border-radius: var(--r-sm);
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, color .15s;
}
.seg-btn:hover { background: var(--surface-3); color: var(--text); }

/* Günlük özet = asistan vurgulu buton */
#btn-digest {
  color: #fff;
  background: var(--grad);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}
#btn-digest:hover { filter: brightness(1.05); background: var(--grad); color: #fff; }

/* --------------------------------- Yerleşim ------------------------------- */

.layout { display: grid; grid-template-columns: 340px 1fr; flex: 1; min-height: 0; }

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.pane-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 16px 16px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-wrap {
  display: flex;
  align-items: center;
  margin: 4px 14px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 12px;
}
.search-wrap:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
#search { flex: 1; padding: 9px 0; background: none; border: none; color: var(--text); font: inherit; font-size: 13.5px; outline: none; }
#search::placeholder { color: var(--text-faint); }

.tabs { display: flex; gap: 6px; padding: 0 14px 10px; }
.tab {
  flex: 1;
  padding: 7px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-dim);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: all .15s;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--accent-soft); border-color: transparent; color: var(--accent); font-weight: 600; }

.pill {
  background: var(--warn);
  color: #fff;
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  text-align: center;
}
.pill[data-zero="1"] { display: none; }

.list { flex: 1; overflow-y: auto; min-height: 0; padding: 0 8px 8px; }

.row {
  display: flex;
  gap: 11px;
  align-items: center;
  padding: 10px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: background .12s;
}
.row:hover { background: var(--surface-2); }
.row.active { background: var(--accent-soft); }

.star { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.star::before { content: none; }

.row-body { flex: 1; min-width: 0; }
.row-top { display: flex; align-items: baseline; gap: 8px; }
.row-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1;
}
.row.active .row-name { color: var(--accent); }
.row-time { font-size: 11.5px; color: var(--text-faint); flex: none; }
.row-preview { font-size: 12.5px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }

.row-badge {
  flex: none;
  background: var(--warn);
  color: #fff;
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 700;
}
.row-badge::before, .row-badge::after { content: none; }

.list-empty { padding: 30px 20px; text-align: center; color: var(--text-dim); font-size: 13px; line-height: 1.7; }

/* --------------------------------- Sohbet --------------------------------- */

.chat { display: flex; flex-direction: column; min-height: 0; background: var(--bg); }

.chat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  height: 60px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex: none;
}
.chat-head-main { flex: 1; min-width: 0; }
.chat-head h2 {
  margin: 0;
  font-size: 15.5px;
  font-weight: 650;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-head h2::before { content: none; }
#chat-sub { font-size: 12px; color: var(--text-faint); }
.chat-head-actions { display: flex; gap: 8px; }

.btn {
  padding: 7px 13px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.on { background: var(--accent-soft); border-color: transparent; color: var(--accent); font-weight: 600; }

.messages { flex: 1; overflow-y: auto; padding: 20px 24px 24px; min-height: 0; display: flex; flex-direction: column; gap: 3px; }
.messages > *:first-child { margin-top: auto; }

.placeholder { margin: auto; text-align: center; max-width: 380px; color: var(--text-dim); }
.placeholder pre { display: none; }
.placeholder .big { font-size: 34px; }

.daysep {
  align-self: center;
  margin: 16px 0 10px;
  padding: 3px 12px;
  background: var(--surface-3);
  border-radius: 999px;
  font-size: 11.5px;
  color: var(--text-dim);
}
.daysep::before, .daysep::after { content: none; }

.msg {
  max-width: min(600px, 76%);
  padding: 9px 13px;
  border-radius: 14px;
  background: var(--bubble-in);
  border: 1px solid var(--border);
  align-self: flex-start;
  box-shadow: var(--shadow-sm);
  word-wrap: break-word; overflow-wrap: anywhere;
}
.msg + .msg { margin-top: 2px; }
.msg.out { background: var(--bubble-out); border-color: transparent; align-self: flex-end; }

.msg-sender { font-size: 12px; font-weight: 650; color: var(--accent); margin-bottom: 2px; }
.msg-sender::before, .msg-sender::after { content: none; }
.msg-quote {
  border-left: 3px solid var(--accent);
  padding: 3px 0 3px 9px;
  margin: 2px 0 5px;
  font-size: 12.5px;
  color: var(--text-dim);
  max-height: 3.4em; overflow: hidden;
}
.msg-text { white-space: pre-wrap; font-size: 14px; }
.msg-kind { display: inline-block; font-size: 12px; color: var(--text-dim); background: var(--surface-3); border-radius: 6px; padding: 2px 8px; margin: 2px 0; }
.msg-time { font-size: 10.5px; color: var(--text-faint); text-align: right; margin-top: 3px; }
.msg-time::before, .msg-time::after { content: none; }
.msg img, .msg video { max-width: 100%; max-height: 340px; border-radius: 10px; display: block; margin: 3px 0; }
.msg audio { width: 260px; margin: 3px 0; }
.msg.new { animation: pop .4s ease-out; }
@keyframes pop { from { transform: translateY(4px); opacity: 0; } }

.hit-chat { font-size: 11.5px; color: var(--accent); font-weight: 600; margin-bottom: 3px; }
.load-more { align-self: center; margin-bottom: 10px; }

/* -------------------------------- Composer -------------------------------- */

.composer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex: none;
}
.composer[hidden] { display: none; }
#msg-input {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 14px;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  outline: none;
}
#msg-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
#msg-input::placeholder { color: var(--text-faint); }
#msg-input:disabled { opacity: .5; }

.btn-send { background: var(--grad); border-color: transparent; color: #fff; font-weight: 600; }
.btn-send:hover { filter: brightness(1.05); color: #fff; }
.btn-send:disabled { opacity: .5; pointer-events: none; }

.btn-suggest { color: var(--accent); border-color: var(--border-2); font-weight: 600; }
.btn-suggest:hover { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.btn-suggest:disabled { opacity: .55; pointer-events: none; }

.send-error { color: var(--danger); font-size: 12px; padding: 4px 20px 8px; background: var(--surface); }

/* -------------------------------- AI paneli ------------------------------- */

.ai-panel {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(26, 32, 48, 0.42);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 40px;
}
.ai-panel[hidden] { display: none; }
.ai-box {
  width: min(720px, 100%);
  max-height: 84vh;
  display: flex; flex-direction: column;
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.ai-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.ai-cmd { flex: 1; font-size: 15px; font-weight: 650; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ai-cmd::before { content: "✦ "; color: var(--accent); }
.ai-close { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; color: var(--text-dim); cursor: pointer; padding: 4px 10px; font-size: 14px; }
.ai-close:hover { border-color: var(--danger); color: var(--danger); }
.ai-body { padding: 20px; overflow-y: auto; font-size: 14px; line-height: 1.65; white-space: pre-wrap; color: var(--text); }
.ai-body .h { color: var(--accent); font-weight: 700; margin-top: 4px; }
.ai-body .meta { color: var(--text-faint); font-size: 12px; margin-top: 14px; border-top: 1px solid var(--border); padding-top: 10px; }
.ai-working { color: var(--accent); font-weight: 500; }
.ai-working::after { content: " ●●●"; animation: dots 1.2s steps(4) infinite; }
@keyframes dots { 0% { opacity: .3 } 50% { opacity: 1 } 100% { opacity: .3 } }
.ai-error { color: var(--danger); }

.key-input {
  display: block; width: 100%;
  margin: 8px 0 0;
  padding: 11px 13px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font: inherit; font-size: 14px;
  outline: none;
}
.key-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.key-input::placeholder { color: var(--text-faint); }
select.key-input { -webkit-appearance: none; appearance: none; cursor: pointer; }

/* --------------------------------- Gate ----------------------------------- */

.gate { position: fixed; inset: 0; z-index: 50; background: var(--bg); display: flex; align-items: center; justify-content: center; padding: 24px; }
.gate[hidden] { display: none; }
.gate-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-md);
  padding: 34px 38px;
  text-align: center;
  max-width: 440px;
}
.gate-card h1 { margin: 0 0 6px; font-size: 19px; font-weight: 700; }
.gate-card img { width: 250px; height: 250px; border-radius: 12px; background: #fff; padding: 8px; margin: 16px 0 6px; border: 1px solid var(--border); }
.steps { text-align: left; color: var(--text-dim); font-size: 13px; padding-left: 20px; margin: 12px 0 0; line-height: 1.9; }
.steps b { color: var(--text); }
#gate-spinner {
  width: 26px; height: 26px; margin: 18px auto 0;
  border: 3px solid var(--surface-3); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .8s linear infinite; color: transparent; font-size: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }
.gate-code {
  font-size: 26px; letter-spacing: 5px; font-weight: 700;
  color: var(--accent); background: var(--accent-soft);
  border-radius: 12px; padding: 14px; margin: 14px 0 4px; user-select: all;
}

/* ------------------------------- Kaydırma --------------------------------- */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 6px; border: 2px solid var(--surface); }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}

/* Reklam-referral bloğu — sohbet başlığının altında */
.ad-banner {
  padding: 12px 20px;
  background: var(--accent-soft);
  border-bottom: 1px solid var(--border);
  border-left: 4px solid var(--accent);
}
.ad-banner[hidden] { display: none; }
.ad-banner-h { font-size: 12px; font-weight: 700; color: var(--accent); letter-spacing: .01em; }
.ad-banner-d { font-size: 13.5px; color: var(--text); margin-top: 3px; }
.ad-banner-link { display: inline-block; margin-top: 5px; font-size: 12.5px; font-weight: 600; }

.ad-banner-row { display: flex; gap: 12px; align-items: flex-start; }
.ad-banner-thumb { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; flex: none; border: 1px solid var(--border); background: var(--surface); }
.ad-banner-txt { flex: 1; min-width: 0; }
.ad-banner-d a { color: var(--accent); text-decoration: underline; word-break: break-all; }
