/* Hostels4Youth AI Chatbot Widget Styles */
:root {
  --h4y-chat-primary: #2f5bff;
  --h4y-chat-primary-dark: #1f45d8;
  --h4y-chat-accent: #0ab39c;
  --h4y-chat-bg: #ffffff;
  --h4y-chat-text: #1b1f2a;
  --h4y-chat-muted: #6b7280;
  --h4y-chat-border: #e6eaf6;
  --h4y-chat-user-bubble: #2f5bff;
  --h4y-chat-bot-bubble: #f6f8ff;
  --h4y-chat-shadow: 0 18px 45px rgba(16, 32, 86, 0.18);
}

#hostels4youth-chatbot-container {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9999;
  font-family: "DM Sans", "Segoe UI", sans-serif;
}

.h4y-chat-widget {
  position: relative;
}

.h4y-chat-toggle {
  width: 62px;
  height: 62px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--h4y-chat-primary), #486dff 60%, #6f8cff);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: var(--h4y-chat-shadow);
  cursor: pointer;
  transition: transform 0.24s ease, box-shadow 0.24s ease;
}

.h4y-chat-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 22px 40px rgba(17, 40, 110, 0.28);
}

.h4y-chat-toggle svg {
  width: 24px;
  height: 24px;
}

.h4y-chat-toggle .h4y-close-icon {
  display: none;
  font-size: 26px;
  line-height: 1;
}

.h4y-chat-widget.is-open .h4y-open-icon {
  display: none;
}

.h4y-chat-widget.is-open .h4y-close-icon {
  display: block;
}

.h4y-chat-window {
  position: absolute;
  right: 0;
  bottom: 78px;
  width: min(380px, calc(100vw - 24px));
  height: min(620px, calc(100vh - 150px));
  border: 1px solid var(--h4y-chat-border);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(6px);
  box-shadow: var(--h4y-chat-shadow);
  display: none;
  overflow: hidden;
}

.h4y-chat-widget.is-open .h4y-chat-window {
  display: flex;
  flex-direction: column;
  animation: h4yChatPop 0.2s ease;
}

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

.h4y-chat-header {
  padding: 14px 16px;
  color: #fff;
  background: linear-gradient(135deg, var(--h4y-chat-primary), #425efe);
  display: flex;
  align-items: center;
  gap: 10px;
}

.h4y-chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: grid;
  place-items: center;
  font-size: 20px;
}

.h4y-chat-header h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.2;
}

.h4y-chat-header p {
  margin: 2px 0 0;
  font-size: 0.78rem;
  opacity: 0.9;
}

.h4y-chat-messages {
  flex: 1;
  padding: 16px 14px;
  background: linear-gradient(180deg, #f8faff 0%, #fefeff 100%);
  overflow-y: auto;
}

.h4y-chat-message {
  display: flex;
  margin: 0 0 14px;
}

.h4y-chat-message p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.h4y-chat-message span {
  display: block;
  margin-top: 6px;
  font-size: 0.7rem;
  color: var(--h4y-chat-muted);
}

.h4y-chat-message.bot {
  justify-content: flex-start;
}

.h4y-chat-message.bot .bubble {
  max-width: 86%;
  padding: 10px 12px;
  border-radius: 15px 15px 15px 6px;
  background: var(--h4y-chat-bot-bubble);
  border: 1px solid #eaf0ff;
}

.h4y-chat-message.user {
  justify-content: flex-end;
}

.h4y-chat-message.user .bubble {
  max-width: 86%;
  padding: 10px 12px;
  border-radius: 15px 15px 6px 15px;
  background: var(--h4y-chat-user-bubble);
  color: #fff;
}

.h4y-chat-message.user span {
  color: #d8e1ff;
}

.h4y-chat-typing {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 0 14px 12px;
  color: var(--h4y-chat-muted);
  font-size: 0.8rem;
}

.h4y-chat-typing.show {
  display: flex;
}

.h4y-chat-dots {
  display: inline-flex;
  gap: 4px;
}

.h4y-chat-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--h4y-chat-muted);
  display: block;
  animation: h4yDots 1s infinite ease-in-out;
}

.h4y-chat-dots i:nth-child(2) {
  animation-delay: 0.15s;
}

.h4y-chat-dots i:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes h4yDots {
  0%,
  100% {
    transform: translateY(0);
    opacity: 0.35;
  }
  50% {
    transform: translateY(-3px);
    opacity: 1;
  }
}

.h4y-chat-quick {
  padding: 10px 12px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  border-top: 1px solid var(--h4y-chat-border);
  background: #fff;
}

.h4y-chat-quick button {
  border: 1px solid #d9e2ff;
  border-radius: 10px;
  padding: 8px 7px;
  background: #f8faff;
  color: #324a96;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.h4y-chat-quick button:hover {
  border-color: #9cb4ff;
  background: #eef3ff;
}

.h4y-chat-input-row {
  padding: 10px 12px 12px;
  display: flex;
  gap: 8px;
  border-top: 1px solid var(--h4y-chat-border);
  background: #fff;
}

.h4y-chat-input {
  flex: 1;
  border: 1px solid #d6def8;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 0.9rem;
  outline: none;
}

.h4y-chat-input:focus {
  border-color: #8ca4ff;
  box-shadow: 0 0 0 3px rgba(47, 91, 255, 0.12);
}

.h4y-chat-send {
  border: none;
  border-radius: 999px;
  min-width: 90px;
  padding: 10px 14px;
  background: linear-gradient(135deg, var(--h4y-chat-primary), var(--h4y-chat-primary-dark));
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.h4y-chat-send:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ============================================================
   CONTACT SECTION (WhatsApp & Instagram)
   ============================================================ */
.h4y-chat-contact-section {
  padding: 14px 12px 12px;
  border-top: 1px solid var(--h4y-chat-border);
  background: linear-gradient(180deg, #fafbff 0%, #fff 100%);
  text-align: center;
}

.h4y-contact-text {
  margin: 0 0 8px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--h4y-chat-muted);
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.h4y-contact-buttons {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.h4y-btn-whatsapp,
.h4y-btn-instagram {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 14px;
  border: none;
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.22s ease, box-shadow 0.22s ease, filter 0.22s ease;
  flex: 1;
  min-width: 130px;
  max-width: 160px;
}

.h4y-btn-whatsapp {
  background: #25D366;
  color: #fff;
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.25);
}

.h4y-btn-whatsapp:hover {
  background: #1fb355;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(37, 211, 102, 0.35);
}

.h4y-btn-whatsapp:active {
  transform: translateY(0);
}

.h4y-btn-instagram {
  background: linear-gradient(135deg, #fd5949 0%, #d6249f 50%, #285AEB 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(212, 36, 159, 0.25);
}

.h4y-btn-instagram:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(212, 36, 159, 0.35);
  filter: brightness(1.05);
}

.h4y-btn-instagram:active {
  transform: translateY(0);
}

.h4y-btn-whatsapp svg,
.h4y-btn-instagram svg {
  display: inline-block;
  flex-shrink: 0;
}

@media (max-width: 640px) {
  #hostels4youth-chatbot-container {
    right: 12px;
    bottom: 12px;
  }

  .h4y-chat-window {
    width: min(96vw, 380px);
    height: min(72vh, 560px);
    right: -2px;
  }

  .h4y-chat-quick {
    grid-template-columns: 1fr;
  }

  .h4y-contact-buttons {
    flex-direction: column;
  }

  .h4y-btn-whatsapp,
  .h4y-btn-instagram {
    min-width: auto;
    width: 100%;
    max-width: 100%;
  }
}

/* Pulse animation for conversion prompts */
.h4y-pulse {
  animation: h4yPulse 1s ease-in-out 3 !important;
}

@keyframes h4yPulse {
  0%, 100% {
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.25);
  }
  50% {
    box-shadow: 0 4px 24px rgba(37, 211, 102, 0.6);
  }
}

/* Conversion message styling */
.h4y-chat-message.conversion {
  background: linear-gradient(135deg, rgba(37, 211, 102, 0.08) 0%, rgba(212, 36, 159, 0.08) 100%);
  padding: 8px;
  border-radius: 10px;
  margin: 12px 0;
}

.h4y-chat-message.conversion .bubble {
  background: linear-gradient(135deg, #f0fff8 0%, #fff5f9 100%);
  border: 1px solid rgba(37, 211, 102, 0.2);
  border-left: 3px solid #25D366;
}

/* Enhanced spacing for contact section */
.h4y-chat-contact-section {
  padding: 16px 12px 12px;
  margin-top: 8px;
  border-top: 2px solid var(--h4y-chat-border);
  background: linear-gradient(180deg, #fafbff 0%, #fff 100%);
  text-align: center;
}

.h4y-contact-buttons {
  margin-top: 10px;
  gap: 10px;
}

/* Improved message spacing */
.h4y-chat-messages {
  gap: 4px;
  padding: 16px 14px;
}

.h4y-chat-message {
  margin-bottom: 16px;
}
