/* ═══════════════════════════════════════
   ArtemisTech AI CHAT WIDGET
═══════════════════════════════════════ */

/* ── FAB Butonu ── */
#ai-fab {
  position: fixed;
  bottom: 28px;
  left: 28px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(99,102,241,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  transition: transform .25s cubic-bezier(.34,1.56,.64,1), box-shadow .25s ease;
  animation: ai-pulse 3s ease-in-out infinite;
}
#ai-fab:hover {
  transform: scale(1.12);
  box-shadow: 0 10px 36px rgba(99,102,241,.6);
  animation: none;
}
#ai-fab svg { width: 26px; height: 26px; fill: #fff; }

@keyframes ai-pulse {
  0%, 100% { box-shadow: 0 6px 24px rgba(99,102,241,.45); }
  50%       { box-shadow: 0 6px 36px rgba(99,102,241,.7); }
}

/* Bildirim noktası */
#ai-fab-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 10px;
  height: 10px;
  background: #ef4444;
  border-radius: 50%;
  border: 2px solid #fff;
  display: none;
}
#ai-fab-dot.visible { display: block; }

/* ── Chat Penceresi ── */
#ai-chat-window {
  position: fixed;
  bottom: 100px;
  left: 28px;
  width: 370px;
  height: 540px;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,.18), 0 4px 20px rgba(99,102,241,.15);
  display: flex;
  flex-direction: column;
  z-index: 9001;
  overflow: hidden;
  transform-origin: bottom left;
  transform: scale(.85) translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: transform .28s cubic-bezier(.34,1.2,.64,1), opacity .22s ease;
}
#ai-chat-window.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* ── Header ── */
#ai-chat-header {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 60%, #a78bfa 100%);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.ai-header-avatar {
  width: 42px;
  height: 42px;
  background: rgba(255,255,255,.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ai-header-avatar svg { width: 22px; height: 22px; fill: #fff; }
.ai-header-info { flex: 1; min-width: 0; }
.ai-header-name {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ai-header-status {
  font-size: 12px;
  color: rgba(255,255,255,.8);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}
.ai-status-dot {
  width: 7px;
  height: 7px;
  background: #4ade80;
  border-radius: 50%;
  animation: blink 2.5s ease-in-out infinite;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.4} }

.ai-header-btns {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.ai-hdr-btn {
  width: 32px;
  height: 32px;
  background: rgba(255,255,255,.15);
  border: none;
  border-radius: 8px;
  color: rgba(255,255,255,.9);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}
.ai-hdr-btn:hover { background: rgba(255,255,255,.28); }

/* ── Mesajlar ── */
#ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
  background: #f8fafc;
}
#ai-messages::-webkit-scrollbar { width: 4px; }
#ai-messages::-webkit-scrollbar-track { background: transparent; }
#ai-messages::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

/* Mesaj balonu */
.ai-msg {
  display: flex;
  gap: 8px;
  animation: msgIn .22s ease-out;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.ai-msg.user { flex-direction: row-reverse; }

.ai-msg-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  align-self: flex-end;
}
.ai-msg.ai .ai-msg-avatar   { background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff; }
.ai-msg.user .ai-msg-avatar { background: linear-gradient(135deg, #06b6d4, #3b82f6); color: #fff; }

.ai-msg-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.55;
  word-break: break-word;
}
.ai-msg.ai   .ai-msg-bubble { background: #fff; color: #1e293b; border-radius: 4px 16px 16px 16px; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.ai-msg.user .ai-msg-bubble { background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff; border-radius: 16px 4px 16px 16px; }

.ai-msg-bubble ul { padding-left: 18px; margin: 4px 0; }
.ai-msg-bubble li { margin-bottom: 2px; }
.ai-msg-bubble strong { font-weight: 700; }

.ai-msg-time {
  font-size: 10px;
  color: #94a3b8;
  align-self: flex-end;
  white-space: nowrap;
  padding-bottom: 2px;
}
.ai-msg.user .ai-msg-time { color: rgba(255,255,255,.6); }

/* Yazıyor göstergesi */
#ai-typing {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 0 4px;
}
#ai-typing.visible { display: flex; }
.typing-dots {
  background: #fff;
  border-radius: 16px;
  padding: 10px 16px;
  display: flex;
  gap: 5px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.typing-dot {
  width: 7px;
  height: 7px;
  background: #a78bfa;
  border-radius: 50%;
  animation: bounce .9s ease-in-out infinite;
}
.typing-dot:nth-child(2) { animation-delay: .15s; }
.typing-dot:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%,60%,100%{transform:translateY(0)} 30%{transform:translateY(-6px)} }

/* ── Giriş Alanı ── */
#ai-input-area {
  padding: 12px 14px;
  background: #fff;
  border-top: 1px solid #e2e8f0;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-shrink: 0;
}
#ai-input {
  flex: 1;
  resize: none;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 9px 13px;
  font-size: 13.5px;
  font-family: inherit;
  color: #1e293b;
  outline: none;
  line-height: 1.4;
  max-height: 100px;
  overflow-y: auto;
  transition: border-color .15s;
  background: #f8fafc;
}
#ai-input:focus { border-color: #6366f1; background: #fff; }
#ai-input::placeholder { color: #94a3b8; }

#ai-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform .15s, opacity .15s;
}
#ai-send-btn:hover   { transform: scale(1.08); }
#ai-send-btn:active  { transform: scale(.95); }
#ai-send-btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
#ai-send-btn svg { width: 18px; height: 18px; fill: #fff; }

/* ── Footer ── */
#ai-chat-footer {
  text-align: center;
  font-size: 10.5px;
  color: #94a3b8;
  padding: 6px 12px 10px;
  background: #fff;
  border-top: 1px solid #f1f5f9;
  flex-shrink: 0;
}
#ai-chat-footer a { color: #6366f1; text-decoration: none; }

/* ── Hoş geldin ekranı (API key yoksa) ── */
.ai-no-key-info {
  text-align: center;
  padding: 24px 20px;
  color: #64748b;
  font-size: 13px;
  line-height: 1.6;
}
.ai-no-key-info svg {
  width: 44px;
  height: 44px;
  fill: #cbd5e1;
  margin-bottom: 12px;
}

/* ── Hata balonu ── */
.ai-msg-error .ai-msg-bubble {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

/* ── Responsive ── */
@media (max-width: 480px) {
  #ai-chat-window {
    left: 12px;
    right: 12px;
    width: auto;
    bottom: 90px;
    height: calc(100dvh - 110px);
    border-radius: 16px;
  }
  #ai-fab { bottom: 24px; left: 20px; }
}
