/**
 * MAISON DALÍ CONCIERGE - UI COMPONENTS
 * Mission 804: World-Class AI Concierge
 * Tasks 1.3-1.6: Complete UI Implementation
 * Version: 1.0.0
 */

/* ═══════════════════════════════════════════════════════════
   TASK 1.3: FLOATING ACTION BUTTON (FAB) STYLES
   ═══════════════════════════════════════════════════════════ */

.dali-fab {
  position: fixed;
  bottom: var(--spacing-lg, 24px);
  right: var(--spacing-lg, 24px);
  width: 64px;
  height: 64px;
  border: none;
  border-radius: 50%;
  background: var(--dali-red-gradient);
  cursor: pointer;
  z-index: var(--z-chatbot-fab, 9998);
  box-shadow: var(--dali-red-shadow);
  transition: var(--transition-smooth);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  animation: dali-pulse 3s infinite;
}

.dali-fab:hover {
  transform: scale(1.1);
  box-shadow: var(--dali-red-shadow-strong);
  animation: dali-glow 1.5s infinite;
}

.dali-fab:active {
  transform: scale(0.95);
}

.dali-fab-avatar {
  position: relative;
  width: 40px;
  height: 40px;
  z-index: 2;
}

.dali-fab-icon {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.dali-fab-pulse {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--dali-red-glow);
  animation: dali-pulse-ring 2s infinite;
  z-index: 1;
}

@keyframes dali-pulse-ring {
  0% {
    transform: scale(1);
    opacity: 0.8;
  }
  100% {
    transform: scale(1.5);
    opacity: 0;
  }
}

/* ═══════════════════════════════════════════════════════════
   TASK 1.4: GLASS MORPHISM CHAT WINDOW
   ═══════════════════════════════════════════════════════════ */

.dali-chat-window {
  position: fixed;
  bottom: calc(64px + var(--spacing-lg, 24px) + var(--spacing-md, 16px));
  right: var(--spacing-lg, 24px);
  width: 400px;
  max-width: calc(100vw - 32px);
  height: 600px;
  max-height: calc(100vh - 120px);
  background: rgba(20, 20, 20, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(196, 30, 58, 0.3);
  border-radius: 20px;
  box-shadow: 
    0 20px 60px rgba(0, 0, 0, 0.5),
    0 0 40px var(--dali-red-glow);
  z-index: var(--z-chatbot-window, 9999);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slide-in-bottom-right 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Chat Header */
.dali-chat-header {
  padding: var(--spacing-md, 16px);
  background: var(--dali-red-gradient);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm, 12px);
  min-height: 72px;
  flex-shrink: 0;
}

.dali-chat-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
  flex-shrink: 0;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.2);
}

.dali-header-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dali-chat-title {
  flex: 1;
  color: white;
}

.dali-chat-title h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: white;
  font-family: var(--font-display, 'Playfair Display', serif);
}

.dali-chat-status {
  font-size: 13px;
  opacity: 0.9;
  color: rgba(255, 255, 255, 0.8);
  margin-top: 2px;
  display: block;
}

.dali-chat-close {
  width: 36px;
  height: 36px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
  color: white;
}

.dali-chat-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

/* Messages Container */
.dali-chat-messages {
  flex: 1;
  padding: var(--spacing-md, 16px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md, 16px);
  scrollbar-width: thin;
  scrollbar-color: rgba(196, 30, 58, 0.5) transparent;
}

.dali-chat-messages::-webkit-scrollbar {
  width: 6px;
}

.dali-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.dali-chat-messages::-webkit-scrollbar-thumb {
  background: rgba(196, 30, 58, 0.5);
  border-radius: 3px;
}

/* ═══════════════════════════════════════════════════════════
   TASK 1.5: MESSAGE BUBBLES WITH RED GRADIENTS
   ═══════════════════════════════════════════════════════════ */

.dali-message {
  display: flex;
  gap: var(--spacing-sm, 12px);
  align-items: flex-start;
  animation: message-slide-in-left 0.3s ease-out;
}

.dali-message-user {
  flex-direction: row-reverse;
  animation: message-slide-in-right 0.3s ease-out;
}

.dali-message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  overflow: hidden;
  background: rgba(196, 30, 58, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.dali-message-icon {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dali-message-content {
  max-width: 280px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 12px 16px;
  color: white;
}

.dali-message-ai .dali-message-content {
  background: linear-gradient(135deg, rgba(196, 30, 58, 0.2), rgba(139, 0, 0, 0.15));
  border: 1px solid rgba(196, 30, 58, 0.3);
}

.dali-message-user .dali-message-content {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.dali-message-content p {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: white;
}

.dali-message-time {
  font-size: 11px;
  opacity: 0.6;
  margin-top: var(--spacing-xs, 4px);
  display: block;
  color: rgba(255, 255, 255, 0.6);
}

/* Typing Indicator */
.dali-typing {
  display: flex;
  gap: var(--spacing-sm, 12px);
  align-items: flex-start;
}

.dali-typing-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  overflow: hidden;
  background: rgba(196, 30, 58, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.dali-typing-content {
  background: linear-gradient(135deg, rgba(196, 30, 58, 0.2), rgba(139, 0, 0, 0.15));
  border: 1px solid rgba(196, 30, 58, 0.3);
  border-radius: 16px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
}

.dali-melting-dots {
  display: flex;
  gap: 6px;
  align-items: center;
}

.dali-melting-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dali-red-primary);
  animation: melting-dots 1.5s infinite ease-in-out;
}

.dali-melting-dots span:nth-child(2) {
  animation-delay: 0.3s;
}

.dali-melting-dots span:nth-child(3) {
  animation-delay: 0.6s;
}

/* ═══════════════════════════════════════════════════════════
   TASK 1.6: AUTO-EXPANDING INPUT INTERFACE
   ═══════════════════════════════════════════════════════════ */

.dali-chat-input-container {
  padding: var(--spacing-md, 16px);
  background: rgba(0, 0, 0, 0.3);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  gap: var(--spacing-sm, 12px);
  align-items: flex-end;
  flex-shrink: 0;
}

.dali-chat-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 12px 16px;
  color: white;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  min-height: 44px;
  max-height: 120px;
  transition: var(--transition-smooth);
  outline: none;
}

.dali-chat-input:focus {
  border-color: var(--dali-red-primary);
  box-shadow: 0 0 0 3px var(--dali-red-glow);
}

.dali-chat-input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.dali-chat-send {
  width: 44px;
  height: 44px;
  border: none;
  background: var(--dali-red-gradient);
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
  flex-shrink: 0;
  color: white;
}

.dali-chat-send:hover {
  transform: scale(1.05);
  box-shadow: var(--dali-red-shadow);
}

.dali-chat-send:active {
  transform: scale(0.95);
}

.dali-chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ═══════════════════════════════════════════════════════════
   MOBILE RESPONSIVE DESIGN
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 767px) {
  .dali-fab {
    width: 56px;
    height: 56px;
    bottom: 20px;
    right: 20px;
  }
  
  .dali-chat-window {
    bottom: calc(56px + 20px + 12px);
    right: 12px;
    width: calc(100vw - 24px);
    height: 500px;
    max-height: calc(100vh - 100px);
  }
  
  .dali-message-content {
    max-width: 250px;
  }
}

@media (max-width: 480px) {
  .dali-chat-window {
    height: 450px;
  }
  
  .dali-message-content {
    max-width: 200px;
  }
  
  .dali-chat-header {
    min-height: 64px;
  }
  
  .dali-chat-avatar {
    width: 40px;
    height: 40px;
  }
}

/* Dark mode compatibility */
@media (prefers-color-scheme: dark) {
  .dali-chat-window {
    background: rgba(10, 10, 10, 0.98);
  }
}

/* ═══════════════════════════════════════════════════════════
   CHECKPOINT 3: API LOADING STATES & ANIMATIONS
   ═══════════════════════════════════════════════════════════ */

/* Spinning animation for loading state */
.animate-spin {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Enhanced disabled states */
.dali-chat-send:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  animation: none !important;
}

.dali-chat-input:disabled {
  opacity: 0.7;
  background: rgba(255, 255, 255, 0.03);
  cursor: not-allowed;
}

/* Error message styling */
.dali-message-error .dali-message-content {
  border-left: 3px solid #ff4444;
  background: rgba(255, 68, 68, 0.1);
  border-color: rgba(255, 68, 68, 0.3);
}

/* Connection status indicators */
.dali-chat-status.connecting {
  color: #ffa500;
}

.dali-chat-status.connected {
  color: #00ff00;
}

.dali-chat-status.error {
  color: #ff4444;
}

/* Pulse for loading states */
.dali-chat-send.loading {
  animation: dali-pulse 1.5s infinite;
}
