/* Reusable CMP styles */
.cmp-hidden {
    display: none !important;
}

.cmp-overlay {
    position: fixed;
    inset: 0;
    background: rgb(0 0 0 / 58%);
    z-index: 99998;
    display: none;
}

.cmp-overlay.is-visible {
    display: block;
}

.cmp-overlay.cmp-overlay--light {
    background: rgb(0 0 0 / 32%);
}

.cmp-modal {
    position: fixed;
    left: 50%;
    width: min(660px, calc(100vw - 24px));
    background: #f3f3f3;
    border-radius: 12px;
    box-shadow: 0 20px 65px rgb(0 0 0 / 35%);
    padding: 18px;
    z-index: 99999;
    color: #2b2c33;
    font-family: Poppins, sans-serif;
    display: none;
}

.cmp-modal.is-visible {
    display: block;
}

.cmp-banner {
    bottom: 14px;
    top: auto;
    transform: translateX(-50%);
    max-height: none;
    overflow: visible;
    width: min(760px, calc(100vw - 24px));
    box-shadow: 0 10px 30px rgb(0 0 0 / 30%);
}

/* Slide-up entrance animation for first-visit banner */
@keyframes cmpSlideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.cmp-banner.is-visible {
    animation: cmpSlideUp 0.45s ease-out both;
}

.cmp-preferences {
    top: 50%;
    transform: translate(-50%, -50%);
    max-height: calc(100vh - 30px);
    overflow: auto;
}

/* Hueco para la × de cerrar. */
.cmp-preferences .cmp-subtitle {
    padding: 0 40px;
}

.cmp-title {
    margin: 0 0 14px;
    text-align: center;
    font-size: 36px;
    line-height: 1.05;
    font-weight: 700;
    color: #0c1f55;
}

.cmp-subtitle {
    margin: 0 0 12px;
    text-align: center;
    font-family: inherit;
    font-size: 17px;
    font-weight: 600;
    line-height: 1.3;
    color: inherit;
}

/* El foco entra en las capas por programa (tabindex=-1): sin marco del contenedor. */
.cmp-modal:focus {
    outline: none;
}

.cmp-btn:focus-visible,
.cmp-link:focus-visible,
.cmp-close:focus-visible,
.cmp-switch:focus-visible {
    outline: 3px solid #0b4f8a;
    outline-offset: 2px;
}

.cmp-copy {
    margin: 0;
    color: #444;
    font-size: 15px;
    line-height: 1.35;
    text-align: center;
}

.cmp-banner .cmp-copy {
    text-align: left;
    font-size: 14px;
}

.cmp-banner .cmp-subtitle {
    margin-bottom: 8px;
    text-align: left;
}

.cmp-links,
.cmp-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    align-items: center;
}

.cmp-actions {
    margin-top: 14px;
}

.cmp-links {
    margin-top: 10px;
}

.cmp-banner .cmp-links {
    justify-content: flex-start;
}

.cmp-banner .cmp-actions {
    justify-content: flex-start;
}

.cmp-btn {
    border: 0;
    border-radius: 9px;
    font-size: 15px;
    line-height: 1;
    padding: 10px 14px;
    min-height: 44px;
    font-weight: 600;
    cursor: pointer;
    background: #ececec;
    color: #21242d;
    min-width: 145px;
}

.cmp-btn:hover {
    opacity: 0.92;
}

/* «Aceptar» y «Rechazar»: el mismo estilo (guía de la AEPD de jul-2023). */
.cmp-btn-choice {
    background: #1666b0;
    color: #fff;
}

/* «Configurar» y «Guardar mi elección». */
.cmp-btn-config {
    background: #fff;
    color: #1666b0;
    box-shadow: inset 0 0 0 1px #1666b0;
}

.cmp-close {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #2b2c33;
    font-size: 30px;
    line-height: 44px;
    cursor: pointer;
}

.cmp-close:hover {
    background: rgb(0 0 0 / 6%);
}

.cmp-pref-always {
    color: #1d7a34;
    font-weight: 600;
    font-size: 14px;
}

.cmp-pref-name label {
    margin: 0;
    font: inherit;
    cursor: pointer;
}

.cmp-link {
    color: #1f84e8;
    text-decoration: none;
    font-size: 14px;
    padding: 2px 10px;
}

.cmp-link:hover {
    text-decoration: underline;
}

.cmp-pref-list {
    margin-top: 14px;
}

.cmp-pref-item {
    background: #ececec;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 8px;
}

.cmp-pref-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.cmp-pref-name {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.cmp-pref-desc {
    margin: 0;
    color: #555;
    font-size: 14px;
    line-height: 1.3;
}

.cmp-switch {
    appearance: none;
    width: 50px;
    height: 28px;
    background: #b5b5b5;
    border-radius: 999px;
    position: relative;
    cursor: pointer;
    outline: none;
    transition: background 0.2s ease;
}

.cmp-switch:checked {
    background: #1f84e8;
}

.cmp-switch:disabled {
    background: #46a046;
    cursor: not-allowed;
}

.cmp-switch::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    transition: left 0.2s ease;
}

.cmp-switch:checked::after {
    left: 25px;
}

.cmp-embed-placeholder {
    border: 1px solid #d9d9d9;
    border-radius: 10px;
    background: #f6f7f8;
    padding: 16px;
    color: #383a44;
    text-align: center;
}

.cmp-embed-placeholder p {
    margin: 0 0 12px;
}

.cmp-embed-placeholder .cmp-btn {
    font-size: 16px;
    min-height: auto;
    min-width: 180px;
    padding: 10px 14px;
}

@media (width <= 991px) {
    .cmp-modal {
        width: calc(100vw - 16px);
        padding: 14px;
        border-radius: 12px;
    }

    .cmp-preferences {
        max-height: calc(100vh - 20px);
    }

    .cmp-banner {
        bottom: 10px;
        width: calc(100vw - 16px);
        box-shadow: 0 -4px 30px rgb(0 0 0 / 35%);
    }

    .cmp-title {
        font-size: 28px;
    }

    .cmp-subtitle {
        font-size: 18px;
    }

    .cmp-copy {
        font-size: 14px;
    }

    .cmp-banner .cmp-copy {
        font-size: 13px;
    }

    .cmp-btn {
        min-width: 130px;
        width: 100%;
        min-height: 42px;
        font-size: 15px;
        padding: 9px 12px;
    }

    .cmp-pref-name {
        font-size: 18px;
    }

    .cmp-pref-desc {
        font-size: 14px;
    }
}

@media (width <= 600px) {
    .cmp-subtitle {
        margin-bottom: 12px;
        font-size: 17px;
    }

    .cmp-copy {
        font-size: 13px;
    }

    .cmp-actions {
        margin-top: 14px;
        gap: 8px;
    }

    /* «Rechazar» y «Aceptar» a medias en la primera fila; «Configurar» debajo, entero. */
    .cmp-banner .cmp-actions .cmp-btn {
        width: auto;
        flex: 1 1 calc(50% - 6px);
        min-width: 120px;
    }

    .cmp-banner .cmp-actions .cmp-btn-config {
        flex-basis: 100%;
    }

    .cmp-links {
        margin-top: 12px;
        gap: 6px;
    }

    .cmp-link {
        font-size: 13px;
        padding: 0 6px;
    }

    .cmp-pref-item {
        padding: 10px;
    }
}
