/*
 * BDV Cookie Manager - Estilos frontend
 */

.bdv-cookie-wrapper {
    position: fixed;
    left: 0;
    right: 0;
    z-index: 99999;
    pointer-events: none;
    font-family: inherit;
}

.bdv-cookie-wrapper.bdv-cookie-wrapper--hidden {
    display: none !important;
}

.bdv-cookie-toggle-btn {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(15, 23, 42, 0.75);
    color: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.35);
    z-index: 99998;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.bdv-cookie-toggle-btn:hover,
.bdv-cookie-toggle-btn:focus {
    transform: translateY(-1px);
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.45);
    background: rgba(14, 165, 233, 0.9);
    outline: none;
}

.bdv-cookie-toggle-btn span {
    pointer-events: none;
    font-size: 20px;
}

.bdv-cookie-wrapper[data-position="bottom"] {
    bottom: 0;
}

.bdv-cookie-wrapper[data-position="top"] {
    top: 0;
}

/* MODIFICADO SEO MASTER: Banner oculto por defecto */
.bdv-cookie-banner {
    display: none;
    background: #111827;
    color: #f9fafb;
    padding: 24px;
    flex-wrap: wrap;
    gap: 24px;
    align-items: center;
    pointer-events: all;
    
    /* Animación de entrada */
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.bdv-cookie-banner.is-visible {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

.bdv-cookie-wrapper[data-layout="modal"] .bdv-cookie-banner {
    max-width: 420px;
    margin: 40px auto;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.bdv-cookie-wrapper[data-layout="modal"] {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.35);
    pointer-events: all;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.bdv-cookie-wrapper[data-layout="bar"] .bdv-cookie-banner {
    border-radius: 0;
}

.bdv-cookie-banner__content {
    flex: 1 1 260px;
}

.bdv-cookie-banner__title {
    margin: 0 0 8px;
    font-size: 1.25rem;
    font-weight: 600;
}

.bdv-cookie-banner__message {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.5;
}

.bdv-cookie-banner__policy {
    margin: 12px 0 0;
    font-size: 0.85rem;
}

.bdv-cookie-banner__policy a {
    color: #22d3ee;
    text-decoration: underline;
}

.bdv-cookie-banner__actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.bdv-cookie-btn {
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    padding: 10px 18px;
    border-radius: 999px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.bdv-cookie-btn:focus {
    outline: 2px solid #22d3ee;
    outline-offset: 2px;
}

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

.bdv-cookie-btn--primary {
    background: #22c55e;
    color: #fff;
}

.bdv-cookie-btn--secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.bdv-cookie-btn--ghost {
    background: transparent;
    color: #f9fafb;
}

/* Panel */

.bdv-cookie-panel {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.8);
    display: none; /* Oculto por defecto */
    align-items: center;
    justify-content: center;
    padding: 20px;
    pointer-events: none;
    z-index: 100000;
}

.bdv-cookie-panel.is-visible {
    display: flex;
    pointer-events: all;
}

.bdv-cookie-panel__inner {
    background: #fff;
    color: #111827;
    width: min(640px, 92vw);
    max-height: 90vh;
    overflow: hidden;
    border-radius: 16px;
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.25);
    padding: 32px;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.bdv-cookie-panel__close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: transparent;
    border: none;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: #64748b;
}

.bdv-cookie-panel__title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.bdv-cookie-panel__description {
    margin: 0;
    color: #475569;
    line-height: 1.6;
}

.bdv-cookie-panel__meta {
    margin: -10px 0 0;
    color: #94a3b8;
}

.bdv-cookie-categories {
    flex: 1 1 auto;
    overflow-y: auto;
    padding-right: 10px;
    display: grid;
    gap: 16px;
}

.bdv-cookie-category {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 18px;
    background: #f8fafc;
}

.bdv-cookie-category__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.bdv-cookie-category__label {
    font-weight: 600;
    font-size: 1rem;
}

.bdv-cookie-category__badge {
    background: #f97316;
    color: #fff;
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bdv-cookie-category__description {
    margin: 12px 0 0;
    color: #475569;
    font-size: 0.92rem;
    line-height: 1.5;
}

.bdv-cookie-table {
    width: 100%;
    margin-top: 12px;
    border-collapse: collapse;
    font-size: 0.85rem;
    background: rgba(255, 255, 255, 0.55);
    border-radius: 10px;
    overflow: hidden;
}

.bdv-cookie-table th,
.bdv-cookie-table td {
    padding: 10px 12px;
    text-align: left;
}

.bdv-cookie-table thead th {
    background: rgba(15, 23, 42, 0.08);
    font-weight: 600;
    color: #0f172a;
}

.bdv-cookie-table tbody tr:nth-child(2n+1) {
    background: rgba(15, 23, 42, 0.03);
}

.bdv-cookie-table code {
    background: rgba(15, 23, 42, 0.09);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.78rem;
}

.bdv-cookie-details {
    margin-top: 12px;
    background: rgba(15, 23, 42, 0.05);
    border-radius: 12px;
    padding: 8px 12px;
}

.bdv-cookie-details > summary {
    cursor: pointer;
    font-weight: 600;
    color: #0f172a;
    outline: none;
}

.bdv-cookie-details[open] > summary {
    margin-bottom: 10px;
}

.bdv-cookie-details > summary::-webkit-details-marker {
    display: none;
}

.bdv-cookie-details > summary::before {
    content: '▸';
    display: inline-block;
    margin-right: 6px;
    transition: transform 0.2s ease;
}

.bdv-cookie-details[open] > summary::before {
    transform: rotate(90deg);
}

.bdv-cookie-details summary:focus {
    outline: none;
}

.bdv-cookie-details summary:hover {
    color: #0ea5e9;
}

.bdv-cookie-panel__actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

/* Toggle */

.bdv-cookie-toggle {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 24px;
}

.bdv-cookie-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.bdv-cookie-toggle__slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: #cbd5f5;
    transition: 0.3s;
    border-radius: 24px;
}

.bdv-cookie-toggle__slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 999px;
    box-shadow: 0 2px 4px rgba(148, 163, 184, 0.5);
}

.bdv-cookie-toggle input:checked + .bdv-cookie-toggle__slider {
    background-color: #22c55e;
}

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

/* Estados antiguos (mantenidos por seguridad, pero anulados por lógica nueva) */
.bdv-cookie-wrapper[data-has-consent="true"] .bdv-cookie-banner {
    display: none;
}

.bdv-cookie-wrapper[data-has-consent="true"] .bdv-cookie-panel {
    display: none;
}

.bdv-cookie-panel[data-visible="true"] {
    display: flex;
}

.bdv-cookie-panel__inner::-webkit-scrollbar {
    width: 6px;
}

.bdv-cookie-panel__inner::-webkit-scrollbar-thumb {
    background: #cbd5f5;
    border-radius: 999px;
}

.bdv-cookie-noscript {
    margin: 0;
    padding: 12px;
    background: #fee2e2;
    color: #991b1b;
    border-radius: 8px;
}

/* Responsive */

@media (max-width: 720px) {
    .bdv-cookie-banner {
        flex-direction: column;
        align-items: flex-start;
    }

    .bdv-cookie-banner__actions {
        width: 100%;
        justify-content: stretch;
    }

    .bdv-cookie-btn {
        flex: 1 1 auto;
        width: 100%;
    }

    .bdv-cookie-panel__inner {
        padding: 24px;
        width: 100%;
    }
}

body.bdv-cookie-panel-open {
    overflow: hidden;
}