/* ===========================================
   CHATBOT STYLES - Burcu Tasan AI Asistan
   Warm Haven Theme Compatible
   =========================================== */

/* ----- Trigger Button ----- */
.ai-agent-trigger {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 999;
  display: flex;
  align-items: center;
  gap: 0;
  cursor: pointer;
  user-select: none;
}
.ai-agent-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 24px rgba(107,172,164,0.35);
  transition: all 0.35s ease;
  position: relative;
  z-index: 2;
  border: 3px solid rgba(107,172,164,0.3);
}
.ai-agent-avatar:hover {
  transform: scale(1.08);
  border-color: var(--primary);
  box-shadow: 0 8px 30px rgba(107,172,164,0.45);
}
.ai-agent-avatar svg {
  width: 26px;
  height: 26px;
  color: #fff;
}
.ai-agent-avatar .online-ring {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #34d399;
  border: 2.5px solid white;
  animation: online-blink 2s ease-in-out infinite;
}
@keyframes online-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ----- Greeting Bubble ----- */
.ai-agent-greeting {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  padding: 0.6rem 1rem 0.6rem 0.8rem;
  border-radius: var(--radius-pill);
  margin-right: -8px;
  font-size: 0.82rem;
  font-family: var(--font-body);
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(107,172,164,0.25);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
  position: relative;
  z-index: 1;
}
.ai-agent-greeting strong {
  color: #fff;
  font-weight: 600;
}
.ai-agent-greeting .close-greeting {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
  border: none;
  padding: 0;
  color: rgba(255,255,255,0.6);
  font-size: 0.7rem;
  line-height: 1;
  margin-left: 4px;
}
.ai-agent-greeting .close-greeting:hover {
  background: rgba(255,255,255,0.25);
  color: white;
}
.ai-agent-trigger.greeting-hidden .ai-agent-greeting {
  display: none;
}

/* ----- Chat Panel ----- */
.ai-agent-panel {
  position: fixed;
  bottom: 6rem;
  right: 2rem;
  z-index: 1050;
  width: 400px;
  height: 560px;
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: 0 25px 80px rgba(0,0,0,0.18), 0 0 0 1px rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.7) translateY(40px);
  opacity: 0;
  pointer-events: none;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-origin: bottom right;
}
.ai-agent-panel.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* ----- Panel Header ----- */
.agent-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  padding: 1.2rem 1.4rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  position: relative;
}
.agent-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), #fff, var(--accent), var(--primary));
  background-size: 200% 100%;
  animation: shimmer-bar 3s linear infinite;
}
@keyframes shimmer-bar {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.agent-header-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1.5px solid rgba(255,255,255,0.25);
}
.agent-header-icon svg {
  width: 22px;
  height: 22px;
  color: #fff;
}
.agent-header-text {
  flex: 1;
}
.agent-header-text h4 {
  color: white;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  padding: 0;
}
.agent-header-text h4 .ai-badge {
  display: inline-block;
  font-size: 0.55rem;
  font-weight: 700;
  background: rgba(255,255,255,0.25);
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: middle;
  letter-spacing: 0.5px;
}
.agent-header-text p {
  color: rgba(255,255,255,0.7);
  font-size: 0.72rem;
  margin: 2px 0 0 0;
  padding: 0;
}
.agent-header-text p .status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #34d399;
  margin-right: 4px;
  vertical-align: middle;
}
.agent-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.5);
  transition: all 0.2s;
}
.agent-close:hover {
  background: rgba(255,255,255,0.15);
  color: white;
}
.agent-close svg {
  width: 16px;
  height: 16px;
}

/* ----- Chat Body ----- */
.agent-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.2rem;
  background: linear-gradient(180deg, var(--bg-alt) 0%, var(--bg) 100%);
  scroll-behavior: smooth;
}
.agent-body::-webkit-scrollbar { width: 4px; }
.agent-body::-webkit-scrollbar-track { background: transparent; }
.agent-body::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 4px; opacity: 0.4; }

/* ----- Messages ----- */
.agent-msg {
  max-width: 88%;
  margin-bottom: 1rem;
  animation: agentMsgIn 0.4s ease both;
}
.agent-msg.bot {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
}
.agent-msg.bot .msg-avatar {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}
.agent-msg.bot .msg-avatar svg {
  width: 14px;
  height: 14px;
  color: #fff;
}
.agent-msg.bot .msg-bubble {
  background: var(--surface);
  border-radius: 4px 18px 18px 18px;
  padding: 0.85rem 1.1rem;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.86rem;
  line-height: 1.6;
  box-shadow: 0 2px 10px rgba(0,0,0,0.04);
}
.agent-msg.user {
  margin-left: auto;
}
.agent-msg.user .msg-bubble {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 18px 4px 18px 18px;
  padding: 0.85rem 1.1rem;
  color: white;
  font-family: var(--font-body);
  font-size: 0.86rem;
  line-height: 1.6;
}
@keyframes agentMsgIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ----- Typing Indicator ----- */
.agent-typing {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}
.agent-typing .msg-avatar {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.agent-typing .msg-avatar svg {
  width: 14px;
  height: 14px;
  color: #fff;
}
.agent-typing .dots {
  display: flex;
  gap: 4px;
  padding: 0.85rem 1.1rem;
  background: var(--surface);
  border-radius: 4px 18px 18px 18px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.04);
}
.agent-typing .dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: agentDot 1.4s ease-in-out infinite;
}
.agent-typing .dots span:nth-child(2) { animation-delay: 0.2s; }
.agent-typing .dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes agentDot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.35; }
  30% { transform: translateY(-7px); opacity: 1; }
}

/* ----- Quick Reply Chips ----- */
.agent-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.6rem;
  padding-left: 36px;
}
.agent-chip {
  background: var(--surface);
  border: 1.5px solid rgba(107,172,164,0.2);
  border-radius: var(--radius-pill);
  padding: 0.5rem 1rem;
  font-size: 0.78rem;
  font-family: var(--font-body);
  color: var(--text);
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.agent-chip:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary-dark);
  transform: translateY(-1px);
}
.agent-chip .chip-icon { font-size: 0.9rem; }

/* ----- Input Area ----- */
.agent-input-area {
  padding: 0.9rem 1rem;
  background: var(--surface);
  border-top: 1px solid rgba(107,172,164,0.08);
  display: flex;
  gap: 0.6rem;
  align-items: center;
}
.agent-input-area input {
  flex: 1;
  border: 1.5px solid rgba(107,172,164,0.15);
  border-radius: var(--radius-pill);
  padding: 0.7rem 1.1rem;
  font-family: var(--font-body);
  font-size: 0.86rem;
  color: var(--text);
  outline: none;
  transition: all 0.3s;
  background: var(--bg);
}
.agent-input-area input:focus {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(107,172,164,0.08);
}
.agent-input-area input::placeholder { color: var(--text-muted); }
.agent-input-area .send-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  flex-shrink: 0;
}
.agent-input-area .send-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 12px rgba(107,172,164,0.3);
}
.agent-input-area .send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.agent-input-area .send-btn svg {
  width: 18px;
  height: 18px;
  color: white;
}

/* ----- Disclaimer ----- */
.agent-disclaimer {
  text-align: center;
  padding: 0.4rem 1rem 0.6rem;
  background: var(--surface);
  font-size: 0.65rem;
  color: var(--text-muted);
  border-top: 1px solid rgba(107,172,164,0.06);
}

/* ----- Mobile ----- */
@media (max-width: 480px) {
  .ai-agent-trigger { bottom: 1.2rem; right: 1.2rem; }
  .ai-agent-avatar { width: 50px; height: 50px; }
  .ai-agent-greeting { display: none; }
  .ai-agent-panel {
    width: calc(100vw - 1rem);
    right: 0.5rem;
    bottom: 5rem;
    height: 70vh;
    max-height: calc(100dvh - 7rem);
    border-radius: 18px;
  }
}
