/* AC Canlı Destek — ortak tasarım değişkenleri ve bileşenler
 *
 * Renk paleti sitenin renklerinden türetildi: turuncu #F2722A (marka), kırık beyaz #FDFDFD (yüzey),
 * gece mavisi #130F28 (metin ve koyu alanlar).
 *  --brand       turuncu dolgu (buton, başlık, odak halkası); üstündeki yazı --brand-text (lacivert, 6,4:1)
 *  --brand-ink   açık zeminde turuncu yazı/bağlantı (beyaz zeminde 5,3:1; beyaz üstünde #F2722A yazı 2,9:1 kalır)
 *  --navy        koyu alanlar (panel üst çubuğu, temsilci mesaj balonu); üstündeki yazı --on-navy
 */
:root {
  --bg: #f5f4f8;
  --surface: #fdfdfd;
  --surface-2: #f8f7fb;
  --surface-3: #efedf4;
  --border: #e5e3ec;
  --border-strong: #cdcad9;
  --text: #130f28;
  --text-2: #4b4766;
  --text-3: #67637f;
  --brand: #f2722a;
  --brand-hover: #e2601a;
  --brand-soft: #fef0e7;
  --brand-text: #130f28;
  --brand-ink: #b4480f;
  --navy: #130f28;
  --navy-hover: #2a2348;
  --on-navy: #fdfdfd;
  --ok: #15803d;
  --ok-soft: #dcfce7;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --bubble-visitor: #efedf4;
  --bubble-agent: #130f28;
  --bubble-agent-text: #fdfdfd;
  --bubble-other: #fde3d3;
  --shadow-sm: 0 1px 2px rgba(19, 15, 40, 0.06);
  --shadow: 0 4px 16px rgba(19, 15, 40, 0.08);
  --shadow-lg: 0 16px 48px rgba(19, 15, 40, 0.2);
  --radius: 10px;
  --radius-sm: 6px;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0a1a;
    --surface: #151229;
    --surface-2: #110e22;
    --surface-3: #221d3c;
    --border: #2b2547;
    --border-strong: #3e3762;
    --text: #f2f1f7;
    --text-2: #bab6ce;
    --text-3: #928dac;
    --brand: #f2722a;
    --brand-hover: #f5884a;
    --brand-soft: #3a2117;
    --brand-text: #130f28;
    --brand-ink: #f7965e;
    --navy: #07051a;
    --navy-hover: #1c1736;
    --on-navy: #f2f1f7;
    --ok: #4ade80;
    --ok-soft: #14532d;
    --warn: #fbbf24;
    --warn-soft: #422006;
    --danger: #f87171;
    --danger-soft: #450a0a;
    --bubble-visitor: #221d3c;
    --bubble-agent: #3b3270;
    --bubble-agent-text: #f2f1f7;
    --bubble-other: #4a2a1a;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: var(--brand-ink); }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
button, input, select, textarea { font: inherit; color: inherit; }

/* Butonlar */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--surface-3); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn:focus-visible, .input:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-text); }
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn-danger { color: var(--danger); border-color: var(--border-strong); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger-solid:hover { filter: brightness(.92); background: var(--danger); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-3); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn-icon { width: 36px; padding: 0; }
.btn-block { width: 100%; }
.btn svg { width: 16px; height: 16px; flex: none; }

/* Form alanları */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 13px; font-weight: 500; color: var(--text-2); }
.field small { color: var(--text-3); font-size: 12px; }
.input {
  width: 100%; height: 38px; padding: 0 12px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); outline: none;
}
textarea.input { height: auto; min-height: 80px; padding: 10px 12px; resize: vertical; }
.input:focus { border-color: var(--brand); }
.check { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; cursor: pointer; }

.alert {
  padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 14px;
  background: var(--danger-soft); color: var(--danger);
}
.alert.ok { background: var(--ok-soft); color: var(--ok); }

/* Rozetler */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 8px; border-radius: 999px;
  font-size: 12px; font-weight: 500; white-space: nowrap;
  background: var(--surface-3); color: var(--text-2);
}
.badge.waiting { background: var(--warn-soft); color: var(--warn); }
.badge.active { background: var(--ok-soft); color: var(--ok); }
.badge.closed { background: var(--surface-3); color: var(--text-3); }
.badge.brand { background: var(--brand-soft); color: var(--brand-ink); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--danger); color: #fff; font-size: 11px; font-weight: 600;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex: none; display: inline-block; }
.dot.on { background: #22c55e; }
.dot.away { background: #f59e0b; }

/* Giriş sayfası */
.auth-page { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.auth-card {
  width: 100%; max-width: 380px; padding: 32px 28px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow);
}
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: var(--brand); color: var(--brand-text);
}
.brand-mark svg { width: 18px; height: 18px; }
/* Firma logosu (public/img/antikbet-logo*.png; 328×80): koyu zeminde beyaz yazılı, açık zeminde koyu yazılı sürüm */
.brand-logo { display: block; height: 28px; width: auto; flex: none; }
/* Giriş kartının başı: ortalanmış logo, altında başlık ve açıklama */
.auth-head { display: flex; flex-direction: column; align-items: center; text-align: center; }
.auth-head picture { display: block; margin-bottom: 22px; }
.auth-head .brand-logo { height: 40px; }
.auth-card .logo { margin-bottom: 24px; }
.auth-card h1 { font-size: 20px; margin-bottom: 4px; }
.auth-card p.muted { margin: 0 0 22px; }
.muted { color: var(--text-3); }

/* Toast */
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 1000; }
.toast {
  max-width: 340px; padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--text); color: var(--surface); box-shadow: var(--shadow-lg); font-size: 13px;
  animation: toast-in .2s ease-out;
}
.toast.error { background: var(--danger); color: #fff; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Mesaj ekleri (resim / PDF) */
.att-image { display: block; margin: 2px 0 4px; }
.att-image img {
  display: block; max-width: min(240px, 100%); max-height: 240px; min-height: 40px; border-radius: 10px;
  object-fit: cover; background: var(--surface-3);
}
.att-file {
  display: flex; align-items: center; gap: 10px; margin: 2px 0 4px; padding: 8px 10px; min-width: 180px; max-width: 260px;
  border-radius: 10px; background: rgba(127, 127, 127, .12); color: inherit; text-decoration: none;
}
.att-file:hover { background: rgba(127, 127, 127, .2); }
.att-icon {
  flex: none; width: 34px; height: 40px; border-radius: 6px; display: grid; place-items: center;
  background: #dc2626; color: #fff; font-size: 10px; font-weight: 700; letter-spacing: .03em;
}
.att-meta { display: flex; flex-direction: column; min-width: 0; }
.att-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-meta small { font-size: 11px; opacity: .75; }
.drop-active { outline: 2px dashed var(--brand); outline-offset: -6px; }
.upload-status { padding: 6px 14px; font-size: 12px; color: var(--text-3); background: var(--surface-2); border-top: 1px solid var(--border); }

/* Mesaj içeriği */
.msg-text { white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; }
.msg-text a { color: inherit; text-decoration: underline; }
