/* ==========================================================================
   MODAL LEGAL (Términos y Condiciones / Política de Privacidad)
   Ubicación: css/legal-modal.css
   ========================================================================== */

.zx-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.62);
    backdrop-filter: blur(3px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.zx-modal-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

.zx-modal-overlay[hidden] {
    display: none;
}

.zx-modal {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 760px;
    max-height: 86vh;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 24px 64px rgba(15, 23, 42, 0.32);
    overflow: hidden;
    transform: translateY(12px) scale(0.985);
    transition: transform 0.2s ease;
    outline: none;
}

.zx-modal-overlay.is-open .zx-modal {
    transform: translateY(0) scale(1);
}

.zx-modal__header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 22px;
    border-bottom: 1px solid #e6eef4;
    background: #ffffff;
}

.zx-modal__title {
    flex: 1 1 auto;
    margin: 0;
    font-size: 20px;
    line-height: 1.3;
    font-weight: 700;
    color: #1f2937;
}

.zx-modal__close {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid #e6eef4;
    border-radius: 999px;
    background: #f8fbfd;
    color: #41505f;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.zx-modal__close:hover,
.zx-modal__close:focus-visible {
    background: #26ADEB;
    border-color: #26ADEB;
    color: #ffffff;
    outline: none;
}

.zx-modal__body {
    padding: 22px;
    overflow-y: auto;
    overscroll-behavior: contain;
    color: #374151;
    font-size: 15px;
    line-height: 1.7;
}

.zx-modal__body > *:first-child {
    margin-top: 0;
}

.zx-modal__body > *:last-child {
    margin-bottom: 0;
}

.zx-modal__body h1,
.zx-modal__body h2,
.zx-modal__body h3,
.zx-modal__body h4 {
    color: #111827;
    line-height: 1.3;
    margin: 1.4em 0 0.6em;
}

.zx-modal__body h1 { font-size: 24px; }
.zx-modal__body h2 { font-size: 20px; }
.zx-modal__body h3 { font-size: 17px; }

.zx-modal__body p,
.zx-modal__body ul,
.zx-modal__body ol {
    margin-bottom: 1em;
}

.zx-modal__body ul,
.zx-modal__body ol {
    padding-left: 1.4em;
}

.zx-modal__body a {
    color: #1b96cf;
    text-decoration: underline;
}

.zx-modal__body img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

.zx-modal__body table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1em;
}

.zx-modal__body th,
.zx-modal__body td {
    border: 1px solid #e6eef4;
    padding: 8px 10px;
    text-align: left;
}

.zx-modal__loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px 0;
    color: #6b7280;
    font-size: 14px;
}

.zx-modal__spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #cfe8f6;
    border-top-color: #26ADEB;
    border-radius: 50%;
    animation: zx-modal-spin 0.7s linear infinite;
}

@keyframes zx-modal-spin {
    to { transform: rotate(360deg); }
}

.zx-modal__error {
    padding: 24px;
    border: 1px solid #f3d6d6;
    border-radius: 12px;
    background: #fdf4f4;
    color: #8a2b2b;
    font-size: 14px;
}

.zx-modal__error a {
    color: #8a2b2b;
    font-weight: 600;
}

body.zx-modal-open {
    overflow: hidden;
}

@media (max-width: 640px) {
    .zx-modal-overlay {
        padding: 0;
        align-items: stretch;
    }

    .zx-modal {
        max-width: 100%;
        max-height: 100%;
        height: 100%;
        border-radius: 0;
    }

    .zx-modal__header {
        padding: 14px 16px;
        padding-top: calc(14px + env(safe-area-inset-top, 0px));
    }

    .zx-modal__title {
        font-size: 17px;
    }

    .zx-modal__close {
        width: 44px;
        height: 44px;
        font-size: 26px;
    }

    .zx-modal__body {
        padding: 16px;
        padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
        font-size: 14px;
    }
}
