/* Premium AI Chatbot Styles */
.chatbot-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
}

@media (max-width: 480px) {
  /* Allow interactions and avoid blocking touch; chatbot hidden for smaller screens via 768px rule */
  .chatbot-container {
    pointer-events: auto;
  }
  .chatbot-toggle {
    pointer-events: auto;
  }
}

/* Hide chatbot completely on most mobile devices to avoid overlap and interaction issues */
@media (max-width: 768px) {
  .chatbot-container {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }
}

.chatbot-toggle {
  width: 70px;
  height: 70px;
  background: linear-gradient(135deg, #ffd700 0%, #ffb700 50%, #ff8f00 100%);
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 
    0 8px 32px rgba(255, 215, 0, 0.4),
    0 0 0 0 rgba(255, 215, 0, 0.7),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  backdrop-filter: blur(10px);
  animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 
      0 8px 32px rgba(255, 215, 0, 0.4),
      0 0 0 0 rgba(255, 215, 0, 0.7),
      inset 0 1px 0 rgba(255, 255, 255, 0.2);
  }
  50% {
    box-shadow: 
      0 8px 32px rgba(255, 215, 0, 0.6),
      0 0 0 10px rgba(255, 215, 0, 0),
      inset 0 1px 0 rgba(255, 255, 255, 0.3);
  }
}

.chatbot-toggle:hover {
  transform: scale(1.15) rotate(5deg);
  box-shadow: 
    0 12px 40px rgba(255, 215, 0, 0.6),
    0 0 0 0 rgba(255, 215, 0, 0.7),
    inset 0 2px 0 rgba(255, 255, 255, 0.3);
  animation: none;
}

.chatbot-toggle:active {
  transform: scale(1.05);
}

.chatbot-toggle ion-icon {
  font-size: 32px;
  color: white;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.chatbot-window {
  position: absolute;
  bottom: 90px;
  right: 0;
  width: 380px;
  height: 550px;
  background: linear-gradient(145deg, 
    rgba(255, 255, 255, 0.95) 0%,
    rgba(255, 255, 255, 0.9) 50%,
    rgba(248, 250, 252, 0.95) 100%);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 20px;
  box-shadow: 
    0 20px 60px rgba(0, 0, 0, 0.15),
    0 8px 32px rgba(102, 126, 234, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  display: none;
  flex-direction: column;
  overflow: hidden;
  backdrop-filter: blur(20px);
}

.chatbot-window.active {
  display: flex;
  animation: slideUpPremium 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chatbot-window::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, 
    transparent 0%,
    rgba(102, 126, 234, 0.5) 50%,
    transparent 100%);
  z-index: 1;
}

@keyframes slideUpPremium {
  0% {
    opacity: 0;
    transform: translateY(30px) scale(0.9);
    filter: blur(5px);
  }
  60% {
    opacity: 0.8;
    transform: translateY(-5px) scale(1.02);
    filter: blur(1px);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

.chatbot-header {
  display: flex;
  align-items: center;
  padding: 20px 25px;
  background: linear-gradient(135deg, 
    #ffd700 0%, 
    #ffb700 50%, 
    #ff8f00 100%);
  border-radius: 20px 20px 0 0;
  position: relative;
  box-shadow: 
    0 4px 20px rgba(255, 215, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.chatbot-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, 
    rgba(255, 255, 255, 0.1) 0%,
    transparent 50%,
    rgba(255, 255, 255, 0.05) 100%);
  border-radius: 20px 20px 0 0;
}

.chatbot-avatar {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  overflow: hidden;
  margin-right: 15px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  position: relative;
  z-index: 1;
}

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

.chatbot-info h4 {
  color: white;
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  position: relative;
  z-index: 1;
}

.chatbot-info h4::after {
  content: '✨';
  margin-left: 8px;
  animation: sparkle 2s ease-in-out infinite;
}

@keyframes sparkle {
  0%, 100% { opacity: 0.7; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.2); }
}

.chatbot-info span {
  color: rgba(255, 255, 255, 0.9);
  font-size: 13px;
  font-weight: 500;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  position: relative;
  z-index: 1;
}

.chatbot-close {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  font-size: 18px;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  backdrop-filter: blur(10px);
  position: relative;
  z-index: 1;
}

.chatbot-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1) rotate(90deg);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.chatbot-close:active {
  transform: scale(0.95) rotate(90deg);
}

.chatbot-messages {
  flex: 1;
  padding: 25px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: linear-gradient(180deg,
    rgba(248, 250, 252, 0.9) 0%,
    rgba(255, 255, 255, 0.8) 100%);
  position: relative;
}

.chatbot-messages::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 20px;
  background: linear-gradient(180deg,
    rgba(102, 126, 234, 0.05) 0%,
    transparent 100%);
  pointer-events: none;
}

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

.chatbot-messages::-webkit-scrollbar-track {
  background: rgba(102, 126, 234, 0.1);
  border-radius: 10px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
  border-radius: 10px;
  transition: all 0.3s ease;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #5a6fd8 0%, #6a4190 100%);
}

.message {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  animation: messageSlideIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes messageSlideIn {
  0% {
    opacity: 0;
    transform: translateY(15px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.message-content {
  max-width: 80%;
  padding: 14px 18px;
  border-radius: 20px;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.5;
  word-wrap: break-word;
}

.bot-message .message-content {
  background: linear-gradient(145deg,
    rgba(255, 255, 255, 0.95) 0%,
    rgba(248, 250, 252, 0.9) 100%);
  color: #2d3748;
  border-radius: 20px 20px 20px 6px;
  box-shadow: 
    0 4px 15px rgba(0, 0, 0, 0.08),
    0 2px 8px rgba(0, 0, 0, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(102, 126, 234, 0.1);
  backdrop-filter: blur(10px);
  position: relative;
}

.bot-message .message-content::before {
  content: '🤖';
  position: absolute;
  left: -25px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  opacity: 0.7;
}

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

.user-message .message-content {
  background: linear-gradient(135deg, 
    #ffd700 0%, 
    #ffb700 50%, 
    #ff8f00 100%);
  color: white;
  border-radius: 20px 20px 6px 20px;
  box-shadow: 
    0 4px 15px rgba(255, 215, 0, 0.3),
    0 2px 8px rgba(255, 183, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  position: relative;
}

.user-message .message-content::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg,
    rgba(255, 255, 255, 0.1) 0%,
    transparent 50%,
    rgba(255, 255, 255, 0.05) 100%);
  border-radius: 20px 20px 6px 20px;
  pointer-events: none;
}

.chatbot-input {
  display: flex;
  padding: 25px;
  background: linear-gradient(145deg,
    rgba(255, 255, 255, 0.95) 0%,
    rgba(248, 250, 252, 0.9) 100%);
  border-radius: 0 0 20px 20px;
  gap: 12px;
  border-top: 1px solid rgba(102, 126, 234, 0.1);
  backdrop-filter: blur(10px);
  position: relative;
}

.chatbot-input::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(102, 126, 234, 0.3) 50%,
    transparent 100%);
}

.chatbot-input input {
  flex: 1;
  background: linear-gradient(145deg,
    rgba(255, 255, 255, 0.9) 0%,
    rgba(248, 250, 252, 0.8) 100%);
  border: 2px solid rgba(102, 126, 234, 0.2);
  border-radius: 30px;
  padding: 14px 20px;
  color: #2d3748;
  font-size: 15px;
  font-weight: 500;
  outline: none;
  backdrop-filter: blur(10px);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 
    inset 0 2px 4px rgba(0, 0, 0, 0.05),
    0 2px 8px rgba(102, 126, 234, 0.1);
}

.chatbot-input input:focus {
  border-color: #667eea;
  box-shadow: 
    0 0 0 4px rgba(102, 126, 234, 0.15),
    inset 0 2px 4px rgba(0, 0, 0, 0.05),
    0 4px 15px rgba(102, 126, 234, 0.2);
  transform: translateY(-1px);
}

.chatbot-input input::placeholder {
  color: rgba(45, 55, 72, 0.6);
  font-weight: 400;
}

.chatbot-input button {
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, 
    #ffd700 0%, 
    #ffb700 50%, 
    #ff8f00 100%);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 600;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 
    0 4px 15px rgba(255, 215, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
}

.chatbot-input button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.2) 50%,
    transparent 100%);
  transition: left 0.5s ease;
}

.chatbot-input button:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 
    0 8px 25px rgba(255, 215, 0, 0.4),
    inset 0 2px 0 rgba(255, 255, 255, 0.3);
}

.chatbot-input button:hover::before {
  left: 100%;
}

.chatbot-input button:active {
  transform: translateY(-1px) scale(1.02);
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  padding: 14px 18px;
  background: rgba(248, 250, 252, 0.9);
  border-radius: 20px 20px 20px 6px;
  margin-bottom: 18px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ffd700;
  margin: 0 2px;
  animation: typingDots 1.4s ease-in-out infinite;
}

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

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

/* Quick Replies */
.quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 15px 0;
}

.quick-reply {
  background: linear-gradient(145deg,
    rgba(255, 255, 255, 0.9) 0%,
    rgba(248, 250, 252, 0.8) 100%);
  color: #2d3748;
  border: 1px solid rgba(102, 126, 234, 0.2);
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.quick-reply:hover {
  background: linear-gradient(135deg, #ffd700 0%, #ffb700 100%);
  color: white;
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
}

@media (max-width: 480px) {
  .chatbot-window {
    width: calc(100vw - 30px);
    height: calc(100vh - 130px);
    bottom: 110px;
    right: 15px;
    border-radius: 15px;
    z-index: 5 !important;
  }
  
  .chatbot-toggle {
    width: 60px;
    height: 60px;
    font-size: 24px;
    bottom: 15px;
    right: 15px;
  }
  
  .chatbot-header {
    padding: 15px 20px;
    border-radius: 15px 15px 0 0;
  }
  
  .chatbot-messages {
    padding: 20px;
  }
  
  .chatbot-input {
    padding: 20px;
    border-radius: 0 0 15px 15px;
  }
}

/* DEBUG helpers: enable by adding class `debug-chatbot` to <body> */
/* debug styles removed */