/* ================= AI CHAT WIDGET ================= */
.ai-chat-widget {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
  font-family: inherit;
}

/* --- YÜZEN BUTON --- */
.ai-chat-toggle {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 9999px;
  background: linear-gradient(180deg, #48494f, #2f3136);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 -2px 2px rgba(0, 0, 0, 0.4),
    0 8px 20px rgba(0, 0, 0, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3px;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
}
.ai-chat-toggle:hover {
  transform: translateY(-2px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 -2px 2px rgba(0, 0, 0, 0.35),
    0 12px 26px rgba(0, 0, 0, 0.32);
}
.ai-chat-toggle:active {
  transform: translateY(1px);
}
.ai-chat-toggle-avatar {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 9999px;
  background: #f1f0ee;
  padding: 4px;
}
.ai-chat-toggle-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  border-radius: 9999px;
  background: #e5231b;
  border: 2.5px solid #fff;
  animation: aiDotPulse 1.8s ease-in-out infinite;
}
@keyframes aiDotPulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(229, 35, 27, 0.55);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(229, 35, 27, 0);
  }
}

/* --- SOHBET PANELİ --- */
.ai-chat-panel {
  position: absolute;
  right: 0;
  bottom: 78px;
  width: min(380px, calc(100vw - 40px));
  height: min(560px, calc(100vh - 140px));
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 24px 48px rgba(35, 36, 39, 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
}
.ai-chat-panel.hidden {
  display: none !important;
}
.ai-chat-panel:not(.hidden) {
  animation: aiPanelOpen 0.22s ease-out;
}
@keyframes aiPanelOpen {
  from {
    transform: scale(0.92) translateY(8px);
    opacity: 0;
  }
  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

/* Header */
.ai-chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(180deg, #45474e, #34363b);
  flex-shrink: 0;
}
.ai-chat-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 9999px;
  background: #f1f0ee;
  object-fit: contain;
  padding: 3px;
  flex-shrink: 0;
}
.ai-chat-header-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.ai-chat-header-title {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}
.ai-chat-header-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: #c9cacd;
}
.ai-chat-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 9999px;
  background: #2fae66;
  flex-shrink: 0;
}
.ai-chat-close {
  width: 30px;
  height: 30px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s ease;
}
.ai-chat-close:hover {
  background: #e5231b;
}

/* Mesaj alanı */
.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #fafaf9;
}

.ai-msg {
  display: flex;
  gap: 8px;
  max-width: 85%;
}
.ai-msg-bot {
  align-self: flex-start;
}
.ai-msg-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.ai-msg-avatar {
  width: 26px;
  height: 26px;
  border-radius: 9999px;
  background: #f1f0ee;
  object-fit: contain;
  padding: 2px;
  flex-shrink: 0;
  align-self: flex-end;
}
.ai-msg-bubble {
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.5;
}
.ai-msg-bot .ai-msg-bubble {
  background: #fff;
  color: #374151;
  border: 1px solid #f0efed;
  border-bottom-left-radius: 4px;
}
.ai-msg-user .ai-msg-bubble {
  background: linear-gradient(180deg, #e5231b, #b81810);
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* Yazıyor göstergesi */
.ai-typing {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 0;
}
.ai-typing span {
  width: 5px;
  height: 5px;
  border-radius: 9999px;
  background: #b6b7bb;
  animation: aiTypingBounce 1.1s ease-in-out infinite;
}
.ai-typing span:nth-child(2) {
  animation-delay: 0.15s;
}
.ai-typing span:nth-child(3) {
  animation-delay: 0.3s;
}
@keyframes aiTypingBounce {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.5;
  }
  30% {
    transform: translateY(-3px);
    opacity: 1;
  }
}

/* Hızlı öneri çipleri */
.ai-chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 12px;
  background: #fafaf9;
  flex-shrink: 0;
}
.ai-suggestion-chip {
  font-size: 12px;
  font-weight: 600;
  color: #e5231b;
  background: rgba(229, 35, 27, 0.08);
  border: 1px solid rgba(229, 35, 27, 0.15);
  border-radius: 9999px;
  padding: 6px 12px;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}
.ai-suggestion-chip:hover {
  background: #e5231b;
  color: #fff;
}

/* Giriş formu */
.ai-chat-form {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid #f0efed;
  background: #fff;
  flex-shrink: 0;
}
.ai-chat-input {
  flex: 1;
  min-width: 0;
  border: 1px solid #e5e5e3;
  border-radius: 9999px;
  padding: 10px 16px;
  font-size: 13.5px;
  color: #374151;
  outline: none;
  transition: border-color 0.15s ease;
}
.ai-chat-input:focus {
  border-color: #e5231b;
}
.ai-chat-send {
  width: 38px;
  height: 38px;
  border-radius: 9999px;
  background: linear-gradient(180deg, #e5231b, #b81810);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease;
}
.ai-chat-send:hover {
  transform: translateY(-1px);
}
.ai-chat-send:active {
  transform: translateY(1px);
}

@media (max-width: 480px) {
  .ai-chat-widget {
    right: 14px;
    bottom: 14px;
  }
  .ai-chat-panel {
    right: -6px;
  }
}
