/* ============================================================
   tarrito-rojo.css — Componente Slider para la Landing de Tarrito Rojo
   Estrategia: Mobile-first
   Breakpoints: 768px (tablet) · 1024px (desktop)
   ============================================================ */

/* ============================================================
   VARIABLES DE MARCA
   ============================================================ */
:root {
  --tarrito-rojo:                  #CC1526;
  --tarrito-rojo-circulo:          #CC1526;
  --tarrito-tab-activo-bg:         #CC1526;
  --tarrito-tab-inactivo-bg:       #D8EEF3; 
  --tarrito-icono-activo:          #CC1526;
  --tarrito-icono-activo-bg:       #FDE8EA;
  --tarrito-texto:                 #1A1A1A;
  --tarrito-beneficio-bg:          #FFE8A94D;
  --tarrito-slide-lateral-opacity: 0.1;
  --tarrito-slide-lateral-scale:   0.75;
  --tarrito-transicion:            300ms ease;
}

/* ============================================================
   CONTENEDOR PRINCIPAL
   display: flex + flex-direction: column permite usar la
   propiedad `order` en los hijos para reordenar en mobile.
   ============================================================ */
.tr-componente {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
  color: var(--tarrito-texto);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

.tr-componente *,
.tr-componente *::before,
.tr-componente *::after {
  box-sizing: inherit;
}

/* ============================================================
   ORDEN EN MOBILE (max-width: 767px)
   1. Slider  2. Tabs  3. Presentaciones  4. Header producto  5. Beneficios
   En desktop el HTML ya está en el orden visual correcto
   (slider → producto-header → tabs → presentaciones → sin beneficios-mobile).
   ============================================================ */
@media (max-width: 767px) {
  .tr-slider-area      { order: 1; }
  .tr-tabs             { order: 2; }
  .tr-presentaciones   { order: 3; }
  .tr-producto-header  { order: 4; }
  .tr-beneficios-mobile { order: 5; }
}

/* ============================================================
   ÁREA DEL SLIDER
   ============================================================ */
.tr-slider-area {
  position: relative;
  width: 100%;
  padding: 3rem 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 380px;
}

/* ============================================================
   FONDO: CÍRCULO ROJO FIJO
   ============================================================ */
.tr-circulo-fondo {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: var(--tarrito-rojo-circulo);
  z-index: 0;
  pointer-events: none;
}

/* ============================================================
   BENEFICIOS FLOTANTES — SOLO DESKTOP (>=1024px)
   ============================================================ */
.tr-beneficios-desktop {
  display: none; /* Se activa en breakpoint 1024px */
}

/* ============================================================
   SLIDER PRINCIPAL
   3 slots fijos: prev · active · next
   JS actualiza el src de las imágenes en cada slot.
   ============================================================ */
.tr-slider {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.tr-slider__viewport {
  flex: 1;
  overflow: hidden;
}

.tr-slider__track {
 	display: flex;
	align-items: center;
    width: 100%;
    justify-content: space-between;
 	gap: 0;
}

/* Slots del slider */
.tr-slider__item {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    transform var(--tarrito-transicion),
    opacity  var(--tarrito-transicion);
}

/* Mobile: solo el slot activo es visible */
.tr-slider__item--prev,
.tr-slider__item--next {
  display: none;
}

/* Slot activo */
.tr-slider__item--active {
  width: 100%;
  max-width: 260px;
  opacity: 1;
  transform: scale(1);
}

/* Imagen del slide */
.tr-slide-img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
  max-height: 280px;
  transition: opacity var(--tarrito-transicion);
}

/* Fade-out durante el cambio de imagen (clase añadida por JS) */
.tr-slider__item--transitioning .tr-slide-img {
  opacity: 0;
}

/* ============================================================
   BOTONES DE NAVEGACIÓN (FLECHAS)
   ============================================================ */
.tr-slider__btn {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--tarrito-rojo);
  background: #fff;
  color: var(--tarrito-rojo);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition:
    background var(--tarrito-transicion),
    color     var(--tarrito-transicion);
  padding: 0;
  line-height: 1;
}

.tr-slider__btn:hover,
.tr-slider__btn:focus-visible {
  background: var(--tarrito-rojo);
  color: #fff;
  outline: none;
}

.tr-slider__btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(204, 21, 38, 0.35);
}

/* ============================================================
   HEADER DEL PRODUCTO (nombre dinámico + logo)
   Flex row: texto a la izquierda, logo a la derecha.
   ============================================================ */
.tr-producto-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 1.5rem 0 0.75rem;
  padding: 0 0.25rem;
}

.tr-producto-info {
  flex: 1;
}

.tr-producto-nombre {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--tarrito-texto);
  margin: 0 0 0.25rem;
  line-height: 1.2;
}

.tr-producto-subtitulo {
  font-size: 0.95rem;
  color: #777;
  margin: 0;
}

.tr-producto-logo {
  flex-shrink: 0;
}

.tr-producto-logo img {
  display: block;
  width: 60px;
  height: 60px;
  object-fit: contain;
}

/* ============================================================
   TABS DE SABORES — ESTILO PILL (según Figma)
   Tab activo: pill rojo · Inactivos: pill gris azulado
   ============================================================ */
.tr-tabs {
  display: flex;
  gap: 5px;
  margin: 0;
  flex-wrap: wrap;
  padding: 0;
}

.tr-tab {
  padding: 0.5rem 1.25rem;
  border: none;
  background: var(--tarrito-tab-inactivo-bg); /* #D8EEF3 */
  color: var(--tarrito-texto);                 /* #1A1A1A */
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  border-radius: 21px 21px 0px 0px;
  line-height: 1;
  transition:
    background var(--tarrito-transicion),
    color      var(--tarrito-transicion);
}

.tr-tab:hover {
  background: #c0d8de;
  color: var(--tarrito-texto);
}

/* Tab activo: fondo rojo, texto blanco */
.tr-tab.tr-tab--activo {
  background: #D8EEF3 !important;
  color: var(--tarrito-tab-activo-bg);
  font-weight: 700;
}

.tr-tab.tr-tab--activo:hover {
  background: #D8EEF3 !important;
  color: var(--tarrito-tab-activo-bg);
  font-weight: 700;
  
}

/* ============================================================
   TABS — SOLO MOBILE
   Evita el salto de línea de las pestañas: en su lugar, el
   contenedor se vuelve scrolleable horizontalmente (swipe),
   con scroll suave y sin mostrar la barra de desplazamiento.
   No afecta tablet (>=768px) ni desktop (>=1024px).
   ============================================================ */
@media (max-width: 767px) {
  .tr-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch; /* inercia/swipe en iOS */
    scroll-behavior: smooth;
    scrollbar-width: none;             /* Firefox: oculta scrollbar */
    -ms-overflow-style: none;          /* IE/Edge legacy: oculta scrollbar */
  }

  .tr-tabs::-webkit-scrollbar {
    display: none;                     /* Chrome/Safari/Edge Chromium: oculta scrollbar */
  }

  .tr-tab {
    flex-shrink: 0;                    /* evita que las pestañas se compriman/deformen */
    white-space: nowrap;
  }
}

/* ============================================================
   ICONOS DE PRESENTACIONES
   JS rellena este contenedor. Cada icono es un <button>.
   ============================================================ */
.tr-presentaciones {
    background: #D8EEF34D;
    padding: 1rem;
    justify-content: start;
    position: relative;
    overflow: visible;
	display: flex;
}

.tr-presentaciones::before {
    content: "";
    position: absolute;
    top: -5px;
    left: 0;
    width: 100%;
    height: 5px;
    background: #D8EEF3;
}

/* Botón de presentación individual */
.tr-presentacion-icono {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.6rem;
  border: 2px solid transparent;
  background: transparent;
  cursor: pointer;
  border-radius: 10px;
  transition:
    border-color var(--tarrito-transicion),
    background   var(--tarrito-transicion);
  min-width: 56px;
  line-height: 1;
}

.tr-presentacion-icono:hover {
  border-color: var(--tarrito-icono-activo);
}

[type=button]:hover, [type=button]:focus {
    background: var(--tarrito-icono-activo-bg) !important;
}

.tr-presentacion-icono:focus-visible {
  outline: none;
  border-color: var(--tarrito-icono-activo);
  box-shadow: 0 0 0 3px rgba(204, 21, 38, 0.25);
}

/* Estado activo: borde rojo + fondo levemente coloreado */
.tr-presentacion-icono--activo {
  border-color: var(--tarrito-icono-activo);
  background: var(--tarrito-icono-activo-bg); /* #FDE8EA */
}

/* Imagen del icono: gris outline por defecto, sin filtro cuando está activo */
.tr-presentacion-icono__img {
    width: 38px;
    height: 38px;
    object-fit: contain;
    filter: grayscale(100%) opacity(1);
    transition: filter var(--tarrito-transicion);
	display: block;
}

/* Al estar activo o hover, se muestra el color real del icono.
   Si hay icono_rojo, JS ya swapea el src — el filter se quita igual. */
.tr-presentacion-icono--activo .tr-presentacion-icono__img,
.tr-presentacion-icono:hover .tr-presentacion-icono__img {
  filter: none;
}

/* Etiqueta de peso */
.tr-presentacion-peso {
  font-size: 0.72rem;
  color: #999;
  transition:
    color       var(--tarrito-transicion),
    font-weight var(--tarrito-transicion);
  white-space: nowrap;
}

.tr-presentacion-icono--activo .tr-presentacion-peso {
  color: var(--tarrito-icono-activo);
  font-weight: 700;
}

/* ============================================================
   BENEFICIOS EN MOBILE (lista vertical)
   Se oculta en desktop (>=1024px).
   ============================================================ */
.tr-beneficios-mobile {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.tr-beneficio-mobile-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem;
  background: var(--tarrito-beneficio-bg);
  border-radius: 12px;
}

/* Estilos compartidos de icono y contenido de beneficio */
.tr-beneficio__icono {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex-shrink: 0;
}

.tr-beneficio__contenido {
  flex: 1;
}

.tr-beneficio__titulo {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--tarrito-texto);
  margin-bottom: 0.2rem;
}

.tr-beneficio__texto {
  font-size: 0.82rem;
  color: #555;
  margin: 0;
  line-height: 1.45;
}

/* ============================================================
   BREAKPOINT: TABLET (>= 768px)
   ============================================================ */
@media (min-width: 768px) {
  .tr-componente {
    padding: 0rem 2rem;
  }

  .tr-slider-area {
    min-height: 460px;
    padding: 3.5rem 1rem;
  }

  .tr-circulo-fondo {
    width: 380px;
    height: 380px;
  }

  .tr-slider__item--active {
    max-width: 320px;
  }

  .tr-slide-img {
    max-height: 340px;
  }

  /* Beneficios en grid 2 columnas en tablet */
  .tr-beneficios-mobile {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }

  .tr-producto-nombre {
    font-size: 1.65rem;
  }

  .tr-presentacion-icono__img {
    width: 44px;
    height: 44px;
  }

  .tr-presentacion-peso {
    font-size: 0.78rem;
  }
}

/* ============================================================
   BREAKPOINT: DESKTOP (>= 1024px)
   Slider con 3 items visibles · beneficios flotando en esquinas
   ============================================================ */
@media (min-width: 1024px) {
  .tr-componente {
    padding: 0rem 2rem;
  }

  /* Más espacio para acomodar los beneficios flotantes */
  .tr-slider-area {
    min-height: 560px;
    padding: 5rem 2rem;
  }

  .tr-circulo-fondo {
    width: 460px;
    height: 460px;
  }

  /* ---- Beneficios flotantes en desktop ---- */
  .tr-beneficios-desktop {
    display: block;
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 2;
  }

  /* Ocultar lista mobile de beneficios */
  .tr-beneficios-mobile {
    display: none;
  }

  /* Tarjeta de beneficio individual */
  .tr-beneficio {
    position: absolute;
    pointer-events: all;
    background: var(--tarrito-beneficio-bg);
    border-radius: 16px;
    padding: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    max-width: 321px;
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.09);
  }


  /* Posición de las 5 esquinas */
  .tr-beneficio--tl { top: 0rem;    left: -6rem;  flex-direction: row-reverse; }
  .tr-beneficio--tr { bottom: 2rem; left: -7rem; flex-direction: row-reverse;  }
  .tr-beneficio.tr-beneficio--mr{ top: -2rem; right: -4rem; }
  .tr-beneficio--bl { top: 29%; right: -11rem; transform: translateY(-50%);    }
  .tr-beneficio--br { bottom: 2rem; right: -7rem;   }

  /* Texto izquierda abajo */
  .tr-beneficio.tr-beneficio--tr .tr-beneficio__contenido{
    text-align: end;
  }

  /* Texto arriba derecha */
  .tr-beneficio.tr-beneficio--tl .tr-beneficio__contenido{
    text-align: end;
  }

  /* ---- Slider con 3 items visibles ---- */
  .tr-slider__viewport {
    overflow: visible;
  }

  .tr-slider__track {
    gap: 0.25rem;
  }

  /* Activar slots prev y next */
  .tr-slider__item--prev,
  .tr-slider__item--next {
    display: flex;
    width: 20%;
    max-width: 160px;
    transform: scale(var(--tarrito-slide-lateral-scale));
    opacity: var(--tarrito-slide-lateral-opacity);
  }

  /* Slot activo ocupa ~60% del área */
  .tr-slider__item--active {
    width: 60%;
    max-width: 400px;
  }

  .tr-slide-img {
    max-height: 400px;
  }

  /* Tipografía */
  .tr-producto-nombre {
    font-size: 1.9rem;
  }

  .tr-producto-subtitulo {
    font-size: 1rem;
  }

  /* Tabs con más espacio */
  .tr-tabs {
    gap: 5px;
  }

  .tr-tab {
    padding: 21px 12px;
    font-size: 15px;
  }

  /* Presentaciones */
  .tr-presentacion-icono__img {
    width: 48px;
    height: 48px;
  }

  .tr-presentacion-peso {
    font-size: 0.8rem;
  }
}

@media (max-width: 1800px) and (orientation:landscape) {
	.tr-presentaciones-main-content {
    	width: 40vw;
    	margin: 0rem auto 6rem auto;
	}
	.tr-slider__track {
		width: 90vw;
	}
	.tr-slider {
		width: 60vw;
	}
	button.tr-slider__btn.tr-slider__btn--prev {
		position: absolute;
		left: 10%;
	}
	button.tr-slider__btn.tr-slider__btn--next {
		position: absolute;
		right: 10%;
	}
}

@media (min-width: 1801px) and (orientation:landscape) {
	.tr-presentaciones-main-content {
    	width: 30vw;
    	margin: 0rem auto 6rem auto;
	}
	.tr-slider__track {
		width: 90vw;
	}
	.tr-slider {
		width: 60vw;
	}
	button.tr-slider__btn.tr-slider__btn--prev {
		position: absolute;
		left: 10%;
	}
	button.tr-slider__btn.tr-slider__btn--next {
		position: absolute;
		right: 10%;
	}
}

@media (max-width: 900px) and (orientation:portrait) {
	.tr-presentacion-icono {
		width: stretch;
		min-width: 40px;
	}
	.tr-presentaciones {
		padding: 0.5rem;
	}
	.tr-slider {
		width: 92%;
    	margin: auto;
	}
}