/*
  WhatsApp botu ekranları (wp-bot/views). Renkler kasıtlı olarak panelin çinko
  temasından ayrılır: sohbet, işletme sahibinin telefonda gördüğü WhatsApp koyu
  temasına yakındır. Böylece "müşterinin gördüğü" ile "sizin notlarınız" karışmaz.
  Sınıflar views/*.ejs ve public/js/whatsapp.js içinden kullanılır.
*/

/* Sekmeler: hap kutu yerine satır altı çizgi. Aktif sayfa, altı çizili bir kelime gibi durur. */
.wa-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 20px;
  margin: 2px 0 22px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: none;
}
.wa-nav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: auto;
  padding: 6px 0 11px;
  border-radius: 0;
  background: none;
  color: var(--faint);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}
.wa-nav a:hover { color: var(--text); background: none; }
.wa-nav a.is-active { color: var(--text); background: none; }
.wa-nav a.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: #25d366;
}

/* Okunmamış sayısı: WhatsApp'taki yeşil damga. Gelen kutusu satırında ve sekmede kullanılır. */
.wa-count {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: 6px;
  border-radius: 999px;
  background: #25d366;
  color: #052e16;
  font-size: 11px;
  font-weight: 700;
}

.wa-ellipsis { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Konuşma durumu: hap rozet yerine kısa etiket. inbox.ejs ve chat.ejs */
.wa-tag {
  flex: none;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .01em;
}
.wa-st-wait { color: #e7c27a; }
.wa-st-human { color: #9ec0ea; }
.wa-st-bot { color: #7dcea0; }

/* Kurulum listesi (overview.ejs). Bitmiş adım silik; sıradaki adımın solunda sarı çizgi. */
.wa-step { display: flex; align-items: center; gap: 10px; padding: 4px 0 4px 10px; color: var(--text); }
.wa-step.is-done { color: var(--faint); }
.wa-step.is-done .icon { color: var(--success); }
.wa-step.is-next { box-shadow: inset 2px 0 0 #e7c27a; }

/* Meta'ya yapıştırılacak adres. Tıklayınca tamamı seçilsin diye user-select: all. */
.wa-code {
  display: block;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  font-size: 12px;
  overflow-wrap: anywhere;
  user-select: all;
}

/* ---------- Genel bakış: eşit kartlar yerine tek satırlık defter ---------- */
.wa-ledger {
  display: flex;
  flex-wrap: wrap;
  margin-bottom: 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  overflow: hidden;
}
.wa-ledger-item {
  flex: 1 1 150px;
  padding: 14px 16px 15px;
  border-right: 1px solid var(--border);
  color: inherit;
  text-decoration: none;
}
.wa-ledger-item:last-child { border-right: 0; }
.wa-ledger-n {
  display: block;
  font-size: 26px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.03em;
  line-height: 1.15;
}
.wa-ledger-l {
  display: block;
  margin-top: 3px;
  max-width: 16ch;
  font-size: 12px;
  line-height: 1.35;
  color: var(--muted);
}
/* Bekleyen varsa bu hücre sarı bir not gibi durur; tıklanınca gelen kutuya gider. */
a.wa-ledger-item.is-alert { background: #1c1910; box-shadow: inset 3px 0 0 #e7c27a; }
a.wa-ledger-item.is-alert .wa-ledger-n { color: #f3d48a; }
a.wa-ledger-item:hover .wa-ledger-l { color: var(--text); }

/* ---------- Gelen kutusu: tablo değil, kişi listesi (inbox.ejs) ---------- */
.wa-people { display: flex; flex-direction: column; }
.wa-person {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: inherit;
  text-decoration: none;
}
.wa-person:last-child { border-bottom: 0; }
.wa-person:hover { background: rgba(255, 255, 255, .03); }
.wa-ava {
  flex: none;
  width: 40px;
  height: 40px;
  margin-top: 2px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .02em;
  color: #f4f4f5;
}
/* Renk telefona göre sabitlenir (inbox.ejs tone). Her kişi aynı daireyi korur, gökkuşağı değil. */
.wa-ava-0 { background: #3f5346; }
.wa-ava-1 { background: #3d4d62; }
.wa-ava-2 { background: #5c4638; }
.wa-ava-3 { background: #4a3d58; }
.wa-ava-4 { background: #3e5358; }
.wa-ava-5 { background: #584848; }
.wa-person-main { min-width: 0; flex: 1; }
.wa-person-top, .wa-person-bot { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.wa-person-name { font-weight: 600; }
.wa-person-time { flex: none; font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.wa-person-preview {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 13px;
}
.wa-person-sub { display: block; margin-top: 2px; font-size: 12px; color: var(--faint); }
.wa-person-side { display: flex; align-items: center; gap: 8px; flex: none; }

/* ---------- Sohbet (chat.ejs + public/js/whatsapp.js aynı DOM'u üretir) ---------- */
.wa-chat-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #111b21;
  border-color: #1c282f;
}
.wa-chat-card > .card-head {
  background: #1f2c33;
  border-bottom-color: transparent;
}

.wa-thread {
  display: flex;
  flex-direction: column;
  gap: 6px;
  height: min(62vh, 640px);
  padding: 14px 12px 16px;
  overflow-y: auto;
  /* Hafif, düzensiz desen: düz boyalı kutu gibi durmasın. Resmi WhatsApp duvar kâğıdı değil. */
  background-color: #0c1419;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='168' height='168'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.045' stroke-width='1'%3E%3Ccircle cx='18' cy='28' r='7'/%3E%3Cpath d='M88 16l9 15-9 15-9-15z'/%3E%3Ccircle cx='146' cy='64' r='3'/%3E%3Cpath d='M36 118h18M45 109v18'/%3E%3Ccircle cx='112' cy='138' r='9'/%3E%3Cpath d='M150 130l6 6-6 6-6-6z'/%3E%3C/g%3E%3C/svg%3E");
}
.wa-msg { max-width: min(78%, 460px); align-self: flex-start; }
.wa-msg.wa-out { align-self: flex-end; }
.wa-msg.wa-system { align-self: center; max-width: 88%; }

.wa-bubble {
  padding: 6px 9px 4px 10px;
  background: #1f2c33;
  border-radius: 8px 8px 8px 3px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .28);
}
.wa-out .wa-bubble { background: #005c4b; border-radius: 8px 8px 3px 8px; }
.wa-system .wa-bubble {
  background: rgba(255, 255, 255, .06);
  border-radius: 8px;
  text-align: center;
  box-shadow: none;
}
.wa-body { white-space: pre-line; overflow-wrap: anywhere; }
.wa-meta { margin-top: 2px; font-size: 11px; color: rgba(233, 237, 239, .62); text-align: right; }
.wa-system .wa-meta { text-align: center; }
.wa-error { margin-top: 4px; font-size: 12px; color: #f0a8a4; }

.wa-reply {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 8px 10px 10px;
  background: #111b21;
  border-top: 0;
}
.wa-reply .textarea,
.wa-reply .input {
  border: 0;
  border-radius: 18px;
  background: #2a3942;
}
.wa-reply .textarea { min-height: 44px; padding-top: 10px; }
.wa-reply .btn { border-radius: 18px; }
.wa-reply-hint { padding: 0 14px 12px; background: #111b21; color: #8696a0; }
.wa-chat-card > .card-body { background: #111b21; }

/* ---------- Simülatör: müşterinin telefonu (simulator.ejs) ---------- */
.wa-phone {
  display: flex;
  flex-direction: column;
  max-width: 390px;
  border: 7px solid #161618;
  border-radius: 26px;
  overflow: hidden;
  background: #0b141a;
  box-shadow: 0 16px 36px rgba(0, 0, 0, .35), inset 0 0 0 1px #2c2c30;
}
.wa-phone-notch {
  display: flex;
  justify-content: center;
  padding: 7px 0 2px;
  background: #1f2c33;
}
.wa-phone-notch span {
  width: 54px;
  height: 5px;
  border-radius: 99px;
  background: #0e161b;
}
.wa-phone-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px 12px;
  background: #1f2c33;
  font-weight: 600;
}
.wa-sim { height: min(58vh, 520px); }
.wa-sim-empty {
  margin: auto;
  max-width: 26ch;
  color: #8696a0;
  text-align: center;
  font-size: 13px;
}
/* Buton / liste: balonun altında, WhatsApp'taki gibi ortalanmış satırlar */
.wa-options { display: flex; flex-direction: column; margin-top: 3px; overflow: hidden; border-radius: 8px; }
.wa-option {
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, .06);
  border-radius: 0;
  background: #1f2c33;
  color: #53bdeb;
  font: inherit;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
}
.wa-options form:first-child .wa-option { border-top: 0; }
.wa-option:hover { background: #263640; }
.wa-option small { display: block; margin-top: 1px; color: #8696a0; font-weight: 400; font-size: 11px; }

/* ---------- Ayarlar: haftalık mesai satırı (settings.ejs) ---------- */
.wa-hours {
  display: grid;
  grid-template-columns: 110px 120px 120px auto;
  gap: 8px;
  align-items: center;
}
.wa-day { font-weight: 500; }
/* "Kapalı" işaretli gün soluklaşır; saat kutuları durur ki tekrar açmak kolay olsun. */
.wa-hours:has(input[type="checkbox"]:checked) .wa-day,
.wa-hours:has(input[type="checkbox"]:checked) input[type="time"] { opacity: .38; }

/* SSS deneme kutusu: eşleşme yüzdesi (faqs.ejs) */
.wa-pct { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--faint); }
.wa-pct.is-ok { color: #86efac; font-weight: 600; }

@media (max-width: 640px) {
  .wa-hours { grid-template-columns: 1fr 1fr; }
  .wa-day { grid-column: 1 / -1; }
  .wa-msg { max-width: 92%; }
  .wa-ellipsis { max-width: 160px; }
  .wa-ledger-item { border-right: 0; border-bottom: 1px solid var(--border); }
}

/* ---------- Raporlar (views/report.ejs) ---------- */
.rp-toolbar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.rp-toolbar .muted { flex: 1; }
.wa-period { display: flex; gap: 6px; flex-wrap: wrap; }
.rp-delta { display: inline-block; margin-top: 4px; font-size: 12px; font-weight: 600; }
.rp-delta.is-up { color: var(--success); }
.rp-delta.is-down { color: var(--danger); }
.rp-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 10px; line-height: 1.5; }
.rp-bars { display: flex; align-items: flex-end; gap: 3px; height: 160px; padding-top: 8px; }
.rp-bar { flex: 1; height: 100%; display: flex; align-items: flex-end; }
.rp-bar span {
  width: 100%; min-height: 2px; border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, #b8e0a0 0%, var(--success) 100%);
  opacity: .85; transform-origin: bottom;
  animation: bar-rise .7s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 18ms);
  box-shadow: 0 0 12px rgba(143, 191, 122, .15);
}
.rp-axis { display: flex; justify-content: space-between; margin-top: 6px; font-size: 11px; color: var(--faint); }
.rp-heat { border-collapse: separate; border-spacing: 2px; font-size: 11px; }
.rp-heat th { color: var(--faint); font-weight: 500; padding: 0 4px; text-align: left; }
.rp-heat td {
  width: 22px; height: 18px; border-radius: 3px;
  background: rgba(74, 222, 128, calc(.06 + var(--a) * .9));
  animation: heat-pop .35s var(--ease) both;
  animation-delay: calc(var(--a) * 200ms);
  transition: transform .15s var(--ease);
}
.rp-heat td:hover { transform: scale(1.25); z-index: 1; }
.rp-dl { grid-template-columns: 150px minmax(0, 1fr); }
.rp-section { display: flex; align-items: center; gap: 8px; margin: 28px 0 12px; font-size: 18px; }
.rp-section:first-of-type { margin-top: 8px; }
.card-head .link.faint { margin-left: auto; font-size: 13px; }
.rp-mood { display: flex; height: 14px; border-radius: 999px; overflow: hidden; margin-bottom: 8px; background: var(--surface-3); }
.rp-mood-pos { background: var(--success); }
.rp-mood-neu { background: #a1a1aa; }
.rp-mood-neg { background: var(--danger); }
.rp-quote { margin: 4px 0 10px; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.rp-hbar { display: grid; grid-template-columns: 180px 1fr 40px; gap: 10px; align-items: center; margin-top: 8px; }
.rp-hbar-label { font-size: 13px; }
.rp-hbar-track { height: 10px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.rp-hbar-track span {
  display: block; height: 100%; width: 100%;
  background: linear-gradient(90deg, #7dd3fc, #93c5fd);
  border-radius: inherit;
  transform-origin: left center;
  animation: hbar-fill .8s var(--ease) both;
}
.wa-period .btn { transition: transform .2s var(--ease), background .2s; }
.wa-period .btn.btn-primary { box-shadow: 0 0 0 1px rgba(243, 234, 220, .25); }
.stat { animation: fade-up .5s var(--ease) both; }
.rp-topic { padding: 8px 0; border-bottom: 1px solid var(--border); }
.rp-topic:last-child { border-bottom: 0; }

/* Yazdırma / PDF: menü ve butonlar gizlenir, açık zemin (mürekkep tasarrufu) */
@media print {
  .sidebar, .rp-toolbar .btn, .rp-toolbar .back, .flash { display: none !important; }
  .shell { display: block; }
  body, .main, .card { background: #fff !important; color: #111 !important; }
  .card { border-color: #ddd !important; break-inside: avoid; }
  .muted, .faint, .hint, .rp-quote, .stat-label { color: #555 !important; }
  .rp-heat td { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .rp-bar span, .rp-mood span, .rp-hbar-track span { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}
@media (max-width: 640px) {
  .rp-hbar { grid-template-columns: 1fr 60px 30px; }
}

/* Kızgın müşteri işareti (canlı duygu ölçümü, bot.js reactToMood) */
.wa-st-angry { color: #fca5a5; border-color: rgba(248, 113, 113, .4); background: rgba(248, 113, 113, .1); }
.wa-angry-note { margin: 0; color: #fca5a5; font-size: 13px; }
.wa-assist-summary { margin: 0; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); white-space: pre-line; }

/* ==========================================================================
   Yapay zekâ merkezi (views/ai.ejs)
   ========================================================================== */
.ai-hero { display: flex; justify-content: space-between; align-items: center; gap: 24px; flex-wrap: wrap; padding: 24px; margin-bottom: 8px;
  background: radial-gradient(120% 140% at 0% 0%, rgba(143, 191, 122, .14), transparent 55%), var(--surface); }
.ai-hero-main { display: flex; align-items: center; gap: 18px; }
.ai-kicker { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.ai-hero-title { margin: 2px 0 4px; font-family: var(--display); font-size: 26px; }
.ai-hero-stats { display: flex; gap: 28px; flex-wrap: wrap; }
.ai-hero-stats > div { display: flex; flex-direction: column; }
.ai-big { font-family: var(--display); font-size: 32px; line-height: 1.1; font-variant-numeric: tabular-nums; }
/* Durum küresi: hazırken yavaşça "nefes alır" */
.ai-orb { position: relative; display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; color: var(--primary-fg);
  background: radial-gradient(circle at 35% 30%, #d9f2c9, var(--success) 60%, #4e7a3d); box-shadow: 0 0 0 0 rgba(143, 191, 122, .45); }
.ai-orb .icon { width: 24px; height: 24px; }
.ai-orb-ready { animation: ai-breathe 3.2s var(--ease) infinite; }
.ai-orb-loading { animation: ai-spin-glow 1.6s linear infinite; }
.ai-orb-down, .ai-orb-off { filter: grayscale(1) brightness(.7); }
@keyframes ai-breathe { 0%, 100% { box-shadow: 0 0 0 0 rgba(143, 191, 122, .45); transform: scale(1); } 50% { box-shadow: 0 0 0 12px rgba(143, 191, 122, 0); transform: scale(1.04); } }
@keyframes ai-spin-glow { to { filter: hue-rotate(360deg); } }

/* Çözüm katmanları: soldan sağa akış, aradaki ok çizgisi */
.ai-pipeline { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.ai-step { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  animation: ai-rise .6s var(--ease) both; animation-delay: calc(var(--i) * 90ms); }
.ai-step:not(:last-child)::after { content: ''; position: absolute; top: 34px; right: -12px; width: 12px; height: 2px; background: linear-gradient(90deg, var(--border-strong), transparent); }
.ai-step-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--surface-3); color: var(--success); }
.ai-step-desc { font-size: 13px; color: var(--muted); flex: 1; }
.ai-step-n { font-family: var(--display); font-size: 28px; font-variant-numeric: tabular-nums; }
.ai-step-cost { font-size: 12px; }
@keyframes ai-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.ai-answer { padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.ai-usage { display: flex; align-items: flex-end; gap: 4px; height: 110px; }
.ai-usage-day { flex: 1; height: 100%; display: flex; align-items: flex-end; }
/* Çubuk: üst kısmı işlenen token, alt (yeşil) kısmı önbellekten gelen pay */
.ai-usage-bar { width: 100%; height: var(--h); min-height: 2px; border-radius: 4px 4px 0 0;
  background: linear-gradient(to top, var(--success) 0 var(--c), #c9a96e var(--c) 100%); transform-origin: bottom; animation: ai-grow .8s var(--ease) both; }
@keyframes ai-grow { from { transform: scaleY(0); } }
.ai-usage-legend { display: flex; gap: 16px; margin-top: 8px; font-size: 12px; color: var(--faint); }
.ai-dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; }
.ai-dot-new { background: #c9a96e; }
.ai-dot-cache { background: var(--success); }

/* Özellik anahtarları (checkbox → kaydırmalı anahtar görünümü) */
.ai-features { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.ai-feature { position: relative; display: flex; gap: 14px; align-items: flex-start; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; transition: border-color .2s, background .2s; }
.ai-feature:hover { border-color: var(--border-strong); background: var(--surface-2); }
.ai-feature input { position: absolute; opacity: 0; pointer-events: none; }
.ai-feature strong { display: block; margin-bottom: 2px; }
.ai-switch { flex: none; position: relative; width: 40px; height: 22px; margin-top: 2px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--border-strong); transition: background .25s var(--ease); }
.ai-switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transition: transform .25s var(--ease), background .25s; }
.ai-feature input:checked + .ai-switch { background: rgba(143, 191, 122, .35); border-color: var(--success); }
.ai-feature input:checked + .ai-switch::after { transform: translateX(18px); background: var(--success); }
.ai-feature input:focus-visible + .ai-switch { outline: 2px solid var(--success); outline-offset: 2px; }
.ai-limit { grid-column: 1 / -1; max-width: 420px; }

@media (max-width: 1100px) { .ai-pipeline { grid-template-columns: repeat(2, minmax(0, 1fr)); } .ai-step::after { display: none; } }
@media (max-width: 640px) { .ai-pipeline, .ai-features { grid-template-columns: 1fr; } .ai-hero { padding: 18px; } }

/* ==========================================================================
   Hareket sistemi (tüm panel) — public/js/panel.js ile birlikte
   ========================================================================== */
/* Sayfa girişi: içerik yumuşakça belirir */
.main { animation: ui-fade .35s var(--ease) both; }
@keyframes ui-fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
/* Kaydırınca beliren bloklar (data-reveal; JS görünür olunca is-in ekler) */
[data-reveal] { opacity: 0; transform: translateY(14px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
[data-reveal].is-in { opacity: 1; transform: none; }
/* Kart üzerine gelince hafif yükselir */
.card:hover { border-color: var(--border-strong); }
a.card:hover, .stat:hover { transform: translateY(-2px); box-shadow: 0 10px 24px -14px rgba(0, 0, 0, .6); }
/* Butona basınca küçük çökme hissi */
.btn:active:not(:disabled) { transform: scale(.97); }
/* Yükleniyor: buton üzerinde parlayan şerit (data-loading, panel.js) */
.btn.is-loading { position: relative; pointer-events: none; opacity: .85; overflow: hidden; }
.btn.is-loading::after { content: ''; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, .18) 50%, transparent 80%); animation: ui-shimmer 1.1s linear infinite; }
@keyframes ui-shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
/* Bildirim (flash) üstten kayarak gelir */
.flash { animation: ui-drop .45s var(--ease) both; }
@keyframes ui-drop { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
/* Bekleyen / kızgın rozetleri dikkat çekmek için hafifçe nabız atar */
.nav-badge, .wa-st-wait, .wa-st-angry { animation: ui-pulse 2.4s ease-in-out infinite; }
@keyframes ui-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(224, 138, 122, .0); } 50% { box-shadow: 0 0 0 4px rgba(224, 138, 122, .18); } }
/* Sohbet balonları açılarak gelir (yeni mesajlar canlı eklendiğinde de) */
.wa-msg { animation: ui-pop .35s var(--ease) both; }
@keyframes ui-pop { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
/* Simülatörde müşteri gönderince bot "yazıyor…" (üç nokta) */
.wa-typing { display: inline-flex; gap: 4px; padding: 12px 14px; }
.wa-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: ui-dot 1.2s infinite ease-in-out; }
.wa-typing i:nth-child(2) { animation-delay: .15s; }
.wa-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes ui-dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-4px); } }
.nav-link { transition: background .2s var(--ease), color .2s, transform .2s var(--ease); }
.nav-link:hover { transform: translateX(2px); }

/* Hareket hassasiyeti olan kullanıcılar: tüm animasyonlar kapanır, içerik hemen görünür */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  [data-reveal] { opacity: 1; transform: none; }
}
@media print { [data-reveal] { opacity: 1 !important; transform: none !important; } }

/* Simülatör: yapay zekâ cevabı rozeti (parlayan kenar) */
.wa-via { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600;
  color: #d9f2c9; background: linear-gradient(90deg, rgba(143, 191, 122, .25), rgba(201, 169, 110, .25)); border: 1px solid rgba(143, 191, 122, .45);
  background-size: 200% 100%; animation: wa-via-shine 3s linear infinite; }
.wa-via .icon { width: 12px; height: 12px; }
.wa-via-ai_answer, .wa-via-ai_answer_cached { color: #f3dfb5; border-color: rgba(201, 169, 110, .55); }
@keyframes wa-via-shine { to { background-position: 200% 0; } }

/* ==========================================================================
   Grafikler (src/charts.js SVG'leri) — animasyonlar kart görünür olunca (.is-in) başlar
   ========================================================================== */
.rp-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.rp-kpi { position: relative; padding: 16px 18px 12px; overflow: hidden; }
.rp-kpi-top { display: flex; align-items: center; gap: 8px; }
.rp-kpi-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--surface-3); color: var(--success); }
.rp-kpi-icon .icon { width: 15px; height: 15px; }
.rp-kpi .stat-value { margin: 8px 0 2px; font-size: 30px; }
.rp-kpi .ch-spark { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 34px; opacity: .9; }
.rp-grid-3 { display: grid; grid-template-columns: 1fr 2fr; gap: 16px; }
.rp-center { display: flex; flex-direction: column; align-items: center; text-align: center; }
.rp-legend-prev { color: var(--muted); }

.ch { display: block; width: 100%; overflow: visible; color: var(--success); }
.ch-grid { stroke: var(--border); stroke-width: 1; stroke-dasharray: 2 4; vector-effect: non-scaling-stroke; }
.ch-ylabel, .ch-xlabel { fill: var(--faint); font-size: 14px; font-family: var(--sans); }
.ch-line { height: auto; }
/* Çizgi soldan sağa çizilir (pathLength=1 → dashoffset 1'den 0'a) */
/* vector-effect yok: Firefox'ta pathLength ile birlikte çizginin sonunu eksik çiziyor */
.ch-stroke { fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; }
.ch-prev { fill: none; stroke: var(--faint); stroke-width: 2; stroke-dasharray: .008 .008; opacity: 0; }
.ch-area { opacity: 0; }
.ch-dot { fill: var(--surface); stroke: currentColor; stroke-width: 2.5; opacity: 0; cursor: pointer; transition: r .15s; }
.ch-dot:hover { r: 8; fill: currentColor; }
.is-in .ch-stroke { animation: ch-draw 1.4s var(--ease) forwards; }
.is-in .ch-area { animation: ch-fade .9s .5s var(--ease) forwards; }
.is-in .ch-prev { animation: ch-fade .8s .9s forwards; }
.is-in .ch-dot { animation: ch-fade .3s forwards; animation-delay: calc(.6s + var(--i) * 25ms); }
@keyframes ch-draw { to { stroke-dashoffset: 0; } }
@keyframes ch-fade { to { opacity: 1; } }

.ch-spark-area { fill: currentColor; opacity: .12; }

/* Halka: dilimler sırayla dolar */
.ch-donut-wrap { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.ch-donut { flex: none; width: auto; transform: rotate(-90deg); }
.ch-donut text { transform: rotate(90deg); transform-origin: 90px 90px; }
.ch-track { fill: none; stroke: var(--surface-3); stroke-width: 18; }
.ch-arc { fill: none; stroke-width: 18; stroke-dasharray: 0 100; stroke-dashoffset: var(--off); cursor: pointer; transition: stroke-width .2s; }
.ch-arc:hover { stroke-width: 24; }
.is-in .ch-arc { animation: ch-arc 1.1s var(--ease) forwards; animation-delay: calc(var(--i) * 150ms); }
@keyframes ch-arc { to { stroke-dasharray: var(--len) 100; } }
.ch-center { fill: var(--text); font-family: var(--display); font-size: 30px; }
.ch-center-sub { fill: var(--faint); font-size: 12px; font-family: var(--sans); }
.ch-legend { flex: 1; min-width: 200px; margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.ch-legend li { display: grid; grid-template-columns: 12px 1fr auto 44px; gap: 10px; align-items: center; font-size: 13px; }
.ch-legend i { width: 12px; height: 12px; border-radius: 3px; }
.ch-legend .faint { text-align: right; }

/* Yarım daire gösterge */
.ch-gauge { max-width: 240px; }
.ch-gauge .ch-track { stroke-width: 16; stroke-linecap: round; }
.ch-gauge-fill { fill: none; stroke-width: 16; stroke-linecap: round; stroke-dasharray: 0 100; }
.is-in .ch-gauge-fill { animation: ch-arc 1.4s var(--ease) forwards; }

/* Yatay çubuklar */
.ch-bars { display: flex; flex-direction: column; gap: 10px; }
.ch-barrow { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 44px; gap: 12px; align-items: center; font-size: 13px; }
.ch-barlabel { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-bartrack { height: 10px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.ch-barfill { display: block; height: 100%; width: 0; border-radius: inherit; box-shadow: 0 0 12px -2px currentColor; }
.ch-barrow strong { text-align: right; font-variant-numeric: tabular-nums; }
.is-in .ch-barfill { animation: ch-bar 1s var(--ease) forwards; animation-delay: calc(var(--i) * 80ms); }
@keyframes ch-bar { to { width: var(--w); } }

/* Dikey sütunlar (saatlik) */
.ch-cols { display: flex; align-items: flex-end; gap: 3px; height: calc(var(--h) + 18px); }
.ch-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; cursor: pointer; }
.ch-col span { width: 100%; height: 0; min-height: 2px; max-height: var(--h); border-radius: 4px 4px 0 0; background: linear-gradient(to top, #6e9a5c, var(--success)); transition: filter .15s; }
.ch-col:hover span { filter: brightness(1.25); }
.ch-col em { height: 18px; font-size: 10px; font-style: normal; color: var(--faint); }
.is-in .ch-col span { animation: ch-col .8s var(--ease) forwards; animation-delay: calc(var(--i) * 25ms); }
@keyframes ch-col { to { height: calc(var(--h) * var(--v) / 100); } }

/* Huni */
.ch-funnel { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.ch-step { display: flex; justify-content: space-between; align-items: center; width: 0; min-width: 0; max-width: 100%; padding: 10px 14px; border-radius: 8px; overflow: hidden; white-space: nowrap;
  background: linear-gradient(90deg, rgba(143, 191, 122, .28), rgba(147, 197, 253, .22)); border: 1px solid var(--border-strong); }
.ch-step strong { font-family: var(--display); font-size: 18px; }
.is-in .ch-step { animation: ch-bar 1s var(--ease) forwards; animation-delay: calc(var(--i) * 200ms); }
.ch-conv { font-size: 12px; color: var(--faint); }

/* Isı haritası hücreleri sırayla belirir */
.rp-heat td { cursor: pointer; }
.is-in .rp-heat td { animation: ch-fade .4s both; animation-delay: calc(var(--i) * 3ms); }

/* Yetkili sayıları, öneri listesi */
.rp-agent { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.rp-agent > div { display: flex; flex-direction: column; padding: 12px; border-radius: var(--radius-sm); background: var(--surface-2); }
.rp-agent .is-alert { box-shadow: inset 0 0 0 1px var(--danger); }
.rp-big { font-family: var(--display); font-size: 28px; font-variant-numeric: tabular-nums; }
.rp-insight { background: radial-gradient(120% 120% at 0% 0%, rgba(201, 169, 110, .12), transparent 60%), var(--surface); }
.is-in .rp-list li { animation: ai-rise .5s var(--ease) both; animation-delay: calc(.2s + var(--i) * 70ms); }

/* Grafik baloncuğu (data-tip, panel.js) */
.ch-tip { position: fixed; z-index: 50; pointer-events: none; padding: 6px 10px; border-radius: 8px; background: var(--primary); color: var(--primary-fg); font-size: 12px; font-weight: 600;
  box-shadow: 0 8px 24px -8px rgba(0, 0, 0, .6); transform: translate(-50%, calc(-100% - 10px)); opacity: 0; transition: opacity .12s; white-space: nowrap; }
.ch-tip.is-on { opacity: 1; }

@media (max-width: 1100px) { .rp-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } .rp-grid-3 { grid-template-columns: 1fr; } .rp-span-2 { grid-column: auto; } }
@media (max-width: 640px) { .rp-kpis, .rp-agent { grid-template-columns: repeat(2, minmax(0, 1fr)); } .ch-barrow { grid-template-columns: 1fr 70px 36px; } }
/* Yazdırma ve hareket azaltma: grafikler animasyonsuz, tam çizilmiş */
@media print, (prefers-reduced-motion: reduce) {
  .ch-stroke { stroke-dashoffset: 0; } .ch-area, .ch-prev, .ch-dot { opacity: 1; }
  .ch-arc, .ch-gauge-fill { stroke-dasharray: var(--len) 100; } .ch-barfill, .ch-step { width: var(--w); }
  .ch-col span { height: calc(var(--h) * var(--v) / 100); }
}

/* Düzen düzeltmeleri: ısı haritası karta sığar, yetkili 2×2, KPI'da mini çizgi yazıya binmez */
.rp-heat { width: 100%; table-layout: fixed; }
.rp-heat td { width: auto; height: 16px; }
.rp-heat th:first-child { width: 30px; }
.rp-agent { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.rp-kpi:has(.ch-spark) { padding-bottom: 40px; }
.rp-kpi .rp-delta { display: block; }
