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

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

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

:root {
  --tcb-accent:       #f5c518;
  --tcb-accent-dark:  #d4a800;
  --tcb-accent-text:  #0a0a0a;

  --tcb-bg:           #111111;
  --tcb-bg-dark:      #0a0a0a;
  --tcb-bubble-bot:   #1c1c1c;
  --tcb-bubble-user:  #f5c518;
  --tcb-border:       #2a2a2a;
  --tcb-border-dark:  #1a1a1a;

  --tcb-text-bot:     #e8e8e8;
  --tcb-text-user:    #0a0a0a;
  --tcb-text-muted:   #777777;
  --tcb-text-time:    #444444;

  --tcb-font:         'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --tcb-radius-lg:    18px;
  --tcb-radius-md:    12px;
  --tcb-radius-pill:  999px;

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

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

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

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

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

  width: 58px;
  height: 58px;
  padding: 0;

  color: var(--tcb-accent-text);
  background: var(--tcb-accent);
  border: 0;
  border-radius: var(--tcb-radius-pill);
  box-shadow: 0 4px 20px rgba(245, 197, 24, 0.45), 0 2px 8px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tcb-launcher:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(245, 197, 24, 0.6), 0 4px 12px rgba(0, 0, 0, 0.4);
}

.tcb-launcher:active  { transform: scale(0.96); }

.tcb-launcher:focus-visible {
  outline: 3px solid rgba(245, 197, 24, 0.5);
  outline-offset: 2px;
}

/* Iconos chat / close */

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

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

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

/* Badge */

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

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

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

.tcb-panel {
  position: fixed;
  right: var(--tcb-gap-x);
  bottom: calc(var(--tcb-gap-y) + 70px);
  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;

  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: 0 24px 64px rgba(0, 0, 0, 0.7), 0 8px 24px rgba(0, 0, 0, 0.4);

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

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

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

.tcb-header {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  flex-shrink: 0;
  padding: 14px 16px;
  color: #fff;
  background: var(--tcb-bg-dark);
  border-bottom: 1px solid var(--tcb-border-dark);
}

.tcb-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 56px;
  height: 2px;
  background: var(--tcb-accent);
}

.tcb-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  color: var(--tcb-accent-text);
  font-size: 15px;
  font-weight: 700;
  background: var(--tcb-accent);
  border-radius: var(--tcb-radius-pill);
}

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

.tcb-header__name {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
}

.tcb-header__status {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
  color: var(--tcb-text-muted);
  font-size: 11px;
  font-weight: 500;
}

.tcb-header__status::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--tcb-accent);
  border-radius: var(--tcb-radius-pill);
  box-shadow: 0 0 5px rgba(245, 197, 24, 0.6);
  animation: tcb-pulse 2s infinite;
}

.tcb-header__status.is-typing::before {
  background: #ff9f0a;
  animation: none;
}

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

.tcb-minimize {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  padding: 5px;
  color: #555;
  background: none;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}

.tcb-minimize:hover,
.tcb-minimize:focus-visible {
  color: var(--tcb-accent);
  background: rgba(245, 197, 24, 0.08);
  outline: none;
}

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

.tcb-messages {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 12px;
  padding: 16px 14px;
  overflow-y: auto;
  background: var(--tcb-bg-dark);
  scroll-behavior: smooth;
}

.tcb-messages::-webkit-scrollbar       { width: 3px; }
.tcb-messages::-webkit-scrollbar-track { background: transparent; }
.tcb-messages::-webkit-scrollbar-thumb { background: #2a2a2a; border-radius: 2px; }
.tcb-messages::-webkit-scrollbar-thumb:hover { background: var(--tcb-accent); }

.tcb-message {
  display: flex;
  flex-direction: column;
  max-width: 84%;
}

.tcb-message--bot,
.tcb-message--typing { align-self: flex-start; }
.tcb-message--user   { align-self: flex-end; }

.tcb-message__bubble {
  padding: 10px 14px;
  color: var(--tcb-text-bot);
  font-size: 13px;
  line-height: 1.6;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  background: var(--tcb-bubble-bot);
  border: 1px solid #282828;
  border-radius: var(--tcb-radius-md);
  border-bottom-left-radius: 3px;
}

.tcb-message--user .tcb-message__bubble {
  color: var(--tcb-text-user);
  font-weight: 500;
  background: var(--tcb-bubble-user);
  border: 0;
  border-bottom-left-radius: var(--tcb-radius-md);
  border-bottom-right-radius: 3px;
  box-shadow: 0 2px 10px rgba(245, 197, 24, 0.22);
}

.tcb-message--error .tcb-message__bubble {
  color: #ff6b6b;
  background: #1a0a0a;
  border-color: #3a1515;
}

.tcb-message__time {
  margin-top: 4px;
  padding: 0 2px;
  color: var(--tcb-text-time);
  font-size: 10px;
  font-weight: 500;
}

.tcb-message--user .tcb-message__time {
  color: #555;
  text-align: right;
}

/* Typing dots */

.tcb-message--typing .tcb-message__bubble { padding: 12px 16px; }

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

.tcb-typing-dots span {
  display: block;
  width: 7px;
  height: 7px;
  background: #555;
  border-radius: var(--tcb-radius-pill);
  animation: tcb-dot 1.2s infinite;
}

.tcb-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.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-message__bubble--actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0;
  background: transparent;
  border: 0;
}

.tcb-action {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 10px 14px;
  color: var(--tcb-accent-text);
  font-family: var(--tcb-font);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  background: var(--tcb-accent);
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}

.tcb-action:hover,
.tcb-action:focus-visible {
  background: var(--tcb-accent-dark);
  outline: none;
  transform: translateY(-1px);
}

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

.tcb-input-area {
  display: flex;
  align-items: flex-end;
  flex-shrink: 0;
  gap: 9px;
  padding: 12px 14px;
  background: var(--tcb-bg);
  border-top: 1px solid var(--tcb-border);
}

.tcb-input {
  flex: 1;
  max-height: 90px;
  padding: 9px 15px;
  overflow-y: hidden;
  resize: none;
  color: var(--tcb-text-bot);
  font-family: var(--tcb-font);
  font-size: 13px;
  line-height: 1.4;
  background: var(--tcb-bubble-bot);
  border: 1px solid var(--tcb-border);
  border-radius: 22px;
  outline: none;
  appearance: none;
  scrollbar-width: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

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

.tcb-input:focus {
  border-color: var(--tcb-accent);
  box-shadow: 0 0 0 2px rgba(245, 197, 24, 0.1);
}

.tcb-input::placeholder { color: #444; }

.tcb-send {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  padding: 0;
  color: var(--tcb-accent-text);
  background: var(--tcb-accent);
  border: 0;
  border-radius: var(--tcb-radius-pill);
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

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

.tcb-send:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
}

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

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

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

  .tcb-launcher {
    width: 52px;
    height: 52px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tcb-launcher,
  .tcb-launcher__icon,
  .tcb-panel,
  .tcb-action,
  .tcb-send {
    transition: none;
    animation: none;
  }
}

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

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

.tcb-action--cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;

  background: linear-gradient(to bottom, #FFD500, #F6C400);
  color: #000000;
  text-decoration: none;

  font-family: 'Oxanium', sans-serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;

  padding: 14px 0;
  border: 2px solid #000000;
  border-radius: 0;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  box-sizing: border-box;

  transition: filter 0.15s, transform 0.1s;
}

.tcb-action--cta:hover,
.tcb-action--cta:focus-visible {
  filter: brightness(1.06);
  transform: translateY(-1px);
  outline: none;
  color: #000000;
}

.tcb-action--cta:active {
  transform: translateY(0);
  filter: brightness(0.97);
}

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

@media (prefers-reduced-motion: reduce) {
  .tcb-action--cta { transition: none; }
}
