/**
 * Banner y panel de consentimiento de cookies — Alegatot
 * Estilos aislados: aspecto idéntico en todas las páginas públicas.
 */

.cookie-consent-banner[hidden],
.cookie-consent-overlay[hidden] {
    display: none !important;
}

/* --- Banner inferior centrado (tarjeta flotante) --- */
.cookie-consent-banner {
    position: fixed;
    bottom: 20px;
    left: 50%;
    z-index: 10050;
    width: min(640px, calc(100vw - 32px));
    padding: 20px 24px;
    background: #fff;
    border: 1px solid #e5e0d8;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(28, 25, 23, 0.14);
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.55;
    color: #44403c;
    text-align: center;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.cookie-consent-banner.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.cookie-consent-banner__inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.cookie-consent-banner__text {
    margin: 0;
    font-size: 14px;
    line-height: 1.55;
    color: #44403c;
    text-align: center;
    max-width: 52ch;
}

.cookie-consent-banner__text strong {
    display: block;
    margin-bottom: 6px;
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 700;
    color: #1c1917;
}

.cookie-consent-banner__text a {
    color: var(--brand-orange);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.cookie-consent-banner__text a:hover {
    color: var(--brand-orange-dark);
}

.cookie-consent-banner__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
}

/* --- Botones (reset aislado frente a estilos globales del sitio) --- */
.cookie-consent-banner .cookie-btn,
.cookie-consent-overlay .cookie-btn,
.legal-cookie-actions .cookie-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 16px;
    margin: 0;
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    white-space: nowrap;
    text-decoration: none;
    appearance: none;
    -webkit-appearance: none;
}

.cookie-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 16px;
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    white-space: nowrap;
}

.cookie-btn:focus-visible {
    outline: 2px solid var(--brand-orange);
    outline-offset: 2px;
}

.cookie-btn--primary {
    background: var(--brand-orange);
    color: #fff;
    border-color: var(--brand-orange);
}

.cookie-btn--primary:hover {
    background: var(--brand-orange-dark);
    border-color: var(--brand-orange-dark);
}

.cookie-btn--secondary {
    background: #fff;
    color: #44403c;
    border-color: #d6d3d1;
}

.cookie-btn--secondary:hover {
    background: #fafaf9;
    border-color: #a8a29e;
}

.cookie-btn--ghost {
    background: transparent;
    color: #57534e;
    border-color: transparent;
    text-decoration: underline;
    text-underline-offset: 2px;
    min-height: auto;
    padding: 0 8px;
}

.cookie-btn--ghost:hover {
    color: #1c1917;
}

/* Enlace/botón «Configurar cookies» fuera del pie principal */
.cookie-configure-trigger:not(.footer-link-btn) {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    color: inherit;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.cookie-configure-trigger:not(.footer-link-btn):hover {
    color: var(--brand-orange);
}

.cookie-configure-trigger:not(.footer-link-btn):focus-visible {
    outline: 2px solid var(--brand-orange);
    outline-offset: 2px;
}

/* Integración con footer landing (fondo oscuro) — legado */
.dwbi-footer-nav .cookie-configure-trigger {
    color: #94a3b8;
    font-size: 0.875rem;
    font-weight: 500;
}

.dwbi-footer-nav .cookie-configure-trigger:hover {
    color: var(--brand-orange);
}

/* Integración con footer principal — legado */
.site-footer .cookie-configure-trigger:not(.footer-link-btn) {
    font-size: 13.5px;
    color: rgba(255, 255, 255, 0.65);
    display: block;
    margin-bottom: 8px;
    text-align: left;
}

.site-footer .cookie-configure-trigger:not(.footer-link-btn):hover {
    color: #fff;
}

/* --- Overlay y modal de preferencias --- */
.cookie-consent-overlay {
    position: fixed;
    inset: 0;
    z-index: 10051;
    background: rgba(28, 25, 23, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    font-family: var(--font-body);
}

.cookie-consent-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

.cookie-consent-modal {
    width: 100%;
    max-width: 520px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 48px rgba(28, 25, 23, 0.18);
    padding: 24px;
}

.cookie-consent-modal__title {
    margin: 0 0 8px;
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 700;
    color: #1c1917;
}

.cookie-consent-modal__intro {
    margin: 0 0 20px;
    font-size: 14px;
    line-height: 1.55;
    color: #57534e;
}

.cookie-consent-modal__intro a {
    color: var(--brand-orange);
}

/* Categorías de cookies */
.cookie-category {
    border: 1px solid #e7e5e4;
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 10px;
}

.cookie-category__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.cookie-category__name {
    margin: 0 0 4px;
    font-size: 15px;
    font-weight: 600;
    color: #1c1917;
}

.cookie-category__desc {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    color: #78716c;
}

.cookie-category__badge {
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 600;
    color: #57534e;
    background: #f5f5f4;
    padding: 4px 10px;
    border-radius: 999px;
}

/* Interruptor personalizado */
.cookie-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.cookie-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.cookie-toggle__slider {
    position: absolute;
    inset: 0;
    background: #d6d3d1;
    border-radius: 24px;
    cursor: pointer;
    transition: background 0.2s;
}

.cookie-toggle__slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.cookie-toggle input:checked + .cookie-toggle__slider {
    background: var(--brand-orange);
}

.cookie-toggle input:checked + .cookie-toggle__slider::before {
    transform: translateX(20px);
}

.cookie-toggle input:disabled + .cookie-toggle__slider {
    opacity: 0.65;
    cursor: not-allowed;
}

.cookie-consent-modal__footer {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #e7e5e4;
}

/* Tabla de cookies en política */
.legal-cookie-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    margin: 16px 0 24px;
}

.legal-cookie-table th,
.legal-cookie-table td {
    border: 1px solid #e7e5e4;
    padding: 10px 12px;
    text-align: left;
    vertical-align: top;
}

.legal-cookie-table th {
    background: #fafaf9;
    font-weight: 600;
    color: #1c1917;
}

.legal-cookie-table td {
    color: #44403c;
}

.legal-cookie-table__note {
    font-size: 12px;
    color: #78716c;
    font-style: italic;
}

.legal-cookie-actions {
    margin: 20px 0;
}

@media (max-width: 600px) {
    .cookie-consent-banner {
        bottom: 12px;
        width: calc(100vw - 24px);
        padding: 16px 18px;
    }

    .cookie-consent-banner__actions {
        flex-direction: column;
        width: 100%;
    }

    .cookie-consent-banner .cookie-btn {
        width: 100%;
    }

    .legal-cookie-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}
