/* ============================================
   URBIE LAUNCHER - Unified Floating Widget System
   Chat + Call buttons with premium styling
   ============================================ */

/* === LAUNCHER CONTAINER === */
#urbie-launcher {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9998;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

/* === FLOATING ACTION BUTTONS === */
.urbie-fab {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #2F80ED 0%, #56CCF2 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(47, 128, 237, 0.3), 0 0 0 0 rgba(47, 128, 237, 0.4);
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  pointer-events: all;
  position: relative;
}

.urbie-fab:hover {
  animation: none !important;
  transform: translateY(-8px) scale(1.08);
  box-shadow: 0 8px 20px rgba(47, 128, 237, 0.4), 0 0 20px rgba(187, 215, 255, 0.5);
}

.urbie-fab:active {
  animation: none !important;
  transform: translateY(-1px) scale(1.02);
}

.urbie-fab svg {
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

/* Floating animations */
#urbie-call-btn {
  animation: urbie-float-call 3s ease-in-out infinite, urbie-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

#urbie-chat-btn {
  animation: urbie-float-chat 3.5s ease-in-out infinite;
  animation-delay: 0.5s;
}

@keyframes urbie-float-call {
  0%, 100% {
    transform: translateY(0px) translateX(0px);
  }
  25% {
    transform: translateY(-4px) translateX(2px);
  }
  50% {
    transform: translateY(-2px) translateX(-2px);
  }
  75% {
    transform: translateY(-6px) translateX(1px);
  }
}

@keyframes urbie-float-chat {
  0%, 100% {
    transform: translateY(0px) translateX(0px);
  }
  25% {
    transform: translateY(-5px) translateX(-2px);
  }
  50% {
    transform: translateY(-3px) translateX(2px);
  }
  75% {
    transform: translateY(-7px) translateX(-1px);
  }
}

@keyframes urbie-pulse {
  0%, 100% {
    box-shadow: 0 4px 12px rgba(47, 128, 237, 0.3), 0 0 0 0 rgba(47, 128, 237, 0.4);
  }
  50% {
    box-shadow: 0 4px 12px rgba(47, 128, 237, 0.3), 0 0 0 8px rgba(47, 128, 237, 0);
  }
}

/* === BACKDROP === */
.urbie-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  z-index: 9997;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.urbie-backdrop.active {
  opacity: 1;
  pointer-events: all;
}

/* === PANEL CONTAINER === */
.urbie-panel {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 420px;
  max-width: calc(100vw - 40px);
  height: 600px;
  max-height: calc(100vh - 100px);
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.urbie-panel.opening,
.urbie-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

.urbie-panel.closing {
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
}

/* === PANEL HEADER === */
.urbie-panel-header {
  padding: 20px;
  background: linear-gradient(135deg, #2F80ED 0%, #56CCF2 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.urbie-panel-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, rgba(255, 255, 255, 0.15) 0%, transparent 60%);
  pointer-events: none;
}

.urbie-panel-title {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  z-index: 1;
}

.urbie-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: white;
  padding: 2px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.urbie-icon-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
}

.urbie-panel-title h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.urbie-panel-title p {
  margin: 0;
  font-size: 13px;
  opacity: 0.9;
  font-weight: 500;
}

.urbie-panel-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.urbie-panel-close:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: rotate(90deg);
}

/* === PANEL BODY === */
.urbie-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #F8F9FA;
}

.urbie-panel-centered {
  align-items: center;
  justify-content: center;
}

/* Custom scrollbar */
.urbie-panel-body::-webkit-scrollbar {
  width: 6px;
}

.urbie-panel-body::-webkit-scrollbar-track {
  background: transparent;
}

.urbie-panel-body::-webkit-scrollbar-thumb {
  background: #CBD5E0;
  border-radius: 3px;
}

.urbie-panel-body::-webkit-scrollbar-thumb:hover {
  background: #A0AEC0;
}

/* === CHAT MESSAGES === */
.urbie-message {
  display: flex;
  margin-bottom: 4px;
  animation: urbie-message-appear 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes urbie-message-appear {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.urbie-message-content {
  max-width: 75%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}

.urbie-message-ai .urbie-message-content {
  background: white;
  color: #1A202C;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.urbie-message-user {
  justify-content: flex-end;
}

.urbie-message-user .urbie-message-content {
  background: linear-gradient(135deg, #2F80ED 0%, #56CCF2 100%);
  color: white;
  border-bottom-right-radius: 4px;
}

/* Typing indicator */
.urbie-typing .urbie-message-content {
  padding: 16px 20px;
}

.urbie-typing-dots {
  display: flex;
  gap: 4px;
  align-items: center;
}

.urbie-typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #A0AEC0;
  animation: urbie-typing 1.4s ease-in-out infinite;
}

.urbie-typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.urbie-typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes urbie-typing {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.6;
  }
  30% {
    transform: translateY(-8px);
    opacity: 1;
  }
}

/* === PANEL FOOTER === */
.urbie-panel-footer {
  padding: 16px;
  border-top: 1px solid #E2E8F0;
  background: white;
  display: flex;
  gap: 12px;
  flex-shrink: 0;
}

.urbie-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: all 0.2s ease;
  background: #F8F9FA;
}

.urbie-input:focus {
  border-color: #2F80ED;
  background: white;
  box-shadow: 0 0 0 3px rgba(47, 128, 237, 0.1);
}

.urbie-send-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, #2F80ED 0%, #56CCF2 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.urbie-send-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(47, 128, 237, 0.3);
}

.urbie-send-btn:active {
  transform: translateY(0);
}

/* === EMPTY STATE === */
.urbie-empty-state {
  text-align: center;
  max-width: 300px;
}

.urbie-icon-large {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, #EAF2FF 0%, #D6E9FF 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #2F80ED;
}

.urbie-empty-state h4 {
  margin: 0 0 12px;
  font-size: 20px;
  font-weight: 700;
  color: #1A202C;
  letter-spacing: -0.01em;
}

.urbie-empty-state p {
  margin: 0 0 24px;
  font-size: 14px;
  color: #718096;
  line-height: 1.6;
}

.urbie-btn-primary {
  padding: 12px 24px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, #2F80ED 0%, #56CCF2 100%);
  color: white;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(47, 128, 237, 0.2);
}

.urbie-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(47, 128, 237, 0.3);
}

.urbie-btn-primary:active {
  transform: translateY(0);
}

/* === MOBILE RESPONSIVE === */
@media (max-width: 768px) {
  #urbie-launcher {
    bottom: 16px;
    right: 16px;
    gap: 10px;
  }

  .urbie-fab {
    width: 52px;
    height: 52px;
  }

  .urbie-panel {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
  }

  .urbie-panel.opening,
  .urbie-panel.open {
    transform: translateY(0) scale(1);
  }

  .urbie-panel.closing,
  .urbie-panel:not(.open) {
    transform: translateY(100%) scale(1);
  }
}

/* === REDUCED MOTION === */
@media (prefers-reduced-motion: reduce) {
  .urbie-fab,
  .urbie-panel,
  .urbie-backdrop,
  .urbie-panel-close,
  .urbie-send-btn,
  .urbie-btn-primary,
  .urbie-message {
    transition: opacity 0.1s ease, transform 0s;
    animation: none !important;
  }

  #urbie-call-btn,
  #urbie-chat-btn {
    animation: none !important;
  }

  .urbie-fab:hover {
    transform: none;
  }

  .urbie-typing-dots span {
    animation: none;
    opacity: 0.6;
  }
}
