/* Main Chatbot Container */
#chatbot-container {
  position: fixed;
  bottom: 90px; /* matches bottomOffset in JS */
  right: 80px;
  width: 400px;
  max-width: 90vw;
  background: #fff;
  border: 1px solid #eee;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  overflow: hidden;
  z-index: 99;
  animation: bounceIn 0.3s;
  font-family: 'Mulish', sans-serif;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  /* remove fixed height */
}

body.chatbot-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
}

/* Chat Header */
.chat-header {
  display: flex;
  align-items: center;
  padding: 15px;
  background: #fff;
  border-bottom: 1px solid #f0f0f0;
  position: relative;
  flex-shrink: 0;
}

.avatar {
  width: 40px;
  height: 40px;
  background: #f1c6c0;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-right: 10px;
  flex-shrink: 0;
}

.agent-name {
  font-weight: bold;
  font-size: 16px;
  color: black;
}

.status {
  display: flex;
  align-items: center;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: #4caf50;
  border-radius: 50%;
  margin-right: 5px;
}

.status-texts {
  font-size: 12px;
  color: #666;
}

#chat-close {
  margin-left: auto;
  cursor: pointer;
  flex-shrink: 0;
}

/* Language Selector */
.language-selector {
  position: absolute;
  top: 20px;
  right: 45px;
  z-index: 10;
}

#language-select {
  padding: 6px 28px 6px 10px;
  border-radius: 6px;
  border: 1px solid #e0e0e0;
  background: #ffffff;
  font-family: 'Mulish', sans-serif;
  font-size: 13px;
  color: #333;
  cursor: pointer;
  appearance: none;
  background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23131313%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E');
  background-repeat: no-repeat;
  background-position: right 10px top 50%;
  background-size: 10px auto;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  transition: all 0.2s ease;
}

#language-select:hover {
  border-color: #0e1a2f;
}

#language-select:focus {
  outline: none;
  border-color: #0e1a2f;
  box-shadow: 0 0 0 2px rgba(14, 26, 47, 0.2);
}

/* Language Notification */
/* Language Notification */
.language-notification {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 15px;
  background: #f0f7ff;
  border-bottom: 1px solid #e0e8f5;
  font-family: 'Mulish', sans-serif;
  font-size: 13px;
  color: #333;
  flex-shrink: 0;
  min-height: 40px; /* Reserve height even if empty */
  transition: background 0.3s ease;
}

.language-notification:empty {
  background: transparent;
  border-bottom: none;
  min-height: 40px; /* same fixed height */
  pointer-events: none; /* prevent accidental clicks */
}

.notification-content {
  flex: 1;
}

.notification-content p {
  margin: 0;
  color: #0e1a2f;
  font-weight: 500;
}

.notification-close {
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.05);
  margin-left: 10px;
  transition: background 0.2s ease;
}

.notification-close:hover {
  background: rgba(0, 0, 0, 0.1);
}

/* Chat Messages Area */
#chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
  background: #f9f9f9;
  font-family: 'Mulish', sans-serif;
  font-size: 14px;
  color: #333;
  display: flex;
  flex-direction: column;
  max-height: calc(80vh - 130px);
  height: auto;
  -webkit-overflow-scrolling: touch;
}

#chat-messages::-webkit-scrollbar {
  width: 6px;
}

#chat-messages::-webkit-scrollbar-track {
  background: #f1f1f1;
}

#chat-messages::-webkit-scrollbar-thumb {
  background: #ddd;
  border-radius: 3px;
}

#chat-messages::-webkit-scrollbar-thumb:hover {
  background: #ccc;
}

/* Message Containers */
#chat-messages > div {
  margin-bottom: 15px;
  width: 100%;
}

#user-message-template {
  display: flex;
  flex-direction: row-reverse;
}

#bot-message-template,
.contact-form-container {
  display: flex;
  flex-direction: row;
}

/* Message Bubbles */
.message-bubble {
  padding: 10px 15px;
  border-radius: 18px;
  max-width: 85%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
}

.message-bubble.user {
  background: #0e1a2f;
  color: white;
  margin-left: 10px;
}

.message-bubble.bot {
  background: #fff;
}

/* Fix bullet point spacing */
.message-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.4; /* Reduced from 1.625 */
  font-family: Mulish, sans-serif;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
  white-space: pre-wrap;
}

.message-text ul {
  margin: 0.5em 0; /* Reduced margins */
  /* padding-left: 1.2em; */
  list-style-type: disc;
}

.message-text li {
  margin: 0.2em 0; /* Minimal spacing between items */
  padding: 0;
  line-height: 1.3;
}

.message-text ul ul {
  margin: 0.2em 0; /* Nested lists */
}

/* Contact Form */
.form-container {
  background: #fff;
  padding: 15px;
  border-radius: 10px;
  max-width: 85%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.form-title {
  margin-top: 0;
  margin-bottom: 5px;
  font-size: 15px;
  font-weight: 500;
}

.form-subtitle {
  margin-top: 0;
  margin-bottom: 14px;
  font-size: 14px;
  word-wrap: break-word;
}

/* Form Elements */
.form-group {
  margin-bottom: 10px;
  position: relative;
}

.chat-contact-form input,
.chat-contact-form textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  font-size: 14px;
  box-sizing: border-box;
}

.chat-contact-form textarea {
  resize: none;
}

.required {
  color: red;
  position: absolute;
  top: 10px;
  right: 10px;
}

.validation-message {
  color: #d9534f;
  font-size: 12px;
  margin-top: 4px;
  display: none;
}

.chat-contact-form button {
  width: 100%;
  padding: 12px;
  background: #0e1a2f;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.chat-header-info {
  margin-left: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-contact-form button:hover {
  background: #1a2d4f;
}

.chat-contact-form input:focus,
.chat-contact-form textarea:focus {
  outline: none;
  border-color: #0e1a2f;
}

/* Chat Input Area */
.chat-input-area {
  padding: 15px;
  background: #fff;
  border-top: 1px solid #f0f0f0;
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

#chat-input {
  flex: 1;
  padding: 10px 10px 13px 10px;
  border: 1px solid #e0e0e0;
  border-radius: 0.875rem;
  outline: none;
  font-size: 14px;
  font-family: 'Mulish', sans-serif;
}

#chat-send {
  background: #0e1a2f;
  color: white;
  border: none;
  border-radius: 0.875rem;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: grid;
  justify-content: center;
  flex-shrink: 0;
}

#chat-send svg {
  position: relative;
  bottom: -8px;
}

/* Chat Button */
#chat-button {
  position: fixed;
  bottom: 27px;
  right: 80px;
  width: 60px;
  height: 60px;
  background: #f1f1f1;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  z-index: 99;
}

/* Chat Popup Styles */
#chat-popup {
  position: fixed;
  bottom: 97px; /* Just above the chat button */
  right: 73px;
  z-index: 99;
  animation: popupSlideIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  font-family: 'Mulish', sans-serif;
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.12));
}

.popup-content {
  background: linear-gradient(135deg, #ffffff 0%, #fafbfc 100%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  padding: 18px 20px 16px 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08), 0 4px 16px rgba(0, 0, 0, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  max-width: 240px;
  position: relative;
  backdrop-filter: blur(10px);
  border-left: 3px solid #0e1a2f;
}

.popup-content::before {
  content: '';
  position: absolute;
  top: -1px;
  left: -1px;
  right: -1px;
  bottom: -1px;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.4) 0%,
    rgba(255, 255, 255, 0.1) 100%
  );
  border-radius: 16px;
  z-index: -1;
}

.popup-close {
  position: absolute;
  top: 10px;
  right: 10px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.04);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(10px);
}

.popup-close:hover {
  background: rgba(0, 0, 0, 0.08);
  transform: scale(1.1);
}

.popup-close:active {
  transform: scale(0.95);
}

.popup-close svg {
  transition: all 0.2s ease;
}

.popup-close:hover svg {
  stroke: #0e1a2f;
}

.popup-text {
  margin: 0;
  padding-right: 30px;
  font-size: 14px;
  color: #2c3e50;
  line-height: 1.5;
  font-weight: 500;
  letter-spacing: -0.01em;
  z-index: auto;
}

.popup-text::before {
  content: '👋';
  margin-right: 8px;
  font-size: 16px;
  display: inline-block;
  animation: wave 1s ease-in-out infinite alternate;
}

.popup-arrow {
  position: absolute;
  bottom: -10px;
  right: 28px;
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 10px solid #ffffff;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.popup-arrow::before {
  content: '';
  position: absolute;
  bottom: 1px;
  left: -11px;
  width: 0;
  height: 0;
  border-left: 11px solid transparent;
  border-right: 11px solid transparent;
  border-top: 11px solid rgba(255, 255, 255, 0.2);
}

/* Animation */
@keyframes bounceIn {
  0% {
    transform: scale(0.8);
    opacity: 0;
  }
  60% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes popupSlideIn {
  0% {
    opacity: 0;
    transform: translateY(20px) scale(0.8);
    filter: blur(4px);
  }
  50% {
    opacity: 0.8;
    transform: translateY(-5px) scale(1.02);
    filter: blur(2px);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes popupSlideOut {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
  100% {
    opacity: 0;
    transform: translateY(15px) scale(0.9);
    filter: blur(2px);
  }
}

@keyframes wave {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(20deg);
  }
}

@keyframes pulseGlow {
  0%,
  100% {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08), 0 4px 16px rgba(0, 0, 0, 0.04),
      inset 0 1px 0 rgba(255, 255, 255, 0.8);
  }
  50% {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 4px 16px rgba(0, 0, 0, 0.06),
      inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 0 20px rgba(14, 26, 47, 0.1);
  }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  #chatbot-container {
    width: 90vw;
    right: 5vw;
    bottom: 80px;
    height: 80vh;
    max-height: 90vh;
  }

  #chat-messages {
    max-height: calc(80vh - 130px);
  }

  .language-selector {
    top: 14px;
    right: 40px;
  }

  .language-notification {
    padding: 8px 12px;
  }

  .notification-content p {
    font-size: 12px;
  }

  .chat-header-info {
    max-width: 140px;
  }

  .avatar {
    width: 36px;
    height: 36px;
  }

  #chat-popup {
    right: 5vw;
    bottom: 85px;
  }

  .popup-content {
    max-width: 200px;
    padding: 16px 18px 14px 18px;
  }

  .popup-text {
    font-size: 13px;
    padding-right: 28px;
  }

  .popup-arrow {
    right: 22px;
  }
}

@media (max-width: 480px) {
  #chatbot-container {
    width: 95vw;
    right: 2.5vw;
    bottom: 75px;
    height: 75vh;
    max-height: 85vh;
  }

  #chat-messages {
    max-height: calc(75vh - 130px);
    padding: 10px;
  }

  .message-bubble {
    max-width: 90%;
  }

  .chat-header-info {
    max-width: 100px;
  }

  .avatar {
    width: 32px;
    height: 32px;
  }

  .chat-input-area {
    padding: 10px;
  }

  #chat-input {
    padding: 8px;
  }

  #chat-popup {
    right: 2.5vw;
    bottom: 80px;
  }

  .popup-content {
    max-width: 180px;
    padding: 14px 16px 12px 16px;
  }

  .popup-text {
    font-size: 12px;
    padding-right: 26px;
  }

  .popup-close {
    width: 22px;
    height: 22px;
    top: 8px;
    right: 8px;
  }

  .popup-arrow {
    right: 80px;
    bottom: -9px;
    border-left-width: 9px;
    border-right-width: 9px;
    border-top-width: 9px;
  }

  .popup-arrow::before {
    left: -10px;
    border-left-width: 10px;
    border-right-width: 10px;
    border-top-width: 10px;
  }
}

@media (max-height: 600px) {
  #chat-messages {
    max-height: calc(60vh - 130px);
  }
}
