/* ============ Banner de consentimiento de cookies ============
 * Autónomo: también se usa en /kitdigital, que no carga Bootstrap ni style.css.
 * Paleta tomada de la web: azul marino de paneles, textos azul claro y botones .cta. */

.cc {
    --cc-surface: #0b2a45;
    --cc-border: rgba(50, 170, 255, 0.3);
    --cc-divider: rgba(185, 221, 254, 0.14);
    --cc-title: #ffffff;
    --cc-text: #d6ebff;
    --cc-muted: #a9cdef;
    --cc-link: #7cc4ff;
    --cc-accent: #0796fe;
    --cc-focus: #33aaff;
    --cc-btn-from: #e8f2fc;
    --cc-btn-to: #d0eaff;
    --cc-btn-text: #0b293f;
    --cc-ease: cubic-bezier(0.16, 1, 0.3, 1);

    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 16px;
    z-index: 2147483000;
    display: flex;
    justify-content: center;
    pointer-events: none;
    font-family: 'Lato', system-ui, -apple-system, 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
}

.cc[hidden] {
    display: none;
}

.cc,
.cc *,
.cc *::before,
.cc *::after {
    box-sizing: border-box;
}

.cc ::selection {
    background: rgba(7, 150, 254, 0.55);
    color: #ffffff;
}

.cc__panel {
    pointer-events: auto;
    width: 100%;
    max-width: 1040px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(185, 221, 254, 0.35) transparent;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "intro actions";
    align-items: center;
    gap: 16px 40px;
    padding: 22px 26px;
    background: var(--cc-surface);
    border: 1px solid var(--cc-border);
    border-radius: 8px;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.5), 0 4px 14px rgba(7, 150, 254, 0.16);
    transform: translateY(calc(100% + 24px));
    transition: transform 560ms var(--cc-ease);
}

.cc--visible .cc__panel {
    transform: none;
}

.cc--expanded .cc__panel {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
        "intro"
        "prefs"
        "actions";
    padding-bottom: 0;
}

/* Con el detalle abierto, los botones quedan siempre a la vista aunque el
 * panel tenga que desplazarse (pantallas bajas y móvil). */
.cc--expanded .cc__actions {
    position: sticky;
    bottom: 0;
    padding: 4px 0 22px;
    background: var(--cc-surface);
}

/* El lanzador del chat usa el z-index máximo y taparía los botones del banner:
 * se oculta solo mientras el banner está abierto. */
html.cc-is-open .copilotKitPopup {
    visibility: hidden;
}

/* --- Texto --- */

.cc__intro {
    grid-area: intro;
}

.cc .cc__title {
    margin: 0 0 6px;
    font-family: inherit;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: 0;
    color: var(--cc-title);
}

.cc .cc__title:focus {
    outline: none;
}

.cc .cc__text {
    margin: 0;
    max-width: 75ch;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--cc-text);
}

.cc .cc__text a {
    color: var(--cc-link);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
    white-space: nowrap;
}

.cc .cc__text a:hover {
    color: #ffffff;
}

.cc .cc__text a:focus-visible {
    color: #ffffff;
    outline: 3px solid var(--cc-focus);
    outline-offset: 3px;
    border-radius: 4px;
}

/* --- Categorías (segunda capa) --- */

.cc__prefs {
    grid-area: prefs;
    border-top: 1px solid var(--cc-divider);
}

.cc__prefs[hidden] {
    display: none;
}

.cc__option {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 24px;
    padding: 16px 0;
    border-bottom: 1px solid var(--cc-divider);
}

.cc .cc__option-title {
    margin: 0 0 4px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--cc-title);
}

.cc .cc__option-desc {
    margin: 0;
    max-width: 70ch;
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--cc-muted);
}

.cc__always {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--cc-muted);
    white-space: nowrap;
}

.cc__switch {
    position: relative;
    display: inline-flex;
    flex-shrink: 0;
    width: 48px;
    height: 28px;
    margin: 0;
    cursor: pointer;
}

.cc .cc__switch input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.cc__track {
    position: relative;
    width: 48px;
    height: 28px;
    border-radius: 999px;
    background: rgba(185, 221, 254, 0.16);
    border: 1px solid rgba(185, 221, 254, 0.4);
    transition: background-color 200ms ease, border-color 200ms ease;
}

.cc__track::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--cc-text);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
    transition: transform 240ms var(--cc-ease), background-color 200ms ease;
}

.cc__switch:hover .cc__track {
    border-color: var(--cc-focus);
}

.cc__switch input:checked + .cc__track {
    background: var(--cc-accent);
    border-color: var(--cc-focus);
}

.cc__switch input:checked + .cc__track::after {
    transform: translateX(20px);
    background: #ffffff;
}

.cc__switch input:focus-visible + .cc__track {
    outline: 3px solid var(--cc-focus);
    outline-offset: 3px;
}

/* --- Acciones: Aceptar y Rechazar con idéntica prominencia (guía AEPD) --- */

.cc__actions {
    grid-area: actions;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px 12px;
}

.cc .cc__btn,
.cc .cc__link {
    min-height: 44px;
    margin: 0;
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.2;
    cursor: pointer;
    border-radius: 8px;
}

.cc .cc__btn {
    min-width: 132px;
    padding: 10px 22px;
    font-weight: 700;
    color: var(--cc-btn-text);
    background: linear-gradient(135deg, var(--cc-btn-from) 0%, var(--cc-btn-to) 100%);
    border: 0;
    transition: transform 240ms var(--cc-ease), box-shadow 240ms var(--cc-ease);
}

.cc .cc__btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(7, 150, 254, 0.3);
}

.cc .cc__btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(7, 150, 254, 0.25);
}

.cc .cc__link {
    padding: 10px 8px;
    font-weight: 600;
    color: var(--cc-text);
    background: none;
    border: 0;
    text-decoration: underline;
    text-underline-offset: 4px;
}

.cc .cc__link:hover {
    color: #ffffff;
}

.cc .cc__btn:focus,
.cc .cc__link:focus {
    outline: none;
}

.cc .cc__btn:focus-visible,
.cc .cc__link:focus-visible {
    outline: 3px solid var(--cc-focus);
    outline-offset: 3px;
}

.cc .cc__btn[hidden],
.cc .cc__link[hidden] {
    display: none;
}

/* --- Móvil --- */

@media (max-width: 767.98px) {
    .cc {
        left: 12px;
        right: 12px;
        bottom: 12px;
    }

    .cc__panel {
        max-height: calc(100vh - 24px);
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "intro"
            "actions";
        gap: 16px;
        padding: 18px;
    }

    .cc--expanded .cc__panel {
        padding-bottom: 0;
    }

    .cc--expanded .cc__actions {
        padding: 12px 0 18px;
    }

    .cc--expanded .cc__panel {
        grid-template-areas:
            "intro"
            "prefs"
            "actions";
    }

    .cc .cc__title {
        font-size: 1.125rem;
    }

    .cc__actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .cc .cc__btn {
        min-width: 0;
        width: 100%;
        padding: 10px 12px;
    }

    .cc .cc__link {
        grid-column: 1 / -1;
    }

    .cc [data-cc-action="save"] {
        grid-column: 1 / -1;
    }

    /* Título e interruptor en una fila; la descripción a todo el ancho debajo. */
    .cc__option {
        grid-template-areas:
            "title control"
            "desc desc";
        gap: 6px 16px;
    }

    .cc__option-text {
        display: contents;
    }

    .cc .cc__option-title {
        grid-area: title;
        align-self: center;
        margin: 0;
    }

    .cc .cc__option-desc {
        grid-area: desc;
    }

    .cc__switch,
    .cc__always {
        grid-area: control;
    }

    /* Indica que hay más contenido bajo los botones fijos. */
    .cc--expanded .cc__actions::before {
        content: "";
        position: absolute;
        left: 0;
        right: 0;
        top: -20px;
        height: 20px;
        background: linear-gradient(to bottom, rgba(11, 42, 69, 0), var(--cc-surface));
        pointer-events: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cc__panel,
    .cc__track,
    .cc__track::after,
    .cc .cc__btn {
        transition: none;
    }
}

/* --- Enlace «Configurar cookies» del pie (botón con aspecto de los enlaces del pie) --- */

.footer .footer-link .cc-open {
    display: block;
    margin: 0 0 10px;
    padding: 0;
    font: inherit;
    color: #ffffff;
    text-align: left;
    background: none;
    border: 0;
    cursor: pointer;
    transition: .3s;
}

.footer .footer-link .cc-open::before {
    position: relative;
    content: "\f105";
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    margin-right: 10px;
}

.footer .footer-link .cc-open:hover {
    color: #0796fe;
    letter-spacing: 1px;
}

.footer .footer-link .cc-open:focus {
    outline: none;
}

.footer .footer-link .cc-open:focus-visible {
    outline: 3px solid #33aaff;
    outline-offset: 3px;
}

.kitdigital-cookies {
    margin: 0 0 40px;
    text-align: center;
}

.kitdigital-cookies .cc-open {
    padding: 8px;
    font: inherit;
    color: #333333;
    background: none;
    border: 0;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}
