/* ==============================
  Chatbot Styles
============================== */
.chat-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.4);
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.chat-toggle:hover {
  transform: scale(1.05);
}

.chat-modal {
  position: fixed;
  bottom: 90px;
  /* Default Centering Logic for Small Screens */
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 380px;
  max-height: 70vh;
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  overflow: hidden;
  z-index: 50;
  display: none;
  flex-direction: column;
}

/* Desktop Positioning: Shift back to right side */
@media (min-width: 640px) {
  .chat-modal {
    left: auto;
    right: 50px;
    transform: none;
    width: 380px;
  }
}

.chat-modal.show {
  display: flex;
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.chat-header {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: white;
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-header h4 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.chat-close {
  background: none;
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
  opacity: 0.8;
}

.chat-messages {
  flex: 1;
  padding: 16px;
  overflow: auto;
  background: #f8fafc;
}

.chat-bubble {
  margin-bottom: 12px;
  padding: 10px 14px;
  border-radius: 18px;
  max-width: 80%;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.chat-bubble.user {
  background: #3b82f6;
  color: white;
  margin-left: auto;
  text-align: right;
}

.chat-bubble.bot {
  background: white;
  color: #374151;
  border: 1px solid #e5e7eb;
  max-width: 100%;
}

.chat-input-container {
  padding: 16px;
  border-top: 1px solid #e5e7eb;
  background: white;
  display: flex;
}

.chat-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #d1d5db;
  border-radius: 20px;
  outline: none;
}

.chat-send {
  background: #3b82f6;
  color: white;
  border: none;
  padding: 10px 14px;
  border-radius: 50%;
  margin-left: 8px;
  cursor: pointer;
}

.typing-indicator {
  display: flex;
  align-items: center;
  opacity: 0.7;
  font-style: italic;
}

.typing-dots {
  display: flex;
  gap: 4px;
  margin-right: 8px;
}

.typing-dots span {
  width: 8px;
  height: 8px;
  background: #9ca3af;
  border-radius: 50%;
  animation: typing 1.4s infinite;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {

  0%,
  60%,
  100% {
    transform: translateY(0);
  }

  30% {
    transform: translateY(-10px);
  }
}

/* TAP TO ZOOM – KAMAY CURSOR + BUMP EFFECT */
.cursor-pointer {
  cursor: pointer !important;
}

#cleanZoomModal {
  animation: fadeIn 0.3s ease-out;
}

#cleanZoomModal.hidden {
  animation: fadeOut 0.3s ease-out forwards;
  pointer-events: none;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}

#cleanZoomImage {
  max-height: 90vh;
  object-fit: contain;
}

/* IMPROVEMENTS FOR TABLES IN CHAT BUBBLES */
.chat-bubble table {
  table-layout: fixed;
  width: 100%;
  border-collapse: collapse;
}

.chat-bubble th,
.chat-bubble td {
  word-break: break-word;
  overflow-wrap: break-word;
  font-size: 13px;
  border: 1px solid #e5e7eb;
  padding: 10px 8px;
  vertical-align: top;
}

.chat-bubble thead th {
  background: #4a90e2;
  color: white;
  font-weight: 600;
  border: 1px solid #4a90e2;
  text-align: left;
}

.chat-bubble tbody tr:nth-child(even) {
  background: #f8fafc;
}

.chat-bubble tbody tr:nth-child(odd) {
  background: #ffffff;
}

.chat-bubble div[style*="background:#f9f9f9"] {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}