/* ============================================================
   SafeCode365 — Consent Management Platform (CMP) AEPD-compliant
   ============================================================ */

/* Banner inferior */
.sc-cmp-banner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2147483600;
    background: #0f1a20;
    color: #e6ecef;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.35);
    border-top: 3px solid #058283;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    transform: translateY(100%);
    transition: transform 0.35s ease-out;
}

.sc-cmp-banner.is-visible {
    transform: translateY(0);
}

.sc-cmp-banner__inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 22px 24px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 24px;
    align-items: center;
}

.sc-cmp-banner__text {
    font-size: 14px;
    line-height: 1.55;
    color: #d3dade;
    margin: 0;
}

.sc-cmp-banner__text strong {
    color: #ffffff;
    font-weight: 600;
}

.sc-cmp-banner__text a {
    color: #5fd0d2;
    text-decoration: underline;
}

.sc-cmp-banner__text a:hover {
    color: #ffffff;
}

.sc-cmp-banner__actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

/* Botones — los tres con peso visual equivalente (AEPD: sin dark patterns) */
.sc-cmp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 20px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    font-family: inherit;
    line-height: 1;
    min-width: 130px;
    white-space: nowrap;
}

.sc-cmp-btn--primary {
    background: #058283;
    color: #ffffff;
    border-color: #058283;
}

.sc-cmp-btn--primary:hover {
    background: #046b6c;
    border-color: #046b6c;
    color: #ffffff;
}

.sc-cmp-btn--secondary {
    background: transparent;
    color: #ffffff;
    border-color: #6c7a82;
}

.sc-cmp-btn--secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: #ffffff;
    color: #ffffff;
}

.sc-cmp-btn--ghost {
    background: transparent;
    color: #b8c1c6;
    border-color: transparent;
    text-decoration: underline;
    min-width: auto;
    padding: 11px 12px;
}

.sc-cmp-btn--ghost:hover {
    color: #ffffff;
}

/* Modal de configuración granular */
.sc-cmp-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(8, 13, 16, 0.78);
    z-index: 2147483601;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    overflow-y: auto;
}

.sc-cmp-modal-overlay.is-visible {
    display: flex;
}

.sc-cmp-modal {
    background: #ffffff;
    color: #21333e;
    max-width: 620px;
    width: 100%;
    border-radius: 12px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    max-height: calc(100vh - 32px);
    display: flex;
    flex-direction: column;
}

.sc-cmp-modal__header {
    padding: 22px 26px 14px;
    border-bottom: 1px solid #e8eef0;
}

.sc-cmp-modal__title {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 6px;
    color: #21333e;
}

.sc-cmp-modal__subtitle {
    font-size: 14px;
    color: #6c7a82;
    margin: 0;
    line-height: 1.5;
}

.sc-cmp-modal__body {
    padding: 18px 26px;
    overflow-y: auto;
    flex: 1;
}

.sc-cmp-category {
    padding: 16px 0;
    border-bottom: 1px solid #eef2f4;
}

.sc-cmp-category:last-child {
    border-bottom: none;
}

.sc-cmp-category__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 6px;
}

.sc-cmp-category__title {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
    color: #21333e;
}

.sc-cmp-category__title small {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #6c7a82;
    margin-top: 3px;
}

.sc-cmp-category__desc {
    font-size: 13px;
    line-height: 1.55;
    color: #4a5862;
    margin: 6px 0 0;
}

/* Toggle switch */
.sc-cmp-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.sc-cmp-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.sc-cmp-toggle__slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #c5ced3;
    transition: background 0.2s;
    border-radius: 24px;
}

.sc-cmp-toggle__slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: #ffffff;
    transition: transform 0.2s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.sc-cmp-toggle input:checked + .sc-cmp-toggle__slider {
    background: #058283;
}

.sc-cmp-toggle input:checked + .sc-cmp-toggle__slider:before {
    transform: translateX(20px);
}

.sc-cmp-toggle input:disabled + .sc-cmp-toggle__slider {
    background: #058283;
    opacity: 0.55;
    cursor: not-allowed;
}

.sc-cmp-modal__footer {
    padding: 18px 26px;
    background: #f6f9fa;
    border-top: 1px solid #e8eef0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
    align-items: center;
}

.sc-cmp-modal__footer .sc-cmp-btn--ghost {
    color: #4a5862;
    margin-right: auto;
}

.sc-cmp-modal__footer .sc-cmp-btn--secondary {
    background: transparent;
    color: #21333e;
    border-color: #c5ced3;
}

.sc-cmp-modal__footer .sc-cmp-btn--secondary:hover {
    background: #eef2f4;
    border-color: #21333e;
    color: #21333e;
}

/* Responsive */
@media (max-width: 768px) {
    .sc-cmp-banner__inner {
        grid-template-columns: 1fr;
        padding: 18px 18px 20px;
    }

    .sc-cmp-banner__actions {
        justify-content: stretch;
    }

    .sc-cmp-btn {
        flex: 1;
        min-width: 0;
        padding: 11px 12px;
        font-size: 13px;
    }

    .sc-cmp-btn--ghost {
        flex-basis: 100%;
        order: 3;
    }

    .sc-cmp-modal__footer {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .sc-cmp-modal__footer .sc-cmp-btn {
        width: 100%;
    }

    .sc-cmp-modal__footer .sc-cmp-btn--ghost {
        margin-right: 0;
        order: 99;
    }
}

/* Cuando no hay JS o el banner no se ha inicializado: nada visible */
.sc-cmp-banner[hidden],
.sc-cmp-modal-overlay[hidden] {
    display: none !important;
}
