/* =====================================================
   BIO FARMA — CARRUSEL DE PRODUCTOS
   Diseño responsive + imágenes publicitarias completas
===================================================== */

.cp-section {
    --cp-green: #078653;
    --cp-dark: #18352b;
    --cp-muted: #718078;

    width: min(1200px, calc(100% - 36px));
    margin: 52px auto;

    color: var(--cp-dark);
    font-family: "DM Sans", "Segoe UI", Arial, sans-serif;
    box-sizing: border-box;
}

.cp-section *,
.cp-section *::before,
.cp-section *::after {
    box-sizing: border-box;
}

/* ENCABEZADO */

.cp-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 28px;
}

.cp-heading-content {
    min-width: 0;
}

.cp-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 9px;

    color: var(--cp-green);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1.8px;
    text-transform: uppercase;
}

.cp-eyebrow-dot {
    width: 7px;
    height: 7px;
    flex: 0 0 7px;

    border-radius: 50%;
    background: #0aa66a;
    box-shadow: 0 0 0 4px rgba(10, 166, 106, .10);
    animation: cpDotPulse 2s infinite ease-in-out;
}

.cp-heading h2 {
    margin: 13px 0 10px;
    color: #18352b;

    font-size: clamp(27px, 3.2vw, 39px);
    font-weight: 800;
    letter-spacing: -1.5px;
    line-height: 1.15;
}

.cp-heading-highlight {
    color: #078653;
}

.cp-heading p {
    margin: 0;
    color: #7b8981;
    font-size: 14px;
    line-height: 1.6;
}

@keyframes cpDotPulse {
    0%, 100% {
        box-shadow: 0 0 0 4px rgba(10, 166, 106, .10);
    }

    50% {
        box-shadow: 0 0 0 7px rgba(10, 166, 106, .04);
    }
}

/* BOTONES DE NAVEGACIÓN */

.cp-controls {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    gap: 10px;
}

.cp-arrow {
    display: grid;
    place-items: center;

    width: 44px;
    height: 44px;
    padding: 0;

    border: 1px solid #dcebe2;
    border-radius: 50%;

    background: #ffffff;
    color: #08784e;

    font-family: Arial, sans-serif;
    font-size: 17px;
    font-weight: 800;
    line-height: 1;

    cursor: pointer;
    box-shadow: 0 5px 14px rgba(15, 80, 48, .07);
    transition: all .25s ease;
}

.cp-arrow:hover {
    background: #078653;
    color: #ffffff;
    border-color: #078653;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(8, 134, 83, .2);
}

.cp-arrow:focus-visible {
    outline: 3px solid rgba(8, 134, 83, .25);
    outline-offset: 3px;
}

/* ÁREA DESLIZABLE */

.cp-viewport {
    width: 100%;

    overflow-x: auto;
    overflow-y: hidden;

    scroll-behavior: smooth;
    scrollbar-width: none;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;

    padding: 3px 1px 16px;
}

.cp-viewport::-webkit-scrollbar {
    display: none;
}

.cp-track {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 18px;

    width: max-content;
    min-width: 100%;

    padding: 2px 2px 5px;
}

/* TARJETAS */

.cp-card {
    position: relative;

    flex: 0 0 calc(
        (min(100vw - 36px, 1200px) - 72px) / 4
    );

    min-width: 0;

    display: flex;
    flex-direction: column;

    border: 1px solid #e7eee9;
    border-radius: 22px;

    background: #ffffff;
    overflow: hidden;
    scroll-snap-align: start;

    box-shadow: 0 5px 18px rgba(15, 80, 48, .035);

    transition:
        transform .3s ease,
        border-color .3s ease,
        box-shadow .3s ease;
}

.cp-card:hover {
    transform: translateY(-5px);
    border-color: #b8e6ce;
    box-shadow: 0 16px 36px rgba(15, 80, 48, .09);
}

/* =====================================================
   IMAGEN DEL PRODUCTO
   Aspect ratio 2:3 para publicidad vertical completa
===================================================== */

.cp-image-box {
    position: relative;

    display: grid;
    place-items: center;

    width: 100%;
    aspect-ratio: 2 / 3;

    height: auto;
    min-height: 0;
    padding: 0;

    background: #f8fcf9;
    overflow: hidden;
    flex-shrink: 0;
}

/* Decoración suave detrás de la imagen */

.cp-image-box::before {
    content: "";

    position: absolute;
    z-index: 0;

    width: 72%;
    aspect-ratio: 1 / 1;

    border-radius: 50%;
    background: rgba(8, 134, 83, .045);
    transition: transform .4s ease;
}

.cp-card:hover .cp-image-box::before {
    transform: scale(1.08);
}

/* Imagen completa, sin cortes */

.cp-image-box .cp-image {
    position: relative;
    z-index: 1;

    display: block;

    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;

    object-fit: contain;
    object-position: center center;

    cursor: zoom-in;
    transition: transform .3s ease;
}

/* No ampliar la imagen al hover: evita recortar los bordes */

.cp-card:hover .cp-image {
    transform: none;
}

/* ICONO CUANDO NO HAY IMAGEN */

.cp-no-image {
    position: relative;
    z-index: 1;

    display: grid;
    place-items: center;
    align-content: center;
    gap: 12px;

    width: 100%;
    height: 100%;

    color: #82b99a;
    text-align: center;
}

.cp-no-image[hidden] {
    display: none !important;
}

.cp-no-image svg {
    display: block;

    width: 78px;
    height: 78px;
    padding: 17px;

    border: 1px solid #d9eee1;
    border-radius: 22px;

    background: #ffffff;
    color: #8dbba0;

    box-shadow: 0 8px 22px rgba(15, 80, 48, .06);
    transition: transform .3s ease;
}

.cp-card:hover .cp-no-image svg {
    transform: translateY(-4px) scale(1.04);
}

.cp-no-image span {
    color: #67927a;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .4px;
}

/* ETIQUETA BIO FARMA */

.cp-image-badge {
    position: absolute;
    z-index: 2;

    left: 13px;
    top: 13px;

    display: inline-flex;
    align-items: center;
    gap: 6px;

    padding: 7px 10px;

    border: 1px solid rgba(255, 255, 255, .8);
    border-radius: 30px;

    background: rgba(255, 255, 255, .9);
    color: #078653;

    font-size: 9px;
    font-weight: 800;
    letter-spacing: .5px;

    box-shadow: 0 3px 10px rgba(15, 80, 48, .05);
    backdrop-filter: blur(8px);
}

.cp-badge-symbol {
    font-size: 12px;
}

/* INFORMACIÓN DEL PRODUCTO */

.cp-card-content {
    display: flex;
    flex-direction: column;
    flex: 1;

    padding: 18px 18px 17px;
}

.cp-product-name {
    display: -webkit-box;

    min-height: 42px;
    margin: 0;

    color: #18352b;

    font-size: 14px;
    font-weight: 750;
    line-height: 1.5;

    overflow: hidden;
    overflow-wrap: anywhere;

    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

/* PRECIO */

.cp-product-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;

    margin-top: 15px;
    padding-top: 13px;

    border-top: 1px solid #edf2ee;
}

.cp-price-label {
    color: #87938c;
    font-size: 11px;
    font-weight: 500;
}

.cp-price {
    color: #078653;

    font-size: 17px;
    font-weight: 800;
    letter-spacing: -.3px;

    white-space: nowrap;
}

/* AGREGAR AL CARRITO */

.cp-add-cart {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;

    width: 100%;
    margin-top: 15px;
    padding: 12px 14px;

    border: 0;
    border-radius: 12px;

    background: linear-gradient(135deg, #078653, #05a66a);
    color: #ffffff;

    font-family: inherit;
    font-size: 12px;
    font-weight: 800;

    cursor: pointer;

    box-shadow: 0 5px 14px rgba(8, 134, 83, .14);
    transition: all .25s ease;
}

.cp-add-cart:hover {
    transform: translateY(-2px);
    background: linear-gradient(135deg, #066b43, #078653);
    box-shadow: 0 8px 20px rgba(8, 134, 83, .22);
}

.cp-add-cart:active {
    transform: scale(.98);
}

.cp-cart-icon {
    width: 17px;
    height: 17px;
    flex: 0 0 17px;
}

/* ESTADO VACÍO */

.cp-empty {
    display: flex;
    flex-direction: column;
    align-items: center;

    padding: 38px 20px;

    border: 1px dashed #cfe2d5;
    border-radius: 20px;

    text-align: center;
}

.cp-empty-icon {
    display: grid;
    place-items: center;

    width: 55px;
    height: 55px;

    margin-bottom: 12px;

    border-radius: 17px;

    background: #e9f7ef;
    color: #078653;

    font-size: 23px;
}

.cp-empty h3 {
    margin: 0 0 7px;
    color: #18352b;
    font-size: 16px;
}

.cp-empty p {
    margin: 0;
    color: #718078;
    font-size: 13px;
}

/* =====================================================
   TABLET
===================================================== */

@media (max-width: 1100px) {

    .cp-card {
        flex-basis: calc(
            (min(100vw - 36px, 1200px) - 54px) / 3
        );
    }

    .cp-track {
        gap: 18px;
    }

    .cp-image-box {
        aspect-ratio: 2 / 3;
    }
}

/* =====================================================
   TABLET PEQUEÑA
===================================================== */

@media (max-width: 800px) {

    .cp-card {
        flex-basis: calc(
            (min(100vw - 36px, 1200px) - 36px) / 2
        );
    }
}

/* =====================================================
   CELULARES
===================================================== */

@media (max-width: 600px) {

    .cp-section {
        width: calc(100% - 28px);
        margin: 38px auto;
    }

    .cp-heading {
        align-items: flex-start;
        gap: 12px;
        margin-bottom: 22px;
    }

    .cp-eyebrow {
        font-size: 9px;
        letter-spacing: 1.3px;
    }

    .cp-heading h2 {
        margin: 11px 0 8px;

        font-size: 27px;
        letter-spacing: -.9px;
        line-height: 1.2;
    }

    .cp-heading p {
        max-width: 280px;
        font-size: 12px;
    }

    .cp-controls {
        gap: 5px;
    }

    .cp-arrow {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }

    .cp-track {
        gap: 12px;
    }

    .cp-card {
        flex-basis: calc(100vw - 28px);
        border-radius: 20px;
    }

    /* Publicidad completa y vertical */

    .cp-image-box {
        width: 100%;
        aspect-ratio: 2 / 3;

        height: auto;
        min-height: 0;

        padding: 0;
    }

    .cp-image-box .cp-image {
        width: 100%;
        height: 100%;

        object-fit: contain;
        object-position: center center;
    }

    .cp-image-badge {
        left: 10px;
        top: 10px;

        padding: 6px 9px;
        font-size: 9px;
    }

    .cp-card-content {
        padding: 17px;
    }

    .cp-product-name {
        min-height: 42px;
        font-size: 14px;
    }

    .cp-price {
        font-size: 17px;
    }

    .cp-add-cart {
        min-height: 44px;
    }

    .cp-no-image svg {
        width: 72px;
        height: 72px;
    }
}

/* CELULARES MUY PEQUEÑOS */

@media (max-width: 360px) {

    .cp-section {
        width: calc(100% - 20px);
    }

    .cp-card {
        flex-basis: calc(100vw - 20px);
    }

    .cp-card-content {
        padding: 14px;
    }

    .cp-heading h2 {
        font-size: 24px;
    }

    .cp-image-badge {
        font-size: 8px;
    }
}

/* ACCESIBILIDAD Y MOVIMIENTO REDUCIDO */

@media (prefers-reduced-motion: reduce) {

    .cp-viewport {
        scroll-behavior: auto;
    }

    .cp-card,
    .cp-image,
    .cp-arrow,
    .cp-image-box::before {
        transition: none;
    }

    .cp-eyebrow-dot {
        animation: none;
    }
}

/* =====================================================
   NOTIFICACIÓN TOAST
===================================================== */

.cp-toast {
    position: fixed;
    z-index: 99999;

    right: 20px;
    bottom: 20px;

    max-width: calc(100% - 40px);
    padding: 14px 18px;

    border-radius: 12px;

    background: #18352b;
    color: #ffffff;

    font-family: "DM Sans", Arial, sans-serif;
    font-size: 13px;
    font-weight: 600;

    box-shadow: 0 10px 30px rgba(0, 0, 0, .18);

    opacity: 0;
    visibility: hidden;

    transform: translateY(12px);
    transition: all .25s ease;
}

.cp-toast-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* =====================================================
   IMAGEN AMPLIABLE DE PRODUCTOS
===================================================== */

.cp-image-zoom {
    cursor: zoom-in;
}

/* FONDO DEL MODAL */

.cp-image-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;

    display: none;
    align-items: center;
    justify-content: center;

    padding: 20px;

    background: rgba(5, 12, 25, 0.88);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* MODAL ACTIVO */

.cp-image-modal.cp-modal-active {
    display: flex;
    animation: cpModalFadeIn .25s ease;
}

/* CONTENEDOR DEL MODAL */

.cp-image-modal-content {
    position: relative;

    width: 100%;
    max-width: 700px;
    max-height: 90vh;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* NOMBRE DEL PRODUCTO */

.cp-image-modal-title {
    width: 100%;
    margin-bottom: 15px;

    text-align: center;

    color: #fdfffe;
    font-size: 18px;
    font-weight: 700;
}

/* IMAGEN AMPLIADA */

#cpImageModalImg {
    display: block;

    max-width: 100%;
    max-height: 75vh;

    width: auto;
    height: auto;

    object-fit: contain;
    object-position: center;

    border-radius: 12px;
}

/* BOTÓN CERRAR */

.cp-image-modal-close {
    position: absolute;
    top: 10px;
    right: 12px;

    width: 38px;
    height: 38px;

    display: flex;
    align-items: center;
    justify-content: center;

    border: none;
    border-radius: 50%;

    background: #f1f5f9;
    color: #1e293b;

    font-size: 30px;
    line-height: 1;

    cursor: pointer;
    transition: all .2s ease;
}

.cp-image-modal-close:hover {
    background: #dc2626;
    color: #ffffff;
}

/* ANIMACIÓN DEL MODAL */

@keyframes cpModalFadeIn {
    from {
        opacity: 0;
        transform: scale(.96);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* MODAL EN CELULARES */

@media (max-width: 600px) {

    .cp-image-modal {
        padding: 12px;
    }

    .cp-image-modal-content {
        max-width: 100%;
        max-height: 90vh;

        padding: 14px;
        border-radius: 16px;
    }

    #cpImageModalImg {
        max-width: 100%;
        max-height: 75vh;
    }

    .cp-image-modal-title {
        font-size: 15px;
        padding: 0 30px;
    }

    .cp-image-modal-close {
        top: 4px;
        right: 4px;
    }
}

/* =====================================================
   DISEÑO MÓVIL COMPACTO Y PREMIUM
   Mantiene la publicidad completa dentro de la tarjeta
===================================================== */

@media (max-width: 600px) {
    .cp-section {
        width: calc(100% - 24px);
        margin: 28px auto;
    }

    .cp-heading {
        align-items: center;
        gap: 10px;
        margin-bottom: 16px;
    }

    .cp-heading h2 {
        margin: 8px 0 5px;
        font-size: 23px;
        letter-spacing: -.7px;
    }

    .cp-heading p {
        font-size: 11px;
        line-height: 1.45;
    }

    .cp-eyebrow {
        gap: 6px;
        font-size: 8px;
        letter-spacing: 1px;
    }

    .cp-controls {
        gap: 5px;
    }

    .cp-arrow {
        width: 31px;
        height: 31px;
        font-size: 12px;
    }

    .cp-track {
        gap: 8px;
        padding: 2px 1px 10px;
    }

    /* Dos tarjetas un poco más pequeñas y completas en celular */
    .cp-card {
        flex: 0 0 calc((100vw - 48px) / 2);
        width: calc((100vw - 48px) / 2);
        min-width: 0;
        border-radius: 15px;
        box-shadow: 0 4px 13px rgba(15, 80, 48, .06);
    }

    /* Imagen vertical completa, en una caja más compacta */
    .cp-image-box {
        width: 100%;
        height: auto;
        min-height: 0;
        aspect-ratio: 2 / 2.45;
        padding: 4px;
        background: linear-gradient(145deg, #f8fcf9, #edf8f1);
    }

    .cp-image-box .cp-image {
        width: 100%;
        height: 100%;
        object-fit: contain;
        object-position: center;
        transform: none;
    }

    .cp-image-badge {
        top: 9px;
        left: 9px;
        gap: 4px;
        padding: 5px 7px;
        font-size: 8px;
    }

    .cp-badge-symbol {
        font-size: 10px;
    }

    .cp-card-content {
        padding: 9px 9px 10px;
    }

    .cp-product-name {
        min-height: 34px;
        font-size: 11px;
        line-height: 1.35;
    }

    .cp-product-bottom {
        flex-wrap: wrap;
        gap: 3px;
        margin-top: 7px;
        padding-top: 7px;
    }

    .cp-price-label {
        font-size: 9px;
    }

    .cp-price {
        font-size: 13px;
    }

    .cp-add-cart {
        min-height: 34px;
        margin-top: 8px;
        padding: 7px 5px;
        gap: 4px;
        border-radius: 9px;
        font-size: 10px;
    }

    .cp-cart-icon {
        width: 13px;
        height: 13px;
        flex-basis: 13px;
    }

    .cp-no-image svg {
        width: 58px;
        height: 58px;
    }
}

/* Celulares muy estrechos */
@media (max-width: 360px) {
    .cp-card {
        flex-basis: calc((100vw - 44px) / 2);
        width: calc((100vw - 44px) / 2);
    }

    .cp-image-box {
        height: auto;
        min-height: 0;
        aspect-ratio: 2 / 2.5;
    }

    .cp-heading h2 {
        font-size: 21px;
    }

    .cp-add-cart span {
        font-size: 9px;
    }
}

/* Pantallas táctiles: evitar agrandar la imagen al tocar */
@media (hover: none) {
    .cp-card:hover {
        transform: none;
    }

    .cp-card:hover .cp-image {
        transform: none;
    }
}
