/* =============================================
   MODERN CHAT AI ASSISTANT WIDGET
   ============================================= */

/* Floating Chat Button */
.chat-widget-btn-modern {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FF9900 0%, #FF7700 100%);
  box-shadow: 0 6px 20px rgba(255, 153, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 9998;
  transition: all 0.3s ease;
  border: 3px solid rgba(255, 255, 255, 0.3);
  animation: pulse 2s infinite;
}

.chat-widget-btn-modern:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 28px rgba(255, 153, 0, 0.7);
}

.chat-widget-btn-modern.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.8);
}

@keyframes pulse {
  0%, 100% {
    box-shadow: 0 6px 20px rgba(255, 153, 0, 0.5);
  }
  50% {
    box-shadow: 0 6px 30px rgba(255, 153, 0, 0.8);
  }
}

/* AI Badge */
.chat-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #22C55E;
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  border: 2px solid white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Chat Modal */
.chat-widget-modal {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 420px;
  max-width: calc(100vw - 48px);
  height: 650px;
  max-height: calc(100vh - 48px);
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.chat-widget-modal.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.chat-widget-container {
  width: 100%;
  height: 100%;
  background: white;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Header */
.chat-widget-header {
  background: linear-gradient(135deg, #FF9900 0%, #FF7700 100%);
  color: white;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-widget-header-content {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.chat-widget-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.5);
}

.chat-widget-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chat-widget-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.chat-widget-subtitle {
  font-size: 0.85rem;
  opacity: 0.95;
}

.chat-widget-close {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.9;
  transition: opacity 0.2s, transform 0.2s;
  border-radius: 50%;
}

.chat-widget-close:hover {
  opacity: 1;
  transform: scale(1.1);
  background: rgba(255, 255, 255, 0.2);
}

/* AI Suggestions */
.chat-widget-suggestions {
  padding: 16px;
  border-bottom: 1px solid #E5E7EB;
  background: #F9FAFB;
}

.chat-suggestion-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 12px;
}

.chat-suggestions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.chat-suggestion-btn {
  background: white;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s;
  color: #374151;
  font-weight: 500;
}

.chat-suggestion-btn:hover {
  border-color: #FF9900;
  background: #FFFBF3;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 153, 0, 0.15);
}

/* Chat Body */
.chat-widget-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  background: white;
}

.chat-welcome-msg {
  margin-bottom: 16px;
}

.chat-bubble {
  background: #F3F4F6;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 0.9rem;
  line-height: 1.5;
  color: #374151;
  max-width: 85%;
}

.chat-message {
  display: flex;
  margin-bottom: 12px;
}

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

.user-bubble {
  background: linear-gradient(135deg, #FF9900 0%, #FF7700 100%);
  color: white;
}

.chat-message.assistant {
  justify-content: flex-start;
}

.chat-wa-link {
  display: inline-block;
  margin-top: 8px;
  padding: 8px 16px;
  background: #25D366;
  color: white;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.85rem;
  transition: background 0.2s, transform 0.2s;
}

.chat-wa-link:hover {
  background: #20BA5A;
  transform: translateY(-2px);
}

/* Input Footer */
.chat-widget-footer {
  border-top: 1px solid #E5E7EB;
  padding: 16px;
  background: white;
}

.chat-input-wrapper {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  margin-bottom: 8px;
}

.chat-input {
  flex: 1;
  border: 1px solid #E5E7EB;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 0.9rem;
  font-family: inherit;
  resize: none;
  max-height: 120px;
  transition: border-color 0.2s;
  outline: none;
}

.chat-input:focus {
  border-color: #FF9900;
  box-shadow: 0 0 0 3px rgba(255, 153, 0, 0.1);
}

.chat-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FF9900 0%, #FF7700 100%);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s, box-shadow 0.2s;
}

.chat-send-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(255, 153, 0, 0.4);
}

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

.chat-footer-text {
  font-size: 0.75rem;
  color: #9CA3AF;
  text-align: center;
}

/* Scrollbar */
.chat-widget-body::-webkit-scrollbar {
  width: 6px;
}

.chat-widget-body::-webkit-scrollbar-track {
  background: #F3F4F6;
}

.chat-widget-body::-webkit-scrollbar-thumb {
  background: #D1D5DB;
  border-radius: 3px;
}

.chat-widget-body::-webkit-scrollbar-thumb:hover {
  background: #9CA3AF;
}

/* =============================================
   MOBILE RESPONSIVE
   ============================================= */

@media (max-width: 768px) {
  .chat-widget-btn-modern {
    bottom: 80px; /* Above bottom nav */
    right: 16px;
    width: 56px;
    height: 56px;
  }

  .chat-widget-modal {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    border-radius: 0;
  }

  .chat-widget-container {
    border-radius: 0;
  }

  .chat-suggestions-grid {
    grid-template-columns: 1fr;
  }

  .chat-badge {
    font-size: 0.6rem;
    padding: 2px 5px;
  }
}

/* Typing indicator animation */
@keyframes typing {
  0%, 20%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  background: #9CA3AF;
  border-radius: 50%;
  animation: typing 1.4s infinite;
}

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

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