/* =========================================================
   ESTILOS RESPONSIVOS GLOBALES - MEGA OUTLET
   Adaptación integral para Móvil (320px-575px), Tablet (576px-991px),
   Laptop (992px-1366px) y Escritorio (1440px+)
   ========================================================= */

/* Prevención segura de scroll horizontal sin romper position: sticky de la navbar */
html,
body {
    overflow-x: clip;
    max-width: 100%;
}

img,
video {
    max-width: 100%;
}

/* Tamaño fluido para cifra destacada en Hero (Slide 2: 40% OFF) */
.hero-highlight-40 {
    font-size: clamp(3.4rem, 5.5vw, 5.6rem);
}

/* Tamaño fluido para precio outlet en detalle.html */
#precioOutlet {
    font-size: clamp(2.1rem, 4.5vw, 3.5rem);
}

/* Botones de flecha compartidos en carruseles (Ofertas, Marcas, Reseñas) */
.carousel-arrow-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    padding: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

.carousel-arrow-prev {
    left: 6px;
}

.carousel-arrow-next {
    right: 6px;
}

/* Tarjeta estándar del carrusel de Súper Ofertas */
.oferta-slide-card {
    width: 280px;
}

/* Puntero y nodo de timeline en Políticas */
.timeline-dot {
    width: 40px;
    height: 40px;
    left: -41.5px;
    top: -4px;
    border: 3px solid var(--color-amarillo);
    color: var(--color-primario);
}

/* Carrusel de reseñas: evitar que los degradados bloqueen toques o clics */
.slider-resenas::before,
.slider-resenas::after {
    pointer-events: none;
}

/* Mejora de contraste para íconos sociales en Footer amarillo (index.html) */
.footer-mega .social-icons a {
    background-color: rgba(11, 36, 71, 0.12);
    color: var(--color-primario);
}

.footer-mega .social-icons a:hover {
    background-color: var(--color-acento);
    color: #ffffff;
}

/* Desactivar efectos puramente de hover/gris en dispositivos táctiles */
@media (hover: none), (pointer: coarse) {
    .slide-marca img {
        filter: grayscale(35%);
        opacity: 0.9;
    }

    .slide-marca.marca-activa img {
        filter: grayscale(0%);
        opacity: 1;
    }

    .card-mision-vision {
        filter: none !important;
        opacity: 1 !important;
        transform: none !important;
    }

    .sucursal-img {
        filter: grayscale(0%);
    }

    .product-image-container {
        cursor: default !important;
    }

    .product-image-container:hover img {
        transform: none !important;
    }
}

/* =========================================================
   DESKTOP GRANDE (>= 1200px) - Hero equilibrado
   ========================================================= */
@media (min-width: 1200px) {
    #heroCarousel .carousel-item {
        height: 62vh;
        min-height: 460px;
        max-height: 620px;
    }

    #heroCarousel .carousel-caption h1 {
        font-size: clamp(2.4rem, 3.8vw, 4.2rem);
    }

    #heroCarousel .carousel-caption p {
        font-size: clamp(1rem, 1.35vw, 1.4rem);
    }
}

/* =========================================================
   TABLET / LAPTOP INTERMEDIO (768px - 1199.98px)
   ========================================================= */
@media (min-width: 768px) and (max-width: 1199.98px) {
    #heroCarousel .carousel-item {
        height: 50vh;
        min-height: 400px;
    }

    #heroCarousel .carousel-caption {
        padding: 40px 8%;
    }

    #heroCarousel .carousel-caption h1 {
        font-size: clamp(1.9rem, 4.2vw, 3rem);
    }

    .hero-highlight-40 {
        font-size: clamp(2.6rem, 6vw, 4rem) !important;
    }

    .oferta-slide-card {
        width: 255px;
    }

    .carousel-arrow-btn {
        width: 40px;
        height: 40px;
    }
}

/* =========================================================
   TELÉFONOS Y TABLETS PEQUEÑAS (< 768px)
   ========================================================= */
@media (max-width: 767.98px) {
    /* Espaciado compacto general en móvil */
    .container.my-5.py-5,
    .container.my-5.py-4 {
        margin-top: 1.75rem !important;
        margin-bottom: 1.75rem !important;
        padding-top: 1.25rem !important;
        padding-bottom: 1.25rem !important;
    }

    h2.fw-bold.text-uppercase {
        font-size: clamp(1.3rem, 5.2vw, 1.75rem);
    }

    /* Botón CTA en políticas y similares para que no desborde en 320px */
    .btn-cta-mobile {
        width: 100%;
        padding-left: 1.25rem !important;
        padding-right: 1.25rem !important;
        font-size: 1rem !important;
    }

    /* Hero Carousel en móvil */
    #heroCarousel .carousel-item {
        height: 420px;
        min-height: 380px;
    }

    #heroCarousel .carousel-caption {
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: flex-start;
        padding: 24px 44px 42px;
        background: linear-gradient(
            to top,
            rgba(11, 36, 71, 0.94) 0%,
            rgba(11, 36, 71, 0.65) 60%,
            rgba(11, 36, 71, 0.35) 100%
        );
    }

    #heroCarousel .carousel-caption h1 {
        font-size: clamp(1.4rem, 6vw, 2.05rem);
        line-height: 1.12;
        margin-bottom: 8px;
    }

    .hero-highlight-40 {
        font-size: clamp(2.15rem, 10.5vw, 3rem) !important;
        line-height: 1.05;
        margin-bottom: 8px;
    }

    #heroCarousel .carousel-caption p {
        font-size: 0.92rem;
        line-height: 1.35;
        margin-bottom: 14px;
    }

    #heroCarousel .carousel-caption .btn-lg {
        padding: 9px 18px;
        font-size: 0.85rem;
    }

    .promo-legales {
        font-size: 0.66rem;
        line-height: 1.25;
        margin-top: 10px;
        max-width: 100%;
    }

    #heroCarousel .carousel-control-prev,
    #heroCarousel .carousel-control-next {
        width: 36px;
    }

    /* Controles de carrusel en contactanos.html */
    #contactCarousel .carousel-item {
        min-height: auto;
        height: auto;
    }

    #contactCarousel .carousel-control-prev-icon,
    #contactCarousel .carousel-control-next-icon {
        padding: 12px !important;
    }

    /* Scroll táctil suave para carrusel de ofertas sin scroll-snap que frene el auto-scroll */
    #carrusel-ofertas {
        -webkit-overflow-scrolling: touch;
        padding-left: 4px;
        padding-right: 4px;
    }

    .oferta-slide-card {
        width: 245px;
    }

    /* Botones flecha de carrusel más compactos dentro de los bordes */
    .carousel-arrow-btn {
        width: 34px;
        height: 34px;
        font-size: 0.85rem;
    }

    .carousel-arrow-prev {
        left: 4px !important;
        margin-left: 0 !important;
    }

    .carousel-arrow-next {
        right: 4px !important;
        margin-right: 0 !important;
    }

    /* Carrusel de Marcas en móvil */
    .slider-marcas {
        padding: 16px 0;
    }

    .slider-marcas::before,
    .slider-marcas::after {
        width: 28px;
    }

    .slide-marca {
        width: 130px;
        height: 74px;
        padding: 10px;
    }

    .slide-track {
        gap: 10px;
    }

    /* Detalle de producto */
    .product-image-container {
        min-height: 260px;
        padding: 18px;
        cursor: default !important;
    }

    .product-image-container img {
        max-height: 240px;
    }

    .product-image-container:hover img {
        transform: none !important;
    }

    .product-title {
        font-size: clamp(1.35rem, 5.5vw, 1.9rem);
        margin-bottom: 12px;
    }

    .product-description {
        font-size: 0.95rem;
        margin-bottom: 18px;
    }

    #precioOutlet {
        font-size: clamp(1.9rem, 8vw, 2.5rem) !important;
        margin-bottom: 10px;
    }

    .precios-box {
        padding: 18px 14px !important;
    }

    .btn-comprar {
        padding: 13px 18px;
        font-size: 0.98rem;
    }

    .specs-list li {
        gap: 12px;
        align-items: flex-start;
        flex-wrap: wrap;
        font-size: 0.92rem;
    }

    /* Conócenos */
    .title-strip {
        padding: 26px 14px;
        margin-bottom: 28px;
    }

    .title-strip h1 {
        font-size: clamp(1.45rem, 6vw, 2rem) !important;
    }

    .title-strip p {
        font-size: 0.95rem !important;
    }

    .intro-box {
        padding: 26px 18px;
        border-left-width: 6px;
        border-radius: 14px;
    }

    .intro-text {
        font-size: 0.98rem;
        line-height: 1.65;
    }

    .quote-icon {
        font-size: 2rem;
    }

    .card-mision-vision {
        padding: 24px 18px !important;
        filter: none !important;
        opacity: 1 !important;
    }

    .audio-btn-overlay {
        width: 40px;
        height: 40px;
        bottom: 12px;
        right: 12px;
    }

    /* Políticas */
    .header-politicas {
        padding: 40px 14px 32px;
        margin-bottom: 28px;
    }

    .header-politicas h1 {
        font-size: clamp(1.45rem, 6vw, 2rem);
    }

    .policy-card {
        padding: 22px 16px;
        margin-bottom: 20px;
    }

    .timeline {
        margin-left: 14px !important;
        padding-left: 26px !important;
    }

    .timeline-dot {
        width: 32px;
        height: 32px;
        left: -43px;
        top: -2px;
        font-size: 0.85rem;
    }

    /* Reseñas */
    .header-hero {
        padding: 38px 14px;
    }

    .header-hero h1 {
        font-size: clamp(1.45rem, 6vw, 2rem);
    }

    .slider-resenas {
        padding: 24px 0;
    }

    .slider-resenas::before,
    .slider-resenas::after {
        width: 24px;
    }

    #carrusel-resenas {
        padding-left: 16px !important;
        padding-right: 16px !important;
        gap: 14px !important;
    }

    .card-resena {
        width: min(295px, 82vw);
        padding: 20px;
    }

    .video-placeholder {
        height: 180px;
    }

    /* Contáctanos - Sucursales */
    .sucursal-img {
        filter: grayscale(0%);
    }

    .sucursal-card {
        height: 310px;
    }

    .sucursal-overlay {
        padding: 18px;
    }

    .sucursal-title {
        font-size: 1.25rem;
    }

    .sucursal-desc {
        font-size: 0.86rem;
        margin-bottom: 14px;
    }

    .btn-maps {
        padding: 9px 14px;
        font-size: 0.78rem;
        width: 100%;
    }

    /* Footer y botón subir: margen inferior para no quedar tapados por botón de chat/subir */
    .footer-mega {
        padding: 36px 0 88px 0;
    }

    .footer-mega h3 img {
        height: 54px !important;
        margin-right: 10px !important;
    }

    .footer-mega h3 {
        font-size: 1.35rem;
    }

    .btn-up {
        width: 44px;
        height: 44px;
        bottom: 18px;
        left: 14px;
        font-size: 1.15rem;
    }

    /* Paneles Admin / Login / Dashboard */
    .login-container {
        margin: 36px auto;
        padding: 24px 18px;
    }

    #searchAdmin {
        width: 100% !important;
        max-width: 100%;
    }

    pre#jsonIA {
        overflow-x: auto;
        max-width: 100%;
        font-size: 0.8rem;
    }
}

/* Páginas sin .footer-mega: reservar espacio abajo en móvil para botones flotantes */
@media (max-width: 767.98px) {
    body.page-no-footer {
        padding-bottom: 84px;
    }
}

/* =========================================================
   CATEGORÍAS EN TABLET INTERMEDIA (576px - 767.98px)
   ========================================================= */
@media (min-width: 576px) and (max-width: 767.98px) {
    .category-card img {
        height: 175px;
    }

    .category-title {
        font-size: 0.95rem;
        padding: 12px 8px;
    }
}

/* =========================================================
   TELÉFONOS PEQUEÑOS Y ESTÁNDAR (< 576px)
   ========================================================= */
@media (max-width: 575.98px) {
    /* Buscador principal en inicio */
    #inputBuscadorInicio {
        font-size: 0.92rem !important;
        padding-left: 2.6rem !important;
        padding-right: 1rem;
        height: 46px;
    }

    #inputBuscadorInicio + #resultadosBusqueda {
        font-size: 0.9rem;
    }

    .position-relative > .fa-search.ms-4 {
        left: 14px !important;
        margin-left: 0 !important;
        font-size: 0.95rem !important;
    }

    #resultadosBusqueda img {
        width: 48px !important;
        height: 48px !important;
    }

    #resultadosBusqueda .fs-5 {
        font-size: 0.95rem !important;
    }

    /* Categorías 2 columnas limpias */
    .category-card img {
        height: 140px;
    }

    .category-title {
        font-size: 0.78rem;
        padding: 9px 6px;
        letter-spacing: 0.3px;
        line-height: 1.2;
        overflow-wrap: break-word;
    }

    /* Súper Ofertas compactas en carrusel móvil */
    .oferta-slide-card {
        width: min(230px, 68vw);
        padding: 12px !important;
    }

    .oferta-slide-card .product-img-wrap {
        height: 150px;
        margin-bottom: 10px;
    }

    .oferta-slide-card .badge-descuento {
        top: 10px;
        left: 10px;
        font-size: 0.7rem;
        padding: 3px 8px;
    }

    .oferta-slide-card .badge-garantia {
        top: 10px;
        right: 10px;
        font-size: 0.65rem;
        padding: 3px 8px;
    }

    .oferta-slide-card .product-title {
        font-size: 0.88rem;
        margin-bottom: 8px;
    }

    .oferta-slide-card .price-outlet {
        font-size: 1.25rem;
    }

    .oferta-slide-card .btn-rojo {
        padding: 9px 10px;
        font-size: 0.78rem;
    }

    /* Catálogo 2 columnas compactas */
    #contenedorProductos .product-card {
        padding: 10px;
        border-radius: 10px;
    }

    #contenedorProductos .product-img-wrap {
        height: 130px;
        margin-bottom: 8px;
    }

    #contenedorProductos .card-body {
        padding: 4px 2px !important;
    }

    #contenedorProductos .card-title {
        font-size: 0.82rem;
        line-height: 1.25;
        margin-bottom: 4px;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    #contenedorProductos .badge-garantia {
        top: 8px;
        right: 8px;
        font-size: 0.6rem;
        padding: 3px 7px;
    }

    #contenedorProductos .precio-regular {
        font-size: 0.72rem;
    }

    #contenedorProductos .precio-outlet {
        font-size: 1.05rem !important;
    }

    #contenedorProductos .btn-rojo {
        padding: 8px 6px !important;
        font-size: 0.72rem !important;
        margin-top: 6px !important;
    }

    /* Paginación catálogo */
    #paginacionContainer .btn {
        padding: 6px 12px;
        font-size: 0.85rem;
    }

    #inputPaginacion {
        width: 62px !important;
    }

    /* Miniaturas en detalle */
    #galeriaThumbs > div {
        width: 64px !important;
        height: 64px !important;
    }

    /* Tarjetas de pago 2x2 en envios-y-pagos.html */
    .pago-card {
        padding: 12px 10px;
        border-radius: 12px;
    }

    .pago-card-img-container {
        height: 105px;
        margin-bottom: 10px;
    }

    .pago-card h5 {
        font-size: 0.95rem;
    }

    .pago-card p {
        font-size: 0.78rem;
    }

    /* Redes sociales 2x2 en contactanos.html */
    .social-panel {
        padding: 18px 10px;
        border-radius: 14px;
    }

    .social-icon-big {
        width: 58px;
        height: 58px;
        font-size: 1.65rem;
        margin-bottom: 10px;
    }

    .social-panel h4 {
        font-size: 1rem;
        margin-bottom: 4px;
    }

    .social-panel p {
        font-size: 0.76rem;
    }
}

/* =========================================================
   TELÉFONOS MUY ANGOSTOS (< 400px)
   ========================================================= */
@media (max-width: 399.98px) {
    #heroCarousel .carousel-item {
        height: 390px;
        min-height: 360px;
    }
}

/* =========================================================
   ACCESIBILIDAD (WCAG 2.1) & BANNER DE COOKIES DISCRETO
   ========================================================= */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid #0090FF !important;
    outline-offset: 2px !important;
}

.cookie-banner {
    position: fixed;
    left: 16px;
    bottom: 16px;
    max-width: 440px;
    z-index: 1045;
    background: #0B2447;
    color: #ffffff;
    border: 2px solid #F4C70F;
    border-radius: 14px;
    padding: 14px 16px;
    font-size: 0.82rem;
    line-height: 1.45;
}

.cookie-banner a {
    color: #F4C70F;
    font-weight: 700;
    text-decoration: underline;
}

.cookie-banner-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

@media (max-width: 767.98px) {
    .cookie-banner {
        left: 12px;
        right: 92px;
        bottom: 14px;
        max-width: none;
        padding: 12px;
        font-size: 0.78rem;
    }
}

.footer-legal-strip {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px 16px;
    font-size: 0.85rem;
    margin-bottom: 10px;
}

.footer-legal-strip a {
    color: inherit;
    font-weight: 600;
    text-decoration: none;
}

.footer-legal-strip a:hover {
    text-decoration: underline;
}
