/* =========================================================================
   ERBE SIEM Demo — ERBE Asistan ("SIEM'e Sor") stilleri
   Yüzen asistan düğmesi + sohbet paneli. Tasarım sistemi styles.css ile aynı
   değişkenleri kullanır (koyu/açık tema otomatik uyar).
   ========================================================================= */

/* Toast'lar asistan düğmesinin üstünde dursun */
.toast-wrap { bottom: 80px; }

/* ---------- Yüzen düğme ---------- */
.as-fab {
  position: fixed; right: 18px; bottom: 18px; z-index: 70;
  display: inline-flex; align-items: center; gap: 9px;
  height: 46px; padding: 0 17px 0 14px; border-radius: 30px;
  border: 1px solid #4493f866;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff; font-family: var(--font); font-size: 13.5px; font-weight: 700; letter-spacing: .2px;
  cursor: pointer; box-shadow: 0 10px 30px #2a78d666;
  transition: transform .16s, filter .16s, box-shadow .16s;
}
.as-fab:hover { transform: translateY(-2px); filter: brightness(1.07); box-shadow: 0 14px 36px #2a78d680; }
.as-fab:active { transform: translateY(0); }
.as-fab svg { width: 19px; height: 19px; animation: asTwinkle 2.6s ease-in-out infinite; }
@keyframes asTwinkle { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .75; transform: scale(.88) rotate(-8deg); } }
.as-fab .as-new {
  position: absolute; top: -3px; right: -3px; width: 13px; height: 13px; border-radius: 50%;
  background: var(--crit); border: 2px solid var(--bg); animation: pulse 1.6s infinite; color: var(--crit);
}

/* ---------- Panel ---------- */
.as-panel {
  position: fixed; right: 18px; bottom: 76px; z-index: 75;
  width: min(432px, calc(100vw - 24px));
  height: min(645px, calc(100dvh - 104px));
  display: flex; flex-direction: column; overflow: hidden;
  background: linear-gradient(180deg, var(--panel), color-mix(in srgb, var(--panel) 94%, #000));
  border: 1px solid var(--border-2); border-radius: 18px;
  box-shadow: 0 24px 90px #00000080, 0 0 0 1px #4493f81a;
  animation: asPanelIn .28s cubic-bezier(.2, .8, .3, 1);
}
@keyframes asPanelIn { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: none; } }
.as-panel[hidden] { display: none; }

/* Başlık */
.as-head {
  display: flex; align-items: center; gap: 11px; padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(90deg, #4493f814, #17b8a60d);
}
.as-av {
  width: 34px; height: 34px; border-radius: 10px; flex: none; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff;
  box-shadow: 0 4px 14px #2a78d64d;
}
.as-av svg { width: 18px; height: 18px; }
.as-head .as-hb { min-width: 0; flex: 1; }
.as-head .as-ht { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; }
.as-head .as-ht .badge { font-size: 9px; letter-spacing: .8px; padding: 1px 7px; }
.as-head .as-hs { font-size: 11px; color: var(--muted); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.as-head .icon-btn { width: 30px; height: 30px; flex: none; }

/* Gövde (mesajlar) */
.as-body { flex: 1; overflow-y: auto; padding: 14px 13px 6px; scroll-behavior: auto; }
.as-m { display: flex; gap: 9px; margin: 0 0 12px; }
.as-m.as-user { justify-content: flex-end; }
.as-m.as-user .as-b {
  max-width: 84%; padding: 8px 13px; font-size: 13px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff;
  border-radius: 14px 14px 4px 14px; box-shadow: 0 4px 14px #2a78d633;
  overflow-wrap: break-word; min-width: 0;
}
.as-m.as-ai .as-av { width: 28px; height: 28px; border-radius: 9px; margin-top: 2px; }
.as-m.as-ai .as-av svg { width: 15px; height: 15px; }
.as-m.as-ai .as-b {
  flex: 1; min-width: 0; max-width: calc(100% - 38px);
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 4px 14px 14px 14px;
  padding: 10px 13px 11px; font-size: 13px; line-height: 1.62; overflow-wrap: break-word;
}
.as-b b { font-weight: 700; }
.as-b a { color: var(--primary); font-weight: 600; }
.as-b a:hover { text-decoration: underline; }
.as-blk + .as-blk { margin-top: 9px; }
.as-fade { animation: asFade .35s ease; }
@keyframes asFade { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

/* Daktilo imleci */
.as-cur { display: inline-block; width: 7px; height: 13px; margin-left: 2px; vertical-align: -2px; border-radius: 2px; background: var(--primary); animation: asBlink .8s steps(1) infinite; }
@keyframes asBlink { 50% { opacity: 0; } }

/* Düşünme animasyonu */
.as-think { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12.5px; }
.as-think .as-dots { display: inline-flex; gap: 4px; }
.as-think .as-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--primary); animation: asBounce 1s infinite; }
.as-think .as-dots i:nth-child(2) { animation-delay: .15s; }
.as-think .as-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes asBounce { 0%, 60%, 100% { transform: none; opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }

/* Cevap içi bileşenler */
.as-card { border: 1px solid var(--border); border-radius: 11px; overflow: hidden; background: var(--panel); }
.as-b table { width: 100%; border-collapse: collapse; font-size: 12px; }
.as-b thead th { text-align: left; font-weight: 600; color: var(--muted); font-size: 10px; letter-spacing: .4px; text-transform: uppercase; padding: 7px 10px; border-bottom: 1px solid var(--border); background: var(--panel); position: static; }
.as-b tbody td { padding: 6.5px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.as-b tbody tr:last-child td { border-bottom: 0; }
.as-b tbody tr:hover { background: var(--panel-2); }
.as-b .badge { font-size: 10px; padding: 1px 7px; }
.as-meter { height: 5px; border-radius: 20px; background: var(--panel-3); overflow: hidden; min-width: 54px; }
.as-meter i { display: block; height: 100%; border-radius: 20px; background: var(--primary); }

/* Mini istatistik şeridi */
.as-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; }
.as-stat { border: 1px solid var(--border); background: var(--panel); border-radius: 10px; padding: 8px 10px; }
.as-stat .l { font-size: 10.5px; color: var(--muted); }
.as-stat .v { font-size: 17px; font-weight: 800; letter-spacing: -.3px; font-variant-numeric: tabular-nums; margin-top: 1px; }

/* Madde listesi */
.as-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.as-list li { display: flex; gap: 8px; align-items: flex-start; padding: 7px 10px; border-radius: 9px; background: var(--panel); border: 1px solid var(--border); font-size: 12.5px; }
.as-list li .e { flex: none; }

/* Sayfa bağlantı pilleri */
.as-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.as-pg {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px;
  border-radius: 8px; border: 1px solid var(--border-2); background: var(--panel-3);
  font-size: 12px; font-weight: 600; color: var(--text) !important; transition: border-color .15s, background .15s;
}
.as-pg:hover { border-color: var(--primary); background: var(--panel-2); text-decoration: none !important; }
.as-pg svg { width: 13px; height: 13px; color: var(--primary); }

/* Cevap içi öneri çipleri */
.as-chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border-2); background: var(--panel-2); color: var(--muted);
  border-radius: 20px; padding: 5px 12px; font-size: 12px; font-weight: 500; font-family: var(--font);
  cursor: pointer; transition: color .15s, border-color .15s, background .15s; white-space: nowrap;
}
.as-chip:hover { color: var(--text); border-color: var(--primary); background: var(--panel-3); }
.as-b .as-chip { white-space: normal; text-align: left; }
.as-b .as-chiprow { display: flex; flex-wrap: wrap; gap: 6px; }

/* Hazır soru çipleri (girdinin üstü) */
.as-chips { display: flex; gap: 7px; padding: 8px 12px 3px; overflow-x: auto; scrollbar-width: none; flex: none; }
.as-chips::-webkit-scrollbar { display: none; }

/* Girdi satırı */
.as-inputrow { display: flex; gap: 8px; padding: 9px 12px 7px; flex: none; }
.as-inputrow input {
  flex: 1; min-width: 0; height: 40px; padding: 0 13px; border-radius: 12px;
  background: var(--panel-2); border: 1px solid var(--border-2); color: var(--text);
  font-size: 13px; font-family: var(--font); outline: none; transition: border-color .15s, box-shadow .15s;
}
.as-inputrow input::placeholder { color: var(--muted-2); }
.as-inputrow input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px #4493f822; }
.as-send {
  width: 40px; height: 40px; flex: none; border-radius: 12px; border: 0; cursor: pointer;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2)); box-shadow: 0 6px 16px #2a78d64d;
  transition: filter .15s, transform .06s;
}
.as-send:hover { filter: brightness(1.08); }
.as-send:active { transform: translateY(1px); }
.as-send:disabled { opacity: .45; cursor: default; filter: none; }
.as-send svg { width: 17px; height: 17px; }

.as-foot { flex: none; padding: 3px 14px 9px; font-size: 10.5px; color: var(--muted-2); text-align: center; }

/* ---------- Mobil ---------- */
@media (max-width: 640px) {
  .as-fab { right: 14px; bottom: 14px; height: 44px; padding: 0 15px 0 13px; font-size: 13px; }
  .as-panel {
    right: 0; left: 0; bottom: 0; width: 100%;
    height: min(80dvh, 640px); border-radius: 18px 18px 0 0; border-left: 0; border-right: 0; border-bottom: 0;
  }
  body.as-open .as-fab { display: none; }
  .as-stats { grid-template-columns: repeat(2, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  .as-fab svg, .as-think .as-dots i, .as-cur { animation: none !important; }
}
