/* =====================================================
   Ecommerce Pack – PymesModernas | Frontend Styles
   Hero [pm_portada] + Sellos [pm_sellos]
===================================================== */

/* ── Hero portada ────────────────────────────────── */
.ecpm-hero {
    position: relative;
    width: 100%;
    overflow: hidden;
    /* Altura por defecto: proporción 1600×600 */
    padding-top: 37.5%;
    background: #1a2e4f;
}

.ecpm-hero__bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* Escritorio visible por defecto, móvil oculto */
.ecpm-hero__bg--desktop { display: block; }
.ecpm-hero__bg--mobile  { display: none;  }

/* Overlay — alineación centrada por defecto */
.ecpm-hero__overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px 32px;
    background: rgba(26, 46, 79, 0.45); /* valor base; el shortcode lo sobreescribe vía inline style */
    gap: 12px;
}

/* Alineaciones alternativas */
.ecpm-hero__overlay--left {
    align-items: flex-start;
    text-align: left;
    padding-left: max(32px, 6%);
}

.ecpm-hero__overlay--right {
    align-items: flex-end;
    text-align: right;
    padding-right: max(32px, 6%);
}

.ecpm-hero__title {
    color: #fff;
    font-size: clamp(22px, 4vw, 48px);
    font-weight: 700;
    line-height: 1.2;
    margin: 0;
    text-shadow: 0 2px 8px rgba(0,0,0,.35);
}

.ecpm-hero__desc {
    color: rgba(255,255,255,.90);
    font-size: clamp(14px, 2vw, 20px);
    line-height: 1.5;
    margin: 0;
    max-width: 600px;
    text-shadow: 0 1px 4px rgba(0,0,0,.30);
}

.ecpm-hero__btn {
    display: inline-block;
    background: #fff;
    color: #1a2e4f;
    font-size: 15px;
    font-weight: 600;
    padding: 12px 28px;
    border-radius: 6px;
    text-decoration: none;
    transition: background .2s, transform .15s, color .2s;
    margin-top: 4px;
}

.ecpm-hero__btn:hover {
    background: #2563a8;
    color: #fff;
    transform: translateY(-2px);
}

/* Móvil: imagen cuadrada 1200×1200 → relación 1:1 */
@media (max-width: 768px) {
    .ecpm-hero {
        padding-top: 100%;   /* cuadrado */
    }

    .ecpm-hero__bg--desktop { display: none;  }
    .ecpm-hero__bg--mobile  { display: block; }

    .ecpm-hero__overlay {
        padding: 20px 16px;
        gap: 8px;
    }

    .ecpm-hero__btn {
        padding: 10px 22px;
        font-size: 14px;
    }
}

/* ── Sellos de confianza ─────────────────────────── */
.ecpm-sellos {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    justify-content: center;
}

.ecpm-sello {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-align: center;
    flex: 1;
    min-width: 80px;
    max-width: 160px;
}

.ecpm-sello__icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ecpm-sello__icon img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.ecpm-sello__text {
    font-size: 13px;
    font-weight: 500;
    color: #1a2e4f;
    margin: 0;
    line-height: 1.3;
}

@media (max-width: 480px) {
    .ecpm-sellos {
        gap: 12px;
    }

    .ecpm-sello {
        min-width: 70px;
    }
}

/* ── Sellos: layout lista ────────────────────────── */
.ecpm-sellos--list {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
}

.ecpm-sellos--list .ecpm-sello {
    flex-direction: row;
    gap: 12px;
    text-align: left;
    max-width: 100%;
    width: 100%;
    flex: none;
    min-width: 0;
}

.ecpm-sellos--list .ecpm-sello__icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
}

/* ── Sellos: layout marquee ──────────────────────── */

/*
 * Doble clase (.ecpm-sellos.ecpm-sellos--marquee) para ganar especificidad
 * (0,2,0 = 20 pts) sobre .ecpm-sellos { display:flex } (0,1,0 = 10 pts).
 * Así `display:block` siempre gana sin importar la cascade del tema.
 */
.ecpm-sellos.ecpm-sellos--marquee {
    display: block !important;  /* bloque: el track arranca desde el borde izquierdo */
    overflow: hidden;
    width: 100%;
    position: relative;
}

.ecpm-sellos__track {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    width: max-content;
    animation: ecpm-marquee 22s linear infinite;
    will-change: transform;
}

/*
 * margin-right en cada ítem (en lugar de CSS gap).
 * Con gap, el espacio FINAL del set es 0 → -50% mueve de más → loop con salto.
 * Con margin-right, cada ítem ocupa (ancho + 48px) incluyendo el último,
 * por lo que -50% es exactamente un set → loop perfecto.
 */
.ecpm-sellos--marquee .ecpm-sello {
    flex: none;
    min-width: auto;
    margin-right: 48px;
}

.ecpm-sellos--marquee:hover .ecpm-sellos__track {
    animation-play-state: paused;
}

@keyframes ecpm-marquee {
    0%   { transform: translateX(0); }
    100% { transform: translateX(calc(-100% / var(--ecpm-sets, 6))); }
    /*
     * Con 6 repeticiones en el DOM, mover 1/6 del track = exactamente un set.
     * Al resetear a 0 el contenido es idéntico → loop visual perfecto.
     * Si la pantalla es muy ancha, siempre hay 5 sets extra fuera de la vista
     * garantizando que nunca se vea espacio vacío.
     */
}

/* Auto-inyección en página de producto */
.ecpm-sellos-product-wrap {
    margin-top: 16px;
}

/* Auto-inyección en checkout */
.ecpm-sellos-checkout-wrap {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 0;
    border-top: 1px solid #dce8f0;
    margin-top: 8px;
}

/* ── Tiempo de entrega ───────────────────────────── */
.ecpm-entrega {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: #1a2e4f;
    line-height: 1.4;
}

.ecpm-entrega__icon {
    font-size: 18px;
    line-height: 1;
    flex-shrink: 0;
}

.ecpm-entrega--checkout {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #eef3f9;
    border: 1px solid #c9d8ea;
    border-radius: 8px;
    padding: 10px 16px;
    margin-bottom: 16px;
    font-size: 14px;
    color: #1a2e4f;
}

.ecpm-entrega--checkout .ecpm-entrega__dates {
    color: #2563a8;
    font-weight: 600;
}

/* ── Crédito / referido ──────────────────────────── */
.ecpm-referido {
    display: inline;
    color: inherit;
    text-decoration: none;
    font-size: inherit;
    line-height: inherit;
}

.ecpm-referido__brand {
    color: #1a2e4f;
    font-weight: 700;
}

.ecpm-referido:hover {
    text-decoration: underline;
    color: #2563a8;
}

/* ── FAQ acordeón ────────────────────────────────── */
.ecpm-faq {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 860px;
    width: 100%;
}

.ecpm-faq__item {
    border: 1px solid #dce8f0;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.ecpm-faq__item > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 20px;
    font-size: 15px;
    font-weight: 600;
    color: #1a2e4f;
    background: #f5f8fc;
    cursor: pointer;
    list-style: none;
    user-select: none;
    transition: background .15s;
}

/* Quitar triángulo nativo (Chrome, Firefox, Safari) */
.ecpm-faq__item > summary::-webkit-details-marker { display: none; }
.ecpm-faq__item > summary::marker               { display: none; }

/* Ícono + / × */
.ecpm-faq__item > summary::after {
    content: '+';
    flex-shrink: 0;
    font-size: 22px;
    font-weight: 300;
    line-height: 1;
    color: #2563a8;
    transition: transform .2s ease;
}

.ecpm-faq__item[open] > summary {
    background: #eef3f9;
}

.ecpm-faq__item[open] > summary::after {
    transform: rotate(45deg);
}

.ecpm-faq__answer {
    padding: 14px 20px 18px;
    line-height: 1.7;
    color: #374151;
    border-top: 1px solid #dce8f0;
    font-size: 15px;
}

.ecpm-faq__answer p:last-child { margin-bottom: 0; }

/* ── Políticas ───────────────────────────────────── */
.ecpm-politica {
    line-height: 1.75;
    color: #374151;
    font-size: 15px;
    max-width: 800px;
}

.ecpm-politica p  { margin: 0 0 1em; }
.ecpm-politica ul,
.ecpm-politica ol { margin: 0 0 1em; padding-left: 1.5em; }
.ecpm-politica li { margin-bottom: .4em; }
.ecpm-politica h2,
.ecpm-politica h3 { color: #1a2e4f; margin: 1.4em 0 .6em; }
.ecpm-politica a  { color: #2563a8; }

/* ── Bloque: Categorías PymesModernas ────────────── */
.ecpm-categories {
    display: grid;
    gap: 20px;
}

.ecpm-categories--cols-2 { grid-template-columns: repeat(2, 1fr); }
.ecpm-categories--cols-3 { grid-template-columns: repeat(3, 1fr); }
.ecpm-categories--cols-4 { grid-template-columns: repeat(4, 1fr); }

.ecpm-category {
    display: block;
    text-decoration: none;
    color: inherit;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    border: 1px solid #dce8f0;
    transition: box-shadow .2s, transform .15s;
    box-shadow: 0 1px 4px rgba(26,46,79,.08);
}

.ecpm-category:hover {
    box-shadow: 0 6px 20px rgba(26,46,79,.14);
    transform: translateY(-3px);
    text-decoration: none;
    color: inherit;
}

.ecpm-cat-img {
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #eef3f9;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ecpm-cat-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .3s ease;
}

.ecpm-category:hover .ecpm-cat-img img {
    transform: scale(1.04);
}

.ecpm-cat-img--placeholder {
    color: #b8cde0;
}

.ecpm-cat-img--placeholder svg {
    width: 40%;
    height: 40%;
    opacity: .5;
}

.ecpm-cat-info {
    padding: 12px 14px;
    text-align: center;
}

.ecpm-cat-name {
    font-size: 15px;
    font-weight: 600;
    color: #1a2e4f;
    margin: 0 0 4px;
    line-height: 1.3;
}

.ecpm-cat-count {
    font-size: 12px;
    color: #5a7399;
}

.ecpm-no-categories {
    color: #5a7399;
    font-style: italic;
}

@media (max-width: 768px) {
    .ecpm-categories--cols-3,
    .ecpm-categories--cols-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
    .ecpm-categories--cols-2,
    .ecpm-categories--cols-3,
    .ecpm-categories--cols-4 { grid-template-columns: 1fr; }
}
