/*
 * Tarjetas de producto + modal — módulo compartido por ventanas, mamparas y
 * puertas (assets/js/producto-cards.js).
 *
 * - Cada tarjeta muestra las imágenes del producto en un carrusel que se
 *   desliza hacia la derecha (no fade), con puntitos que indican cuántas hay.
 * - La tarjeta completa es clickeable (cursor pointer) y abre un modal grande
 *   y responsive con la info del producto y su galería.
 */

/* ---------- Tarjeta ---------- */
.producto-modelo-card {
    position: relative;
    display: block;
    background: #fff;
    border: 1px solid #ececf1;
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    transition: transform .35s ease, box-shadow .35s ease, border-color .35s ease;
}
.producto-modelo-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 4px;
    background: linear-gradient(90deg, #06A4EA, #94D10F);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .4s ease;
    z-index: 3;
}
.producto-modelo-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 22px 44px rgba(17, 22, 31, .12);
    border-color: transparent;
}
.producto-modelo-card:hover::after { transform: scaleX(1); }

/* Carrusel de la tarjeta */
.pmc-slider {
    position: relative;
    width: 100%;
    height: 310px;
    overflow: hidden;
    background: #eef2f5;
}
.pmc-track {
    display: flex;
    height: 100%;
    width: 100%;
    will-change: transform;
}
.pmc-track.is-animating {
    transition: transform .6s cubic-bezier(.4, 0, .2, 1);
}
.pmc-slide {
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
}
.pmc-slide img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .5s ease;
}
.producto-modelo-card:hover .pmc-slide img { transform: scale(1.05); }

/* Puntitos */
.pmc-dots {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 12px;
    z-index: 2;
    display: flex;
    justify-content: center;
    gap: 7px;
    pointer-events: none;
}
.pmc-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .55);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .35);
    transition: width .3s ease, background-color .3s ease;
}
.pmc-dot.is-active {
    width: 20px;
    border-radius: 4px;
    background: #fff;
}

.producto-modelo-card h4 {
    color: #11161f;
    font-size: 16px;
    font-weight: 700;
    margin: 20px 22px 8px;
    line-height: 1.4;
}
.producto-modelo-card p {
    color: #767676;
    font-size: 13.5px;
    line-height: 1.65;
    margin: 0 22px 22px;
}

@media (prefers-reduced-motion: reduce) {
    .producto-modelo-card,
    .pmc-slide img { transition: none; }
    .pmc-track.is-animating { transition: none; }
}

/* ---------- Modal ---------- */
.pm-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
/* is-shown controla la visibilidad; is-open controla el estado animado. Así la
   transición de entrada/salida sí corre (un cambio de display no la dispara). */
.pm-modal.is-shown { display: flex; }
.pm-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(6, 12, 20, .8);
    opacity: 0;
    transition: opacity .3s ease;
}
.pm-modal.is-open .pm-modal__backdrop { opacity: 1; }
/* Flex (no grid): align-items:stretch estira ambas columnas a la altura del
   panel, que está topada a 90vh. Así la info (con min-height:0 y overflow-y)
   scrollea en vez de desbordarse y cortarse. */
.pm-modal__panel {
    position: relative;
    display: flex;
    align-items: stretch;
    width: min(1000px, 100%);
    max-height: 90vh;
    background: #fff;
    border-radius: 18px;
    overflow: hidden;
    transform: translateY(24px) scale(.96);
    opacity: 0;
    transition: transform .4s cubic-bezier(.2, .7, .2, 1), opacity .4s ease;
}
.pm-modal.is-open .pm-modal__panel {
    transform: translateY(0) scale(1);
    opacity: 1;
}
.pm-modal__close {
    position: absolute;
    top: 12px;
    right: 14px;
    z-index: 5;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .9);
    color: #11161f;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    transition: background-color .2s ease;
}
.pm-modal__close:hover { background: #fff; }

/* Galería del modal */
.pm-gallery {
    position: relative;
    flex: 0 0 54%;
    background: #0f131a;
    overflow: hidden;
    min-height: 320px;
}
/* Tag del tipo de producto, sobre la imagen (arriba-izquierda) */
.pm-gallery__tag {
    position: absolute;
    top: 14px;
    left: 14px;
    z-index: 4;
    padding: 6px 13px;
    border-radius: 999px;
    background: rgba(6, 164, 234, .92);
    color: #fff;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    box-shadow: 0 3px 10px rgba(0, 0, 0, .3);
}
.pm-gallery__track {
    display: flex;
    height: 100%;
    width: 100%;
}
.pm-gallery__track.is-animating {
    transition: transform .45s cubic-bezier(.4, 0, .2, 1);
}
.pm-gallery__slide {
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    min-height: 320px;
}
.pm-gallery__slide img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.pm-gallery__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .85);
    color: #11161f;
    font-size: 18px;
    cursor: pointer;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color .2s ease;
}
.pm-gallery__nav:hover { background: #fff; }
.pm-gallery__nav--prev { left: 14px; }
.pm-gallery__nav--next { right: 14px; }
.pm-gallery__dots {
    position: absolute;
    left: 0; right: 0; bottom: 14px;
    z-index: 3;
    display: flex;
    justify-content: center;
    gap: 7px;
}
.pm-gallery__dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    border: 0;
    padding: 0;
    background: rgba(255, 255, 255, .5);
    cursor: pointer;
    transition: width .3s ease, background-color .3s ease;
}
.pm-gallery__dot.is-active {
    width: 22px;
    border-radius: 4px;
    background: #fff;
}

/* Info del modal — min-height:0 permite que overflow-y:auto realmente
   scrollee dentro del grid (si no, el item no encoge y el contenido se corta). */
.pm-info {
    flex: 1 1 46%;
    min-height: 0;
    padding: 30px 34px 30px;
    overflow-y: auto;
}
.pm-info h3 {
    margin: 0 0 10px;
    font-size: 24px;
    line-height: 1.25;
    color: #11161f;
}
.pm-info__desc {
    margin: 0 0 18px;
    color: #5c6673;
    font-size: 14.5px;
    line-height: 1.7;
}
.pm-info__subtitle {
    margin: 0 0 10px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
    color: #11161f;
}
.pm-info__feats {
    margin: 0 0 20px;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 8px;
}
.pm-info__feats li {
    position: relative;
    padding-left: 26px;
    color: #40474f;
    font-size: 14px;
    line-height: 1.5;
}
.pm-info__feats li::before {
    content: "\f00c";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    position: absolute;
    left: 0; top: 1px;
    color: #94D10F;
    font-size: 12px;
}
.pm-info__specs {
    margin: 0 0 22px;
    border-top: 1px solid #eef1f5;
}
.pm-info__specs div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 9px 0;
    border-bottom: 1px solid #eef1f5;
    font-size: 13.5px;
}
.pm-info__specs dt { color: #8a95a1; margin: 0; }
.pm-info__specs dd { color: #11161f; font-weight: 600; margin: 0; text-align: right; }
.pm-info__cta {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 13px 26px;
    border-radius: 8px;
    background: #06A4EA;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    transition: background-color .25s ease;
}
.pm-info__cta:hover { background: #022436; color: #fff; }

@media (max-width: 860px) {
    /* Se apila: imagen arriba, info abajo, y scrollea el panel completo */
    .pm-modal__panel {
        flex-direction: column;
        max-height: 92vh;
        overflow-y: auto;
    }
    .pm-gallery { flex: 0 0 auto; min-height: 260px; }
    .pm-gallery__slide { min-height: 260px; }
    .pm-info { flex: 0 0 auto; overflow-y: visible; padding: 26px 24px 30px; }
    .pm-info h3 { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) {
    .pm-modal__panel,
    .pm-modal__backdrop,
    .pm-gallery__track.is-animating { transition: none; }
}
