/* Enhanced Chat Widget Styles */

#chat-widget {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.chat-tooltip {
  position: absolute;
  bottom: 80px;
  right: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 12px 16px;
  border-radius: 20px;
  font-size: 14px;
  white-space: nowrap;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  animation: pulse 2s infinite;
  max-width: 280px;
  text-align: center;
  width: fit-content;
}

.chat-tooltip::after {
  content: '';
  position: absolute;
  bottom: -8px;
  right: 20px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid #667eea;
}

.chat-toggle {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.chat-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 25px rgba(102, 126, 234, 0.4);
}

.chat-toggle img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  transition: transform 0.3s ease;
}

.chat-toggle:hover img {
  transform: scale(1.1);
}

#notif-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: #ff4757;
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  animation: bounce 1s infinite;
}

.chat-window {
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 350px;
  height: 500px;
  background: white;
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 9998;
  animation: slideUp 0.3s ease-out;
}

@media (max-width: 768px) {
  .chat-window {
    width: calc(100vw - 40px);
    height: 70vh;
    bottom: 90px;
    right: 20px;
    left: 20px;
  }
}

.chat-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 15px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 16px;
}

.bot-header-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.close-chat {
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

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

.chat-body {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  background: #f8f9fa;
  scroll-behavior: smooth;
}

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

.chat-body::-webkit-scrollbar-track {
  background: #e9ecef;
  border-radius: 3px;
}

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

.chat-body::-webkit-scrollbar-thumb:hover {
  background: #a0aec0;
}

.message {
  margin-bottom: 15px;
  animation: fadeIn 0.3s ease-out;
}

.message.user {
  text-align: right;
  margin-bottom: 15px;
}

.message.user .user-label {
  font-weight: bold;
  color: white;
  font-size: 14px;
  margin-bottom: 4px;
}

.message.user .user-text {
  background: #f8f9fa;
  color: #495057;
  padding: 12px 16px;
  border-radius: 18px 18px 5px 18px;
  display: inline-block;
  max-width: 80%;
  word-wrap: break-word;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border: 1px solid #e9ecef;
}

.message.bot {
  text-align: left;
}

.message.bot > div {
  max-width: 90%;
  width: 100%;
}

.message.bot .bot-content {
  background: white;
  padding: 12px 16px;
  border-radius: 5px 18px 18px 18px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border: 1px solid #e9ecef;
  flex: 1;
  width: 100%;
}

.message.bot p {
  margin: 8px 0;
  line-height: 1.5;
}

.message.bot ul {
  margin: 8px 0;
  padding-left: 20px;
}

.message.bot li {
  margin: 4px 0;
  line-height: 1.4;
}

.message.bot strong {
  color: #2d3748;
  font-weight: 600;
}

.message.bot a {
  color: #25D366;
  text-decoration: none;
  font-weight: 500;
  transition: opacity 0.2s;
}

.message.bot a:hover {
  opacity: 0.8;
  text-decoration: underline;
}

.quick-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}

.quick-btn {
  background: #f8f9fa;
  border: 2px solid #e9ecef;
  padding: 8px 12px;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  color: #495057;
  font-weight: 500;
}

.quick-btn:hover {
  background: #667eea;
  border-color: #667eea;
  color: white;
  transform: translateY(-1px);
}

.info-form input {
  width: 100%;
  margin: 5px 0;
  padding: 10px 12px;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  font-size: 14px;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.info-form input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.info-form button {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  margin-top: 10px;
  cursor: pointer;
  width: 100%;
  font-weight: 600;
  font-size: 14px;
  transition: transform 0.2s;
}

.info-form button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.chat-input {
  padding: 15px 20px;
  background: white;
  border-top: 1px solid #e9ecef;
  display: flex;
  gap: 10px;
  align-items: center;
}

.chat-input input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid #e9ecef;
  border-radius: 25px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.chat-input input:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.chat-input button {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 25px;
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.2s;
  min-width: 70px;
}

.chat-input button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.typing-animation {
  display: flex;
  align-items: center;
  gap: 4px;
}

.typing-animation span {
  width: 6px;
  height: 6px;
  background: #667eea;
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out;
}

.typing-animation span:nth-child(1) {
  animation-delay: -0.32s;
}

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

/* Animations */
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-5px); }
  60% { transform: translateY(-3px); }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .chat-window {
    background: #2d3748;
  }

  .chat-body {
    background: #4a5568;
  }

  .message.bot div > div:last-child {
    background: #2d3748;
    border-color: #4a5568;
    color: #e2e8f0;
  }

  .chat-input {
    background: #2d3748;
    border-color: #4a5568;
  }

  .chat-input input {
    background: #4a5568;
    border-color: #718096;
    color: #e2e8f0;
  }

  .info-form input {
    background: #4a5568;
    border-color: #718096;
    color: #e2e8f0;
  }
}

/* Loading state */
.message.typing {
  opacity: 0.7;
}

/* Accessibility improvements */
.chat-toggle:focus,
.close-chat:focus,
.chat-input button:focus,
.quick-btn:focus,
.info-form button:focus {
  outline: 2px solid #667eea;
  outline-offset: 2px;
}

/* Print styles */
@media print {
  #chat-widget,
  .chat-window {
    display: none !important;
  }
}