/* ============================================================
   LEGAL MODALS
   AVISO DE PRIVACIDAD / POLÍTICA DE USO
============================================================ */

.contenedorModal {
    position: fixed;
    inset: 0;
    z-index: 99990;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 28px;
    overflow: hidden;
    background: rgba(6, 11, 22, 0.76);
    backdrop-filter: blur(11px);
    -webkit-backdrop-filter: blur(11px);
}


/* Compatibilidad con el JS actual */

.contenedorModal[style*="display: block"],
.contenedorModal[style*="display:block"] {
    display: flex !important;
}

.contenedorModal[style*="display: flex"],
.contenedorModal[style*="display:flex"] {
    display: flex !important;
}


/* ============================================================
   MODAL WINDOW
============================================================ */

.ventanaModal {
    position: relative;
    width: min(850px, 100%);
    max-height: min(780px, calc(100vh - 56px));
    padding: 54px 50px 45px;
    overflow-x: hidden;
    overflow-y: auto;
    color: #4c566b;
    background:
        radial-gradient(
            circle at 100% 0%,
            rgba(91, 92, 240, 0.07),
            transparent 28%
        ),
        #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.84);
    border-radius: 25px;
    box-shadow:
        0 40px 110px rgba(0, 0, 0, 0.38);
    font-size: 14px;
    line-height: 1.8;
    animation: dmxLegalModalEntrance 320ms ease both;
    overscroll-behavior: contain;
}


/* Barra decorativa superior */

.ventanaModal::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 5px;
    background:
        linear-gradient(
            90deg,
            var(--dmx-primary-dark),
            var(--dmx-primary),
            var(--dmx-secondary)
        );
}


/* ============================================================
   CLOSE BUTTON
============================================================ */

.cerrarModal {
    position: sticky;
    top: -35px;
    z-index: 10;
    display: grid;
    float: right;
    width: 40px;
    height: 40px;
    margin:
        -35px
        -31px
        12px
        20px;
    place-items: center;
    color: #737c90;
    background: #f3f5f9;
    border: 1px solid #e3e7ef;
    border-radius: 12px;
    box-shadow:
        0 6px 18px rgba(19, 29, 52, 0.08);
    font-size: 0;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    transition:
        color 220ms ease,
        background 220ms ease,
        border-color 220ms ease,
        transform 220ms ease;
}

.cerrarModal::before,
.cerrarModal::after {
    content: "";
    position: absolute;
    width: 17px;
    height: 2px;
    background: currentColor;
    border-radius: 10px;
}

.cerrarModal::before {
    transform: rotate(45deg);
}

.cerrarModal::after {
    transform: rotate(-45deg);
}

.cerrarModal:hover {
    color: #ffffff;
    background: var(--dmx-primary);
    border-color: var(--dmx-primary);
    transform: rotate(5deg);
}


/* ============================================================
   DATABASE CONTENT
============================================================ */

.ventanaModal h1,
.ventanaModal h2,
.ventanaModal h3,
.ventanaModal h4 {
    clear: both;
    color: #192136;
    font-weight: 750;
    line-height: 1.3;
    letter-spacing: -0.025em;
}

.ventanaModal h1 {
    margin: 0 55px 27px 0;
    padding-bottom: 23px;
    border-bottom: 1px solid #e7eaf1;
    font-size: clamp(28px, 4vw, 40px);
}

.ventanaModal h1::after {
    content: "";
    display: block;
    width: 46px;
    height: 3px;
    margin-top: 17px;
    background:
        linear-gradient(
            90deg,
            var(--dmx-primary),
            var(--dmx-secondary)
        );
    border-radius: 20px;
}

.ventanaModal h2 {
    margin: 34px 0 14px;
    font-size: 21px;
}

.ventanaModal h3 {
    margin: 27px 0 12px;
    font-size: 17px;
}

.ventanaModal h4 {
    margin: 23px 0 10px;
    font-size: 15px;
}

.ventanaModal p {
    margin: 0 0 18px;
    color: #596276;
    font-size: 14px;
    line-height: 1.82;
}

.ventanaModal strong,
.ventanaModal b {
    color: #30394d;
    font-weight: 720;
}

.ventanaModal a:not(.cerrarModal) {
    color: var(--dmx-primary);
    font-weight: 650;
    text-decoration: underline;
    text-decoration-color: rgba(91, 92, 240, 0.3);
    text-underline-offset: 3px;
    transition:
        color 220ms ease,
        text-decoration-color 220ms ease;
}

.ventanaModal a:not(.cerrarModal):hover {
    color: var(--dmx-primary-dark);
    text-decoration-color: var(--dmx-primary-dark);
}

.ventanaModal ul,
.ventanaModal ol {
    margin: 15px 0 22px;
    padding-left: 24px;
}

.ventanaModal li {
    margin-bottom: 10px;
    padding-left: 5px;
    color: #596276;
    line-height: 1.7;
}

.ventanaModal li::marker {
    color: var(--dmx-primary);
}

.ventanaModal blockquote {
    margin: 24px 0;
    padding: 18px 21px;
    color: #525b70;
    background: rgba(91, 92, 240, 0.05);
    border-left: 3px solid var(--dmx-primary);
    border-radius: 0 12px 12px 0;
}

.ventanaModal hr {
    height: 1px;
    margin: 28px 0;
    background: #e7eaf1;
    border: 0;
}


/* ============================================================
   TABLES INSIDE LEGAL CONTENT
============================================================ */

.ventanaModal table {
    width: 100%;
    margin: 24px 0;
    overflow: hidden;
    border: 1px solid #e3e7ef;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 13px;
    font-size: 13px;
}

.ventanaModal th,
.ventanaModal td {
    padding: 13px 15px;
    border-right: 1px solid #e8ebf1;
    border-bottom: 1px solid #e8ebf1;
    text-align: left;
    vertical-align: top;
}

.ventanaModal th {
    color: #343d51;
    background: #f5f6fa;
    font-weight: 720;
}

.ventanaModal tr:last-child td {
    border-bottom: 0;
}

.ventanaModal th:last-child,
.ventanaModal td:last-child {
    border-right: 0;
}


/* ============================================================
   SCROLLBAR
============================================================ */

.ventanaModal {
    scrollbar-width: thin;
    scrollbar-color:
        rgba(91, 92, 240, 0.45)
        #eef0f5;
}

.ventanaModal::-webkit-scrollbar {
    width: 9px;
}

.ventanaModal::-webkit-scrollbar-track {
    margin: 18px 0;
    background: transparent;
}

.ventanaModal::-webkit-scrollbar-thumb {
    background:
        linear-gradient(
            to bottom,
            var(--dmx-primary),
            var(--dmx-primary-light)
        );
    border: 3px solid #ffffff;
    border-radius: 20px;
}


/* ============================================================
   MODAL ANIMATION
============================================================ */

@keyframes dmxLegalModalEntrance {

    from {
        opacity: 0;
        transform:
            translateY(18px)
            scale(0.97);
    }

    to {
        opacity: 1;
        transform:
            translateY(0)
            scale(1);
    }

}


/* ============================================================
   TABLET
============================================================ */

@media (max-width: 800px) {

    .contenedorModal {
        padding: 20px;
    }

    .ventanaModal {
        max-height: calc(100vh - 40px);
        padding:
            48px
            34px
            35px;
        border-radius: 21px;
    }

    .cerrarModal {
        top: -31px;
        margin:
            -31px
            -17px
            10px
            17px;
    }

    .ventanaModal h1 {
        font-size: 30px;
    }

}


/* ============================================================
   MOBILE
============================================================ */

@media (max-width: 560px) {

    .contenedorModal {
        align-items: flex-end;
        padding: 0;
    }

    .ventanaModal {
        width: 100%;
        max-height: calc(
            100vh -
            env(safe-area-inset-top) -
            15px
        );
        padding:
            47px
            22px
            calc(30px + env(safe-area-inset-bottom));
        border-radius: 24px 24px 0 0;
        font-size: 13px;
        animation-name: dmxLegalModalMobileEntrance;
    }

    .ventanaModal::after {
        content: "";
        position: absolute;
        top: 12px;
        left: 50%;
        width: 42px;
        height: 4px;
        background: #d7dbe4;
        border-radius: 20px;
        transform: translateX(-50%);
    }

    .cerrarModal {
        top: -34px;
        width: 38px;
        height: 38px;
        margin:
            -34px
            -10px
            8px
            15px;
    }

    .ventanaModal h1 {
        margin-right: 45px;
        padding-bottom: 18px;
        font-size: 26px;
    }

    .ventanaModal h2 {
        margin-top: 28px;
        font-size: 19px;
    }

    .ventanaModal h3 {
        font-size: 16px;
    }

    .ventanaModal p {
        font-size: 13px;
        line-height: 1.75;
    }

    .ventanaModal table {
        display: block;
        width: 100%;
        overflow-x: auto;
        white-space: nowrap;
    }

}


@keyframes dmxLegalModalMobileEntrance {

    from {
        opacity: 0;
        transform: translateY(100%);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }

}


/* ============================================================
   REDUCED MOTION
============================================================ */

@media (prefers-reduced-motion: reduce) {

    .ventanaModal {
        animation-duration: 0.01ms;
    }

}