/* ═══════════════════════════════════════════════════════════════
   ESTILOS PREMIUM PARA EL TUTORIAL INTERACTIVO (tutorial.css)
   Diseño de Barra Horizontal / Dock Flotante, Glassmorphism.
   ═══════════════════════════════════════════════════════════════ */

/* Contenedor Overlay del Tutorial (Mayor Z-Index que modales comunes) */
.tutorial-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 12000; /* Superposición absoluta */
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s cubic-bezier(0.2, 0.8, 0.2, 1),
              visibility 0s linear 0.35s,
              background 0.45s cubic-bezier(0.2, 0.8, 0.2, 1),
              backdrop-filter 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
  pointer-events: auto; /* Bloquea clics accidentales en el fondo */
}

.tutorial-overlay.active {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.35s cubic-bezier(0.2, 0.8, 0.2, 1),
              visibility 0s linear 0s,
              background 0.45s cubic-bezier(0.2, 0.8, 0.2, 1),
              backdrop-filter 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Fondos reactivos según el paso (Atractivo en inicio, transparente en el recorrido) */
.tutorial-overlay.pos-step-0,
.tutorial-overlay.pos-step-1,
.tutorial-overlay.pos-step-6 {
  background: rgba(9, 9, 11, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.tutorial-overlay.pos-step-2,
.tutorial-overlay.pos-step-3,
.tutorial-overlay.pos-step-4,
.tutorial-overlay.pos-step-5 {
  background: rgba(0, 0, 0, 0.02);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* Tarjeta / Barra Flotante del Tutorial (Morphing Container) */
.tutorial-modal {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 0) scale(0.96);
  width: calc(100% - 48px);
  max-width: 980px; /* Ancho de barra en desktop */
  background: rgba(24, 24, 27, 0.65); /* Glassmorphism translúcido */
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.25),
              0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  background-clip: padding-box;
  
  /* Transición premium de deslizamiento y cambio de tamaño */
  transition: left 0.5s cubic-bezier(0.2, 0.8, 0.2, 1),
              bottom 0.5s cubic-bezier(0.2, 0.8, 0.2, 1),
              transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1),
              max-width 0.45s cubic-bezier(0.2, 0.8, 0.2, 1),
              height 0.4s cubic-bezier(0.2, 0.8, 0.2, 1),
              opacity 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Adaptación del Glassmorphism al tema claro */
[data-theme="light"] .tutorial-modal {
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.1),
              0 0 0 1px rgba(255, 255, 255, 0.5) inset;
}

.tutorial-overlay.active .tutorial-modal {
  transform: translate(-50%, 0) scale(1);
  opacity: 1;
}

/* ─────────────────────────────────────────────────────────────
   POSICIONAMIENTO Y REDIMENSIONAMIENTO (COORDINADAS UNIFICADAS)
   ───────────────────────────────────────────────────────────── */

/* Paso 0 (Bienvenida), Paso 1 (Personalización) y Paso 6 (Finalización): Modal Centrado */
.tutorial-overlay.pos-step-0 .tutorial-modal,
.tutorial-overlay.pos-step-1 .tutorial-modal,
.tutorial-overlay.pos-step-6 .tutorial-modal {
  left: 50%;
  bottom: 50%;
  transform: translate(-50%, 50%) scale(1);
  max-width: 500px; /* Tamaño ligeramente más grande para evitar desbordamientos */
}

/* Pasos 2, 3, 4 y 5 (Horizontal): Barra Centrada al Fondo con Mayor Tamaño */
.tutorial-overlay.pos-step-2 .tutorial-modal,
.tutorial-overlay.pos-step-3 .tutorial-modal,
.tutorial-overlay.pos-step-4 .tutorial-modal,
.tutorial-overlay.pos-step-5 .tutorial-modal {
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 0) scale(1);
  width: calc(100% - 48px);
  max-width: 880px; /* Tamaño ligeramente más grande y centrado para que quepan todos los elementos */
}

/* ─────────────────────────────────────────────────────────────
   ESTRUCTURA DE CONTENIDO (ROW VS COLUMN DINÁMICO)
   ───────────────────────────────────────────────────────────── */

/* Estructura Base de la Barra (Horizontal por defecto) */
.tutorial-body {
  padding: 14px 20px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
}

/* Estructura Vertical para Diapositivas Centradas (Pasos 0, 1 y 6) */
.tutorial-overlay.pos-step-0 .tutorial-body,
.tutorial-overlay.pos-step-1 .tutorial-body,
.tutorial-overlay.pos-step-6 .tutorial-body {
  flex-direction: column;
  align-items: stretch;
  padding: 28px 28px 24px 28px;
  gap: 20px;
}

/* Diapositivas Individuales (Horizontal por defecto) */
.tutorial-step {
  display: none;
  opacity: 0;
  transform: translateY(5px);
  transition: opacity 0.3s cubic-bezier(0.2, 0.8, 0.2, 1),
              transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  flex-direction: row;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.tutorial-step.active {
  display: flex;
  opacity: 1;
  transform: translateY(0);
}

/* Diapositivas Verticales para Pasos Centrados (Pasos 0, 1 y 6) */
.tutorial-overlay.pos-step-0 .tutorial-step,
.tutorial-overlay.pos-step-1 .tutorial-step,
.tutorial-overlay.pos-step-6 .tutorial-step {
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.tutorial-overlay.pos-step-1 .tutorial-step {
  align-items: stretch; /* Formulario estirado horizontalmente */
  text-align: left;
}

/* Iconos de Diapositiva */
.tutorial-icon-wrapper {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--accent-glow-pulse, rgba(37, 99, 235, 0.1));
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tutorial-overlay.pos-step-0 .tutorial-icon-wrapper {
  width: 60px;
  height: 60px;
  margin-bottom: 8px;
}

.tutorial-icon-wrapper i {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

.tutorial-overlay.pos-step-0 .tutorial-icon-wrapper i {
  width: 26px;
  height: 26px;
}

/* Textos e Info (Horizontal - Staged Vertically next to Icon) */
.tutorial-text-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

/* Textos Verticales para Pasos Centrados */
.tutorial-overlay.pos-step-0 .tutorial-text-content,
.tutorial-overlay.pos-step-1 .tutorial-text-content,
.tutorial-overlay.pos-step-6 .tutorial-text-content {
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.tutorial-title {
  font-size: 15px; /* Aumentado de 13px */
  font-weight: 800;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: -0.1px;
  white-space: normal;
  flex-shrink: 0;
}

.tutorial-overlay.pos-step-0 .tutorial-title,
.tutorial-overlay.pos-step-1 .tutorial-title,
.tutorial-overlay.pos-step-6 .tutorial-title {
  font-size: 21px; /* Aumentado de 18px */
  white-space: normal;
  text-align: center;
  letter-spacing: -0.3px;
}

.tutorial-desc {
  font-size: 13.5px; /* Aumentado de 12px */
  color: var(--text-secondary);
  line-height: 1.45;
  margin: 0;
  white-space: normal;
  width: 100%;
}

.tutorial-overlay.pos-step-0 .tutorial-desc,
.tutorial-overlay.pos-step-1 .tutorial-desc,
.tutorial-overlay.pos-step-6 .tutorial-desc {
  font-size: 15px; /* Aumentado de 13px */
  white-space: normal;
  text-align: center;
  line-height: 1.5;
  max-width: 380px;
}

/* Tip Box (Horizontal) */
.tutorial-tip-box {
  margin: 0;
  padding: 5px 12px;
  background: rgba(var(--accent-rgb, 37, 99, 235), 0.08);
  border: 1px dashed var(--accent-glow-pulse, rgba(37, 99, 235, 0.2));
  border-radius: var(--radius-full);
  font-size: 11.5px; /* Aumentado de 10px */
  color: var(--accent);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

.tutorial-overlay.pos-step-0 .tutorial-tip-box,
.tutorial-overlay.pos-step-1 .tutorial-tip-box,
.tutorial-overlay.pos-step-6 .tutorial-tip-box {
  margin-top: 12px;
  width: 100%;
  justify-content: center;
  border-radius: var(--radius-md);
  padding: 8px 12px;
}

.tutorial-tip-box i {
  width: 13px;
  height: 13px;
}

/* ─────────────────────────────────────────────────────────────
   WIDGETS DE PERSONALIZACIÓN ("Personaliza Bookable")
   ───────────────────────────────────────────────────────────── */

.tutorial-setup-form {
  width: 100%;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 16px 20px;
  margin-top: 10px;
  text-align: left;
}

.tutorial-setup-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tutorial-setup-label {
  font-size: 11.5px; /* Aumentado de 10px */
  font-weight: 800;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Segmented Control de Tema (Estilo iOS Premium - Proporcionado) */
.tutorial-theme-segmented {
  position: relative;
  display: flex;
  background: var(--bg-body);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 2px;
  width: 100%;
  max-width: 100%; /* Ocupa todo el ancho de su columna de la grilla */
  height: 38px; /* Altura más robusta y premium */
  box-shadow: 0 1px 2px rgba(0,0,0,0.02) inset;
}

.tutorial-theme-segment-btn {
  flex: 1;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 13px; /* Tamaño de letra legible solicitado */
  font-weight: 700;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  z-index: 2;
  transition: color 0.22s ease;
  height: 100%;
  padding: 0;
}

.tutorial-theme-segment-btn i,
.tutorial-theme-segment-btn svg {
  width: 14px;
  height: 14px;
}

.tutorial-theme-segment-btn.active {
  color: var(--accent);
}

.tutorial-theme-segment-slider {
  position: absolute;
  top: 2px;
  left: 2px;
  width: calc(50% - 2px);
  height: calc(100% - 4px);
  background: var(--card-bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
  z-index: 1;
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

[data-theme="light"] .tutorial-theme-segment-slider {
  border-color: rgba(0, 0, 0, 0.06);
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Mover slider de tema */
.tutorial-theme-segmented.dark-active .tutorial-theme-segment-slider {
  transform: translateX(100%);
}

/* Enlace Omitir en parte superior del paso 1 */
.tutorial-skip-link {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: color 0.2s ease;
  padding: 4px 8px;
  margin-right: -8px;
}

@media (hover: hover) {
  .tutorial-skip-link:hover {
    color: var(--accent);
  }
}

/* Selector de Paletas */
.tutorial-palette-row {
  display: flex;
  gap: 8px; /* Espaciado más compacto para encajar en la grilla de dos columnas */
  align-items: center;
  justify-content: flex-start;
  padding: 4px 0;
}

.tutorial-palette-row .palette-dot-btn {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-full);
  border: 2px solid transparent;
  cursor: pointer;
  background-clip: content-box;
  padding: 2px;
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@media (hover: hover) {
  .tutorial-palette-row .palette-dot-btn:hover {
    transform: scale(1.12);
  }
}

.tutorial-palette-row .palette-dot-btn.active {
  border-color: var(--accent);
  transform: scale(1.05);
}

/* Subida de Logotipo */
.tutorial-logo-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.tutorial-logo-preview {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-full);
  border: 1px dashed var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-body);
  overflow: hidden;
  flex-shrink: 0;
}

.tutorial-logo-preview i {
  width: 14px;
  height: 14px;
  color: var(--text-tertiary);
}

/* ─────────────────────────────────────────────────────────────
   FOOTER, BOTONES Y DOTS
   ───────────────────────────────────────────────────────────── */

.tutorial-footer {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
  border: none;
  background: transparent;
  padding: 0;
}

/* Formato de Footer en Diapositivas Centradas (Modales) */
.tutorial-overlay.pos-step-0 .tutorial-footer,
.tutorial-overlay.pos-step-1 .tutorial-footer,
.tutorial-overlay.pos-step-6 .tutorial-footer {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-top: 8px;
  justify-content: space-between;
  width: 100%;
}

.tutorial-dots {
  display: flex;
  gap: 5px;
}

.tutorial-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--border-strong);
  opacity: 0.45;
  transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  cursor: pointer;
  border: none;
  padding: 0;
}

.tutorial-dot.active {
  background: var(--accent);
  width: 14px;
  opacity: 1;
}

/* Contraste mejorado en modo claro */
[data-theme="light"] .tutorial-dot {
  background: rgba(0, 0, 0, 0.28);
}

[data-theme="light"] .tutorial-dot.active {
  background: var(--accent);
}

#btn-tutorial-prev,
#btn-tutorial-next {
  min-width: 115px;
  justify-content: center;
}

#btn-tutorial-next {
  background: var(--accent) !important;
  color: var(--white) !important;
  border-color: var(--accent) !important;
}

@media (hover: hover) {
  #btn-tutorial-next:hover:not(:disabled) {
    background: var(--accent-hover) !important;
    border-color: var(--accent-hover) !important;
  }
}

.tutorial-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.tutorial-actions button {
  height: 36px; /* Aumentado de 34px */
  padding: 0 16px; /* Aumentado de 12px */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13.5px; /* Aumentado de 12px */
  font-weight: 700;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.22s ease;
}

/* Botón Omitir general (Removido por desuso en la barra) */
.tutorial-btn-skip {
  display: none;
}

/* ─────────────────────────────────────────────────────────────
   RESPONSIVO PARA MÓVILES (Posiciones adaptativas y footer vertical)
   ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Blur y oscurecido solo para pasos de bienvenida, personalización y finalización */
  .tutorial-overlay.pos-step-0,
  .tutorial-overlay.pos-step-1,
  .tutorial-overlay.pos-step-6 {
    background: rgba(9, 9, 11, 0.5) !important;
    backdrop-filter: blur(4px) !important;
    -webkit-backdrop-filter: blur(4px) !important;
  }
  
  /* Overlay transparente y click-through para el recorrido interactivo */
  .tutorial-overlay.pos-step-2,
  .tutorial-overlay.pos-step-3,
  .tutorial-overlay.pos-step-4,
  .tutorial-overlay.pos-step-5 {
    background: rgba(0, 0, 0, 0.02) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
  
  .tutorial-modal {
    border-radius: var(--radius-md);
    width: calc(100% - 24px) !important;
    max-width: 440px !important;
    height: auto !important; /* Desactivar resize de JS en móvil */
    transition: left 0.4s ease, bottom 0.4s ease, transform 0.4s ease !important;
  }

  /* Centrado en móvil para los pasos de tipo tarjeta */
  .tutorial-overlay.pos-step-0 .tutorial-modal,
  .tutorial-overlay.pos-step-1 .tutorial-modal,
  .tutorial-overlay.pos-step-6 .tutorial-modal {
    left: 50% !important;
    bottom: 50% !important;
    transform: translate(-50%, 50%) scale(1) !important;
  }

  /* Posicionado abajo en móvil para el recorrido interactivo (libera la pantalla) */
  .tutorial-overlay.pos-step-2 .tutorial-modal,
  .tutorial-overlay.pos-step-3 .tutorial-modal,
  .tutorial-overlay.pos-step-4 .tutorial-modal,
  .tutorial-overlay.pos-step-5 .tutorial-modal {
    left: 50% !important;
    bottom: 12px !important;
    transform: translate(-50%, 0) scale(1) !important;
  }

  .tutorial-body {
    flex-direction: column !important;
    align-items: stretch !important;
    padding: 12px 14px !important;
    gap: 10px !important;
  }

  /* Reducir tamaño del setup form en paso 1 */
  .tutorial-setup-form {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
    margin-top: 4px !important;
  }
  
  .tutorial-logo-row {
    gap: 10px !important;
  }
  .tutorial-logo-preview {
    width: 32px !important;
    height: 32px !important;
  }
  #btn-tutorial-logo-upload {
    height: 32px !important;
    font-size: 12px !important;
    padding: 0 10px !important;
  }

  /* Alineación vertical del paso de bienvenida, personalización y fin */
  .tutorial-overlay.pos-step-0 .tutorial-body,
  .tutorial-overlay.pos-step-1 .tutorial-body,
  .tutorial-overlay.pos-step-6 .tutorial-body {
    flex-direction: column !important;
    align-items: stretch !important;
    padding: 16px 16px 12px 16px !important;
    gap: 12px !important;
  }

  .tutorial-overlay.pos-step-0 .tutorial-step,
  .tutorial-overlay.pos-step-1 .tutorial-step,
  .tutorial-overlay.pos-step-6 .tutorial-step {
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
  }

  .tutorial-overlay.pos-step-0 .tutorial-text-content,
  .tutorial-overlay.pos-step-1 .tutorial-text-content,
  .tutorial-overlay.pos-step-6 .tutorial-text-content {
    align-items: center !important;
    text-align: center !important;
    gap: 4px !important;
  }

  /* Alineación horizontal compacta para los pasos del recorrido (2-5) en móvil */
  .tutorial-overlay.pos-step-2 .tutorial-step,
  .tutorial-overlay.pos-step-3 .tutorial-step,
  .tutorial-overlay.pos-step-4 .tutorial-step,
  .tutorial-overlay.pos-step-5 .tutorial-step {
    flex-direction: row !important;
    align-items: flex-start !important;
    text-align: left !important;
    gap: 10px !important;
    width: 100% !important;
  }

  .tutorial-overlay.pos-step-2 .tutorial-text-content,
  .tutorial-overlay.pos-step-3 .tutorial-text-content,
  .tutorial-overlay.pos-step-4 .tutorial-text-content,
  .tutorial-overlay.pos-step-5 .tutorial-text-content {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 2px !important;
    text-align: left !important;
    flex: 1 !important;
    min-width: 0 !important;
  }

  /* Reducir tamaño del icono en móvil */
  .tutorial-icon-wrapper {
    width: 28px !important;
    height: 28px !important;
    margin-bottom: 0 !important;
    flex-shrink: 0 !important;
    background: rgba(var(--accent-rgb), 0.1) !important;
    color: var(--accent) !important;
  }
  
  .tutorial-icon-wrapper i,
  .tutorial-icon-wrapper svg {
    width: 14px !important;
    height: 14px !important;
  }

  .tutorial-title {
    font-size: 14.5px !important;
    white-space: normal !important;
    text-align: inherit !important;
  }

  .tutorial-desc {
    font-size: 12.5px !important;
    white-space: normal !important;
    text-align: inherit !important;
    max-width: 100% !important;
  }

  /* Omitir cajas de tips en pasos del recorrido en móvil para ahorrar espacio */
  .tutorial-overlay.pos-step-2 .tutorial-tip-box,
  .tutorial-overlay.pos-step-3 .tutorial-tip-box,
  .tutorial-overlay.pos-step-4 .tutorial-tip-box,
  .tutorial-overlay.pos-step-5 .tutorial-tip-box {
    display: none !important;
  }

  .tutorial-tip-box {
    margin-top: 6px !important;
    width: 100% !important;
    justify-content: center !important;
    border-radius: var(--radius-md) !important;
    padding: 6px 10px !important;
    font-size: 11px !important;
  }

  /* Footer en una sola fila compacta: [Atrás]   [dots]   [Siguiente] */
  .tutorial-footer {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
    border-top: 1px solid var(--border) !important;
    padding-top: 10px !important;
    margin-top: 4px !important;
    gap: 6px !important;
  }

  .tutorial-actions {
    display: contents !important; /* Permite ordenar los botones junto con el dots container */
  }

  #btn-tutorial-prev {
    order: 1 !important;
    flex: 0 0 auto !important;
    width: 90px !important;
    min-width: 90px !important;
    height: 32px !important;
    font-size: 12px !important;
    padding: 0 6px !important;
  }

  .tutorial-dots {
    order: 2 !important;
    flex: 1 !important;
    justify-content: center !important;
    margin: 0 !important;
    gap: 3px !important;
  }

  #btn-tutorial-next {
    order: 3 !important;
    flex: 0 0 auto !important;
    width: 90px !important;
    min-width: 90px !important;
    height: 32px !important;
    font-size: 12px !important;
    padding: 0 6px !important;
  }

  #btn-tutorial-skip-step {
    display: none !important; /* Omitimos el skip en la botonera móvil, el link del header es suficiente */
  }
}
