/* ============================================================
   WhatsApp AI Panel — Ana Stil
   ============================================================ */

:root {
  --bg:        #f4f5f7;
  --card:      #ffffff;
  --text:      #111b21;
  --text-soft: #667781;
  --line:      #e9edef;
  --ok:        #22c55e;
  --err:       #ef4444;
  --warn:      #f59e0b;
  --radius:    16px;
  --shadow:    0 10px 30px rgba(17, 27, 33, .06);
  --shadow-lg: 0 24px 60px rgba(17, 27, 33, .16);

  --brand:     #25d366;
  --brand-2:   #128c7e;
  --brand-dk:  #0c6b5e;
  --brand-soft:#e7f9ee;
  --grad:      linear-gradient(135deg, #25d366 0%, #128c7e 100%);
  --grad-soft: linear-gradient(135deg, #eafff3, #e6f7f3);

  --bal-out:   #d9fdd3;   /* AI/temsilci baloncuğu (WhatsApp yeşili) */
  --bal-in:    #ffffff;   /* Müşteri baloncuğu */
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--brand-dk); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============================================================
   Giriş ekranı
   ============================================================ */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
}
.auth-yan {
  background: var(--grad);
  color: #fff;
  padding: 60px 54px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.auth-yan::after {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(circle at 80% 20%, rgba(255,255,255,.18), transparent 45%),
              radial-gradient(circle at 10% 90%, rgba(255,255,255,.12), transparent 40%);
}
.auth-yan .logo { font-size: 30px; font-weight: 800; letter-spacing: -.5px; position: relative; }
.auth-yan h1 { font-size: 40px; line-height: 1.1; margin: 22px 0 12px; position: relative; }
.auth-yan p  { font-size: 17px; opacity: .92; max-width: 400px; position: relative; }
.auth-ozellikler { margin-top: 34px; position: relative; display: grid; gap: 14px; }
.auth-ozellikler div { display: flex; align-items: center; gap: 12px; font-size: 15px; }
.auth-ozellikler span.ic {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: rgba(255,255,255,.2); flex: none; font-size: 17px;
}
.auth-form {
  display: flex; align-items: center; justify-content: center; padding: 40px;
}
.auth-card { width: 100%; max-width: 400px; }
.auth-card h2 { font-size: 26px; margin: 0 0 6px; }
.auth-card .alt { color: var(--text-soft); margin: 0 0 26px; }
.auth-demo { background: var(--grad-soft); color: var(--brand-dk); padding: 12px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 20px; }

@media (max-width: 860px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-yan { display: none; }
}

/* ============================================================
   Form elemanları
   ============================================================ */
.alan { margin-bottom: 16px; }
.alan label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text-soft); }
.alan .ipucu { font-size: 12.5px; color: var(--text-soft); margin-top: 5px; }
.girdi, select, textarea {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--line);
  border-radius: 12px; font-size: 15px; font-family: inherit; background: #fff; color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.girdi:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 15%, transparent);
}
textarea { resize: vertical; min-height: 72px; }
.anahtar-alan { display: flex; gap: 8px; }
.anahtar-alan .girdi { font-family: ui-monospace, "SF Mono", Consolas, monospace; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border: none; border-radius: 12px; font-size: 15px; font-weight: 600;
  cursor: pointer; font-family: inherit; transition: transform .08s, box-shadow .15s, opacity .15s;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-esas { background: var(--grad); color: #fff; box-shadow: 0 8px 20px color-mix(in srgb, var(--brand) 35%, transparent); }
.btn-esas:hover { box-shadow: 0 12px 26px color-mix(in srgb, var(--brand) 45%, transparent); }
.btn-sade { background: var(--card); color: var(--text); border: 1.5px solid var(--line); }
.btn-sade:hover { border-color: var(--brand); color: var(--brand-dk); }
.btn-tehlike { background: #fef2f2; color: var(--err); border: 1.5px solid #fecaca; }
.btn-tehlike:hover { background: var(--err); color: #fff; }
.btn-blok { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }

/* ============================================================
   Uygulama düzeni (sidebar + içerik)
   ============================================================ */
.kabuk { display: flex; min-height: 100vh; }

.yan-menu {
  width: 250px; background: var(--card); border-right: 1px solid var(--line);
  padding: 22px 16px; position: fixed; top: 0; left: 0; bottom: 0; z-index: 40;
  display: flex; flex-direction: column; transition: transform .25s;
}
.yan-menu .marka {
  display: flex; align-items: center; gap: 10px; padding: 4px 8px 22px; font-weight: 800; font-size: 17px;
}
.yan-menu .marka .rozet {
  width: 38px; height: 38px; border-radius: 11px; background: var(--grad); color: #fff;
  display: grid; place-items: center; font-size: 20px; flex: none;
}
.yan-menu .isletme-adi { padding: 0 8px 14px; font-size: 12.5px; color: var(--text-soft); border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.menu-link {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 12px;
  color: var(--text-soft); font-weight: 600; margin-bottom: 4px; transition: all .15s;
}
.menu-link:hover { background: var(--grad-soft); color: var(--brand-dk); text-decoration: none; }
.menu-link.aktif { background: var(--grad); color: #fff; box-shadow: 0 8px 18px color-mix(in srgb, var(--brand) 30%, transparent); }
.menu-link .ic { font-size: 18px; width: 22px; text-align: center; }
.menu-alt { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line); }
.menu-kul { display: flex; align-items: center; gap: 10px; padding: 8px; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; background: var(--grad); color: #fff;
  display: grid; place-items: center; font-weight: 700; flex: none; font-size: 14px;
}
.menu-kul .ad { font-weight: 600; font-size: 14px; }
.menu-kul .rol { font-size: 12px; color: var(--text-soft); }

.icerik { flex: 1; margin-left: 250px; padding: 26px 32px 60px; max-width: 1280px; }

.ust-bar {
  display: none; align-items: center; justify-content: space-between;
  background: var(--card); padding: 12px 16px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
}
.hamburger { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--text); }
.perde { display: none; position: fixed; inset: 0; background: rgba(15,23,42,.4); z-index: 39; }

@media (max-width: 900px) {
  .yan-menu { transform: translateX(-100%); }
  body.menu-acik .yan-menu { transform: translateX(0); }
  body.menu-acik .perde { display: block; }
  .icerik { margin-left: 0; padding: 18px; }
  .ust-bar { display: flex; }
}

/* ============================================================
   Sayfa başlığı / kart
   ============================================================ */
.sayfa-bas { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.sayfa-bas h1 { font-size: 22px; margin: 0; }
.sayfa-bas .ac { color: var(--text-soft); margin: 4px 0 0; font-size: 14px; }

.kart {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px; border: 1px solid var(--line);
}
.kart-bas { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.kart-bas h3 { margin: 0; font-size: 16px; }
.kart-bas .ac { font-size: 12.5px; color: var(--text-soft); margin-top: 3px; }

.izgara { display: grid; gap: 20px; }
.izgara.k2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 900px){ .izgara.k2 { grid-template-columns: 1fr; } }

/* Salt-okunur bilgi satırları (Ayarlar — Abonelik/Bayi) */
.bilgi-liste { display: grid; gap: 12px; }
.bilgi-satir { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.bilgi-satir:last-child { border-bottom: none; padding-bottom: 0; }
.bilgi-satir .et { font-size: 13px; color: var(--text-soft); }
.bilgi-satir .deg { font-weight: 600; text-align: right; }
.bilgi-satir .deg.bos { color: var(--text-soft); font-weight: 400; font-style: italic; }

.kontor-ozet { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.kontor-kutu { background: var(--bg); border-radius: 12px; padding: 12px 14px; text-align: center; }
.kontor-kutu .sayi { font-size: 22px; font-weight: 800; }
.kontor-kutu .et { font-size: 11.5px; color: var(--text-soft); margin-top: 2px; }
.kontor-kutu.vurgu .sayi { color: var(--brand-dk); }
@media (max-width: 480px){ .kontor-ozet { grid-template-columns: 1fr; } }

.satir { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 540px){ .satir { grid-template-columns: 1fr; } }

/* Anahtar/parola gizleme */
.goster-gizle { background: var(--card); border: 1.5px solid var(--line); border-radius: 12px; padding: 0 14px; cursor: pointer; font-size: 15px; }

/* Bölüm başlığı (ayarlar formu içinde) */
.bolum-bas { display: flex; align-items: center; gap: 10px; margin: 28px 0 14px; font-weight: 700; font-size: 14.5px; color: var(--brand-dk); }
.bolum-bas:first-child { margin-top: 0; }
.bolum-bas .cizgi { flex: 1; height: 1px; background: var(--line); }

/* Anahtar (switch) */
.svc { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.svc input { display: none; }
.svc .kol { width: 42px; height: 24px; border-radius: 999px; background: var(--line); position: relative; transition: background .15s; flex: none; }
.svc .kol::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .15s; }
.svc input:checked + .kol { background: var(--brand); }
.svc input:checked + .kol::after { transform: translateX(18px); }

/* ============================================================
   Rozet / durum
   ============================================================ */
.rozet { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.rozet.ai      { background: var(--grad-soft); color: var(--brand-dk); }
.rozet.insan   { background: #fff7ed; color: #c2410c; }
.rozet.kapali  { background: #f1f5f9; color: #64748b; }
.rozet-nokta { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.rozet-nokta.ai { background: var(--brand); }
.rozet-nokta.insan { background: #f97316; }
.rozet-nokta.kapali { background: #94a3b8; }

/* ============================================================
   Konuşmalar listesi (Tabulator)
   ============================================================ */
#konusmaTablo { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow); }
.tabulator { border: none; background: var(--card); font-family: inherit; font-size: 14px; }
.tabulator .tabulator-header { background: var(--card); border-bottom: 2px solid var(--line); }
.tabulator .tabulator-col { background: var(--card); }
.tabulator .tabulator-col-title { font-weight: 600; color: var(--text-soft); font-size: 12.5px; text-transform: uppercase; letter-spacing: .3px; }
.tabulator-row { background: var(--card); border-bottom: 1px solid var(--line); }
.tabulator-row:hover { background: var(--grad-soft) !important; cursor: pointer; }
.tabulator-row.tabulator-row-even { background: var(--card); }
.tabulator-row .okunmadi-nokta { width: 9px; height: 9px; border-radius: 50%; background: var(--brand); display: inline-block; }

.musteri-hucre { display: flex; flex-direction: column; }
.musteri-hucre .ad { font-weight: 600; }
.musteri-hucre .tel { font-size: 12.5px; color: var(--text-soft); }
.ozet-hucre { color: var(--text-soft); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; max-width: 320px; }

.ata-secim { width: auto; padding: 6px 10px; font-size: 13px; border-radius: 8px; }

/* ============================================================
   Kaynaklar — sekme çubuğu, kural listesi, önizleme
   ============================================================ */
.seg { display: inline-flex; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 4px; gap: 4px; margin-bottom: 18px; }
.seg a { padding: 8px 16px; border-radius: 9px; font-weight: 600; font-size: 13.5px; color: var(--text-soft); }
.seg a:hover { text-decoration: none; }
.seg a.aktif { background: var(--grad); color: #fff; }

.kalan-gun { font-weight: 700; }
.kalan-gun.uyari { color: var(--warn); }
.kalan-gun.kritik { color: var(--err); }

.kural-satir { display: grid; grid-template-columns: 1fr 110px 32px; gap: 8px; align-items: center; margin-bottom: 8px; }
.kural-sil { background: none; border: none; color: var(--err); font-size: 18px; cursor: pointer; line-height: 1; padding: 4px; }

.dropzone {
  border: 2px dashed var(--line); border-radius: 14px; padding: 28px; text-align: center;
  color: var(--text-soft); cursor: pointer; transition: all .15s; font-size: 14px;
}
.dropzone:hover, .dropzone.surukleniyor { border-color: var(--brand); background: var(--grad-soft); color: var(--brand-dk); }
.dropzone .buyuk { font-size: 30px; display: block; margin-bottom: 8px; }

.onizleme-tablo { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 4px; }
.onizleme-tablo th { text-align: left; padding: 8px 10px; background: var(--bg); font-size: 11.5px; text-transform: uppercase; color: var(--text-soft); }
.onizleme-tablo td { padding: 8px 10px; border-bottom: 1px solid var(--line); }
.onizleme-tablo .sayi { text-align: right; font-variant-numeric: tabular-nums; }
.onizleme-tablo .kural-yok { color: var(--warn); font-size: 11px; }

/* ============================================================
   Modal + WhatsApp balon görünümü
   ============================================================ */
.modal-perde {
  display: none; position: fixed; inset: 0; background: rgba(15,23,42,.55);
  z-index: 60; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto;
  backdrop-filter: blur(2px);
}
.modal-perde.acik { display: flex; }
.modal {
  background: var(--card); border-radius: 20px; width: 100%; max-width: 640px;
  box-shadow: var(--shadow-lg); animation: modalGir .2s ease; margin: auto;
}
.modal.modal-genis { max-width: 760px; }
@keyframes modalGir { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-bas { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); gap: 14px; flex-wrap: wrap; }
.modal-bas h3 { margin: 0; font-size: 17px; }
.modal-bas .alt-bilgi { font-size: 12.5px; color: var(--text-soft); margin-top: 2px; }
.modal-kapat { background: none; border: none; font-size: 26px; line-height: 1; cursor: pointer; color: var(--text-soft); }
.modal-govde { padding: 0; }
.modal-alt { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }

.sohbet-alan {
  background: #efeae2;
  background-image: linear-gradient(rgba(255,255,255,.4), rgba(255,255,255,.4));
  padding: 20px; max-height: 480px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px;
}
.balon-satir { display: flex; margin-bottom: 4px; }
.balon-satir.disa { justify-content: flex-end; }
.balon {
  max-width: 78%; padding: 8px 12px; border-radius: 10px; font-size: 14px; line-height: 1.4;
  box-shadow: 0 1px 1px rgba(0,0,0,.1); position: relative;
}
.balon .metin { white-space: pre-wrap; word-break: break-word; }
.balon .zaman { font-size: 10.5px; color: #667781; margin-top: 4px; text-align: right; }
.balon.gelen { background: var(--bal-in); border-top-left-radius: 2px; }
.balon.giden { background: var(--bal-out); border-top-right-radius: 2px; }
.balon .kim { font-size: 11px; font-weight: 700; color: var(--brand-dk); margin-bottom: 2px; }
.balon .fonksiyon-etiket { display: inline-block; font-size: 10.5px; background: var(--grad-soft); color: var(--brand-dk); padding: 1px 7px; border-radius: 999px; margin-bottom: 4px; }

/* Boş durum */
.bos-durum { text-align: center; padding: 50px 20px; color: var(--text-soft); }
.bos-durum .emoji { font-size: 46px; display: block; margin-bottom: 12px; }

/* Flash */
.flash-alan { position: fixed; top: 18px; right: 18px; z-index: 90; display: grid; gap: 10px; max-width: 340px; }
.flash { padding: 14px 18px; border-radius: 12px; box-shadow: var(--shadow-lg); font-weight: 600; font-size: 14px; animation: flashGir .3s; background: #fff; border-left: 4px solid var(--brand); }
.flash.ok  { border-left-color: var(--ok); }
.flash.err { border-left-color: var(--err); }
@keyframes flashGir { from { opacity: 0; transform: translateX(20px); } }

/* Yardımcılar */
.mt { margin-top: 18px; } .mt-l { margin-top: 28px; }
.metin-soft { color: var(--text-soft); }
.aralik { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.satir-sil { background: none; border: 1.5px solid var(--line); border-radius: 8px; color: var(--err); font-size: 15px; cursor: pointer; padding: 4px 9px; line-height: 1.4; }
.satir-sil:hover { background: #fef2f2; border-color: #fecaca; }
