/* ══════════════════════════════════════════════════════════════
   UX Popup — Frontend Public Styles v1.1.0
   BLINDADO: Isolado via namespace, cross-browser, responsivo
   ══════════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────
   CSS RESET / ISOLATION
   Impede que estilos de temas/plugins
   vazem para dentro do popup
   ───────────────────────────────────── */
.ux-popup-overlay,
.ux-popup-overlay *,
.ux-popup-overlay *::before,
.ux-popup-overlay *::after {
    -webkit-box-sizing: border-box;
       -moz-box-sizing: border-box;
            box-sizing: border-box;
    margin: 0;
    padding: 0;
    border: 0;
    outline: none;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Overlay ── */
.ux-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    z-index: 2147483640; /* Máximo seguro, acima de qualquer plugin */
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    -ms-flex-align: center;
            align-items: center;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    -ms-flex-pack: center;
            justify-content: center;
    opacity: 0;
    visibility: hidden;
    -webkit-transition: opacity 0.35s ease, visibility 0.35s ease;
    -moz-transition: opacity 0.35s ease, visibility 0.35s ease;
    -o-transition: opacity 0.35s ease, visibility 0.35s ease;
    transition: opacity 0.35s ease, visibility 0.35s ease;
    /* Impedir herança de font do tema */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: #333;
    text-align: left;
    direction: ltr;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

.ux-popup-overlay.ux-popup-visible {
    opacity: 1;
    visibility: visible;
}

/* ── Device Targeting ── */
@media (max-width: 768px) {
    .ux-popup-device-desktop { display: none !important; }
}
@media (min-width: 769px) {
    .ux-popup-device-mobile { display: none !important; }
}

/* ── Modal ── */
.ux-popup-modal {
    position: relative;
    width: 92%;
    max-height: 90vh;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch; /* Scroll suave iOS */
    -webkit-box-shadow: 0 25px 80px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255,255,255,0.08);
       -moz-box-shadow: 0 25px 80px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255,255,255,0.08);
            box-shadow: 0 25px 80px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255,255,255,0.08);
    -webkit-transform: scale(0.88) translateY(20px);
       -moz-transform: scale(0.88) translateY(20px);
        -ms-transform: scale(0.88) translateY(20px);
         -o-transform: scale(0.88) translateY(20px);
            transform: scale(0.88) translateY(20px);
    -webkit-transition: -webkit-transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
       -moz-transition: -moz-transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
         -o-transition: -o-transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
            transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    /* Prevenir que o tema force estilos */
    background-clip: padding-box;
    -webkit-backface-visibility: hidden;
            backface-visibility: hidden;
}

.ux-popup-visible .ux-popup-modal {
    -webkit-transform: scale(1) translateY(0);
       -moz-transform: scale(1) translateY(0);
        -ms-transform: scale(1) translateY(0);
         -o-transform: scale(1) translateY(0);
            transform: scale(1) translateY(0);
}

/* Custom scrollbar */
.ux-popup-modal::-webkit-scrollbar { width: 6px; }
.ux-popup-modal::-webkit-scrollbar-track { background: transparent; }
.ux-popup-modal::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 3px; }
/* Firefox */
.ux-popup-modal {
    scrollbar-width: thin;
    scrollbar-color: rgba(0,0,0,0.15) transparent;
}

/* ── Close Button (X) ── */
.ux-popup-close {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 100;
    width: 36px;
    height: 36px;
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    -ms-flex-align: center;
            align-items: center;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    -ms-flex-pack: center;
            justify-content: center;
    background: rgba(0, 0, 0, 0.5) !important;
    color: #fff !important;
    border: none !important;
    -webkit-border-radius: 50%;
       -moz-border-radius: 50%;
            border-radius: 50%;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    -webkit-transition: background 0.2s ease, -webkit-transform 0.2s ease;
       -moz-transition: background 0.2s ease, -moz-transform 0.2s ease;
            transition: background 0.2s ease, transform 0.2s ease;
    padding: 0 !important;
    margin: 0 !important;
    font-family: Arial, Helvetica, sans-serif !important;
    text-decoration: none !important;
    -webkit-appearance: none;
       -moz-appearance: none;
            appearance: none;
    text-shadow: none !important;
    box-shadow: none !important;
    min-width: 0 !important;
    min-height: 0 !important;
    /* Touch target mínimo */
    -webkit-tap-highlight-color: transparent;
}

.ux-popup-close:hover,
.ux-popup-close:focus {
    background: rgba(0, 0, 0, 0.8) !important;
    -webkit-transform: scale(1.1);
       -moz-transform: scale(1.1);
        -ms-transform: scale(1.1);
            transform: scale(1.1);
    color: #fff !important;
    text-decoration: none !important;
    outline: none !important;
}

/* ── Body ── */
.ux-popup-body {
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
    -ms-word-break: break-all;
    word-break: break-word;
}

/* ─────────────────────────────────────
   RESPONSIVIDADE UNIVERSAL DE MÍDIA
   Qualquer img, iframe, video, embed,
   object sempre ocupa 100% do container
   ───────────────────────────────────── */
.ux-popup-body img,
.ux-popup-body video,
.ux-popup-body svg {
    max-width: 100%;
    width: 100%;
    height: auto;
    display: block;
    border: none;
}

.ux-popup-body iframe,
.ux-popup-body embed,
.ux-popup-body object {
    max-width: 100%;
    width: 100%;
    display: block;
    border: none;
}

/* Wrapper responsivo para qualquer conteúdo embarcado (16:9) */
.ux-popup-body iframe:not(.ux-popup-video-wrapper iframe) {
    width: 100%;
    min-height: 200px;
    aspect-ratio: 16 / 9;
}

/* Fallback para browsers sem aspect-ratio */
@supports not (aspect-ratio: 16 / 9) {
    .ux-popup-body iframe:not(.ux-popup-video-wrapper iframe) {
        height: 0;
        padding-bottom: 56.25%;
    }
}

/* ── Image Type ── */
.ux-popup-image {
    display: block;
    width: 100%;
    height: auto;
    -webkit-border-radius: inherit;
       -moz-border-radius: inherit;
            border-radius: inherit;
}

/* Quando o popup é só imagem, remover padding */
.ux-popup-modal--image-type {
    padding: 0 !important;
    overflow: hidden;
}

.ux-popup-modal--image-type .ux-popup-body {
    line-height: 0;
    font-size: 0;
}

.ux-popup-modal--image-type .ux-popup-body a {
    display: block;
    line-height: 0;
    font-size: 0;
}

/* ── Title ── */
.ux-popup-title {
    margin: 0 0 16px 0 !important;
    padding: 0 !important;
    font-size: 24px;
    font-weight: 700;
    line-height: 1.3;
    color: #2d3436;
    font-family: inherit;
    text-transform: none;
    letter-spacing: normal;
    border: none !important;
    background: none !important;
}

/* ── Video Wrapper (16:9 responsivo) ── */
.ux-popup-video-wrapper {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 ratio */
    margin: 12px 0;
    -webkit-border-radius: 8px;
       -moz-border-radius: 8px;
            border-radius: 8px;
    overflow: hidden;
    background: #000;
}

.ux-popup-video-wrapper iframe,
.ux-popup-video-wrapper video,
.ux-popup-video-wrapper embed,
.ux-popup-video-wrapper object {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    border: none !important;
}

/* ── CTA Button ── */
.ux-popup-cta-wrap {
    text-align: center;
    margin-top: 20px;
    padding: 0;
}

.ux-popup-cta-btn {
    display: inline-block;
    padding: 14px 36px;
    color: #fff !important;
    text-decoration: none !important;
    -webkit-border-radius: 8px;
       -moz-border-radius: 8px;
            border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.3px;
    -webkit-transition: -webkit-transform 0.2s ease, box-shadow 0.2s ease, -webkit-filter 0.2s ease;
       -moz-transition: -moz-transform 0.2s ease, box-shadow 0.2s ease;
            transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
    -webkit-box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
       -moz-box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    border: none !important;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    font-family: inherit;
    text-shadow: none !important;
    line-height: 1.4;
}

.ux-popup-cta-btn:hover,
.ux-popup-cta-btn:focus {
    -webkit-transform: translateY(-2px);
       -moz-transform: translateY(-2px);
        -ms-transform: translateY(-2px);
            transform: translateY(-2px);
    -webkit-box-shadow: 0 6px 25px rgba(0, 0, 0, 0.3);
       -moz-box-shadow: 0 6px 25px rgba(0, 0, 0, 0.3);
            box-shadow: 0 6px 25px rgba(0, 0, 0, 0.3);
    -webkit-filter: brightness(1.1);
            filter: brightness(1.1);
    color: #fff !important;
    text-decoration: none !important;
}

/* ── Background Image + HTML ── */
.ux-popup-bg-layer {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    min-height: 300px;
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    -ms-flex-align: center;
            align-items: center;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    -ms-flex-pack: center;
            justify-content: center;
    -webkit-border-radius: inherit;
       -moz-border-radius: inherit;
            border-radius: inherit;
    margin: -24px;
    padding: 40px;
}

.ux-popup-bg-content {
    position: relative;
    z-index: 2;
    color: #fff;
    text-align: center;
    width: 100%;
}

/* Garantir mídia dentro do bg_html também responsiva */
.ux-popup-bg-content img,
.ux-popup-bg-content video,
.ux-popup-bg-content iframe {
    max-width: 100%;
    height: auto;
}

/* ── WP Content ── */
.ux-popup-body p { margin: 0 0 12px 0; }
.ux-popup-body p:last-child { margin-bottom: 0; }
.ux-popup-body ul, .ux-popup-body ol { padding-left: 20px; margin: 8px 0; list-style-position: inside; }
.ux-popup-body li { margin: 4px 0; }
.ux-popup-body a { color: #6c5ce7; text-decoration: underline; }
.ux-popup-body a:hover { color: #5a4bd1; }
.ux-popup-body h1, .ux-popup-body h2, .ux-popup-body h3,
.ux-popup-body h4, .ux-popup-body h5, .ux-popup-body h6 {
    margin: 0 0 12px 0;
    padding: 0;
    line-height: 1.3;
    font-family: inherit;
    color: inherit;
}
.ux-popup-body table { width: 100%; border-collapse: collapse; }
.ux-popup-body table td, .ux-popup-body table th { padding: 8px; border: 1px solid #e0e0e0; }

/* ── Tabelas responsivas dentro do popup ── */
@media (max-width: 480px) {
    .ux-popup-body table { font-size: 13px; }
    .ux-popup-body table td, .ux-popup-body table th { padding: 4px 6px; }
}

/* ─────────────────────────────────────
   MOBILE RESPONSIVE
   ───────────────────────────────────── */
@media (max-width: 768px) {
    .ux-popup-modal {
        width: 95% !important;
        max-width: 95% !important;
        max-height: 85vh;
    }

    .ux-popup-title {
        font-size: 20px;
    }

    .ux-popup-cta-btn {
        padding: 12px 20px;
        font-size: 15px;
        width: 100%;
        text-align: center;
        display: block;
    }

    .ux-popup-close {
        width: 40px; /* Maior para touch */
        height: 40px;
        font-size: 22px;
        top: 4px;
        right: 4px;
    }

    .ux-popup-bg-layer {
        min-height: 250px;
        padding: 20px;
        margin: -16px;
    }

    /* Vídeos menores no mobile */
    .ux-popup-video-wrapper {
        margin: 8px 0;
    }
}

/* Small phones */
@media (max-width: 380px) {
    .ux-popup-modal {
        width: 98% !important;
        max-width: 98% !important;
        max-height: 90vh;
    }

    .ux-popup-title {
        font-size: 18px;
    }

    .ux-popup-bg-layer {
        min-height: 200px;
        padding: 16px;
    }
}

/* ── Landscape mobile ── */
@media (max-height: 500px) and (orientation: landscape) {
    .ux-popup-modal {
        max-height: 95vh;
    }

    .ux-popup-bg-layer {
        min-height: 180px;
    }
}

/* ─────────────────────────────────────
   ACESSIBILIDADE
   ───────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .ux-popup-overlay,
    .ux-popup-modal,
    .ux-popup-close,
    .ux-popup-cta-btn {
        -webkit-transition: none !important;
           -moz-transition: none !important;
                transition: none !important;
    }

    .ux-popup-modal {
        -webkit-transform: none !important;
           -moz-transform: none !important;
            -ms-transform: none !important;
                transform: none !important;
    }
}

/* ─────────────────────────────────────
   PRINT: esconde popups na impressão
   ───────────────────────────────────── */
@media print {
    .ux-popup-overlay { display: none !important; }
}
