/* ==========================================================================
   Taxi Chatbot — v4.0.4
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Oxanium:wght@700&display=swap');

/* --------------------------------------------------------------------------
   Tokens
   -------------------------------------------------------------------------- */

:root {
  --tcb-accent:        #f5c400;
  --tcb-accent-dark:   #d8a900;
  --tcb-accent-soft:   #fff7d6;
  --tcb-accent-text:   #111111;

  --tcb-ink:           #111111;
  --tcb-ink-soft:      #2a2a2a;
  --tcb-muted:         #666666;
  --tcb-muted-light:   #8a8a8a;

  --tcb-bg:            #ffffff;
  --tcb-bg-soft:       #f7f7f2;
  --tcb-surface:       #ffffff;
  --tcb-surface-alt:   #fbfaf5;

  --tcb-border:        #e3ddcc;
  --tcb-border-strong: #111111;

  --tcb-bubble-bot:    #ffffff;
  --tcb-bubble-user:   #f5c400;

  --tcb-error-text:    #b42318;
  --tcb-error-bg:      #fff1f0;
  --tcb-error-border:  #f3b4ad;

  --tcb-font:          'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --tcb-font-display:  'Oxanium', var(--tcb-font);

  --tcb-radius-lg:     0;
  --tcb-radius-md:     0;
  --tcb-radius-sm:     0;
  --tcb-radius-pill:   0;

  --tcb-panel-w:       360px;
  --tcb-panel-h:       500px;
  --tcb-gap-x:         24px;
  --tcb-gap-y:         24px;

  --tcb-shadow-panel:  0 18px 48px rgba(0, 0, 0, 0.22), 0 6px 18px rgba(0, 0, 0, 0.12);
  --tcb-shadow-soft:   0 6px 18px rgba(0, 0, 0, 0.10);
  --tcb-shadow-yellow: 0 10px 24px rgba(245, 196, 0, 0.28);

  --tcb-z-panel:       2147483646;
  --tcb-z-launcher:    2147483647;
}

/* --------------------------------------------------------------------------
   Frontera visual del componente
   -------------------------------------------------------------------------- */

#tcb-launcher,
#tcb-launcher *,
#tcb-launcher *::before,
#tcb-launcher *::after,
#tcb-panel,
#tcb-panel *,
#tcb-panel *::before,
#tcb-panel *::after {
  box-sizing: border-box;
}

/* --------------------------------------------------------------------------
   Launcher
   -------------------------------------------------------------------------- */

button#tcb-launcher.tcb-launcher {
  position: fixed;
  right: var(--tcb-gap-x);
  bottom: var(--tcb-gap-y);
  z-index: var(--tcb-z-launcher);

  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: 58px;
  height: 58px;
  min-width: 58px;
  min-height: 58px;
  max-width: 58px;
  max-height: 58px;

  padding: 0;
  margin: 0;

  color: var(--tcb-ink);
  background: var(--tcb-accent);
  background-image: none;
  border: 2px solid var(--tcb-border-strong);
  border-radius: var(--tcb-radius-md);
  box-shadow: var(--tcb-shadow-yellow);

  font-family: var(--tcb-font);
  font-size: 13px;
  line-height: 1;
  text-align: center;

  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;

  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

button#tcb-launcher.tcb-launcher:hover {
  background: var(--tcb-accent-dark);
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.20);
}

button#tcb-launcher.tcb-launcher:active {
  transform: translateY(0);
}

button#tcb-launcher.tcb-launcher:focus-visible {
  outline: 3px solid rgba(245, 196, 0, 0.35);
  outline-offset: 3px;
}

#tcb-launcher .tcb-launcher__icon {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  color: currentColor;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

#tcb-launcher .tcb-launcher__icon svg {
  display: block;
  flex-shrink: 0;
}

#tcb-launcher .tcb-launcher__icon--chat {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

#tcb-launcher .tcb-launcher__icon--close {
  opacity: 0;
  transform: scale(0.6) rotate(-90deg);
}

#tcb-launcher.tcb-launcher.is-open .tcb-launcher__icon--chat {
  opacity: 0;
  transform: scale(0.6) rotate(90deg);
}

#tcb-launcher.tcb-launcher.is-open .tcb-launcher__icon--close {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

/* Badge */

#tcb-launcher .tcb-launcher__badge {
  position: absolute;
  top: -4px;
  right: -4px;
  display: none;
  width: 14px;
  height: 14px;
  background: #d92d20;
  border: 2px solid var(--tcb-bg);
  border-radius: var(--tcb-radius-pill);
}

#tcb-launcher .tcb-launcher__badge.is-visible {
  display: block;
}

/* --------------------------------------------------------------------------
   Panel
   -------------------------------------------------------------------------- */

#tcb-panel.tcb-panel {
  position: fixed;
  right: var(--tcb-gap-x);
  bottom: calc(var(--tcb-gap-y) + 74px);
  z-index: var(--tcb-z-panel);

  display: flex;
  flex-direction: column;

  width: var(--tcb-panel-w);
  height: var(--tcb-panel-h);
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 120px);
  overflow: hidden;

  color: var(--tcb-ink);
  font-family: var(--tcb-font);
  font-size: 13px;

  background: var(--tcb-bg);
  border: 1px solid var(--tcb-border);
  border-radius: var(--tcb-radius-lg);
  box-shadow: var(--tcb-shadow-panel);

  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(18px) scale(0.96);
  transform-origin: bottom right;
  transition: opacity 0.24s ease, transform 0.24s ease, visibility 0.24s ease;
}

#tcb-panel.tcb-panel.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

#tcb-panel .tcb-header {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  flex-shrink: 0;

  padding: 14px 16px;

  color: var(--tcb-ink);
  background: var(--tcb-accent);
  border-bottom: 2px solid var(--tcb-border-strong);
}

#tcb-panel .tcb-header::after {
  display: none;
}

#tcb-panel .tcb-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;

  width: 34px;
  height: 34px;

  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  background: var(--tcb-ink);
  border-radius: var(--tcb-radius-pill);
}

#tcb-panel .tcb-header__info {
  flex: 1;
  min-width: 0;
}

#tcb-panel .tcb-header__name {
  color: var(--tcb-ink);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
}

#tcb-panel .tcb-header__status {
  display: flex;
  align-items: center;
  gap: 5px;

  margin-top: 2px;

  color: rgba(17, 17, 17, 0.72);
  font-size: 11px;
  font-weight: 600;
}

#tcb-panel .tcb-header__status::before {
  content: '';
  display: inline-block;

  width: 6px;
  height: 6px;

  background: var(--tcb-ink);
  border-radius: var(--tcb-radius-pill);
  animation: tcb-pulse 2s infinite;
}

#tcb-panel .tcb-header__status.is-typing::before {
  background: var(--tcb-ink);
  animation: none;
}

@keyframes tcb-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

/* Minimizar */

#tcb-panel button#tcb-minimize.tcb-minimize {
  appearance: none;
  -webkit-appearance: none;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 28px;

  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  max-width: 28px;
  max-height: 28px;

  padding: 0;
  margin: 0;

  color: var(--tcb-ink);
  background: rgba(255, 255, 255, 0.36);
  background-image: none;
  border: 1px solid rgba(17, 17, 17, 0.18);
  border-radius: var(--tcb-radius-sm);
  box-shadow: none;

  font-family: var(--tcb-font);
  font-size: 0;
  line-height: 1;

  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

#tcb-panel button#tcb-minimize.tcb-minimize svg {
  display: block;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

#tcb-panel button#tcb-minimize.tcb-minimize:hover,
#tcb-panel button#tcb-minimize.tcb-minimize:focus-visible {
  color: var(--tcb-ink);
  background: #ffffff;
  border-color: var(--tcb-border-strong);
  outline: none;
  transform: translateY(-1px);
}

/* --------------------------------------------------------------------------
   Mensajes
   -------------------------------------------------------------------------- */

#tcb-panel.tcb-panel #tcb-messages.tcb-messages {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 12px;

  padding: 16px 14px;
  overflow-y: auto;

  background: var(--tcb-bg-soft);
  scroll-behavior: smooth;
}

#tcb-panel.tcb-panel #tcb-messages.tcb-messages::-webkit-scrollbar {
  width: 4px;
}

#tcb-panel.tcb-panel #tcb-messages.tcb-messages::-webkit-scrollbar-track {
  background: transparent;
}

#tcb-panel.tcb-panel #tcb-messages.tcb-messages::-webkit-scrollbar-thumb {
  background: #d2c9b6;
  border-radius: 2px;
}

#tcb-panel.tcb-panel #tcb-messages.tcb-messages::-webkit-scrollbar-thumb:hover {
  background: var(--tcb-accent-dark);
}

#tcb-panel.tcb-panel #tcb-messages.tcb-messages > .tcb-message {
  display: flex;
  flex-direction: column;
  width: fit-content;
  max-width: 84%;
}

#tcb-panel.tcb-panel #tcb-messages.tcb-messages > .tcb-message--bot,
#tcb-panel.tcb-panel #tcb-messages.tcb-messages > .tcb-message--typing {
  align-self: flex-start;
}

#tcb-panel.tcb-panel #tcb-messages.tcb-messages > .tcb-message--user {
  align-self: flex-end;
}

#tcb-panel.tcb-panel #tcb-messages.tcb-messages > .tcb-message .tcb-message__bubble {
  padding: 10px 14px;

  color: var(--tcb-ink-soft);
  font-size: 13px;
  line-height: 1.6;

  overflow-wrap: anywhere;
  white-space: pre-wrap;

  background: var(--tcb-bubble-bot);
  border: 1px solid var(--tcb-border);
  border-radius: var(--tcb-radius-md);
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

#tcb-panel.tcb-panel #tcb-messages.tcb-messages > .tcb-message--user .tcb-message__bubble {
  color: var(--tcb-ink);
  font-weight: 600;
  background: var(--tcb-bubble-user);
  border: 1px solid rgba(17, 17, 17, 0.18);
  border-bottom-left-radius: var(--tcb-radius-md);
  border-bottom-right-radius: 4px;
  box-shadow: 0 3px 10px rgba(245, 196, 0, 0.22);
}

#tcb-panel.tcb-panel #tcb-messages.tcb-messages > .tcb-message--error .tcb-message__bubble {
  color: var(--tcb-error-text);
  background: var(--tcb-error-bg);
  border-color: var(--tcb-error-border);
}

#tcb-panel.tcb-panel #tcb-messages.tcb-messages > .tcb-message .tcb-message__time {
  margin-top: 4px;
  padding: 0 2px;

  color: var(--tcb-muted-light);
  font-size: 10px;
  font-weight: 500;
}

#tcb-panel.tcb-panel #tcb-messages.tcb-messages > .tcb-message--user .tcb-message__time {
  color: var(--tcb-muted);
  text-align: right;
}

/* Typing dots */

#tcb-panel.tcb-panel #tcb-messages.tcb-messages > .tcb-message--typing .tcb-message__bubble {
  padding: 12px 16px;
}

#tcb-panel.tcb-panel #tcb-messages.tcb-messages .tcb-typing-dots {
  display: flex;
  gap: 5px;
  align-items: center;
}

#tcb-panel.tcb-panel #tcb-messages.tcb-messages .tcb-typing-dots span {
  display: block;

  width: 7px;
  height: 7px;

  background: var(--tcb-muted);
  border-radius: var(--tcb-radius-pill);
  animation: tcb-dot 1.2s infinite;
}

#tcb-panel.tcb-panel #tcb-messages.tcb-messages .tcb-typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

#tcb-panel.tcb-panel #tcb-messages.tcb-messages .tcb-typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes tcb-dot {
  0%, 80%, 100% { transform: scale(0.8); opacity: 0.4; }
  40%           { transform: scale(1.1); opacity: 1; }
}

/* --------------------------------------------------------------------------
   Botones de acción
   -------------------------------------------------------------------------- */

#tcb-panel .tcb-message__bubble--actions {
  display: flex;
  flex-direction: column;
  gap: 8px;

  padding: 0;

  background: transparent;
  border: 0;
  box-shadow: none;
}

#tcb-panel .tcb-action {
  appearance: none;
  -webkit-appearance: none;

  display: flex;
  align-items: center;
  justify-content: center;

  min-height: 40px;
  padding: 10px 14px;
  margin: 0;

  color: var(--tcb-ink);
  font-family: var(--tcb-font);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;

  background: var(--tcb-accent);
  background-image: none;
  border: 1px solid var(--tcb-border-strong);
  border-radius: var(--tcb-radius-md);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.10);

  cursor: pointer;
  transition: background 0.18s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

#tcb-panel .tcb-action:hover,
#tcb-panel .tcb-action:focus-visible {
  color: var(--tcb-ink);
  background: var(--tcb-accent-dark);
  outline: none;
  transform: translateY(-1px);
  box-shadow: var(--tcb-shadow-soft);
}

/* --------------------------------------------------------------------------
   Input
   -------------------------------------------------------------------------- */

#tcb-panel .tcb-input-area {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 9px;

  padding: 12px 14px;

  background: var(--tcb-bg);
  border-top: 1px solid var(--tcb-border);
}

#tcb-panel textarea#tcb-input.tcb-input {
  flex: 1 1 auto;

  width: auto;
  min-width: 0;
  min-height: 40px;
  max-height: 90px;

  padding: 10px 15px;
  margin: 0;

  overflow-y: hidden;
  resize: none;

  color: var(--tcb-ink);
  font-family: var(--tcb-font);
  font-size: 13px;
  line-height: 1.4;

  background: var(--tcb-bg-soft);
  border: 1px solid var(--tcb-border);
  border-radius: var(--tcb-radius-md);
  outline: none;

  appearance: none;
  -webkit-appearance: none;
  scrollbar-width: none;

  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

#tcb-panel textarea#tcb-input.tcb-input::-webkit-scrollbar {
  display: none;
}

#tcb-panel textarea#tcb-input.tcb-input:focus {
  background: #ffffff;
  border-color: var(--tcb-border-strong);
  box-shadow: 0 0 0 3px rgba(245, 196, 0, 0.18);
}

#tcb-panel textarea#tcb-input.tcb-input::placeholder {
  color: var(--tcb-muted-light);
}

#tcb-panel button#tcb-send.tcb-send {
  appearance: none;
  -webkit-appearance: none;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 40px;

  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  max-width: 40px;
  max-height: 40px;

  padding: 0;
  margin: 0;

  color: var(--tcb-ink);
  background: var(--tcb-accent);
  background-image: none;
  border: 1px solid var(--tcb-border-strong);
  border-radius: var(--tcb-radius-md);
  box-shadow: none;

  font-family: var(--tcb-font);
  font-size: 0;
  line-height: 1;

  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

#tcb-panel button#tcb-send.tcb-send svg {
  display: block;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

#tcb-panel button#tcb-send.tcb-send:hover,
#tcb-panel button#tcb-send.tcb-send:focus-visible {
  background: var(--tcb-accent-dark);
  outline: none;
  transform: translateY(-1px);
  box-shadow: var(--tcb-shadow-soft);
}

#tcb-panel button#tcb-send.tcb-send:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
  box-shadow: none;
}

/* --------------------------------------------------------------------------
   Botones CTA — formulario y llamada
   -------------------------------------------------------------------------- */

#tcb-panel .tcb-action--cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;

  width: 100%;

  color: var(--tcb-ink);
  text-decoration: none;

  font-family: var(--tcb-font-display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;

  background: linear-gradient(to bottom, #ffd84d, var(--tcb-accent));
  border: 2px solid var(--tcb-border-strong);
  border-radius: var(--tcb-radius-md);
  box-shadow: 0 4px 0 rgba(17, 17, 17, 0.16);

  padding: 13px 14px;

  cursor: pointer;
  transition: filter 0.15s ease, transform 0.1s ease, box-shadow 0.1s ease;
}

#tcb-panel .tcb-action--cta:hover,
#tcb-panel .tcb-action--cta:focus-visible {
  color: var(--tcb-ink);
  filter: brightness(1.03);
  transform: translateY(-1px);
  outline: none;
  box-shadow: 0 5px 0 rgba(17, 17, 17, 0.18);
}

#tcb-panel .tcb-action--cta:active {
  filter: brightness(0.98);
  transform: translateY(0);
  box-shadow: 0 2px 0 rgba(17, 17, 17, 0.18);
}

#tcb-panel .tcb-action__icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

#tcb-panel .tcb-action__icon svg {
  display: block;
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 420px) {
  :root {
    --tcb-panel-w: calc(100vw - 20px);
    --tcb-gap-x:   10px;
    --tcb-gap-y:   16px;
  }

  #tcb-panel.tcb-panel {
    height: 70vh;
    border-radius: 16px;
  }

  button#tcb-launcher.tcb-launcher {
    width: 52px;
    height: 52px;
    min-width: 52px;
    min-height: 52px;
    max-width: 52px;
    max-height: 52px;
    border-radius: var(--tcb-radius-md);
  }
}

@media (prefers-reduced-motion: reduce) {
  button#tcb-launcher.tcb-launcher,
  #tcb-launcher .tcb-launcher__icon,
  #tcb-panel.tcb-panel,
  #tcb-panel .tcb-header__status::before,
  #tcb-panel .tcb-typing-dots span,
  #tcb-panel .tcb-action,
  #tcb-panel button#tcb-send.tcb-send,
  #tcb-panel .tcb-action--cta {
    transition: none;
    animation: none;
  }
}