/* ==========================================================================
   GERARDO DEV — ILLUSTRATED CHARACTER ASSISTANT BOT (100% DETERMINISTIC JS)
   ========================================================================== */

.gds-bot {
  position: fixed;
  right: clamp(16px, 2.2vw, 28px);
  bottom: clamp(16px, 2.2svh, 26px);
  z-index: 90;
  font-family: 'DM Sans', Arial, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  pointer-events: none;
}

/* Hide bot cleanly when fullscreen menu or contact modal is open */
body:has(#navigation[open]) .gds-bot,
body:has(#gds-contact-modal[open]) .gds-bot,
html.is-intro-pending .gds-bot {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Floating Character Launcher Pill */
.gds-bot__launcher {
  pointer-events: auto;
  appearance: none;
  border: 1px solid rgba(96, 165, 250, 0.38);
  background: linear-gradient(135deg, #071433 0%, #0b2159 100%);
  color: #ffffff;
  border-radius: 999px;
  padding: 6px 18px 6px 6px;
  display: inline-flex;
  align-items: center;
  gap: 11px;
  cursor: pointer;
  box-shadow:
    0 16px 38px rgba(2, 11, 28, 0.42),
    0 0 0 1px rgba(255, 255, 255, 0.06) inset;
  transition:
    transform 0.28s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.28s ease,
    border-color 0.28s ease;
}

.gds-bot__launcher:hover {
  transform: translateY(-3px);
  border-color: rgba(147, 197, 253, 0.78);
  box-shadow:
    0 20px 44px rgba(1, 43, 186, 0.42),
    0 0 0 1px rgba(255, 255, 255, 0.14) inset;
}

.gds-bot__launcher:focus-visible {
  outline: 2px solid #60a5fa;
  outline-offset: 3px;
}

.gds-bot__avatar-wrap {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #012bba;
  border: 2px solid rgba(255, 255, 255, 0.85);
  overflow: visible;
}

.gds-bot__avatar-wrap img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 22%;
  display: block;
}

.gds-bot__status-dot {
  position: absolute;
  right: -1px;
  bottom: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #10b981;
  border: 2px solid #071433;
}

.gds-bot__launcher-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  line-height: 1.18;
}

.gds-bot__launcher-eyebrow {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: #93c5fd;
  margin-bottom: 2px;
}

.gds-bot__launcher-title {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: #ffffff;
}

.gds-bot.is-open .gds-bot__launcher,
.gds-bot.is-open .gds-bot__whatsapp {
  display: none;
}

/* Floating Official WhatsApp Button Above Bot Launcher */
.gds-bot__whatsapp {
  pointer-events: auto;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: #25D366;
  color: #ffffff;
  border: 2px solid rgba(255, 255, 255, 0.92);
  display: grid;
  place-items: center;
  text-decoration: none;
  box-shadow:
    0 14px 32px rgba(2, 11, 28, 0.36),
    0 4px 12px rgba(37, 211, 102, 0.35);
  transition:
    transform 0.28s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.28s ease,
    background-color 0.2s ease;
}

.gds-bot__whatsapp:hover {
  background: #20bd5a;
  transform: translateY(-3px) scale(1.04);
  box-shadow:
    0 18px 38px rgba(2, 11, 28, 0.44),
    0 6px 18px rgba(37, 211, 102, 0.5);
}

.gds-bot__whatsapp:focus-visible {
  outline: 2px solid #25D366;
  outline-offset: 3px;
}

.gds-bot__whatsapp-icon {
  width: 30px;
  height: 30px;
  display: block;
}

/* Chat Panel */
.gds-bot__panel {
  pointer-events: auto;
  width: min(392px, calc(100vw - 24px));
  height: min(585px, calc(100dvh - 44px));
  background: #ffffff;
  color: #0b1736;
  border-radius: 20px;
  border: 1px solid rgba(11, 23, 54, 0.16);
  box-shadow: 0 28px 75px rgba(2, 11, 28, 0.38);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
  transition:
    opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.gds-bot__panel[hidden] {
  display: none !important;
}

/* Panel Header */
.gds-bot__header {
  background: linear-gradient(135deg, #012bba 0%, #071642 100%);
  color: #ffffff;
  padding: 15px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.gds-bot__identity {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.gds-bot__header-avatar {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.82);
  background: #081b5c;
  flex-shrink: 0;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
}

.gds-bot__header-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 18%;
  display: block;
}

.gds-bot__header-text {
  min-width: 0;
}

.gds-bot__header-text strong {
  display: block;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: #ffffff;
}

.gds-bot__header-text span {
  display: block;
  font-size: 11.5px;
  color: rgba(219, 234, 254, 0.86);
  margin-top: 2px;
  line-height: 1.3;
}

.gds-bot__close {
  appearance: none;
  background: transparent;
  border: 0;
  color: rgba(255, 255, 255, 0.84);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.2s ease, background 0.2s ease;
}

.gds-bot__close:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
}

/* Conversation Area */
.gds-bot__messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 15px 12px;
  background: #f4f7fc;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overscroll-behavior: contain;
}

.gds-bot__msg {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 92%;
}

.gds-bot__msg--user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.gds-bot__msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid rgba(1, 43, 186, 0.25);
  flex-shrink: 0;
  background: #012bba;
}

.gds-bot__msg-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
  display: block;
}

.gds-bot__bubble {
  padding: 11px 13.5px;
  border-radius: 14px 14px 14px 4px;
  background: #ffffff;
  color: #0b1736;
  border: 1px solid rgba(11, 23, 54, 0.1);
  box-shadow: 0 4px 14px rgba(11, 23, 54, 0.05);
  font-size: 13.2px;
  line-height: 1.48;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gds-bot__msg--user .gds-bot__bubble {
  background: #012bba;
  color: #ffffff;
  border-color: #012bba;
  border-radius: 14px 14px 4px 14px;
}

.gds-bot__bubble p {
  margin: 0;
}

.gds-bot__bubble strong {
  font-weight: 600;
}

.gds-bot__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

.gds-bot__action-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 11px;
  border-radius: 8px;
  background: #eef4ff;
  border: 1px solid rgba(1, 43, 186, 0.25);
  color: #012bba;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.gds-bot__action-btn:hover {
  background: #dbe8ff;
  border-color: #012bba;
}

/* Typing dots */
.gds-bot__typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 2px;
}

.gds-bot__typing i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #012bba;
  opacity: 0.45;
  animation: gds-bot-pulse 1s infinite ease-in-out;
}

.gds-bot__typing i:nth-child(2) { animation-delay: 0.16s; }
.gds-bot__typing i:nth-child(3) { animation-delay: 0.32s; }

@keyframes gds-bot-pulse {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.35; }
  40% { transform: translateY(-3px); opacity: 1; }
}

/* Quick Chips Strip */
.gds-bot__chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 9px 14px;
  background: #ffffff;
  border-top: 1px solid rgba(11, 23, 54, 0.08);
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.gds-bot__chips::-webkit-scrollbar {
  display: none;
}

.gds-bot__chip {
  appearance: none;
  flex: 0 0 auto;
  padding: 6px 11px;
  border-radius: 999px;
  background: #f4f7fc;
  border: 1px solid rgba(11, 23, 54, 0.14);
  color: #0b1736;
  font-family: inherit;
  font-size: 11.8px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.18s ease;
}

.gds-bot__chip:hover {
  border-color: #012bba;
  color: #012bba;
  background: #eef4ff;
}

/* Input Form */
.gds-bot__form {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 12px;
  background: #ffffff;
  border-top: 1px solid rgba(11, 23, 54, 0.09);
}

.gds-bot__input {
  flex: 1;
  min-width: 0;
  padding: 10px 13px;
  border-radius: 999px;
  border: 1px solid rgba(11, 23, 54, 0.18);
  background: #f8faff;
  color: #0b1736;
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.3;
}

.gds-bot__input:focus {
  outline: none;
  border-color: #012bba;
  background: #ffffff;
}

.gds-bot__send {
  appearance: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 0;
  background: #012bba;
  color: #ffffff;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s ease, transform 0.2s ease;
}

.gds-bot__send:hover {
  background: #00208f;
  transform: scale(1.04);
}

.gds-bot__send svg {
  width: 16px;
  height: 16px;
}

.gds-bot__launcher-title-short {
  display: none;
}

@media (max-width: 540px) {
  .gds-bot {
    right: 12px;
    bottom: 12px;
  }

  .gds-bot__launcher {
    padding: 5px 13px 5px 5px;
    gap: 8px;
  }

  .gds-bot__avatar-wrap {
    width: 40px;
    height: 40px;
  }

  .gds-bot__whatsapp {
    width: 48px;
    height: 48px;
  }

  .gds-bot__whatsapp-icon {
    width: 26px;
    height: 26px;
  }

  .gds-bot__launcher-eyebrow,
  .gds-bot__launcher-title-full {
    display: none;
  }

  .gds-bot__launcher-title-short {
    display: inline;
  }

  .gds-bot__launcher-title {
    font-size: 12.5px;
  }

  .gds-bot__panel {
    width: calc(100vw - 24px);
    height: min(545px, calc(100dvh - 28px));
  }

  .gds-bot__input {
    font-size: 16px; /* Prevents iOS auto-zoom on focus */
  }
}
