/* Estilos específicos de index.html */


/* Hero Skewed Carousel */
.hero-section {
  padding: 60px 0 100px;
  position: relative;
  background-size: cover;
  background-position: center;
  overflow: hidden;
}

.hero-section::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
  z-index: 0;
}

.hero-content {
  display: flex;
  flex-direction: column;
  align-items: center ;
  position: relative;
  z-index: 1;
}

.hero-content h1,
.hero-content h2 {
  font-size: 4rem;
  margin-bottom: 0px;
  text-transform: none;
  color: #ffffff;
}

.hero-carousel {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 1350px;
  margin: 0 auto;
 /*  padding: 0 50px; */
}

/* El "Viewport" que recorta el contenido */
.hero-carousel-viewport {
  width: 100%;
  overflow: hidden;
  padding: 30px 0;
}

.hero-carousel .carousel-track {
  display: flex;
  gap: 15px; /* Aumentamos el gap para evitar empalme por el skew */
  justify-content: flex-start;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  width: max-content;
  padding: 0 80px; /* Ajustado para que el contenido empiece justo después de los botones absolutos */
}

.hero-carousel .carousel-item {
  flex: 0 0 200px; /* Ancho estandarizado para todas las categorías */
  background: transparent;
  border: none;
  overflow: visible;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
  position: relative;
  z-index: 1;
}

.hero-carousel .carousel-item:hover {
  transform: translateY(-15px) scale(1.05);
  z-index: 10;
}

.skew-wrapper {
  width: 100%;
  height: 220px;
  transform: skewX(-15deg);
  overflow: hidden;
  border: 2px solid #fff;
  background-color: #333;
  transition: border-color 0.3s;
}

.hero-carousel .carousel-item.active .skew-wrapper {
  border-color: var(--primary);
  border-width: 3px;
}

.hero-carousel .carousel-item:hover .skew-wrapper {
  border-color: var(--primary);
  box-shadow: 0 10px 25px rgba(0,0,0,0.4);
}

.hero-carousel .carousel-item:hover .category-label {
  color: var(--primary);
}

.skew-wrapper img {
  width: 100%; /* Más ancho para cubrir el skew */
  height: 100%;
  object-fit: cover;
  object-position: 0px 0px;
  transform: skewX(0deg) scale(1); /* Invertimos el skew para que la imagen se vea derecha */
  margin-left: -0%; /* Centramos la imagen */
 /*  filter: brightness(200%); */
}

.hero-carousel .carousel-item:hover .category-label {
  color: var(--primary);
  transform: scale(1.1);
}

.category-label {
  margin-top: 10px;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  text-align: center;
  white-space: nowrap;
  transition: all 0.3s ease;
  position: relative;
  /* Ajuste visual para alinear con el centro del trapecio */
  /* Eliminado el desplazamiento fijo para permitir que el texto se centre naturalmente o con un ajuste menor */
  left: -20px; 
}

.hero-carousel .carousel-btn {
  background-color: rgba(255, 255, 255, 0.9);
  color: #4a4a4a;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  font-size: 28px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 20;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.hero-carousel .carousel-btn.prev { left: 0; }
.hero-carousel .carousel-btn.next { right: 0; }

.hero-carousel .carousel-btn:hover {
  background-color: #fff;
}

/* Featured Products Section */
.featured-section {
  background-color: #fff;
  padding: 80px 0;
}

.featured-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 40px;
  margin-bottom: 60px;
}

.featured-header-left {
  flex: 1;
}

.featured-header-right {
  flex: 1;
}

.featured-section h2 {
  color: var(--primary);
  font-size: 64px;
  line-height: 1;
  margin-bottom: 24px;
  text-align: left;
}

#main-featured-title, #main-featured-desc, #main-featured-img {
  transition: opacity 0.3s ease;
}

#main-featured-title {
  font-size: 56px;
  font-weight: 800;
  color: var(--secondary);
  margin-bottom: 16px;
}

#main-featured-desc {
  font-size: 25px;
  color: #666;
  line-height: 1.3;
  margin-bottom: 32px;
  max-width: 500px;
  text-align: justify;
}

.featured-header-right img {
  width: 100%;
  max-height: 400px;
  object-fit: contain;
}

/* Featured Carousel */
.featured-carousel {
  position: relative;
  padding: 0 70px; /* Space for buttons */
  margin-top: 40px;
}

.featured-carousel .carousel-track {
  display: flex;
  gap: 24px;
  justify-content: flex-start; /* Important for sliding logic */
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.featured-carousel .carousel-item {
  flex: 0 0 calc(25% - 18px); /* 4 items per view with gap */
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.featured-card-wrapper {
  background: #fff;
  border: 1px solid var(--surface-dim);
  border-radius: 20px;
  padding: 15px;
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  transition: all 0.3s ease;
  position: relative;
}

.carousel-item.active .featured-card-wrapper {
  border-color: var(--primary);
  border-width: 2px;
  box-shadow: 0 10px 25px rgba(232, 119, 34, 0.2);
  /* transform: translateY(-5px); */
}

.featured-card-wrapper img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.featured-item-title {
  font-weight: 700;
  color: var(--secondary);
  font-size: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.featured-carousel .carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background-color: var(--primary);
  color: #fff;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  font-size: 20px;
  border: none;
  cursor: pointer;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.featured-carousel .carousel-btn:hover {
  background-color: var(--secondary);
  transform: translateY(-50%) scale(1.1);
}

.featured-carousel .carousel-btn.prev { left: 0; }
.featured-carousel .carousel-btn.next { right: 0; }

/* Category Grid Irregular */
.category-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 250px;
  gap: 15px;
}

.category-item {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background-color: #333;
}

.category-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.category-item:hover img {
  transform: scale(1.15);
  filter: brightness(0.7);
}

.category-item::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0) 50%);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 1;
}

.category-item:hover::after {
  opacity: 1;
}

.grid-span-v { grid-row: span 2; }
.grid-span-h { grid-column: span 2; }
.grid-span-large { grid-column: span 2; grid-row: span 2; }
.grid-span-xlarge { grid-column: span 4; grid-row: span 1; }

.category-overlay {
  position: absolute;
  background-color: var(--primary);
  color: #fff;
  padding: 8px 16px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1.2rem;
  text-transform: uppercase;
  z-index: 2;
  transition: all 0.3s ease;
  pointer-events: none;
}

.pos-bottom-left { bottom: 15px; left: 0; }
.pos-bottom-right { bottom: 15px; right: 0; }
.pos-top-left { top: 15px; left: 0; }
.pos-top-right { top: 15px; right: 20px; }
.pos-center { top: 50%; left: 50%; transform: translate(-50%, -50%); }

.category-item:hover .category-overlay {
  background-color: var(--secondary);
  padding-left: 24px;
  transform: translateY(-5px);
  box-shadow: 5px 5px 15px rgba(0,0,0,0.3);
}

.section-title-large {
    font-size: 5rem;
    margin-bottom: 40px;
}

.compliance-text {
    margin-top: 24px;
    font-weight: 500;
}

/* Brands Section Infinite Carousel */
.brands-section {
  background-color: var(--surface-container-low);
  padding: 60px 0;
  overflow: hidden;
}

.brands-slider {
  width: 100%;
  overflow: hidden;
  position: relative;
  padding: 20px 0;
}

.brands-slider::before,
.brands-slider::after {
  content: "";
  position: absolute;
  top: 0;
  width: 150px;
  height: 100%;
  z-index: 2;
  pointer-events: none;
}

.brands-slider::before {
  left: 0;
  background: linear-gradient(to right, var(--surface-container-low), transparent);
}

.brands-slider::after {
  right: 0;
  background: linear-gradient(to left, var(--surface-container-low), transparent);
}

.brands-track {
  display: flex;
  width: max-content;
  animation: scroll-brands 40s linear infinite;
}

.brands-group {
  display: flex;
  align-items: center;
  gap: 120px;
  padding-right: 120px; /* Debe coincidir con el gap para un loop perfecto */
}

@keyframes scroll-brands {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.brands-track:hover {
  animation-play-state: paused;
}

.brands-track img {
  max-height: 160px;
  width: auto;
  filter: grayscale(100%);
  opacity: 0.5;
  transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
  cursor: pointer;
}

.brands-track img:hover {
  filter: grayscale(0%);
  opacity: 1;
  transform: scale(1.1);
}

/* Sucursales / Mapa */
.branches-container {
    display: flex;
    gap: 32px;
}
.branches-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.branch-item {
    padding: 24px;
    background: var(--surface-container-lowest);
    border-radius: var(--radius-lg);
    border: 1px solid var(--surface-dim);
    cursor: pointer;
    transition: all 0.3s;
}
.branch-item:hover, .branch-item.active-branch {
    border-color: var(--primary);
    box-shadow: 6px 6px 6px rgb(0 0 0 / 34%);
}
.map-display {
    flex: 2;
    border-radius: 80px 0 80px;
    overflow: hidden;
    /* eight: 600px; */
    border: 3px solid var(--primary);
    box-shadow: 9px 9px 10px 0px #a19e9e;
}
.map-display iframe {
    width: 100%;
    height: 100%;
    border: none;
}

@media (max-width: 768px) {
    .section {
        padding: 20px;
    }
    
    .hero-section {
        padding: 40px 0 60px;
    }

    /* AQUÍ ESTÁ EL CAMBIO: Se agregó el h1 y el line-height */
    .hero-content h1,
    .hero-content h2 {
        font-size: 2.2rem;
        margin-bottom: 30px;
        text-align: center;
        padding: 0 20px;
        line-height: 1.2; 
    }

    .hero-carousel .carousel-track {
        gap: 15px;
        padding: 0 25px; /* Padding ajustado para móviles para evitar cortes en el inicio/fin */
    }

    .hero-carousel .carousel-item {
        flex: 0 0 110px;
    }

    .skew-wrapper {
        height: 150px;
    }

    .category-label {
        font-size: 11px;
        margin-top: 8px;
    }

    .hero-carousel .carousel-btn {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    .hero-carousel .carousel-btn.prev { left: -10px; }
    .hero-carousel .carousel-btn.next { right: -10px; }

    .branches-container {
        flex-direction: column;
        gap: 20px;
        height: auto;
    }

    .branches-list {
        gap: 12px;
    }

    .branch-item {
        padding: 15px;
    }

    /* Productos Destacados Mobile */
    .featured-section {
        padding: 60px 0;
    }

    .featured-section h2 {
        font-size: 3rem;
        text-align: center;
    }

    #main-featured-title {
        font-size: 32px;
        text-align: center;
    }

    #main-featured-desc {
        font-size: 18px;
    }

    .featured-header-right img {
        max-height: 250px;
        margin: 20px auto;
    }

    .featured-carousel {
        padding: 0 20px;
    }

    .featured-carousel .carousel-item {
        flex: 0 0 calc(50% - 12px); /* 2 items por vista en lugar de 4 */
    }

    .featured-card-wrapper {
        height: 120px;
        border-radius: 12px;
        padding: 10px;
    }

    .featured-item-title {
        font-size: 11px;
        line-height: 1.2;
    }

    .featured-carousel .carousel-btn {
        width: 30px;
        height: 30px;
        font-size: 14px;
    }

    .featured-carousel .carousel-btn.prev { left: -5px; }
    .featured-carousel .carousel-btn.next { right: -5px; }

    /* Catálogo Grid Mobile */
    .section-title-large {
        font-size: 2.2rem;
        text-align: center;
        margin-bottom: 30px;
    }

    .category-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: 180px;
        gap: 10px;
    }

    .category-item, 
    .grid-span-v, 
    .grid-span-h, 
    .grid-span-large {
        grid-column: span 1 !important;
        grid-row: span 1 !important;
    }

    .category-overlay {
        font-size: 0.85rem;
        padding: 6px 5px;
        width: 100%;
        text-align: center;
    }

    .pos-bottom-left, .pos-bottom-right, .pos-top-left, .pos-top-right, .pos-center {
        bottom: 0 !important;
        left: 0 !important;
        top: auto !important;
        right: auto !important;
        transform: none !important;
    }

    /* Marcas Mobile */
    .brands-group {
        gap: 60px;
        padding-right: 60px;
    }
    .brands-track img {
        max-height: 80px;
    }
    .brands-slider::before,
    .brands-slider::after {
        width: 60px;
    }
}

/* Sucursales - Interactive Map */
.branches-container {
    display: flex;
    gap: 32px;
    margin-top: 40px;
}

.branches-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.branch-item {
    padding: 24px;
    background: var(--surface-container-lowest);
    border-radius: var(--radius-lg);
    border: 1px solid var(--surface-dim);
    cursor: pointer;
    transition: all 0.3s;
}

.branch-item:hover,
.branch-item.active-branch {
    border-color: var(--primary);
    box-shadow: 6px 6px 6px rgb(0 0 0 / 34%);
}

.branch-item.active-branch {
    border-left: 5px solid var(--primary);
    transform: translateX(5px);
}

.branch-actions {
    margin-top: 16px;
    display: flex;
    gap: 16px;
}

.map-display {
    flex: 2;
    border-radius: 40px 0 40px;
    overflow: hidden;
    border: 2px solid var(--primary);
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    background: #f8f9fa;
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 550px;
}

.map-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    flex: 1;
    display: flex;
}

#leaf-map {
    width: 100%;
    height: 100%;
    z-index: 1;
}

.mexico-map-view {
    position: relative;
    width: 100%;
    height: 100%;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.mexico-map-view.zoomed {
    opacity: 0;
    transform: scale(1.5);
    filter: blur(10px);
    pointer-events: none;
}

/* Google Style Marker */
.google-marker {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.pin {
    width: 32px;
    height: 32px;
    background: #ea4335;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    border: 1px solid #c5221f;
}

.inner-dot {
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    transform: rotate(45deg);
}

.pulse {
    width: 15px;
    height: 15px;
    background: rgba(234, 67, 53, 0.4);
    border-radius: 50%;
    position: absolute;
    bottom: -8px;
    animation: marker-pulse 2s infinite;
}

@keyframes marker-pulse {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(3); opacity: 0; }
}

.detail-map-view {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
    transition: all 0.6s ease;
    transform: translateY(30px);
    z-index: 10;
    background: #fff;
    display: flex;
    flex-direction: column;
}

.detail-map-view.active {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0);
}

.detail-map-view iframe {
    width: 100%;
    height: 100%;
    border: none;
    flex-grow: 1;
}

.btn-back-map {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 100;
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 30px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-back-map:hover {
    background: var(--primary, #ff6600);
    transform: translateX(-5px);
}

@media (max-width: 992px) {
    .branches-container {
        flex-direction: column;
        height: auto;
    }
    .map-display {
        height: 500px !important;
        min-height: 500px !important;
        border-radius: 20px;
    }
    .map-wrapper, .mexico-map-view, #leaf-map {
        height: 500px !important;
        width: 100% !important;
        display: block !important;
    }
}
