/* MOBILE FLOATING CHAT - CLEAN VERSION */
/* This CSS only handles mobile chat overlay, no conflicts with analytics.css */

/* Hide mobile elements on desktop */
.floating-chat-btn,
.mobile-chat-overlay {
  display: none;
}

/* MOBILE-ONLY STYLES */
@media (max-width: 768px) {
  
  /* Floating Chat Button */
  .floating-chat-btn {
    display: flex !important;
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    width: 60px !important;
    height: 60px !important;
    background: linear-gradient(135deg, #5566ff 0%, #6472f3 100%) !important;
    border-radius: 50% !important;
    border: none !important;
    box-shadow: 0 8px 25px rgba(85, 102, 255, 0.4) !important;
    cursor: pointer !important;
    z-index: 9999 !important;
    align-items: center !important;
    justify-content: center !important;
    color: white !important;
    font-size: 24px !important;
    transition: all 0.3s ease !important;
    backdrop-filter: blur(10px) !important;
  }

  .floating-chat-btn:hover {
    transform: translateY(-2px) scale(1.05) !important;
    box-shadow: 0 12px 35px rgba(85, 102, 255, 0.6) !important;
  }

  .floating-chat-btn.active {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.4) !important;
  }

  .floating-chat-btn.active:hover {
    box-shadow: 0 12px 35px rgba(239, 68, 68, 0.6) !important;
  }

  /* Mobile Chat Overlay */
  .mobile-chat-overlay {
    display: block !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: rgba(0, 0, 0, 0.7) !important;
    z-index: 10000 !important;
    backdrop-filter: blur(10px) !important;
    opacity: 0 !important;
    visibility: hidden !important;
    transition: all 0.3s ease !important;
  }

  .mobile-chat-overlay.show {
    opacity: 1 !important;
    visibility: visible !important;
  }

  /* Mobile Chat Container */
  .mobile-chat-container {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 85vh !important;
    max-height: 700px !important;
    background: rgba(2, 1, 25, 0.95) !important;
    backdrop-filter: blur(100px) !important;
    border-radius: 20px 20px 0 0 !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.3) !important;
    z-index: 10001 !important;
    transform: translateY(100%) !important;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }

  .mobile-chat-overlay.show .mobile-chat-container {
    transform: translateY(0) !important;
  }

  /* Drag Handle */
  .mobile-chat-handle {
    position: absolute !important;
    top: 8px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: 36px !important;
    height: 4px !important;
    background: rgba(255, 255, 255, 0.3) !important;
    border-radius: 2px !important;
    cursor: grab !important;
    z-index: 1 !important;
  }

  /* Mobile Chat Header */
  .mobile-chat-header {
    background: #132436 !important;
    background-image: linear-gradient(140deg, #0b1040, #000002) !important;
    padding: 24px 24px 20px !important;
    color: white !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 2px 20px rgba(86, 102, 243, 0.3) !important;
    flex-shrink: 0 !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    border-radius: 20px 20px 0 0 !important;
  }

  .mobile-chat-title {
    font-size: 18px !important;
    font-weight: 600 !important;
    margin-bottom: 4px !important;
    color: white !important;
    background-image: linear-gradient(140deg, white, rgba(189, 215, 241, 0.8)) !important;
    -webkit-text-fill-color: transparent !important;
    -webkit-background-clip: text !important;
    background-clip: text !important;
  }

  .mobile-chat-subtitle {
    font-size: 12px !important;
    opacity: 0.8 !important;
    color: rgba(255, 255, 255, 0.6) !important;
  }

  .mobile-chat-close {
    background: none !important;
    border: none !important;
    color: rgba(255, 255, 255, 0.8) !important;
    font-size: 24px !important;
    cursor: pointer !important;
    padding: 8px !important;
    border-radius: 8px !important;
    transition: all 0.3s ease !important;
    width: 40px !important;
    height: 40px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .mobile-chat-close:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    color: white !important;
  }

  /* Mobile Chat Messages */
  .mobile-chat-messages {
    flex: 1 !important;
    padding: 20px 24px !important;
    overflow-y: auto !important;
    background: rgba(255, 255, 255, 0.02) !important;
    background-image: 
      radial-gradient(circle at 20% 80%, rgba(86, 102, 243, 0.08) 0%, transparent 50%),
      radial-gradient(circle at 80% 20%, rgba(100, 114, 243, 0.05) 0%, transparent 50%) !important;
    backdrop-filter: blur(10px) !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 16px !important;
    scrollbar-width: thin !important;
    scrollbar-color: rgba(86, 102, 243, 0.3) transparent !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .mobile-chat-messages::-webkit-scrollbar {
    width: 4px !important;
  }

  .mobile-chat-messages::-webkit-scrollbar-track {
    background: transparent !important;
  }

  .mobile-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(86, 102, 243, 0.3) !important;
    border-radius: 2px !important;
  }

  /* Mobile Chat Input Area */
  .mobile-chat-input-area {
    padding: 16px 20px 20px !important;
    background: rgba(19, 36, 54, 0.8) !important;
    background-image: linear-gradient(140deg, rgba(11, 16, 64, 0.5), rgba(0, 0, 2, 0.3)) !important;
    backdrop-filter: blur(100px) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
    flex-shrink: 0 !important;
  }

  .mobile-input-container {
    display: flex !important;
    align-items: end !important;
    background: rgba(19, 36, 54, 0.7) !important;
    background-image: linear-gradient(140deg, rgba(11, 16, 64, 0.4), rgba(0, 0, 2, 0.6)) !important;
    backdrop-filter: blur(100px) !important;
    border-radius: 16px !important;
    padding: 12px !important;
    border: 2px solid rgba(255, 255, 255, 0.15) !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.3) !important;
  }

  .mobile-input-container:focus-within {
    border-color: rgba(86, 102, 243, 0.6) !important;
    background: rgba(19, 36, 54, 0.9) !important;
    box-shadow: 0 8px 32px rgba(86, 102, 243, 0.3) !important;
  }

  .mobile-chat-input {
    flex: 1 !important;
    background: none !important;
    border: none !important;
    outline: none !important;
    resize: none !important;
    font-size: 16px !important; /* Prevents zoom on iOS */
    color: #ffffff !important;
    min-height: 20px !important;
    max-height: 80px !important;
    padding: 8px 12px !important;
    font-family: inherit !important;
    line-height: 1.4 !important;
  }

  .mobile-chat-input::placeholder {
    color: rgba(255, 255, 255, 0.6) !important;
    opacity: 0.8 !important;
  }

  .mobile-attach-btn {
    background: none !important;
    border: none !important;
    color: rgba(255, 255, 255, 0.7) !important;
    padding: 8px !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    margin-right: 8px !important;
    font-size: 16px !important;
    width: 40px !important;
    height: 40px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .mobile-attach-btn:hover {
    background: rgba(86, 102, 243, 0.2) !important;
    color: #ffffff !important;
  }

  .mobile-send-btn {
    background: linear-gradient(135deg, #5566ff 0%, #6472f3 100%) !important;
    border: none !important;
    color: white !important;
    padding: 10px 12px !important;
    border-radius: 10px !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    margin-left: 8px !important;
    box-shadow: 0 5px 20px rgba(85, 102, 255, 0.3) !important;
    font-size: 16px !important;
    width: 44px !important;
    height: 44px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .mobile-send-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #4455ee 0%, #5361e2 100%) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 8px 25px rgba(85, 102, 255, 0.4) !important;
  }

  .mobile-send-btn:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: 0 2px 10px rgba(85, 102, 255, 0.1) !important;
  }

  /* Message Bubbles */
  .mobile-message {
    display: flex !important;
    margin-bottom: 16px !important;
    animation: fadeIn 0.3s ease-out !important;
  }

  .mobile-message.user {
    flex-direction: row-reverse !important;
  }

  .mobile-message-avatar {
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    background: #3b82f6 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin-right: 12px !important;
    flex-shrink: 0 !important;
    color: white !important;
    font-size: 14px !important;
  }

  .mobile-message.user .mobile-message-avatar {
    background: #6b7280 !important;
    margin-right: 0 !important;
    margin-left: 12px !important;
  }

  .mobile-message-content {
    flex: 1 !important;
    max-width: 85% !important;
    background: rgba(0, 0, 0, 0.15) !important;
    backdrop-filter: blur(100px) !important;
    border-radius: 1.2em !important;
    padding: 14px 16px !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #ffffff !important;
    font-size: 14px !important;
    line-height: 1.6 !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    transition: all 0.3s ease !important;
  }

  .mobile-message.user .mobile-message-content {
    background: linear-gradient(135deg, #5566ff 0%, #6472f3 100%) !important;
    border: 1px solid rgba(84, 102, 255, 0.3) !important;
    box-shadow: 0 4px 20px rgba(85, 102, 255, 0.3) !important;
  }

  /* Typing Indicator */
  .mobile-typing-indicator {
    display: flex !important;
    gap: 4px !important;
    padding: 8px 0 !important;
  }

  .mobile-typing-dot {
    width: 6px !important;
    height: 6px !important;
    background: rgba(255,255,255,0.6) !important;
    border-radius: 50% !important;
    animation: typingDot 1.4s infinite ease-in-out !important;
  }

  .mobile-typing-dot:nth-child(2) {
    animation-delay: 0.16s !important;
  }

  .mobile-typing-dot:nth-child(3) {
    animation-delay: 0.32s !important;
  }

  /* Hide desktop chat on mobile */
  .right-column .chat-card-enhanced {
    display: none !important;
  }

  /* Add bottom padding to content for floating button */
  .analytics-content {
    padding-bottom: 100px !important;
  }

  /* Animations */
  @keyframes fadeIn {
    from {
      opacity: 0;
      transform: translateY(10px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  @keyframes typingDot {
    0%, 80%, 100% {
      transform: scale(0.8);
      opacity: 0.5;
    }
    40% {
      transform: scale(1);
      opacity: 1;
    }
  }
}

/* Smaller mobile devices */
@media (max-width: 480px) {
  .floating-chat-btn {
    bottom: 16px !important;
    right: 16px !important;
    width: 56px !important;
    height: 56px !important;
  }
  
  .floating-chat-btn i {
    font-size: 22px !important;
  }
  
  .mobile-chat-container {
    height: 90vh !important;
    max-height: calc(100vh - 50px) !important;
  }
  
  .mobile-chat-header {
    padding: 20px 20px 16px !important;
  }
  
  .mobile-chat-title {
    font-size: 16px !important;
  }
  
  .mobile-chat-subtitle {
    font-size: 11px !important;
  }
  
  .mobile-chat-messages {
    padding: 16px 20px !important;
    gap: 14px !important;
  }
  
  .mobile-chat-input-area {
    padding: 12px 16px 16px !important;
  }
  
  .analytics-content {
    padding-bottom: 90px !important;
  }
}