
:root {
  --primary-gradient: linear-gradient(135deg, #4E9FA7 0%, #5BB5BD 50%, #68CBD3 100%);
  --secondary-gradient: linear-gradient(135deg, #3A7B83 0%, #4E9FA7 100%);
  --accent-gradient: linear-gradient(135deg, #4E9FA7 0%, #68CBD3 100%);
  --surface-glass: rgba(255, 255, 255, 0.1);
  --surface-card: rgba(255, 255, 255, 0.95);
  --text-primary: #2C3E50;
  --text-secondary: #6C7B7F;
  --text-light: #FFFFFF;
  --shadow-soft: 0 8px 32px rgba(0, 0, 0, 0.12);
  --shadow-medium: 0 12px 40px rgba(0, 0, 0, 0.15);
  --shadow-strong: 0 20px 60px rgba(0, 0, 0, 0.2);
  --border-glass: rgba(255, 255, 255, 0.2);
  --backdrop-blur: blur(20px);
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: all 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

.chatbot-trigger-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

#chatbot-icon {
  width: 64px;
  height: 64px;
  background: var(--primary-gradient);
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-medium);
  transition: var(--transition-bounce);
  position: relative;
  overflow: hidden;
  backdrop-filter: var(--backdrop-blur);
  border: 2px solid var(--border-glass);
  font-size: 56px;
}

#chatbot-icon:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow: var(--shadow-strong);
}

#chatbot-icon:active {
  transform: translateY(-2px) scale(1.02);
}

#chatbot-icon::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 50%;
  background: var(--primary-gradient);
  animation: pulse 2s infinite;
  z-index: -1;
}

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

#chatbot-icon.with-notification::after {
  animation: pulse 1.5s infinite;
}

.chatbot-tooltip {
  position: absolute;
  bottom: 80px;
  right: 0;
  background: var(--surface-card);
  backdrop-filter: var(--backdrop-blur);
  color: var(--text-primary);
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border-glass);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: var(--transition-smooth);
  max-width: 200px;
  text-align: center;
  z-index: 10000;
}

.chatbot-tooltip.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

#chatbot-wrapper {
  position: fixed;
  bottom: 100px;
  right: 20px;
  width: 380px;
  height: 600px;
  background: var(--surface-glass);
  backdrop-filter: var(--backdrop-blur);
  border-radius: 24px;
  box-shadow: var(--shadow-strong);
  border: 1px solid var(--border-glass);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 9998;
  animation: slideIn 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

@keyframes slideIn {
  0% {
    opacity: 0;
    transform: translateY(20px) scale(0.9);
    filter: blur(10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

.chat-header {
  background: var(--primary-gradient);
  color: var(--text-light);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-glass);
  backdrop-filter: var(--backdrop-blur);
}

.chat-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

#close-chat {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: var(--text-light);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: var(--transition-smooth);
  backdrop-filter: blur(10px);
}

#close-chat:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

.progress-container {
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  overflow: hidden;
}

#progress {
  height: 100%;
  background: linear-gradient(90deg, #68CBD3, #FFFFFF);
  width: 0%;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 10px rgba(104, 203, 211, 0.5);
}

.chat-body {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  overflow-x: hidden;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  scroll-behavior: smooth;
  gap: 14px;
  height: 100%;
  max-height: calc(600px - 140px);
}

.bot-message, .user-message {
  padding: 12px 16px;
  border-radius: 16px;
  max-width: 82%;
  position: relative;
  transition: var(--transition-smooth);
  font-size: 13px;
  line-height: 1.5;
  word-wrap: break-word;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  opacity: 0;
  transform: translateY(20px);
}

.message-appear {
  animation: progressiveMessageSlide 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes progressiveMessageSlide {
  0% { 
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    filter: blur(3px);
  }
  100% { 
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

.bot-message.show, .user-message.show {
  opacity: 1;
  transform: translateY(0);
}

.bot-message {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.95);
  color: var(--text-primary);
  margin-right: auto;
  border: 1px solid rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(10px);
}

.user-message {
  align-self: flex-end;
  background: var(--accent-gradient);
  color: var(--text-light);
  margin-left: auto;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.bot-message:hover, .user-message:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

/* IMPROVED Option Buttons */
.option-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
  padding: 0;
}

.option-button, .start-button {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(78, 159, 167, 0.3);
  color: var(--text-primary);
  padding: 12px 16px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  text-align: left;
  transition: var(--transition-smooth);
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.option-button::before, .start-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: var(--secondary-gradient);
  transition: left 0.3s ease;
  z-index: -1;
}

.option-button:hover::before, .start-button:hover::before {
  left: 0;
}

.option-button:hover, .start-button:hover {
  color: var(--text-light);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(78, 159, 167, 0.3);
}

.option-button:active, .start-button:active {
  transform: translateY(0);
}

.option-button.selected-option {
  background: var(--accent-gradient);
  color: var(--text-light);
  border-color: rgba(78, 159, 167, 0.5);
}

.back-button {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(78, 159, 167, 0.3);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 11px;
  padding: 8px 12px;
  transition: var(--transition-smooth);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 10px;
  margin: 6px 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.back-button:hover {
  background: var(--secondary-gradient);
  color: var(--text-light);
  transform: translateX(-2px);
}

button#back-to-main {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(78, 159, 167, 0.3);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 12px;
  padding: 10px 14px;
  transition: var(--transition-smooth);
  display: inline-flex;
  align-items: center;
  border-radius: 12px;
  margin: 8px 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.progressive-typing {
  display: flex;
  align-items: center;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 16px;
  max-width: 80px;
  margin-bottom: 14px;
  animation: progressiveMessageSlide 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  align-self: flex-start;
}

.progressive-typing .typing-dots {
  display: flex;
  gap: 3px;
}

.progressive-typing .typing-dots span {
  width: 7px;
  height: 7px;
  background: var(--text-secondary);
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out both;
}

.progressive-typing .typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.progressive-typing .typing-dots span:nth-child(2) { animation-delay: -0.16s; }
.progressive-typing .typing-dots span:nth-child(3) { animation-delay: 0s; }

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

.result-item {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 12px;
  padding: 16px;
  margin: 8px 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transition: var(--transition-smooth);
  position: relative;
  overflow: hidden;
}

.result-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary-gradient);
}

.result-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.15);
  border-color: rgba(78, 159, 167, 0.4);
}

.result-item strong {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.result-item strong svg {
  opacity: 0.7;
  min-width: 16px;
}

.view-button {
  background: var(--secondary-gradient);
  color: var(--text-light);
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  display: inline-block;
  text-align: center;
  transition: var(--transition-smooth);
  box-shadow: 0 4px 12px rgba(78, 159, 167, 0.3);
  margin-top: 12px;
}

.view-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(78, 159, 167, 0.4);
  background: var(--primary-gradient);
}

/* IMPROVED Chat Input */
.chat-input {
  padding: 20px 24px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border-glass);
  display: block;
}

.chat-input.typing {
  background: rgba(255, 255, 255, 0.15);
}

.input-container {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

#user-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  color: var(--text-primary);
  font-size: 13px;
  resize: none;
  max-height: 120px;
  transition: var(--transition-smooth);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

#user-input:focus {
  outline: none;
  border-color: rgba(78, 159, 167, 0.5);
  box-shadow: 0 4px 15px rgba(78, 159, 167, 0.2);
  background: rgba(255, 255, 255, 0.95);
}

#send-suggest-message {
  background: var(--accent-gradient);
  color: var(--text-light);
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: var(--transition-smooth);
  box-shadow: 0 4px 12px rgba(78, 159, 167, 0.3);
}

#send-suggest-message:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(78, 159, 167, 0.4);
}

#send-suggest-message:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.bot-message.welcome {
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(15px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 18px;
  padding: 20px;
  margin: 0 0 16px 0;
  max-width: 100%;
  align-self: stretch;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.bot-message.welcome::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--primary-gradient);
}

.bot-message.welcome p {
  margin: 0 0 16px 0;
  color: var(--text-primary);
  font-weight: 600;
  width: 100%;
  box-sizing: border-box;
  font-size: 1.4rem;
  letter-spacing: 0.2px;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.bot-message.welcome .option-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.toast-message {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--surface-card);
  backdrop-filter: var(--backdrop-blur);
  color: var(--text-primary);
  padding: 16px 20px;
  border-radius: 12px;
  box-shadow: var(--shadow-medium);
  border: 1px solid var(--border-glass);
  z-index: 10001;
  opacity: 0;
  transform: translateX(100%);
  transition: var(--transition-smooth);
  font-size: 14px;
  font-weight: 500;
  max-width: 300px;
}

.toast-message.show {
  opacity: 1;
  transform: translateX(0);
}

.toast-message.success {
  border-left: 4px solid #4CAF50;
}

.toast-message.error {
  border-left: 4px solid #F44336;
}

.toast-message.warning {
  border-left: 4px solid #FF9800;
}

/* Responsive Design */
@media (max-width: 480px) {
  .chatbot-trigger-container {
    bottom: 15px;
    right: 15px;
  }
  
  #chatbot-wrapper {
    width: calc(100vw - 30px);
    height: calc(100vh - 120px);
    bottom: 85px;
    right: 15px;
    border-radius: 20px;
  }
  
  .chat-header {
    padding: 16px 20px;
  }
  
  .chat-body {
    padding: 16px;
  }
  
  .chat-input {
    padding: 16px 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
} 