/* ── AI Chat Widget ─────────────────────────────────────── */
#ai-chat-btn {
  position: fixed;
  bottom: 28px;
  right: 24px;
  z-index: 9000;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #B31217, #8B0000);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(179,18,23,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .2s, box-shadow .2s;
  color: #fff;
  font-size: 22px;
}
#ai-chat-btn:hover { transform: scale(1.08); box-shadow: 0 6px 28px rgba(179,18,23,0.55); }
#ai-chat-btn .ai-btn-badge {
  position: absolute;
  top: -4px; right: -4px;
  background: #C9A84C;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 10px;
  white-space: nowrap;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

/* Chat Penceresi */
#ai-chat-panel {
  position: fixed;
  bottom: 100px;
  right: 24px;
  z-index: 9001;
  width: 370px;
  max-height: 560px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: opacity .25s, transform .25s;
  transform-origin: bottom right;
}
#ai-chat-panel.ai-hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.92) translateY(12px);
}

/* Header */
.ai-chat-header {
  background: linear-gradient(135deg, #B31217, #8B0000);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.ai-chat-avatar {
  width: 38px; height: 38px;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.ai-chat-title { flex: 1; }
.ai-chat-title strong { font-size: 14px; font-weight: 700; display: block; }
.ai-chat-title span { font-size: 11px; opacity: .8; }
.ai-chat-close {
  background: none; border: none; color: rgba(255,255,255,0.8);
  font-size: 18px; cursor: pointer; padding: 4px; line-height: 1;
  transition: color .15s;
}
.ai-chat-close:hover { color: #fff; }

/* Mesajlar alanı */
.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f9fafb;
  scrollbar-width: thin;
  scrollbar-color: #ddd transparent;
}
.ai-chat-messages::-webkit-scrollbar { width: 4px; }
.ai-chat-messages::-webkit-scrollbar-thumb { background: #ddd; border-radius: 4px; }

/* Mesaj balonu */
.ai-msg {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  max-width: 92%;
}
.ai-msg.ai-msg-user { flex-direction: row-reverse; align-self: flex-end; }
.ai-msg.ai-msg-bot  { align-self: flex-start; }

.ai-msg-icon {
  width: 28px; height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
}
.ai-msg-bot  .ai-msg-icon { background: #B31217; color: #fff; }
.ai-msg-user .ai-msg-icon { background: #C9A84C; color: #fff; }

.ai-msg-bubble {
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.55;
  word-break: break-word;
}
.ai-msg-bot  .ai-msg-bubble {
  background: #fff;
  color: #1a0a0a;
  border: 1px solid #e5e7eb;
  border-bottom-left-radius: 4px;
}
.ai-msg-user .ai-msg-bubble {
  background: #B31217;
  color: #fff;
  border-bottom-right-radius: 4px;
}
.ai-msg-bubble p   { margin: 0 0 6px; }
.ai-msg-bubble p:last-child { margin-bottom: 0; }
.ai-msg-bubble ul  { margin: 4px 0; padding-left: 16px; }
.ai-msg-bubble li  { margin-bottom: 3px; }
.ai-msg-bubble strong { font-weight: 700; }

/* Yazıyor animasyonu */
.ai-typing .ai-msg-bubble {
  display: flex; gap: 4px; align-items: center; padding: 12px 14px;
}
.ai-typing-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #B31217;
  animation: aiDotPulse 1.2s infinite ease-in-out;
}
.ai-typing-dot:nth-child(2) { animation-delay: .2s; }
.ai-typing-dot:nth-child(3) { animation-delay: .4s; }
@keyframes aiDotPulse {
  0%, 80%, 100% { transform: scale(0.7); opacity: .4; }
  40% { transform: scale(1); opacity: 1; }
}

/* Hızlı sorular */
.ai-quick-btns {
  padding: 8px 16px 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  background: #f9fafb;
  flex-shrink: 0;
}
.ai-quick-btn {
  background: #fff;
  border: 1px solid #e5e7eb;
  color: #B31217;
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 20px;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.ai-quick-btn:hover { background: #B31217; color: #fff; border-color: #B31217; }

/* Input alanı */
.ai-chat-input {
  padding: 12px 14px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  gap: 8px;
  background: #fff;
  flex-shrink: 0;
}
.ai-chat-input textarea {
  flex: 1;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
  font-family: inherit;
  resize: none;
  outline: none;
  max-height: 80px;
  min-height: 38px;
  line-height: 1.4;
  color: #1a0a0a;
  transition: border-color .15s;
}
.ai-chat-input textarea:focus { border-color: #B31217; }
.ai-chat-input button {
  width: 38px; height: 38px;
  background: #B31217;
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 15px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: opacity .15s;
  align-self: flex-end;
}
.ai-chat-input button:hover { opacity: .85; }
.ai-chat-input button:disabled { opacity: .5; cursor: not-allowed; }

/* Mobil */
@media (max-width: 480px) {
  #ai-chat-panel {
    right: 0; bottom: 0;
    width: 100vw;
    max-height: 80vh;
    border-radius: 16px 16px 0 0;
  }
  #ai-chat-btn { bottom: 20px; right: 16px; }
}
