/* Botones de ayuda y chat: la misma apariencia en todas las páginas. */
.fab-menu, .fab-nudge, .chatbot-window {
  --bg: #fcf8f6;
  --white: #ffffff;
  --text: #4a403c;
  --text-light: #7d716b;
  --gold: #c8a76c;
  --gold-dark: #ab8850;
  --pink-soft: #f6eaee;
  --line: rgba(74, 64, 60, 0.12);
  font-family: "Montserrat", sans-serif;
}

.fab-nudge {
  position: fixed;
  right: calc(86px + env(safe-area-inset-right));
  bottom: calc(26px + env(safe-area-inset-bottom));
  max-width: 220px;
  background: var(--white);
  color: var(--text);
  border: 1px solid rgba(74, 64, 60, 0.12);
  border-radius: 16px;
  padding: 10px 30px 10px 14px;
  font-size: 0.82rem;
  line-height: 1.4;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  opacity: 0;
  transform: translateX(8px);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 1001;
}

.fab-nudge.show {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
  animation: nudgeBounce 2.4s ease-in-out infinite;
}

.fab-nudge::after {
  content: "";
  position: absolute;
  right: -6px;
  bottom: 16px;
  width: 12px;
  height: 12px;
  background: var(--white);
  border-right: 1px solid rgba(74, 64, 60, 0.12);
  border-top: 1px solid rgba(74, 64, 60, 0.12);
  transform: rotate(45deg);
}

.fab-nudge-close {
  position: absolute;
  top: 4px;
  right: 6px;
  width: 20px;
  height: 20px;
  border: none;
  background: transparent;
  color: var(--text-light);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}

.fab-nudge-close:hover {
  background: #f7f3f1;
  color: var(--text);
}

.fab-nudge-text {
  display: flex;
  align-items: center;
  gap: 9px;
}

.nudge-ico {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--gold-dark);
}

@keyframes nudgeBounce {
  0%, 100% { transform: translateX(0); }
  50%      { transform: translateX(-3px); }
}

.fab-menu {
  position: fixed;
  right: 20px;
  /* En un iPhone con barra de gestos, 20px desde abajo deja el
     botón justo encima de ella: se toca la barra y se sale de la
     página en lugar de abrir el chat. El safe-area lo corrige y en
     un aparato sin notch vale 0, así que no cambia nada ahí. */
  bottom: calc(20px + env(safe-area-inset-bottom));
  right: calc(20px + env(safe-area-inset-right));
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  pointer-events: none;
}

.fab-menu .fab-main,
.fab-menu.open .fab-items {
  pointer-events: auto;
}

.fab-main {
  width: 52px;
  height: 52px;
  border: none;
  border-radius: 50%;
  background: var(--gold);
  color: var(--white);
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, transform 0.2s ease;
}

.fab-main:hover {
  background: var(--gold-dark);
}

.fab-main svg {
  width: 22px;
  height: 22px;
  transition: transform 0.25s ease;
}

.fab-icon-close { display: none; }
.fab-menu.open .fab-main { transform: rotate(45deg); background: var(--gold-dark); }

.fab-items {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.fab-menu.open .fab-items {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.fab-item {
  position: relative;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--white);
  border: 1px solid rgba(74, 64, 60, 0.12);
  border-radius: 50%;
  color: var(--gold-dark);
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
  text-decoration: none;
  font-family: inherit;
  transition: border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.fab-item:hover {
  border-color: var(--text);
  transform: translateY(-1px);
}

.fab-item svg {
  width: 20px;
  height: 20px;
}

.fab-item.fab-wa svg {
  width: 22px;
  height: 22px;
}

.fab-item.fab-wa {
  background: #25d366;
  border-color: #25d366;
  color: var(--white);
}

.fab-item.fab-wa:hover {
  background: #20b858;
  border-color: #20b858;
}

.fab-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 10px;
  height: 10px;
  background: #e53935;
  border: 2px solid var(--white);
  border-radius: 50%;
  box-sizing: content-box;
}

.fab-badge::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  border: 2px solid #e53935;
  animation: fabBadgePulse 1.8s ease-out infinite;
}

@keyframes fabBadgePulse {
  0%   { transform: scale(1);   opacity: 0.9; }
  80%  { transform: scale(2);   opacity: 0; }
  100% { transform: scale(2);   opacity: 0; }
}

.fab-badge.hidden {
  display: none;
}

.chatbot-window {
  position: fixed;
  right: 22px;
  bottom: 90px;
  width: 320px;
  max-width: calc(100vw - 44px);
  max-height: min(520px, calc(100vh - 140px));
  background: var(--white);
  border: 1px solid rgba(74, 64, 60, 0.1);
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 999;
}

.chatbot-window.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.chatbot-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--white);
  border-bottom: 1px solid rgba(74, 64, 60, 0.08);
}

.chatbot-close {
  margin-left: auto;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--text-light);
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}

.chatbot-close:hover {
  background: #f7f3f1;
  color: var(--text);
}

.chatbot-close svg {
  width: 16px;
  height: 16px;
}

.chatbot-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--pink-soft);
  border: 1px solid rgba(74, 64, 60, 0.1);
  flex-shrink: 0;
}

.chatbot-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.chatbot-meta {
  display: flex;
  flex-direction: column;
}

.chatbot-meta strong {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.9rem;
  color: var(--text);
  font-weight: 500;
  letter-spacing: 0.01em;
}

.chatbot-meta span {
  font-size: 0.7rem;
  color: var(--text-light);
  display: flex;
  align-items: center;
  gap: 5px;
}

.chatbot-meta span i {
  width: 6px;
  height: 6px;
  background: #36c46b;
  border-radius: 50%;
  display: inline-block;
}

.chatbot-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--white);
}

.chatbot-msg {
  max-width: 85%;
  padding: 9px 13px;
  border-radius: 10px;
  font-size: 0.85rem;
  line-height: 1.45;
  animation: chatFade 0.2s ease;
}

.chatbot-msg.bot {
  background: #f7f3f1;
  color: var(--text);
  border-bottom-left-radius: 3px;
  align-self: flex-start;
}

.chatbot-msg.user {
  background: var(--text);
  color: var(--white);
  border-bottom-right-radius: 3px;
  align-self: flex-end;
}

.chatbot-link {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--gold-dark);
  border-bottom: 1px solid rgba(171, 136, 80, 0.4);
  padding-bottom: 1px;
}

.chatbot-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 2px 0;
  animation: chatFade 0.25s ease;
}

.chatbot-chip {
  border: 1px solid rgba(74, 64, 60, 0.15);
  background: var(--white);
  color: var(--text);
  padding: 6px 11px;
  border-radius: 999px;
  font-size: 0.76rem;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
  font-family: inherit;
}

.chatbot-chip:hover {
  border-color: var(--text);
  color: var(--gold-dark);
}

.chatbot-footer {
  padding: 10px 16px;
  text-align: center;
  border-top: 1px solid rgba(74, 64, 60, 0.08);
  background: var(--white);
}

.chatbot-footer small {
  font-size: 0.72rem;
  color: var(--text-light);
}

.chatbot-footer a {
  color: var(--gold-dark);
  font-weight: 500;
}

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


@media (max-width: 768px) {
  .fab-nudge {
    right: 80px;
    max-width: 180px;
    font-size: 0.76rem;
    padding: 9px 26px 9px 12px;
  }
}
