/* ============================================================
   smart-lead-router.1.0.3.css
   Versión: 1.0.5 · Julio 2026

   Cambios vs 1.0.2:
   - Panel desktop: compacto, flotante abajo-derecha, height:auto
   - max-height: 58vh — nunca ocupa toda la pantalla
   - overlay: rgba(0,0,0,0.18) — sitio siempre visible
   - Mobile: bottom sheet, max-height 82vh
   - Botón "Siguiente" renombrado (texto vía JS/config)
============================================================ */

/* ── RESET SCOPED ──────────────────────────────────────── */
.slr-root *,
.slr-root *::before,
.slr-root *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── HOST ──────────────────────────────────────────────── */
.slr-root {
  position: fixed;
  inset: 0;
  z-index: 999990;
  pointer-events: none;
}

/* ── OVERLAY ───────────────────────────────────────────── */
.slr-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  transition: background 0.22s ease;
  pointer-events: none;
}

.slr-root.slr-open .slr-overlay {
  /* 0.18 → sitio claramente visible detrás del panel */
  background: rgba(0, 0, 0, var(--slr-overlay-alpha, 0.18));
  pointer-events: auto;
}

/* ── PANEL DESKTOP ─────────────────────────────────────── */
/*
  Panel flotante compacto, abajo a la derecha.
  - height: auto → crece solo según el contenido
  - max-height: 58vh → nunca ocupa la pantalla completa
  - overflow-y: auto → scroll interno si el contenido excede
  - border-radius: 18px → ventana flotante, no drawer
  - transform: scale + opacity → aparece in-place, no desliza
*/
.slr-panel {
  position: fixed;
  bottom: 24px;
  right: 24px;
  top: auto;
  left: auto;
  width: clamp(340px, 26vw, 380px);
  max-width: calc(100vw - 48px);
  height: auto;
  max-height: 58vh;
  background: var(--slr-bg, #0e0e0e);
  border-radius: 18px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  pointer-events: auto;
  /* Aparece con scale desde el botón — no desliza desde el borde */
  transform: scale(0.92) translateY(8px);
  opacity: 0;
  transform-origin: bottom right;
  transition:
    transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity   0.18s ease;
  /* Oculto hasta que se abra */
  visibility: hidden;
  pointer-events: none;
}

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

/* scrollbar sutil dentro del panel */
.slr-panel::-webkit-scrollbar {
  width: 3px;
}
.slr-panel::-webkit-scrollbar-track {
  background: transparent;
}
.slr-panel::-webkit-scrollbar-thumb {
  background: var(--slr-border, #2a2a2a);
  border-radius: 2px;
}

/* ── PANEL HEADER ──────────────────────────────────────── */
.slr-header {
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--slr-border, #2a2a2a);
  flex-shrink: 0;
  /* sticky al scroll interno */
  position: sticky;
  top: 0;
  background: var(--slr-bg, #0e0e0e);
  z-index: 1;
}

.slr-header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.slr-heading {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 16px;
  font-weight: 400;
  color: var(--slr-text, #f0ede8);
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.slr-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--slr-text-muted, #a09a92);
  padding: 2px 4px;
  line-height: 1;
  font-size: 20px;
  flex-shrink: 0;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  transition: color 0.15s;
}

.slr-close:hover { color: var(--slr-text, #f0ede8); }

.slr-tagline {
  font-size: 11px;
  color: var(--slr-accent, #BEAF87);
  margin-top: 4px;
  letter-spacing: 0.02em;
}

/* ── PANEL BODY ────────────────────────────────────────── */
.slr-body {
  flex: 1;
  padding: 14px 18px 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  /* overflow controlado por el panel padre */
  overflow: visible;
}

/* ── TARJETA DE CONTEXTO ───────────────────────────────── */
.slr-context-card {
  background: var(--slr-surface, #1a1a1a);
  border: 1px solid var(--slr-border, #2a2a2a);
  border-left: 3px solid var(--slr-accent, #BEAF87);
  border-radius: 7px;
  padding: 9px 12px;
}

.slr-context-label {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--slr-accent, #BEAF87);
  margin-bottom: 3px;
}

.slr-context-title {
  font-size: 13px;
  color: var(--slr-text, #f0ede8);
  line-height: 1.35;
  font-weight: 500;
}

.slr-context-meta {
  font-size: 11px;
  color: var(--slr-text-muted, #a09a92);
  margin-top: 2px;
}

/* ── STEP ──────────────────────────────────────────────── */
.slr-step {
  display: flex;
  flex-direction: column;
  gap: 7px;
  animation: slr-step-in 0.15s ease-out;
}

@keyframes slr-step-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0);   }
}

.slr-step[hidden] { display: none; }

.slr-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--slr-text, #f0ede8);
  letter-spacing: 0.01em;
}

/* ── INPUT TEXT ────────────────────────────────────────── */
.slr-input {
  width: 100%;
  background: var(--slr-surface, #1a1a1a);
  border: 1px solid var(--slr-border, #2a2a2a);
  border-radius: 7px;
  padding: 11px 13px;
  font-size: 14px;
  color: var(--slr-text, #f0ede8);
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
  min-height: 44px;
}

.slr-input::placeholder {
  color: var(--slr-text-muted, #a09a92);
  font-size: 13px;
}

.slr-input:focus { border-color: var(--slr-accent, #BEAF87); }
.slr-input.slr-error { border-color: #e05c5c; }

/* ── RADIO OPTIONS ─────────────────────────────────────── */
.slr-options {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.slr-option {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: 1px solid var(--slr-border, #2a2a2a);
  border-radius: 7px;
  padding: 9px 12px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  font-size: 13px;
  color: var(--slr-text, #f0ede8);
  text-align: left;
  width: 100%;
  font-family: inherit;
  min-height: 44px;
}

.slr-option:hover {
  border-color: var(--slr-accent, #BEAF87);
  background: rgba(190, 175, 135, 0.06);
}

.slr-option.slr-selected {
  border-color: var(--slr-accent, #BEAF87);
  background: rgba(190, 175, 135, 0.10);
}

.slr-option-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid var(--slr-text-muted, #a09a92);
  flex-shrink: 0;
  transition: border-color 0.15s;
  position: relative;
}

.slr-option.slr-selected .slr-option-dot {
  border-color: var(--slr-accent, #BEAF87);
}

.slr-option.slr-selected .slr-option-dot::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--slr-accent, #BEAF87);
}

/* ── ERROR ─────────────────────────────────────────────── */
.slr-error-msg {
  font-size: 11px;
  color: #e05c5c;
  display: none;
}

.slr-error-msg.slr-visible { display: block; }

/* ── PANEL FOOTER ──────────────────────────────────────── */
.slr-footer {
  padding: 10px 18px 18px;
  border-top: 1px solid var(--slr-border, #2a2a2a);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
  /* sticky al scroll interno */
  position: sticky;
  bottom: 0;
  background: var(--slr-bg, #0e0e0e);
}

.slr-btn-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 18px;
  background: var(--slr-wa-green, #25D366);
  color: #fff;
  border: none;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  font-family: inherit;
  min-height: 44px;
}

.slr-btn-submit:hover { background: var(--slr-wa-green-dark, #1aad52); }
.slr-btn-submit:active { transform: scale(0.98); }

.slr-btn-submit svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  fill: currentColor;
  pointer-events: none;
}

.slr-btn-back {
  background: none;
  border: none;
  color: var(--slr-text-muted, #a09a92);
  font-size: 12px;
  cursor: pointer;
  text-align: center;
  padding: 4px;
  font-family: inherit;
  transition: color 0.15s;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.slr-btn-back:hover { color: var(--slr-text, #f0ede8); }

.slr-privacy {
  font-size: 10px;
  color: var(--slr-text-muted, #a09a92);
  text-align: center;
  line-height: 1.5;
}

/* ── TRIGGER (botón flotante) ──────────────────────────── */
.slr-trigger {
  position: fixed;
  right: 20px;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--slr-wa-green, #25D366);
  border: none;
  cursor: pointer;
  z-index: 999989;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(37, 211, 102, 0.36);
  transition: transform 0.2s, background 0.15s;
  pointer-events: auto;
}

.slr-trigger:hover {
  background: var(--slr-wa-green-dark, #1aad52);
  transform: scale(1.05);
}

.slr-trigger svg {
  width: 26px;
  height: 26px;
  fill: #fff;
}

.slr-trigger-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--slr-wa-green, #25D366);
  animation: slr-pulse 2s infinite;
}

@keyframes slr-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(255,255,255,0.7); }
  70%  { box-shadow: 0 0 0 6px rgba(255,255,255,0);  }
  100% { box-shadow: 0 0 0 0 rgba(255,255,255,0);    }
}

/* ── TOOLTIP ───────────────────────────────────────────── */
.slr-tooltip {
  position: fixed;
  right: 84px;
  bottom: calc(26px + env(safe-area-inset-bottom, 0px));
  background: var(--slr-bg, #0e0e0e);
  color: var(--slr-text, #f0ede8);
  border: 1px solid var(--slr-border, #2a2a2a);
  border-radius: 9px;
  padding: 9px 14px;
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 999988;
  opacity: 0;
  transform: translateX(6px);
  transition: opacity 0.18s, transform 0.18s;
  box-shadow: 0 4px 12px rgba(0,0,0,0.26);
}

.slr-tooltip::after {
  content: '';
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
  width: 10px;
  height: 10px;
  background: var(--slr-bg, #0e0e0e);
  border-right: 1px solid var(--slr-border, #2a2a2a);
  border-top: 1px solid var(--slr-border, #2a2a2a);
}

.slr-tooltip.slr-visible {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

/* ── MOBILE: BOTTOM SHEET ──────────────────────────────── */
@media (max-width: 640px) {
  .slr-panel {
    position: fixed;
    top: auto;
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: 82vh;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -6px 32px rgba(0,0,0,0.36);
    transform-origin: bottom center;
    /* En mobile: desliza desde abajo */
    transform: translateY(105%);
    opacity: 1;
    visibility: hidden;
    pointer-events: none;
    transition: transform 0.24s cubic-bezier(0.4, 0, 0.2, 1),
                opacity   0.18s ease;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

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

  .slr-trigger {
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }

  .slr-tooltip {
    right: 80px;
    bottom: calc(22px + env(safe-area-inset-bottom, 0px));
    max-width: calc(100vw - 106px);
    white-space: normal;
  }

  .slr-heading { font-size: 15px; }
}

/* ── ACCESIBILIDAD ─────────────────────────────────────── */
.slr-trigger:focus-visible,
.slr-option:focus-visible,
.slr-input:focus-visible,
.slr-btn-submit:focus-visible,
.slr-btn-back:focus-visible,
.slr-close:focus-visible {
  outline: 2px solid var(--slr-accent, #BEAF87);
  outline-offset: 2px;
}

/* ── REDUCIR MOVIMIENTO ────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .slr-panel,
  .slr-overlay,
  .slr-tooltip,
  .slr-trigger { transition: none; animation: none; }
  .slr-trigger-dot { animation: none; }
  /* Step: eliminar transform, mantener fade muy breve (accesibilidad) */
  .slr-step { animation: slr-step-fade 0.1s ease-out; }
}

@keyframes slr-step-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── LEGACY HIDDEN ─────────────────────────────────────── */
.slr-legacy-hidden {
  display: none !important;
  pointer-events: none !important;
  visibility: hidden !important;
}
