/*
 * Uygulamaya ait küçük stil katmanı — tema (metronic/css/styles.css) ELLE derlendiği için ona sınıf eklenemiyor
 * (bkz. hafıza: project_theme_css_compiled). Yalnız temada OLMAYAN, proje genelinde gereken yardımcılar buraya.
 * Layout'larda styles.css'ten SONRA yüklenir.
 */

/* "İçeriğe geç": yalnız klavyeyle odaklanınca görünür (menüyü atlamak için ilk Tab durağı) */
.skip-link {
  position: absolute;
  inset-inline-start: 12px;
  top: -60px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--primary, #1b84ff);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  transition: top .15s ease;
}
.skip-link:focus { top: 12px; outline: 2px solid #fff; outline-offset: 2px; }
#content:focus { outline: none; }

/* Klavye odağı her etkileşimli öğede GÖRÜNÜR olsun (temanın bazı bileşenleri odağı tamamen siliyor) */
a:focus-visible, button:focus-visible, [role="button"]:focus-visible, summary:focus-visible {
  outline: 2px solid var(--primary, #1b84ff);
  outline-offset: 2px;
}

/* Tablo içi metin bağlantıları (Düzenle / Detay / Görüntüle): dokunmatikte en az 24×24 hedef (WCAG 2.5.8).
   Görsel düzen değişmez; tıklanabilir alan dikeyde büyür. */
.kt-table td a:not(.kt-btn), .kt-table td button:not(.kt-btn) {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  min-width: 24px;
}

/* Alt bilgi ve sayfa yolu (breadcrumb) bağlantıları: metin 20px satırda — dokunma alanı 24px'e çıkar (WCAG 2.5.8) */
.kt-footer a:not(.kt-badge), .app-breadcrumb a {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
}

/* Ekranda görünmez, ekran okuyucu okur (ikon-yalnız bağlantı/düğmelerin metni, ek açıklamalar) */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ===================== AI Asistan (personel tam sayfa + bayi sağ alt pencere) =====================
   Tema CSS'i elle derlendiğinden asistan arayüzü kendi sınıflarını taşır; renkler tema değişkenlerinden
   (açık/koyu tema otomatik). */
.ai-chat { display: flex; flex-direction: column; min-height: 0; height: 100%; }
.ai-log { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.ai-msg { max-width: 85%; padding: 10px 14px; border-radius: 14px; font-size: 14px; line-height: 1.55; overflow-wrap: anywhere; }
.ai-msg-user { align-self: flex-end; background: var(--primary); color: var(--primary-foreground); border-bottom-right-radius: 4px; white-space: pre-wrap; }
.ai-msg-assistant { align-self: flex-start; background: var(--muted); color: var(--foreground); border-bottom-left-radius: 4px; }
.ai-msg-assistant p { margin: 0 0 8px; } .ai-msg-assistant p:last-child { margin-bottom: 0; }
.ai-msg-assistant ul, .ai-msg-assistant ol { margin: 4px 0 8px; padding-inline-start: 20px; }
.ai-msg-assistant ul { list-style: disc; } .ai-msg-assistant ol { list-style: decimal; }
.ai-msg-assistant a { color: var(--primary); text-decoration: underline; }
.ai-msg-assistant code { font-size: 12px; padding: 1px 4px; border-radius: 4px; background: var(--background); }
.ai-msg-assistant table { border-collapse: collapse; margin: 6px 0; font-size: 13px; display: block; overflow-x: auto; }
.ai-msg-assistant th, .ai-msg-assistant td { border: 1px solid var(--border); padding: 4px 8px; text-align: start; white-space: nowrap; }
.ai-msg-error { align-self: stretch; max-width: none; background: transparent; border: 1px solid var(--destructive); color: var(--destructive); }
.ai-card { align-self: flex-start; width: min(100%, 420px); border: 1px solid var(--border); border-radius: 12px; background: var(--card, var(--background)); padding: 12px 14px; font-size: 13px; }
.ai-card-title { font-weight: 600; font-size: 14px; margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.ai-card ul { margin: 0 0 10px; padding-inline-start: 18px; list-style: disc; color: var(--secondary-foreground); }
.ai-card-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ai-card-img { width: 96px; height: 96px; object-fit: contain; border: 1px solid var(--border); border-radius: 8px; margin: 2px 0 10px; background: #fff; }
.ai-attachments { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 10px 0; }
.ai-attachments[hidden] { display: none; }
.ai-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 240px; border: 1px solid var(--border); border-radius: 999px; padding: 3px 4px 3px 8px; font-size: 12px; background: var(--muted); }
.ai-chip img { width: 20px; height: 20px; object-fit: cover; border-radius: 4px; }
.ai-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-chip button { min-width: 24px; min-height: 24px; border-radius: 999px; color: var(--muted-foreground); }
.ai-chip button:hover { background: var(--background); color: var(--foreground); }
.ai-card-status { font-size: 12px; font-weight: 600; }
.ai-card-status.ok { color: var(--success); } .ai-card-status.bad { color: var(--destructive); } .ai-card-status.muted { color: var(--muted-foreground); }
.ai-typing { align-self: flex-start; color: var(--muted-foreground); font-size: 13px; padding: 4px 2px; }
.ai-typing span { display: inline-block; width: 6px; height: 6px; margin-inline-end: 3px; border-radius: 50%; background: currentColor; animation: ai-blink 1.2s infinite both; }
.ai-typing span:nth-child(2) { animation-delay: .2s; } .ai-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes ai-blink { 0%, 80%, 100% { opacity: .2; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .ai-typing span { animation: none; opacity: .6; } }
.ai-input { border-top: 1px solid var(--border); padding: 10px; display: flex; gap: 8px; align-items: flex-end; }
.ai-input textarea { flex: 1; resize: none; min-height: 40px; max-height: 160px; border: 1px solid var(--input); border-radius: 10px; padding: 9px 12px; font-size: 14px; background: var(--background); color: var(--foreground); }
.ai-input textarea:focus { outline: 2px solid var(--ring); outline-offset: 0; }
.ai-note { font-size: 11px; color: var(--muted-foreground); padding: 0 12px 8px; }
.ai-empty { margin: auto; text-align: center; color: var(--muted-foreground); font-size: 14px; max-width: 360px; }
.ai-suggest { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 12px; }
.ai-suggest button { border: 1px solid var(--border); border-radius: 999px; padding: 5px 12px; font-size: 12px; color: var(--foreground); background: var(--background); min-height: 28px; }
.ai-suggest button:hover { border-color: var(--primary); color: var(--primary); }
.ai-readonly-bar { padding: 8px 16px; font-size: 12px; background: var(--muted); color: var(--secondary-foreground); border-bottom: 1px solid var(--border); }
/* Sohbet listesi (tam sayfa sol sütun) */
.ai-conv { display: flex; align-items: center; gap: 4px; border-radius: 8px; }
.ai-conv:hover, .ai-conv.active { background: var(--muted); }
.ai-conv > a { flex: 1; min-width: 0; padding: 8px 10px; font-size: 13px; color: var(--foreground); display: block; }
.ai-conv > a span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-conv > a small { display: block; color: var(--muted-foreground); font-size: 11px; }
.ai-conv button { visibility: hidden; min-width: 28px; min-height: 28px; border-radius: 6px; color: var(--muted-foreground); }
.ai-conv:hover button, .ai-conv.active button, .ai-conv button:focus-visible { visibility: visible; }
.ai-conv button:hover { color: var(--foreground); background: var(--background); }
/* Bayi sağ alt penceresi */
.ai-fab { position: fixed; inset-inline-end: 20px; bottom: 20px; z-index: 40; width: 56px; height: 56px; border-radius: 50%; background: var(--primary); color: var(--primary-foreground); box-shadow: 0 6px 20px rgba(0,0,0,.18); display: flex; align-items: center; justify-content: center; font-size: 24px; }
.ai-fab:hover { filter: brightness(1.08); }
.ai-panel { position: fixed; inset-inline-end: 20px; bottom: 88px; z-index: 41; width: 380px; height: min(600px, calc(100vh - 120px)); background: var(--background); border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 12px 40px rgba(0,0,0,.2); display: flex; flex-direction: column; overflow: hidden; }
.ai-panel[hidden] { display: none; }
.ai-panel-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border); font-weight: 600; font-size: 14px; }
.ai-panel-head button { min-width: 32px; min-height: 32px; border-radius: 8px; color: var(--muted-foreground); }
.ai-panel-head button:hover { background: var(--muted); color: var(--foreground); }
@media (max-width: 640px) {
  .ai-panel { inset: 0; width: auto; height: auto; border-radius: 0; bottom: 0; }
  .ai-fab { bottom: 16px; inset-inline-end: 16px; }
}
/* Personel tam sayfa: sol sohbet listesi + sağ sohbet; dar ekranda liste düğmeyle açılır */
.ai-page { display: grid; grid-template-columns: 280px minmax(0, 1fr); height: calc(100vh - 190px); min-height: 520px; }
.ai-side { display: flex; flex-direction: column; min-height: 0; border-inline-end: 1px solid var(--border); padding: 12px; gap: 10px; }
.ai-side-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.ai-side-toggle { display: none; }
@media (max-width: 1023px) {
  .ai-page { grid-template-columns: minmax(0, 1fr); height: calc(100vh - 150px); }
  .ai-side { display: none; border-inline-end: 0; border-bottom: 1px solid var(--border); max-height: 50vh; }
  .ai-page.show-side .ai-side { display: flex; }
  .ai-side-toggle { display: inline-flex; }
}
