/* Token limiti dolunca bağlamsal uyarı (Murat Bey, 29.09.2026).
 *
 * shadcn/ui bileşenlerinin (Alert, Tooltip, Badge) bu projedeki karşılığı: uygulama
 * React değil, bu yüzden aynı görünüm ve tw-animate hareketleri düz CSS ile kuruldu.
 * Menüler kilitlenmez; token harcayan eylem uyarının yanında pasifleşir.
 */
:root {
  --tk-bg: #fffbeb;
  --tk-line: #f6dfae;
  --tk-ink: #3f3a2e;
  --tk-strong: #1f1a10;
  --tk-icon: #c2570c;
  --tk-badge-bg: #fff3d6;
  --tk-badge-ink: #8a5100;
  --tk-dot: #f59e0b;
  --tk-tip-bg: #18181b;
  --tk-tip-ink: #fafafa;
  --tk-off-bg: #eceef2;
  --tk-off-ink: #9aa1ad;
  --tk-ease: cubic-bezier(.16, 1, .3, 1);
}
[data-theme="dark"] {
  --tk-bg: rgba(245, 158, 11, .09);
  --tk-line: rgba(245, 158, 11, .30);
  --tk-ink: #e9dcc0;
  --tk-strong: #fef3c7;
  --tk-icon: #fbbf24;
  --tk-badge-bg: rgba(245, 158, 11, .16);
  --tk-badge-ink: #fcd34d;
  --tk-tip-bg: #fafafa;
  --tk-tip-ink: #18181b;
  --tk-off-bg: rgba(255, 255, 255, .06);
  --tk-off-ink: #717784;
}

/* ── Alert (shadcn <Alert>, uyarı tonu) ─────────────────────────────── */
.tk-uyari {
  display: flex; align-items: center; gap: 12px;
  width: 100%; box-sizing: border-box;
  padding: 13px 18px; border: 1px solid var(--tk-line); border-radius: 12px;
  background: var(--tk-bg); color: var(--tk-ink);
  font-size: 14px; line-height: 1.45; letter-spacing: -.005em;
  animation: tk-uyari-gir .42s var(--tk-ease) both;
}
.tk-uyari svg { flex: none; width: 19px; height: 19px; color: var(--tk-icon); }
.tk-uyari svg .tk-halka { transform-origin: 12px 12px; animation: tk-halka 1.8s var(--tk-ease) .35s 2 both; }
.tk-uyari strong { color: var(--tk-strong); font-weight: 700; }
.tk-uyari.titret { animation: tk-titret .38s cubic-bezier(.36, .07, .19, .97) both; }
.tk-uyari.tk-sayfa { margin: 0 0 18px; }

/* Prompt kutusunun içinde, üst kenara oturan sürüm: genişliği kutuyla aynıdır.
   Kenar payı JS'te kutunun iç boşluğundan hesaplanır (tokenKilidiUygula). */
.tk-uyari.tk-ek {
  width: auto; border: 0; border-bottom: 1px solid var(--tk-line);
  border-radius: inherit; border-bottom-left-radius: 0; border-bottom-right-radius: 0;
  padding: 12px 20px; animation-name: tk-ek-gir;
}
@keyframes tk-ek-gir { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@media (max-width: 760px) {
  .tk-uyari.tk-ek { padding: 11px 16px; font-size: 13px; }
}

/* ── Kilitli besteci ───────────────────────────────────────────────── */
.agentic-shell .ag-composer.tk-kilitli,
.agentic-shell .ag-composer.tk-kilitli:focus-within {
  background: color-mix(in oklab, var(--tk-off-bg) 55%, var(--bg-elevated, #fff));
  border-color: var(--tk-line); box-shadow: none;
}
.ag-composer.tk-kilitli #msg-input { cursor: not-allowed; color: var(--tk-off-ink); }
.ag-composer.tk-kilitli #msg-input::placeholder { color: var(--tk-off-ink); }
.ag-composer.tk-kilitli :is(#ag-attach, #chat-send, .prompt-mic) {
  opacity: .45; cursor: not-allowed; pointer-events: none; filter: saturate(.3);
}
.agentic-shell .ag-composer.tk-kilitli #chat-send { background: var(--tk-off-bg); color: var(--tk-off-ink); box-shadow: none; }

/* Öneri kartlarının hepsi pasif (Murat Bey, 30.09.2026: "Masraflarımı incele" de). */
body.token-kilitli .ag-suggestions button {
  pointer-events: none;
  opacity: .42; cursor: not-allowed; filter: saturate(.2); transition: opacity .3s var(--tk-ease);
}

/* ── Pasif düğme + Tooltip (shadcn <Tooltip>) ──────────────────────── */
.tk-kapali,
.agentic-shell .automation-agent-actions .ajan-calistir.tk-kapali {
  background: var(--tk-off-bg) !important; border-color: transparent !important;
  color: var(--tk-off-ink) !important; box-shadow: none !important; cursor: not-allowed;
}
.tk-ipucu { position: relative; display: inline-flex; }
.tk-ipucu::after, .tk-ipucu::before {
  position: absolute; left: 50%; pointer-events: none; opacity: 0; z-index: 60;
}
.tk-ipucu::after {
  content: attr(data-ipucu); bottom: calc(100% + 8px);
  transform: translate(-50%, 4px) scale(.95); transform-origin: 50% 100%;
  padding: 7px 12px; border-radius: 8px; white-space: nowrap;
  background: var(--tk-tip-bg); color: var(--tk-tip-ink);
  font: 500 13px/1.3 var(--font, system-ui); letter-spacing: -.005em;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
}
.tk-ipucu::before {
  content: ""; bottom: calc(100% + 3px); width: 10px; height: 10px; margin-left: -5px;
  background: var(--tk-tip-bg); transform: rotate(45deg) scale(.6); border-radius: 2px;
}
.tk-ipucu:is(:hover, :focus-within)::after {
  opacity: 1; transform: translate(-50%, 0) scale(1);
  transition: opacity .15s ease .12s, transform .2s var(--tk-ease) .12s;
}
.tk-ipucu:is(:hover, :focus-within)::before {
  opacity: 1; transform: rotate(45deg) scale(1);
  transition: opacity .15s ease .12s, transform .2s var(--tk-ease) .12s;
}

/* ── Badge (shadcn <Badge>) — görev satırı ─────────────────────────── */
.tk-rozet {
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  padding: 6px 14px; border-radius: 999px;
  background: var(--tk-badge-bg); color: var(--tk-badge-ink);
  font-size: 13px; font-weight: 600; line-height: 1.2;
  animation: tk-uyari-gir .4s var(--tk-ease) both;
}
.tk-rozet i { position: relative; width: 7px; height: 7px; border-radius: 50%; background: var(--tk-dot); }
.tk-rozet i::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--tk-dot);
  animation: tk-nabiz 2s var(--tk-ease) infinite;
}
.tk-atlanacak { color: var(--tk-icon); }

@keyframes tk-uyari-gir {
  from { opacity: 0; transform: translateY(-6px) scale(.985); filter: blur(2px); }
  to { opacity: 1; transform: none; filter: none; }
}
@keyframes tk-halka {
  0% { transform: scale(1); }
  30% { transform: scale(1.18); }
  60%, 100% { transform: scale(1); }
}
@keyframes tk-titret {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(3px); }
  30%, 50%, 70% { transform: translateX(-5px); }
  40%, 60% { transform: translateX(5px); }
}
@keyframes tk-nabiz {
  0% { transform: scale(1); opacity: .7; }
  70%, 100% { transform: scale(2.6); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .tk-uyari, .tk-uyari.titret, .tk-rozet, .tk-uyari svg .tk-halka, .tk-rozet i::after { animation: none; }
  .tk-ipucu::after, .tk-ipucu::before { transition: none !important; }
}

/* Görünür uyarı olmayan yüzeyde (asistan çekmecesi) kısa süreli yüzen uyarı. */
.tk-uyari.tk-yuzen {
  position: fixed; left: 50%; bottom: 24px; z-index: 9999; width: min(560px, calc(100vw - 32px));
  transform: translateX(-50%); box-shadow: 0 12px 32px rgba(0, 0, 0, .14);
  animation: tk-yuzen-gir .42s var(--tk-ease) both;
}
@keyframes tk-yuzen-gir {
  from { opacity: 0; transform: translate(-50%, 10px) scale(.98); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
