/* CostaCX Popup – Frontend Styles */
.ccxp-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none;          /* oculto hasta que JS lo active */
    align-items: center;
    justify-content: center;
    padding: 12px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .35s ease;
}

.ccxp-overlay.ccxp-visible {
    display: flex;
    opacity: 1;
}

.ccxp-modal {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,.4);
    max-width: 680px;
    width: 100%;
    display: flex;
    overflow: visible;      /* el botón de cierre puede salir de la caja */
    position: relative;
    max-height: 92vh;
    transform: translateY(30px) scale(.97);
    transition: transform .35s ease;
}

.ccxp-overlay.ccxp-visible .ccxp-modal {
    transform: translateY(0) scale(1);
}

/* ── Imagen principal – columna izquierda (desktop) ── */
.ccxp-img-main-wrap {
    flex: 0 0 42%;
    min-height: 280px;
    overflow: hidden;
    border-radius: 12px 0 0 12px;   /* mantiene la esquina izquierda redondeada */
}

.ccxp-img-main-wrap a { display: block; height: 100%; }

.ccxp-img-main {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .4s ease;
}

.ccxp-img-main:hover { transform: scale(1.04); }

/* ── Slider (1 imagen en desktop · 2 imágenes con fundido en móvil) ── */
.ccxp-slider { position: relative; width: 100%; height: 100%; }
.ccxp-slide  { width: 100%; height: 100%; }
.ccxp-slide a { display: block; height: 100%; }
/* En desktop la 2ª imagen no se muestra arriba (sale en su sitio, dentro del contenido) */
.ccxp-slide--small { display: none; }

/* ── Columna derecha ── */
.ccxp-content {
    flex: 1;
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.ccxp-h3-top {
    font-size: 24px;
    font-weight: 600;
    color: #555;
    margin: 0;
}

.ccxp-h2 {
    font-size: 22px;
    font-weight: 800;
    line-height: 1.2;
    margin: 0;
}

.ccxp-h2 a { color: inherit; text-decoration: none; }
.ccxp-h2 a:hover { text-decoration: underline; }

.ccxp-h3-sub1 {
    font-size: 15px;
    font-weight: 400;
    color: #333;
    line-height: 1.5;
    margin: 0;
}

.ccxp-h3-sub2 { font-size: 15px; margin: 0; }

/* ── Imagen pequeña ── */
.ccxp-img-small-wrap { border-radius: 8px; overflow: hidden; }
.ccxp-img-small-wrap a { display: block; }
.ccxp-img-small { width: 100%; height: auto; display: block; border-radius: 8px; transition: opacity .2s; }
.ccxp-img-small:hover { opacity: .9; }

/* ── Botón CTA ── */
.ccxp-btn {
    display: block;
    color: #fff !important;
    text-decoration: none !important;
    padding: 12px 20px;
    border-radius: 7px;
    font-size: 15px;
    font-weight: 700;
    text-align: center;
    margin-top: 4px;
    transition: filter .2s, transform .15s;
}
.ccxp-btn:hover { filter: brightness(1.1); transform: translateY(-1px); }

/* ── Barra de progreso (auto-cierre) ── */
.ccxp-progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(0, 0, 0, .08);
    border-radius: 3px;
    margin-top: 10px;
    overflow: hidden;
    position: relative;
}

.ccxp-progress-fill {
    width: 100%;
    height: 100%;
    background-color: var(--ccxp-accent, #e74c3c);
    border-radius: 3px;
    transform-origin: left center;
    /* La transición la fija el JS dinámicamente según auto_close_seconds */
}

/* ── Botón cerrar (círculo sobre la esquina, fuera de la caja) ── */
.ccxp-close {
    position: absolute;
    top: -15px;
    right: -15px;
    box-sizing: border-box !important;
    width: 38px !important;
    height: 38px !important;
    min-width: 0 !important;
    max-width: 38px !important;
    padding: 0 !important;
    margin: 0 !important;
    background: #e74c3c;
    color: #fff;
    border: 3px solid #fff !important;
    border-radius: 50% !important;   /* círculo perfecto */
    font-size: 0 !important;         /* oculta la ✕ de la fuente; la dibujamos abajo */
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    box-shadow: 0 3px 10px rgba(0,0,0,.3);
    transition: background .2s, transform .15s;
    flex: 0 0 auto;
}
.ccxp-close:hover { background: #c0392b; transform: scale(1.08); }

/* X dibujada con dos barras: centrada y gruesa */
.ccxp-close::before,
.ccxp-close::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 17px;
    height: 3.5px;
    background: #fff;
    border-radius: 3px;
}
.ccxp-close::before { transform: translate(-50%, -50%) rotate(45deg); }
.ccxp-close::after  { transform: translate(-50%, -50%) rotate(-45deg); }

/* ══════════════════════════════════════════
   RESPONSIVE — tablet estrecha
══════════════════════════════════════════ */
@media (max-width: 600px) {

    .ccxp-overlay { padding: 10px; align-items: center; justify-content: center; }

    .ccxp-modal {
        flex-direction: column;
        max-height: 90vh;
        border-radius: 14px;
        width: 100%;
        margin: auto;
    }

    /* Imagen principal: franja horizontal, menos alta */
    .ccxp-img-main-wrap {
        flex: 0 0 auto;
        height: 200px;
        min-height: unset;
        width: 100%;
        border-radius: 14px 14px 0 0;   /* esquinas superiores al apilar */
    }

    .ccxp-img-main {
        width: 100%;
        height: 200px;
        object-fit: cover;
    }

    /* La 2ª imagen ya NO va suelta en el contenido: pasa al slider de arriba */
    .ccxp-img-small-wrap { display: none !important; }

    /* Slider con fundido entre las dos imágenes */
    .ccxp-slider { position: relative; width: 100%; height: 100%; }

    .ccxp-has-slider .ccxp-slide {
        position: absolute;
        inset: 0;
        opacity: 0;
        transition: opacity .8s ease;
    }
    .ccxp-has-slider .ccxp-slide.is-active { opacity: 1; }

    /* La 2ª imagen sí se muestra dentro del slider en móvil */
    .ccxp-has-slider .ccxp-slide--small { display: block; }

    .ccxp-slide img { width: 100%; height: 100%; object-fit: cover; display: block; }

    /* Contenido más compacto */
    .ccxp-content {
        padding: 16px 16px 20px;
        gap: 7px;
        overflow-y: auto;
        max-height: calc(90vh - 200px);
    }

    .ccxp-h3-top { font-size: 22px; }

    .ccxp-h2 {
        font-size: 19px;
        line-height: 1.15;
    }

    .ccxp-h3-sub1 { font-size: 13px; line-height: 1.45; }
    .ccxp-h3-sub2 { font-size: 13px; }

    .ccxp-btn {
        padding: 11px 16px;
        font-size: 14px;
        margin-top: 2px;
    }

    .ccxp-progress-bar { margin-top: 8px; }
}

/* ══════════════════════════════════════════
   RESPONSIVE — móvil pequeño (< 380px)
══════════════════════════════════════════ */
@media (max-width: 380px) {

    .ccxp-img-main-wrap,
    .ccxp-img-main { height: 160px; }

    .ccxp-content {
        padding: 12px 14px 16px;
        max-height: calc(88vh - 160px);
    }

    .ccxp-h2 { font-size: 17px; }
    .ccxp-h3-sub1 { font-size: 12px; }
}
