/* ============================================================
   CanalVal - Aviso flotante y configuración de cookies
   ============================================================ */

.cv-cookie,
.cv-cookie-modal,
.cv-cookie-fab,
.cv-inline-cookie-btn {
    font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    box-sizing: border-box;
}

.cv-cookie *,
.cv-cookie-modal * {
    box-sizing: border-box;
}

/* ---------- Aviso flotante ---------- */
.cv-cookie {
    position: fixed;
    left: 24px;
    bottom: 24px;
    z-index: 10000;
    width: min(440px, calc(100vw - 48px));
    padding: 20px 20px 16px;
    background: #ffffff;
    color: #2c3e50;
    border: 1px solid rgba(44, 62, 80, 0.14);
    border-top: 4px solid #1a5f7a;
    border-radius: 16px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.22);
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.cv-cookie[hidden] {
    display: none;
}

.cv-cookie.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.cv-cookie:focus {
    outline: none;
}

.cv-cookie__head {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.cv-cookie__icon {
    flex: 0 0 auto;
    font-size: 1.7rem;
    line-height: 1;
}

.cv-cookie__title {
    margin: 0 0 6px;
    font-family: 'Montserrat', sans-serif;
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1.25;
    color: #2c3e50;
}

.cv-cookie__text {
    margin: 0;
    font-size: 0.86rem;
    line-height: 1.55;
    color: #4a5a67;
}

.cv-cookie__text a {
    color: #1a5f7a;
    font-weight: 600;
    text-decoration: underline;
}

.cv-cookie__close {
    flex: 0 0 auto;
    margin-left: auto;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #6c757d;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.cv-cookie__close:hover,
.cv-cookie__close:focus-visible {
    background: #f1f4f6;
    color: #2c3e50;
}

.cv-cookie__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.cv-cookie__meta {
    margin: 12px 0 0;
    font-size: 0.75rem;
    line-height: 1.45;
    color: #6c757d;
}

/* ---------- Botones ---------- */
.cv-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 9px 15px;
    border: 1px solid transparent;
    border-radius: 9px;
    font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.84rem;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.cv-btn:hover {
    transform: translateY(-1px);
}

.cv-btn:focus-visible {
    outline: 3px solid rgba(249, 212, 35, 0.85);
    outline-offset: 2px;
}

.cv-btn--primary {
    background: #1a5f7a;
    color: #ffffff;
    border-color: #1a5f7a;
}

.cv-btn--primary:hover {
    background: #144d63;
    border-color: #144d63;
}

.cv-btn--outline {
    background: #ffffff;
    color: #1a5f7a;
    border-color: #1a5f7a;
}

.cv-btn--outline:hover {
    background: #eef5f8;
}

.cv-btn--ghost {
    background: transparent;
    color: #1a5f7a;
    border-color: transparent;
    text-decoration: underline;
    padding-left: 8px;
    padding-right: 8px;
}

.cv-btn--ghost:hover {
    background: #eef5f8;
}

/* ---------- Botón flotante persistente ---------- */
.cv-cookie-fab {
    position: fixed;
    left: 24px;
    bottom: 24px;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #1a5f7a;
    color: #ffffff;
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(26, 95, 122, 0.42);
    transition: transform 0.2s ease, background 0.2s ease;
}

.cv-cookie-fab[hidden] {
    display: none;
}

.cv-cookie-fab:hover {
    transform: scale(1.08);
    background: #144d63;
}

.cv-cookie-fab:focus-visible {
    outline: 3px solid rgba(249, 212, 35, 0.85);
    outline-offset: 3px;
}

/* ---------- Ventana de configuración ---------- */
.cv-cookie-modal {
    position: fixed;
    inset: 0;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.cv-cookie-modal[hidden] {
    display: none;
}

.cv-cookie-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(20, 30, 40, 0.58);
    backdrop-filter: blur(2px);
}

.cv-cookie-modal__panel {
    position: relative;
    width: min(620px, 100%);
    max-height: min(90vh, 780px);
    overflow-y: auto;
    padding: 24px;
    background: #ffffff;
    color: #2c3e50;
    border-radius: 18px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
}

.cv-cookie-modal__head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 6px;
}

.cv-cookie-modal__title {
    margin: 0;
    font-family: 'Montserrat', sans-serif;
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1.25;
    color: #2c3e50;
}

.cv-cookie-modal__close {
    flex: 0 0 auto;
    margin-left: auto;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #f1f4f6;
    color: #2c3e50;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s ease;
}

.cv-cookie-modal__close:hover,
.cv-cookie-modal__close:focus-visible {
    background: #e2e8ec;
}

.cv-cookie-modal__intro {
    margin: 0 0 16px;
    font-size: 0.88rem;
    line-height: 1.6;
    color: #4a5a67;
}

.cv-cookie-modal__intro a {
    color: #1a5f7a;
    font-weight: 600;
    text-decoration: underline;
}

.cv-cookie-cat {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 14px;
    margin-bottom: 10px;
    border: 1px solid rgba(44, 62, 80, 0.14);
    border-radius: 12px;
    background: #ffffff;
}

.cv-cookie-cat--locked {
    background: #f4f8fa;
}

.cv-cookie-cat input[type="checkbox"] {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    margin: 2px 0 0;
    accent-color: #1a5f7a;
    cursor: pointer;
}

.cv-cookie-cat input[type="checkbox"]:disabled {
    cursor: not-allowed;
}

.cv-cookie-cat__title {
    display: block;
    margin-bottom: 3px;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.92rem;
    font-weight: 700;
    color: #2c3e50;
}

.cv-cookie-cat__desc {
    display: block;
    font-size: 0.8rem;
    line-height: 1.5;
    color: #5d6d7a;
}

.cv-cookie-cat__state {
    display: inline-block;
    margin-top: 6px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #e6f2f6;
    color: #1a5f7a;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.cv-cookie-modal__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
}

.cv-cookie-withdraw {
    display: inline-block;
    margin-top: 14px;
    padding: 6px 0;
    border: 0;
    background: transparent;
    color: #c84b31;
    font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.8rem;
    font-weight: 700;
    text-decoration: underline;
    cursor: pointer;
}

.cv-cookie-withdraw:hover,
.cv-cookie-withdraw:focus-visible {
    color: #9e3823;
}

.cv-cookie-withdraw[hidden] {
    display: none;
}

/* ---------- Botón dentro de la política de cookies ---------- */
.cv-inline-cookie-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 10px;
    padding: 10px 16px;
    border: 1px solid #1a5f7a;
    border-radius: 9px;
    background: #1a5f7a;
    color: #ffffff;
    font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.cv-inline-cookie-btn:hover {
    background: #144d63;
    transform: translateY(-1px);
}

.cv-inline-cookie-btn:focus-visible {
    outline: 3px solid rgba(249, 212, 35, 0.85);
    outline-offset: 2px;
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
    .cv-cookie {
        left: 12px;
        right: 12px;
        bottom: 96px;
        width: auto;
        padding: 16px;
    }

    .cv-cookie__actions {
        flex-direction: column;
    }

    .cv-cookie__actions .cv-btn {
        width: 100%;
    }

    .cv-cookie-fab {
        left: 16px;
        bottom: 20px;
    }

    .cv-cookie-modal {
        align-items: flex-end;
        padding: 12px;
    }

    .cv-cookie-modal__panel {
        max-height: 92vh;
        padding: 20px;
        border-radius: 16px 16px 0 0;
    }

    .cv-cookie-modal__actions {
        flex-direction: column;
    }

    .cv-cookie-modal__actions .cv-btn {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cv-cookie,
    .cv-btn,
    .cv-cookie-fab,
    .cv-inline-cookie-btn {
        transition: none;
    }
}
