/* ============================================================================
 * slider-trapa.css — slider hero de la home (sustituye a Revolution Slider)
 * ----------------------------------------------------------------------------
 * Sistema propio, ligero, totalmente responsive y configurable desde el CRM.
 * Sin dependencias de jQuery. Tipografía fluida con clamp().
 *
 * Convenciones:
 *   .trapa-slider             contenedor raíz
 *     .trapa-slider__slides   track de slides (transform translateX)
 *       .trapa-slide          slide individual
 *         .trapa-slide__media  <img> de fondo (absolute, object-fit: cover)
 *         .trapa-slide__content  caja de texto + CTA
 *           .trapa-slide__eyebrow pequeño texto superior
 *           .trapa-slide__title   h2 del slide
 *           .trapa-slide__cta     botón
 *     .trapa-slider__arrow   flechas izq/der
 *     .trapa-slider__nav     dots
 * ========================================================================== */

/* ---------- Reset del contenedor .intro de la plantilla ------------------- */
.intro.trapa-slider {
  background: #1a1a1a;
  width: 100%;
  position: relative;
  overflow: hidden;
  margin: 0;
  padding: 0;
}

/* ---------- Contenedor principal ------------------------------------------ */
.trapa-slider {
  --ts-height: clamp(360px, 62vw, 620px);
  --ts-max-width: 100%;
  --ts-radius: 0;
  --ts-padding-x: clamp(20px, 6vw, 80px);
  --ts-accent: #ee820f;
  --ts-text-color: #ffffff;
  --ts-title-size: clamp(28px, 5.2vw, 64px);
  --ts-subtitle-size: clamp(14px, 1.6vw, 20px);
  --ts-eyebrow-size: clamp(11px, 0.9vw, 13px);
  --ts-overlay: rgba(0, 0, 0, 0.35);
  --ts-content-max: 600px;
  --ts-focal: 50% 50%;
  position: relative;
  width: 100%;
  height: var(--ts-height);
  background: #1a1a1a;
  overflow: hidden;
  font-family: inherit;
}

/* Slides: track horizontal */
.trapa-slider__slides {
  position: absolute;
  inset: 0;
  display: flex;
  width: 100%;
  height: 100%;
  transform: translate3d(0, 0, 0);
  transition: transform 700ms cubic-bezier(.65, .05, .36, 1);
  will-change: transform;
}

/* Slide individual */
.trapa-slide {
  position: relative;
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.trapa-slide__media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--ts-focal, 50% 50%);
  transform: scale(1.04);
  transition: transform 7s linear;
}

.trapa-slide.is-active .trapa-slide__media { transform: scale(1); }

.trapa-slide__overlay {
  position: absolute;
  inset: 0;
  background: var(--ts-overlay);
  pointer-events: none;
}

/* Contenido textual */
.trapa-slide__content {
  position: relative;
  z-index: 2;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: clamp(24px, 5vw, 60px) var(--ts-padding-x);
  max-width: 1320px;
  margin: 0 auto;
  color: var(--ts-text-color);
  text-align: left;
  pointer-events: none;
}

.trapa-slide__content > * { pointer-events: auto; }

.trapa-slide__content.is-center {
  align-items: center;
  text-align: center;
}
.trapa-slide__content.is-center .trapa-slide__title { margin-left: auto; margin-right: auto; }
.trapa-slide__content.is-center .trapa-slide__text { margin-left: auto; margin-right: auto; }

.trapa-slide__content.is-right {
  align-items: flex-end;
  text-align: right;
}
.trapa-slide__content.is-right .trapa-slide__title { margin-left: auto; }
.trapa-slide__content.is-right .trapa-slide__text { margin-left: auto; }

/* Eyebrow */
.trapa-slide__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: var(--ts-eyebrow-size);
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin: 0 0 clamp(12px, 1.5vw, 18px);
  color: var(--ts-text-color);
  opacity: 0.92;
}
.trapa-slide__eyebrow::before {
  content: '';
  display: inline-block;
  width: clamp(24px, 3vw, 40px);
  height: 2px;
  background: var(--ts-accent);
}

/* Título principal */
.trapa-slide__title {
  font-size: var(--ts-title-size);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin: 0 0 clamp(14px, 1.8vw, 22px);
  max-width: var(--ts-content-max);
  color: var(--ts-text-color);
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.25);
}

/* Subtítulo */
.trapa-slide__text {
  font-size: var(--ts-subtitle-size);
  font-weight: 400;
  line-height: 1.5;
  margin: 0 0 clamp(20px, 2.6vw, 32px);
  max-width: var(--ts-content-max);
  color: var(--ts-text-color);
  opacity: 0.94;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.35);
}

/* CTA */
.trapa-slide__cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 32px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  text-decoration: none;
  border-radius: 999px;
  border: 2px solid var(--ts-accent);
  background: var(--ts-accent);
  color: #fff;
  transition: transform .25s ease, background .25s ease, color .25s ease, box-shadow .25s ease;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}
.trapa-slide__cta::after {
  content: '\2192';
  font-size: 1.1em;
  line-height: 1;
  transition: transform .25s ease;
}
.trapa-slide__cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.32);
}
.trapa-slide__cta:hover::after { transform: translateX(4px); }

.trapa-slide__cta.is-outline {
  background: transparent;
  color: var(--ts-accent);
}
.trapa-slide__cta.is-outline:hover { background: var(--ts-accent); color: #fff; }

.trapa-slide__cta.is-ghost {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.trapa-slide__cta.is-ghost:hover { background: rgba(255, 255, 255, 0.95); color: #111; border-color: transparent; }

/* ---------- Navegación: flechas ------------------------------------------ */
.trapa-slider__arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: background .25s ease, transform .25s ease;
}
.trapa-slider__arrow:hover { background: var(--ts-accent); }
.trapa-slider__arrow:focus-visible {
  outline: 3px solid var(--ts-accent);
  outline-offset: 3px;
}
.trapa-slider__arrow[disabled] { opacity: 0.35; cursor: not-allowed; }
.trapa-slider__arrow--prev { left: clamp(8px, 1.6vw, 22px); }
.trapa-slider__arrow--next { right: clamp(8px, 1.6vw, 22px); }

/* ---------- Puntos (dots) ------------------------------------------------- */
.trapa-slider__nav {
  position: absolute;
  z-index: 5;
  bottom: clamp(18px, 2.4vw, 28px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.trapa-slider__dot {
  width: 10px;
  height: 10px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.45);
  cursor: pointer;
  transition: background .25s ease, width .35s ease;
}
.trapa-slider__dot:hover { background: rgba(255, 255, 255, 0.85); }
.trapa-slider__dot.is-active {
  width: 30px;
  background: var(--ts-accent);
}
.trapa-slider__dot:focus-visible {
  outline: 2px solid var(--ts-accent);
  outline-offset: 3px;
}

/* ---------- Variantes de tamaño (sm/md/lg/xl) ----------------------------- */
.trapa-slide__content.is-sm { --ts-title-size: clamp(22px, 3.6vw, 36px); --ts-subtitle-size: clamp(13px, 1.2vw, 16px); }
.trapa-slide__content.is-md { --ts-title-size: clamp(26px, 4.6vw, 48px); --ts-subtitle-size: clamp(14px, 1.4vw, 18px); }
.trapa-slide__content.is-lg { --ts-title-size: clamp(30px, 5.4vw, 58px); --ts-subtitle-size: clamp(15px, 1.6vw, 20px); }
.trapa-slide__content.is-xl { --ts-title-size: clamp(34px, 6.2vw, 68px); --ts-subtitle-size: clamp(16px, 1.8vw, 22px); }

/* ---------- Animaciones de entrada --------------------------------------- */
@keyframes ts-fade-up {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: translateY(0); }
}
.trapa-slide.is-active .trapa-slide__eyebrow,
.trapa-slide.is-active .trapa-slide__title,
.trapa-slide.is-active .trapa-slide__text,
.trapa-slide.is-active .trapa-slide__cta {
  animation: ts-fade-up 700ms cubic-bezier(.2, .7, .2, 1) both;
}
.trapa-slide.is-active .trapa-slide__eyebrow { animation-delay: 200ms; }
.trapa-slide.is-active .trapa-slide__title   { animation-delay: 360ms; }
.trapa-slide.is-active .trapa-slide__text    { animation-delay: 520ms; }
.trapa-slide.is-active .trapa-slide__cta     { animation-delay: 680ms; }

.trapa-slide:not(.is-active) .trapa-slide__eyebrow,
.trapa-slide:not(.is-active) .trapa-slide__title,
.trapa-slide:not(.is-active) .trapa-slide__text,
.trapa-slide:not(.is-active) .trapa-slide__cta {
  opacity: 0;
}

/* ---------- Responsive --------------------------------------------------- */
@media (max-width: 768px) {
  .trapa-slider { --ts-height: clamp(420px, 92vw, 620px); --ts-padding-x: 22px; }
  .trapa-slider__nav { bottom: 18px; }
  .trapa-slider__arrow { width: 40px; height: 40px; font-size: 18px; }

  /* Por defecto en móvil el contenido va abajo a la izquierda (mantiene la versión
     de escritorio si no se ha definido una posición específica para móvil). */
  .trapa-slide__content:not(.is-pos-mv-left):not(.is-pos-mv-center):not(.is-pos-mv-right) {
    align-items: flex-end;
    text-align: left;
    padding-bottom: clamp(72px, 14vw, 110px);
  }
  .trapa-slide__content:not(.is-pos-mv-left):not(.is-pos-mv-center):not(.is-pos-mv-right)
    .trapa-slide__title,
  .trapa-slide__content:not(.is-pos-mv-left):not(.is-pos-mv-center):not(.is-pos-mv-right)
    .trapa-slide__text {
    margin-left: 0;
    margin-right: 0;
  }

  /* Override por posición móvil elegida desde el CRM */
  .trapa-slide__content.is-pos-mv-left {
    align-items: flex-start;
    text-align: left;
    padding-bottom: clamp(72px, 14vw, 110px);
  }
  .trapa-slide__content.is-pos-mv-left .trapa-slide__title,
  .trapa-slide__content.is-pos-mv-left .trapa-slide__text {
    margin-left: 0;
    margin-right: 0;
  }

  .trapa-slide__content.is-pos-mv-center {
    align-items: center;
    text-align: center;
    padding-bottom: clamp(72px, 14vw, 110px);
  }
  .trapa-slide__content.is-pos-mv-center .trapa-slide__title,
  .trapa-slide__content.is-pos-mv-center .trapa-slide__text {
    margin-left: auto;
    margin-right: auto;
  }

  .trapa-slide__content.is-pos-mv-right {
    align-items: flex-end;
    text-align: right;
    padding-bottom: clamp(72px, 14vw, 110px);
  }
  .trapa-slide__content.is-pos-mv-right .trapa-slide__title,
  .trapa-slide__content.is-pos-mv-right .trapa-slide__text {
    margin-left: auto;
    margin-right: 0;
  }
}

@media (max-width: 480px) {
  .trapa-slider { --ts-height: clamp(440px, 130vw, 560px); }
  .trapa-slide__cta { padding: 12px 22px; font-size: 14px; }
}

/* ---------- Accesibilidad: prefers-reduced-motion ------------------------ */
@media (prefers-reduced-motion: reduce) {
  .trapa-slider__slides { transition: none; }
  .trapa-slide__media { transition: none; transform: none; }
  .trapa-slide.is-active .trapa-slide__eyebrow,
  .trapa-slide.is-active .trapa-slide__title,
  .trapa-slide.is-active .trapa-slide__text,
  .trapa-slide.is-active .trapa-slide__cta {
    animation: none;
  }
}

/* ============================================================================
 * Estilos del editor CRM (preview del slide)
 * ========================================================================== */
.trapa-crm-preview {
  position: sticky;
  top: 20px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}
.trapa-crm-preview .trapa-slider { --ts-height: 380px; }
.trapa-crm-preview-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #6b7280;
  margin: 0 0 8px;
  text-align: center;
}

/* ============================================================================
 * Estilos del listado CRM
 * ========================================================================== */
.trapa-crm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.trapa-crm-card {
  position: relative;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: box-shadow .2s ease, transform .2s ease;
}
.trapa-crm-card:hover {
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}
.trapa-crm-card__thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #1a1a1a;
  overflow: hidden;
}
.trapa-crm-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.trapa-crm-card__thumb-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.05) 0%, rgba(0,0,0,0.55) 100%);
  display: flex;
  align-items: flex-end;
  padding: 12px;
}
.trapa-crm-card__thumb-title {
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
  line-height: 1.2;
  margin: 0;
  max-height: 2.4em;
  overflow: hidden;
}
.trapa-crm-card__status {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: #10b981;
  color: #fff;
  z-index: 2;
}
.trapa-crm-card__status.is-inactive { background: #9ca3af; }
.trapa-crm-card__status.is-scheduled { background: #3b82f6; }
.trapa-crm-card__status.is-expired { background: #ef4444; }

.trapa-crm-card__body {
  padding: 12px 14px;
}
.trapa-crm-card__meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 8px;
}
.trapa-crm-card__orden {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #f3f4f6;
  color: #374151;
  font-weight: 700;
  font-size: 12px;
}
.trapa-crm-card__actions {
  display: flex;
  gap: 6px;
}
.trapa-crm-card__actions .btn {
  flex: 1;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 6px;
}
