:root {
    --cookie-banner-height: 0px;
    --cookie-safe-gap: 16px;
    --cookie-scroll-top-gap: 16px;
    --cookie-scroll-bottom-gap: max(24px, env(safe-area-inset-bottom, 0px));
    --cookie-accent: #36e0f7;
    --cookie-surface: rgba(2, 22, 45, 0.95);
    --cookie-btn-min-height: 44px;
    --cookie-focus-ring: 0 0 0 3px rgba(54, 224, 247, 0.55);
}

html.cookies-pending,
html.cookie-banner-visible,
html.cookie-preferences-visible,
html.cookies-pending body,
html.cookie-banner-visible body,
html.cookie-preferences-visible body {
    height: 100vh;
    min-height: 100vh;
    height: 100dvh;
    min-height: 100dvh;
    overflow: hidden;
}

html.cookies-pending body,
html.cookie-banner-visible body,
html.cookie-preferences-visible body {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    width: 100%;
}

#cookie-page-viewport {
    display: contents;
}

html.cookies-pending body > #cookie-page-viewport,
html.cookie-banner-visible body > #cookie-page-viewport,
html.cookie-preferences-visible body > #cookie-page-viewport {
    display: block;
    min-height: 0;
    width: 100%;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    scrollbar-gutter: stable;
    scroll-padding-block-start: var(--cookie-scroll-top-gap, 16px);
    scroll-padding-block-end: var(--cookie-scroll-bottom-gap, 24px);
    padding-bottom: var(--cookie-scroll-bottom-gap, 24px);
}

html.cookies-pending body > #cookie-banner,
html.cookie-banner-visible body > #cookie-banner {
    position: static;
    inset: auto;
    grid-row: 2;
    align-self: end;
    transform: none;
    max-height: min(48dvh, 420px);
    margin: var(--cookie-safe-gap, 16px) auto;
    overflow-y: auto;
}

html.cookies-pending .conversion-sticky,
html.cookies-pending .iadev-whatsapp-float,
html.cookies-pending .iadev-chatwoot-launcher,
html.cookies-pending #movetop,
html.cookies-pending #custom-movetop-btn,
html.cookie-banner-visible .conversion-sticky,
html.cookie-banner-visible .iadev-whatsapp-float,
html.cookie-banner-visible .iadev-chatwoot-launcher,
html.cookie-banner-visible #movetop,
html.cookie-banner-visible #custom-movetop-btn,
html.cookie-preferences-visible .conversion-sticky,
html.cookie-preferences-visible .iadev-whatsapp-float,
html.cookie-preferences-visible .iadev-chatwoot-launcher,
html.cookie-preferences-visible #movetop,
html.cookie-preferences-visible #custom-movetop-btn {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

@media (max-width: 767px) {
    body.has-diagnose-form-inview .iadev-whatsapp-float,
    body.has-diagnose-form-inview .iadev-chatwoot-launcher,
    body.has-diagnose-form-inview #movetop,
    body.has-diagnose-form-inview #custom-movetop-btn {
        display: none !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }
}

/* Banner */
#cookie-banner {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 600px;
    background-color: var(--cookie-surface);
    color: #fff;
    padding: 20px 25px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.3);
    z-index: 10020;
    display: none;
    box-sizing: border-box;
    border-radius: 8px;
    border-left: 4px solid var(--cookie-accent);
}

#cookie-banner .cookie-banner__title {
    font-size: 1.2rem;
    margin-bottom: 10px;
    color: var(--cookie-accent);
    font-weight: 700;
}

#cookie-banner p {
    font-size: 0.85rem;
    margin-bottom: 12px;
    line-height: 1.45;
}

#cookie-banner a {
    color: var(--cookie-accent);
    text-decoration: underline;
}

#cookie-banner a:hover {
    color: #fff;
}

.cookie-banner__actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}

.cookie-banner__choices {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.cookie-btn {
    box-sizing: border-box;
    min-height: var(--cookie-btn-min-height);
    padding: 10px 14px;
    border-radius: 4px;
    border: 2px solid transparent;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.85rem;
    line-height: 1.2;
    text-align: center;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.cookie-btn:focus {
    outline: none;
}

.cookie-btn:focus-visible {
    outline: none;
    box-shadow: var(--cookie-focus-ring);
}

.cookie-btn--choice {
    flex: 1 1 0;
    min-width: 0;
}

#cookie-banner .cookie-btn--accept {
    background-color: rgba(54, 224, 247, 0.14);
    border-color: var(--cookie-accent);
    color: #fff;
}

#cookie-banner .cookie-btn--accept:hover {
    background-color: rgba(54, 224, 247, 0.24);
}

#cookie-banner .cookie-btn--reject {
    background-color: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.92);
    color: #fff;
}

#cookie-banner .cookie-btn--reject:hover {
    background-color: rgba(255, 255, 255, 0.12);
}

.cookie-btn--configure {
    width: 100%;
    background-color: transparent;
    border-color: rgba(255, 255, 255, 0.55);
    color: #fff;
    font-weight: 600;
}

.cookie-btn--configure:hover {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.85);
}

/* Backdrop modal */
.cookie-preferences-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(2, 22, 45, 0.55);
    z-index: 10025;
}

html.cookie-preferences-visible .cookie-preferences-backdrop {
    display: block !important;
}

html.cookie-preferences-visible .cookie-preferences-backdrop[hidden] {
    display: block !important;
}

/* Panel de preferencias */
#preferences-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #fff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
    z-index: 10030;
    width: min(90%, 500px);
    max-height: min(90dvh, 640px);
    overflow-y: auto;
    color: #333;
    box-sizing: border-box;
}

#preferences-popup h3 {
    color: #02162d;
    margin-bottom: 12px;
    border-bottom: 2px solid var(--cookie-accent);
    padding-bottom: 10px;
}

.cookie-preferences-intro {
    margin-bottom: 16px;
    font-size: 0.9rem;
    color: #555;
    line-height: 1.45;
}

.cookie-preference {
    margin-bottom: 18px;
}

.cookie-preference label {
    display: flex;
    align-items: center;
    font-weight: 700;
    margin-bottom: 5px;
    gap: 10px;
}

.cookie-preference input[type="checkbox"] {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.cookie-preference input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--cookie-accent);
    outline-offset: 2px;
}

.cookie-preference p {
    margin-left: 28px;
    font-size: 0.9rem;
    color: #666;
    line-height: 1.45;
}

.preferences-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0;
}

#preferences-popup .cookie-btn--panel {
    flex: 1 1 0;
    min-width: 0;
    color: #02162d;
}

#preferences-popup .cookie-btn--accept {
    background-color: rgba(54, 224, 247, 0.12);
    border-color: #0f6f82;
}

#preferences-popup .cookie-btn--accept:hover {
    background-color: rgba(54, 224, 247, 0.22);
}

#preferences-popup .cookie-btn--reject {
    background-color: #f7f7f7;
    border-color: #8a8a8a;
}

#preferences-popup .cookie-btn--reject:hover {
    background-color: #ececec;
}

.preferences-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 12px;
}

.cookie-btn--save {
    background-color: #02162d;
    border-color: #02162d;
    color: #fff;
}

.cookie-btn--save:hover {
    background-color: #0a2d52;
    border-color: #0a2d52;
}

.cookie-btn--close {
    background-color: #eee;
    border-color: #bbb;
    color: #333;
}

.cookie-btn--close:hover {
    background-color: #ddd;
}

/* Footer: enlace permanente */
.cookie-settings-trigger {
    display: inline;
    padding: 0;
    margin: 0;
    border: 0;
    background: none;
    font: inherit;
    color: inherit;
    text-decoration: underline;
    cursor: pointer;
}

.cookie-settings-trigger:hover {
    color: var(--cookie-accent, #36e0f7);
}

.cookie-settings-trigger:focus {
    outline: none;
}

.cookie-settings-trigger:focus-visible {
    outline: 2px solid var(--cookie-accent, #36e0f7);
    outline-offset: 2px;
}

.footer-section .cookie-settings-trigger,
.blog-footer .cookie-settings-trigger {
    color: inherit;
}

.footer-section .cookie-settings-trigger:hover {
    color: #fff;
}

.footer-section .footer-cookie-settings-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.footer-section .footer-cookie-settings-item > i {
    flex: 0 0 12px;
    margin-top: 7px;
}

.footer-section .footer-cookie-settings-item .cookie-settings-trigger {
    display: inline-block;
    margin-left: 0;
    text-align: left;
    line-height: 1.55;
}

/* Responsive */
@media (max-width: 768px) {
    #cookie-banner {
        width: calc(100% - 16px);
        padding: 12px 14px;
        border-left-width: 3px;
    }

    #cookie-banner .cookie-banner__title {
        margin-bottom: 6px;
        font-size: 0.95rem;
        line-height: 1.2;
    }

    #cookie-banner p {
        margin-bottom: 6px;
        font-size: 0.78rem;
        line-height: 1.3;
    }

    .cookie-banner__actions {
        gap: 8px;
        margin-top: 8px;
    }

    .cookie-banner__choices {
        flex-flow: row nowrap;
        gap: 6px;
    }

    .cookie-btn {
        padding: 8px 10px;
        font-size: 0.74rem;
        min-height: var(--cookie-btn-min-height);
    }

    html.cookies-pending body > #cookie-banner,
    html.cookie-banner-visible body > #cookie-banner {
        max-height: 52dvh;
        margin: 8px auto;
    }

    #preferences-popup {
        width: calc(100% - 16px);
        padding: 16px;
        max-height: min(92dvh, 640px);
    }
}

@media (max-width: 480px) {
    #cookie-banner {
        padding: 10px 12px;
    }
}

@media (max-width: 375px) {
    html.cookies-pending .hero-premium__badges {
        gap: 4px;
        min-height: 0;
        margin-bottom: 8px;
    }

    html.cookies-pending .hero-premium__badge {
        gap: 3px;
        padding: 3px 6px;
        font-size: 0.65rem;
    }

    html.cookies-pending .hero-premium__eyebrow {
        margin-bottom: 4px;
        font-size: 0.7rem;
        line-height: 1.2;
        letter-spacing: 0;
    }

    html.cookies-pending .hero-premium__title {
        margin-bottom: 8px;
        font-size: 1.5rem !important;
        line-height: 1.08 !important;
    }

    html.cookies-pending .hero-premium__audience {
        margin-bottom: 8px;
        font-size: 0.85rem !important;
        line-height: 1.3 !important;
    }

    html.cookies-pending .hero-premium__lead {
        margin-bottom: 12px;
        font-size: 0.88rem !important;
        line-height: 1.35 !important;
    }

    html.cookies-pending .hero-premium__actions {
        gap: 8px;
        margin-bottom: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cookie-btn {
        transition: none;
    }
}
