/* ============================================================
   AI Asistan (ADR-0022) — sistem-geneli sohbet cekmecesi.
   macOS Siri yan-paneli hissi: notr chrome icinde aurora kimligi.
   Sag kenardan overlay; masaustu + pencerelerin ustune gelir.
   Token'lar degiskenler.css'ten — dark mode otomatik.
   ============================================================ */

:root {
  --asis-indigo: #5B6CF0;
  --asis-mor: #8B5CF6;
  --asis-teal: #37C6D0;
  --asis-aurora: linear-gradient(112deg, #5B6CF0 0%, #8B5CF6 54%, #37C6D0 120%);
  --asis-launcher: linear-gradient(150deg, #A855F7 0%, #7C3AED 100%);
  --asis-genislik: 400px;
  --asis-mor-yumusak: rgba(139, 92, 246, 0.10);
  --asis-mor-cizgi: rgba(139, 92, 246, 0.22);
  /* Sistem overlay: pencere (1000) ustunde; toast (3000) altinda kalir ki hatalar gorunur */
  --asis-z-fab: 2400;
  --asis-z-perde: 2450;
  --asis-z-panel: 2500;
}

/* ---- Launcher (yuzen FAB + parlayan halo) ---- */
.asis-fab {
  position: fixed; right: 26px; bottom: 26px; z-index: var(--asis-z-fab);
  width: 48px; height: 48px; border-radius: 50%;
  border: none; cursor: pointer; color: #fff;
  background: var(--asis-launcher);
  box-shadow: 0 8px 22px rgba(124, 58, 237, 0.5), inset 0 1px 1px rgba(255, 255, 255, 0.4);
  display: flex; align-items: center; justify-content: center; font-size: 20px;
  /* macOS estetigi: yaylanmali (overshoot) buyume + maksimize gecisinde yumusak yukselme */
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), bottom 0.24s ease;
}
/* Tam-ekran pencere action-bar'lari (Kaydet/Olustur) sag-alt kosede FAB ile cakisiyordu;
   maksimize pencere VARKEN FAB'i butonlarin ustune al (masaustunde kosede kalir). */
body:has(.p360-pencere.tam-ekran) .asis-fab { bottom: 84px; }
.asis-fab::before {
  content: ""; position: absolute; inset: -12px; border-radius: 50%; z-index: -1;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.6), transparent 68%);
  filter: blur(9px); animation: asisHalo 3.6s ease-in-out infinite;
}
@keyframes asisHalo { 0%, 100% { transform: scale(1); opacity: 0.65; } 50% { transform: scale(1.2); opacity: 1; } }
.asis-fab:hover { transform: translateY(-3px) scale(1.2); }
.asis-fab:active { transform: scale(1.05); }
.asis-fab .asis-pip {
  position: absolute; top: 0; right: 0; width: 13px; height: 13px; border-radius: 50%;
  background: var(--green); border: 2px solid #fff;
}
.asis-fab.gizli { opacity: 0; pointer-events: none; transform: scale(0.6); }
@media (prefers-reduced-motion: reduce) { .asis-fab::before { animation: none; } }

.asis-ipucu {
  position: fixed; right: 94px; bottom: 40px; z-index: var(--asis-z-fab);
  background: var(--surface); color: var(--text); font-size: 12px; font-weight: 500;
  padding: 7px 11px; border-radius: var(--koselik-md); white-space: nowrap;
  box-shadow: var(--golge-durgun); border: 1px solid var(--border-soft);
  opacity: 0; transform: translateX(6px); pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
}
.asis-fab:hover + .asis-ipucu { opacity: 1; transform: translateX(0); }
.asis-ipucu kbd { font-family: var(--font-mono); background: var(--gray-surface); padding: 1px 5px; border-radius: 4px; }

/* ---- Perde (cok hafif scrim; arkadaki icerik gorunur kalir) ---- */
.asis-perde {
  position: fixed; inset: 0; z-index: var(--asis-z-perde); background: rgba(15, 20, 35, 0.10);
  opacity: 0; pointer-events: none; transition: opacity 0.25s ease;
}
.asis-perde.acik { opacity: 1; pointer-events: auto; }

/* ---- Drawer ---- */
.asis-panel {
  position: fixed; top: 0; right: 0; z-index: var(--asis-z-panel);
  width: var(--asis-genislik); max-width: 92vw; height: 100vh;
  background: var(--surface); box-shadow: -18px 0 48px rgba(0, 0, 0, 0.2);
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform 0.34s cubic-bezier(0.32, 0.72, 0, 1);
}
.asis-panel.acik { transform: translateX(0); }

/* ---- Header (aurora, iki satir) ---- */
.asis-head {
  background: var(--asis-aurora); background-size: 150% 150%; animation: asisKay 14s ease infinite;
  color: #fff; padding: var(--bosluk-3) var(--bosluk-4);
  display: flex; flex-direction: column; gap: var(--bosluk-3);
}
@keyframes asisKay { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
@media (prefers-reduced-motion: reduce) { .asis-head { animation: none; } }
.asis-head-ust { display: flex; align-items: center; gap: var(--bosluk-2); }
.asis-head-alt { display: flex; align-items: center; justify-content: space-between; gap: var(--bosluk-2); }
.asis-logo {
  width: 38px; height: 38px; border-radius: var(--koselik-lg); flex-shrink: 0;
  background: rgba(255, 255, 255, 0.2); display: flex; align-items: center; justify-content: center; font-size: 20px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}
.asis-head .baslik { flex: 1; min-width: 0; }
.asis-head .baslik .ad { font-size: 15.5px; font-weight: 600; letter-spacing: -0.2px; }
.asis-head .baslik .durum { font-size: 11.5px; opacity: 0.92; display: flex; align-items: center; gap: 5px; margin-top: 1px; }
.asis-head .baslik .durum .nok { width: 7px; height: 7px; border-radius: 50%; background: #4ADE80; box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.3); }
.asis-kapat {
  width: 30px; height: 30px; border-radius: var(--koselik-md); border: none; cursor: pointer;
  background: rgba(255, 255, 255, 0.16); color: #fff; font-size: 14px;
  display: flex; align-items: center; justify-content: center; transition: background 0.15s ease; flex-shrink: 0;
}
.asis-kapat:hover { background: rgba(255, 255, 255, 0.3); }

/* Derin Dusun pill (header icinde) */
.asis-derin {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none;
  background: rgba(255, 255, 255, 0.16); padding: 6px 13px 6px 7px; border-radius: var(--koselik-pill);
  font-size: 12.5px; font-weight: 500; transition: background 0.15s ease;
}
.asis-derin:hover { background: rgba(255, 255, 255, 0.24); }
.asis-derin i { font-size: 13px; opacity: 0.92; }
.asis-sw { position: relative; width: 34px; height: 20px; border-radius: 999px; background: rgba(255, 255, 255, 0.35); transition: background 0.18s ease; flex-shrink: 0; }
.asis-sw .knob { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); transition: left 0.18s ease; }
.asis-sw.acik { background: rgba(255, 255, 255, 0.92); }
.asis-sw.acik .knob { left: 16px; background: var(--asis-mor); }

.asis-yeni {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; color: #fff;
  background: rgba(255, 255, 255, 0.14); border: 1px solid rgba(255, 255, 255, 0.32);
  padding: 6px 13px; border-radius: var(--koselik-pill); font-size: 12.5px; font-weight: 500; transition: background 0.15s ease;
}
.asis-yeni:hover { background: rgba(255, 255, 255, 0.26); }

/* ---- Mesaj alani ---- */
.asis-govde { flex: 1; overflow-y: auto; padding: var(--bosluk-4); display: flex; flex-direction: column; gap: var(--bosluk-3); background: linear-gradient(180deg, var(--surface) 60%, var(--gray-surface)); }
.asis-govde::-webkit-scrollbar { width: 8px; }
.asis-govde::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.14); border-radius: 8px; }

.asis-satir { display: flex; gap: var(--bosluk-2); max-width: 100%; }
.asis-satir.kul { justify-content: flex-end; }
.asis-av { width: 30px; height: 30px; border-radius: var(--koselik-md); flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 14px; background: var(--asis-aurora); color: #fff; box-shadow: 0 2px 6px rgba(124, 58, 237, 0.3); }
.asis-icerik { display: flex; flex-direction: column; min-width: 0; max-width: 88%; }
.asis-balon-kul { padding: 10px 14px; border-radius: var(--koselik-xl); border-top-right-radius: var(--koselik-xs); background: var(--mac-blue); color: #fff; font-size: 13.5px; line-height: 1.5; max-width: 82%; white-space: pre-wrap; word-break: break-word; }

/* Arac-cagri cipi */
.asis-arac-cip {
  display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; margin-bottom: 8px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--koselik-pill);
  padding: 5px 11px 5px 6px; font-size: 12px; color: var(--text); box-shadow: var(--golge-durgun);
}
.asis-arac-cip .ikon { width: 20px; height: 20px; border-radius: 50%; background: var(--asis-aurora); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 10px; flex-shrink: 0; }
.asis-arac-cip .check { color: var(--green); font-size: 13px; }
.asis-arac-cip .spin { animation: asisDon 1s linear infinite; }
@keyframes asisDon { to { transform: rotate(360deg); } }

/* Cevap karti */
.asis-kart { background: var(--surface); border: 1px solid var(--border); border-radius: var(--koselik-xl); padding: var(--bosluk-3); font-size: 13.5px; line-height: 1.55; color: var(--text); box-shadow: var(--golge-durgun); word-break: break-word; }
.asis-kart p { margin: 0 0 9px; }
.asis-kart p:last-child { margin-bottom: 0; }
.asis-kart b { font-weight: 600; }
.asis-kart code { font-family: var(--font-mono); font-size: 11.5px; background: var(--gray-surface); padding: 1px 5px; border-radius: 4px; }
.asis-liste { list-style: none; padding: 0; margin: 9px 0; display: flex; flex-direction: column; gap: 7px; }
.asis-liste li { position: relative; padding-left: 18px; font-size: 13px; line-height: 1.5; }
.asis-liste li::before { content: ""; position: absolute; left: 0; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--asis-mor); }
.asis-liste.ol { counter-reset: asis-say; }
.asis-liste.ol li { counter-increment: asis-say; }
.asis-liste.ol li::before { content: counter(asis-say) "."; top: 0; left: 0; width: auto; height: auto; border-radius: 0; background: none; color: var(--asis-mor); font-weight: 600; font-size: 12px; }

/* Kaynak satiri */
.asis-kaynak { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-top: 9px; padding-left: 2px; font-size: 11px; color: var(--muted); }
.asis-kaynak .lbl { display: inline-flex; align-items: center; gap: 4px; }
.asis-kaynak .lbl i { color: var(--asis-teal); font-size: 13px; }
.asis-kaynak .src { color: var(--asis-mor); background: var(--asis-mor-yumusak); border: 1px solid var(--asis-mor-cizgi); padding: 2px 9px; border-radius: var(--koselik-pill); }

/* Deterministik yapisal veri karti — liste/sayilar araç verisinden BIREBIR (ADR-0022 Karar 11) */
.asis-veri-kart { margin-top: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--koselik-xl); overflow: hidden; box-shadow: var(--golge-durgun); }
.asis-veri-bas { display: flex; align-items: center; gap: 7px; padding: 9px 12px; background: var(--gray-surface); border-bottom: 1px solid var(--border-soft); font-size: 12.5px; font-weight: 600; color: var(--text); }
.asis-veri-bas i { color: var(--orange); }
.asis-dagilim { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--border-soft); }
.asis-dcip { font-size: 11.5px; color: var(--text); background: var(--gray-surface); border: 1px solid var(--border-soft); padding: 3px 9px; border-radius: var(--koselik-pill); }
.asis-dcip b { color: var(--asis-mor); }
.asis-veri-liste { list-style: none; margin: 0; padding: 6px 0; }
.asis-veri-liste li { display: flex; align-items: flex-start; gap: 9px; padding: 8px 12px; font-size: 13px; line-height: 1.4; }
.asis-veri-liste li + li { border-top: 1px solid var(--border-soft); }
.asis-voncelik { flex-shrink: 0; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; padding: 2px 7px; border-radius: var(--koselik-pill); margin-top: 1px; }
.asis-voncelik.o3 { background: var(--red-bg); color: var(--red-dark); }
.asis-voncelik.o2 { background: var(--orange-bg); color: var(--orange-dark); }
.asis-voncelik.o1 { background: var(--gray-surface); color: var(--muted); }
.asis-voncelik.og { background: var(--green-bg); color: var(--green-dark); }
.asis-voncelik.ob { background: rgba(0, 122, 255, 0.14); color: var(--mac-blue); }
.asis-voncelik.om { background: var(--purple-bg); color: var(--purple-dark); }
.asis-vmetin { min-width: 0; }
.asis-vbirim { font-size: 11px; color: var(--muted); margin-top: 2px; }
.asis-vgecti { color: var(--red-dark); font-weight: 600; }
.asis-veri-not { padding: 7px 12px; font-size: 11px; color: var(--muted); border-top: 1px solid var(--border-soft); background: var(--gray-surface); }
/* Katlanır liste: ilk N görünür, kalanı "daha gör" ile açılır.
   Özgüllük notu: ".asis-veri-liste li" (0,1,1) gizleme kuralını ezmesin diye seçici
   li'yi de içerir (0,1,2) — açık halde de aynı özgüllükte geri gösterilir (0,2,2). */
.asis-veri-liste li.asis-vgizli { display: none; }
.asis-veri-kart.acik .asis-veri-liste li.asis-vgizli { display: flex; }
.asis-veri-gost { display: block; width: 100%; border: none; border-top: 1px solid var(--border-soft); background: var(--gray-surface); color: var(--asis-mor); font-size: 12px; font-weight: 500; padding: 8px; cursor: pointer; }
.asis-veri-gost:hover { background: var(--asis-mor-yumusak); }

/* Typing */
.asis-yaziyor { display: inline-flex; gap: 4px; padding: 11px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--koselik-xl); box-shadow: var(--golge-durgun); align-self: flex-start; }
.asis-yaziyor span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: asisZipla 1.2s ease-in-out infinite; }
.asis-yaziyor span:nth-child(2) { animation-delay: 0.18s; }
.asis-yaziyor span:nth-child(3) { animation-delay: 0.36s; }
@keyframes asisZipla { 0%, 60%, 100% { transform: translateY(0); opacity: 0.4; } 30% { transform: translateY(-5px); opacity: 1; } }

/* Bos durum + oneri kartlari */
.asis-bos { text-align: center; padding: var(--bosluk-5) var(--bosluk-1) var(--bosluk-3); }
.asis-bos .amblem { width: 72px; height: 72px; border-radius: var(--koselik-2xl); background: var(--asis-aurora); color: #fff; font-size: 34px; display: flex; align-items: center; justify-content: center; margin: 0 auto var(--bosluk-3); box-shadow: 0 12px 30px rgba(124, 58, 237, 0.35); }
.asis-bos h3 { font-size: 17px; font-weight: 600; letter-spacing: -0.2px; margin: 0 0 6px; }
.asis-bos p { font-size: 12.5px; color: var(--muted); margin: 0 auto var(--bosluk-4); max-width: 290px; line-height: 1.5; }
.asis-kartlar { display: flex; flex-direction: column; gap: var(--bosluk-2); text-align: left; }
.asis-oneri-kart { display: flex; align-items: center; gap: var(--bosluk-3); background: var(--surface); border: 1px solid var(--border); border-radius: var(--koselik-lg); padding: var(--bosluk-3); cursor: pointer; box-shadow: var(--golge-durgun); transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease; }
.asis-oneri-kart:hover { border-color: var(--asis-mor-cizgi); box-shadow: 0 6px 18px rgba(124, 58, 237, 0.12); transform: translateY(-1px); }
.asis-oneri-kart .ikon { width: 38px; height: 38px; border-radius: var(--koselik-md); background: var(--asis-mor-yumusak); color: var(--asis-mor); display: flex; align-items: center; justify-content: center; font-size: 17px; flex-shrink: 0; }
.asis-oneri-kart .yazi .bas { font-size: 13.5px; font-weight: 600; color: var(--text); }
.asis-oneri-kart .yazi .alt { font-size: 11.5px; color: var(--muted); margin-top: 1px; }

/* Input + imza */
.asis-alt { border-top: 1px solid var(--border); padding: var(--bosluk-3) var(--bosluk-4) var(--bosluk-2); background: var(--surface); }
.asis-giris { display: flex; align-items: flex-end; gap: var(--bosluk-2); background: var(--gray-surface); border: 1px solid var(--border); border-radius: var(--koselik-xl); padding: 6px 6px 6px 14px; transition: box-shadow 0.15s ease, border-color 0.15s ease; }
.asis-giris:focus-within { border-color: var(--asis-mor); box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15); }
.asis-giris textarea { flex: 1; border: none; background: none; resize: none; outline: none; font-family: var(--font); font-size: 13.5px; line-height: 1.45; color: var(--text); max-height: 120px; padding: 5px 0; }
.asis-gonder { width: 34px; height: 34px; border-radius: var(--koselik-lg); border: none; cursor: pointer; flex-shrink: 0; background: var(--asis-launcher); color: #fff; font-size: 15px; display: flex; align-items: center; justify-content: center; transition: transform 0.12s ease, opacity 0.15s ease; }
.asis-gonder:hover { transform: scale(1.06); }
.asis-gonder:disabled { opacity: 0.4; cursor: default; transform: none; }
.asis-imza { text-align: center; font-size: 11px; color: var(--muted); margin-top: 9px; display: flex; align-items: center; justify-content: center; gap: 5px; }
.asis-imza i { color: var(--green); font-size: 12px; }

/* ============================================================
   DERİN DÜŞÜN MODU — kozmik/uzay teması. Toggle açılınca panel
   "derin düşüneceğini" belli eden agresif bir kimliğe bürünür.
   ============================================================ */
.asis-panel.derin { box-shadow: -18px 0 48px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(139, 92, 246, 0.5), 0 0 60px rgba(124, 58, 237, 0.32); }

/* Header: derin uzay nebulası + kayan yıldız alanı */
.asis-panel.derin .asis-head {
  background: linear-gradient(120deg, #1E1B4B 0%, #3B0764 46%, #0E7490 122%);
  background-size: 220% 220%; animation: asisKay 8s ease infinite;
  position: relative; overflow: hidden;
}
.asis-panel.derin .asis-head-ust, .asis-panel.derin .asis-head-alt { position: relative; z-index: 1; }
.asis-panel.derin .asis-head::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    radial-gradient(1.5px 1.5px at 18% 28%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 68% 62%, rgba(255, 255, 255, 0.85), transparent),
    radial-gradient(1px 1px at 42% 82%, #fff, transparent),
    radial-gradient(1px 1px at 86% 22%, rgba(255, 255, 255, 0.7), transparent),
    radial-gradient(1.5px 1.5px at 54% 14%, #fff, transparent),
    radial-gradient(1px 1px at 28% 58%, rgba(255, 255, 255, 0.6), transparent),
    radial-gradient(1px 1px at 78% 78%, rgba(255, 255, 255, 0.75), transparent);
  animation: asisYildiz 3s ease-in-out infinite;
}
@keyframes asisYildiz { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }

/* Derin pill: ampul yanar + parlama */
.asis-panel.derin .asis-derin { background: rgba(255, 255, 255, 0.22); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.4), 0 0 16px rgba(139, 92, 246, 0.6); }
.asis-panel.derin .asis-derin i { color: #FDE047; opacity: 1; text-shadow: 0 0 8px rgba(253, 224, 71, 0.7); }

/* AI avatar + gönder butonu: kozmik hale */
.asis-panel.derin .asis-av { box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.35), 0 0 14px rgba(124, 58, 237, 0.5); }
.asis-panel.derin .asis-giris:focus-within { border-color: #7C3AED; box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.28); }

/* Yörüngeli "derin düşünüyor" yükleyici (normal 3-nokta yerine) */
.asis-dusunuyor { display: inline-flex; align-items: center; gap: 11px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--asis-mor-cizgi); border-radius: var(--koselik-xl); box-shadow: 0 0 18px rgba(124, 58, 237, 0.25); align-self: flex-start; }
.asis-dusunuyor .metin { font-size: 12.5px; color: var(--asis-mor); font-weight: 500; }
.asis-dusunuyor .orbit { position: relative; width: 22px; height: 22px; flex-shrink: 0; }
.asis-dusunuyor .orbit::before, .asis-dusunuyor .orbit::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 1px solid rgba(124, 58, 237, 0.35); }
.asis-dusunuyor .orbit::after { transform: rotate(60deg); border-color: rgba(55, 198, 208, 0.4); }
.asis-dusunuyor .cekirdek { position: absolute; top: 50%; left: 50%; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: var(--asis-aurora); box-shadow: 0 0 8px rgba(124, 58, 237, 0.8); animation: asisNabiz 1.4s ease-in-out infinite; }
.asis-dusunuyor .parcacik { position: absolute; top: -1px; left: 50%; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: #7C3AED; box-shadow: 0 0 6px #7C3AED; transform-origin: 2px 12px; animation: asisYorunge 1.1s linear infinite; }
@keyframes asisYorunge { to { transform: rotate(360deg); } }
@keyframes asisNabiz { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.4); opacity: 0.7; } }

@media (prefers-reduced-motion: reduce) {
  .asis-panel.derin .asis-head, .asis-panel.derin .asis-head::before, .asis-dusunuyor .cekirdek, .asis-dusunuyor .parcacik { animation: none; }
}

@media (max-width: 520px) { .asis-panel { width: 100vw; max-width: 100vw; } }
