/* =============================================
   SmartCity Tashkent — Chatbot Styles
   Zamonaviy glassmorphism dizayn
   ============================================= */

/* ── FAB (Floating Action Button) ─────────── */
#smartbot-container {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  font-family: 'Inter', sans-serif;
}

#smartbot-fab {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 32px rgba(99, 102, 241, 0.45);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}

#smartbot-fab:hover {
  transform: scale(1.1) translateY(-2px);
  box-shadow: 0 12px 40px rgba(99, 102, 241, 0.6);
}

#smartbot-fab.active {
  transform: scale(0.9) rotate(10deg);
}

.fab-icon {
  color: #fff;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fab-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 22px;
  height: 22px;
  background: linear-gradient(135deg, #ef4444, #f97316);
  border-radius: 50%;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-color, #0a0f1e);
  animation: badgePop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes badgePop {
  from { transform: scale(0); }
  to   { transform: scale(1); }
}

.fab-pulse {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.4);
  animation: pulseRing 2s ease-out infinite;
}

@keyframes pulseRing {
  0%   { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(1.7); opacity: 0; }
}

/* ── CHATBOT WINDOW ────────────────────────── */
#smartbot-window {
  position: absolute;
  bottom: 76px;
  right: 0;
  width: 360px;
  height: 520px;
  background: rgba(15, 20, 40, 0.92);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255,255,255,0.04) inset,
    0 4px 24px rgba(99, 102, 241, 0.2);
  overflow: hidden;
  opacity: 0;
  transform: scale(0.8) translateY(20px);
  transform-origin: bottom right;
  pointer-events: none;
  transition:
    opacity 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
    transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#smartbot-window.open {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: all;
}

/* ── HEADER ────────────────────────────────── */
#smartbot-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(139, 92, 246, 0.2));
  border-bottom: 1px solid rgba(99, 102, 241, 0.2);
  flex-shrink: 0;
}

.bot-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.1rem;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.bot-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

#botTitle {
  color: #e2e8f0;
  font-weight: 600;
  font-size: 0.9rem;
}

.bot-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: #94a3b8;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.7);
  animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

#smartbot-close {
  background: rgba(255,255,255,0.08);
  border: none;
  color: #94a3b8;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  font-size: 0.9rem;
}

#smartbot-close:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  transform: rotate(90deg);
}

/* ── MESSAGES ──────────────────────────────── */
#smartbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(99, 102, 241, 0.3) transparent;
}

#smartbot-messages::-webkit-scrollbar {
  width: 4px;
}

#smartbot-messages::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.4);
  border-radius: 4px;
}

.chat-msg {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 85%;
}

.chat-msg.animate-in {
  animation: msgSlideIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes msgSlideIn {
  from { opacity: 0; transform: translateY(12px) scale(0.9); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Bot messages */
.bot-msg {
  align-self: flex-start;
}

.bot-msg .msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.7rem;
  flex-shrink: 0;
}

.bot-msg .msg-bubble {
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.25);
  color: #e2e8f0;
  border-radius: 16px 16px 16px 4px;
  padding: 10px 14px;
  font-size: 0.83rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

/* User messages */
.user-msg {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.user-msg .msg-bubble {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border-radius: 16px 16px 4px 16px;
  padding: 10px 14px;
  font-size: 0.83rem;
  line-height: 1.5;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

/* ── TYPING INDICATOR ──────────────────────── */
#smartbot-typing {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 16px 8px;
  flex-shrink: 0;
}

#smartbot-typing.hidden {
  display: none;
}

.typing-bubble {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 12px;
  padding: 8px 12px;
}

.typing-bubble span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #6366f1;
  animation: typingDot 1.4s ease-in-out infinite;
}

.typing-bubble span:nth-child(2) { animation-delay: 0.2s; }
.typing-bubble span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingDot {
  0%, 60%, 100% { transform: translateY(0);    opacity: 0.4; }
  30%           { transform: translateY(-6px); opacity: 1;   }
}

#typingLabel {
  font-size: 0.72rem;
  color: #64748b;
  font-style: italic;
}

/* ── INPUT AREA ────────────────────────────── */
#smartbot-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid rgba(99, 102, 241, 0.15);
  background: rgba(10, 15, 30, 0.5);
  flex-shrink: 0;
}

#smartbot-input {
  flex: 1;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 12px;
  color: #e2e8f0;
  padding: 10px 14px;
  font-size: 0.83rem;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: all 0.25s;
}

#smartbot-input::placeholder { color: #475569; }

#smartbot-input:focus {
  border-color: rgba(99, 102, 241, 0.6);
  background: rgba(255,255,255,0.09);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

#smartbot-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  transition: all 0.2s;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

#smartbot-send:hover {
  transform: scale(1.1) rotate(-5deg);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.55);
}

#smartbot-send:active {
  transform: scale(0.95);
}

/* ── FOOTER ────────────────────────────────── */
#smartbot-footer {
  text-align: center;
  padding: 6px;
  font-size: 0.67rem;
  color: #334155;
  background: rgba(5, 8, 18, 0.5);
  flex-shrink: 0;
}

#langDetected {
  font-weight: 700;
  color: #6366f1;
}

/* ── RESPONSIVE ────────────────────────────── */
@media (max-width: 480px) {
  #smartbot-container {
    bottom: 16px;
    right: 16px;
  }

  #smartbot-window {
    width: calc(100vw - 32px);
    height: 480px;
    right: 0;
    bottom: 72px;
  }
}

/* ── RTL SUPPORT ───────────────────────────── */
[dir="rtl"] #smartbot-window {
  right: auto;
  left: 0;
}

[dir="rtl"] #smartbot-container {
  right: auto;
  left: 28px;
}

[dir="rtl"] .bot-msg .msg-bubble {
  border-radius: 16px 16px 4px 16px;
}

[dir="rtl"] .user-msg .msg-bubble {
  border-radius: 16px 16px 16px 4px;
}
