/* ========================================
   BMP POPUP FRONTEND STYLES — v2
   Premium design with glass morphism,
   smooth animations, and micro-interactions
   ======================================== */

/* ═══════════════════════════════════════
   THEME ISOLATION RESET
   Neutralize ALL inherited theme styles
   so the popup looks the same on every theme
   ═══════════════════════════════════════ */
/* Reset the popup container and structural elements only */
.bmp-popup,
.bmp-popup .bmp-popup-inner,
.bmp-popup .bmp-popup-close {
    box-sizing: border-box;
    text-decoration: none;
    text-transform: none;
    letter-spacing: normal;
    text-shadow: none;
    float: none;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
/* Reset theme styles on close button specifically */
.bmp-popup .bmp-popup-close,
.bmp-popup .bmp-popup-close:hover,
.bmp-popup .bmp-popup-close:focus,
.bmp-popup .bmp-popup-close:active {
    box-shadow: none;
    outline: none;
}
/* Reset theme button/link styles ONLY on structural elements, NOT on content */
.bmp-popup .bmp-popup-post-btn,
.bmp-popup .bmp-popup-post-btn:hover,
.bmp-popup .bmp-popup-post-btn:focus {
    box-shadow: none;
    outline: none;
    text-decoration: none;
}
/* ── Isolate popup HTML content from theme ──
   Theme sets h1,h2{color:var(--dp-ink)} which overrides inherited colors.
   We use 'unset' (= inherit for color) with higher specificity to beat
   the theme rule, so elements inherit the auto text color set on .bmp-popup-inner
   (white on dark bg, dark on light bg). Inline styles still win. ── */
.bmp-popup .bmp-popup-html h1,
.bmp-popup .bmp-popup-html h2,
.bmp-popup .bmp-popup-html h3,
.bmp-popup .bmp-popup-html h4,
.bmp-popup .bmp-popup-html h5,
.bmp-popup .bmp-popup-html h6,
.bmp-popup .bmp-popup-html p,
.bmp-popup .bmp-popup-html span,
.bmp-popup .bmp-popup-html div,
.bmp-popup .bmp-popup-html li,
.bmp-popup .bmp-popup-html strong,
.bmp-popup .bmp-popup-html em {
    color: unset;
    font-family: unset;
    letter-spacing: unset;
}
.bmp-popup .bmp-popup-html a {
    color: unset;
}

/* Restore essential styles after reset — no forced color, let inline styles win */
.bmp-popup-inner {
    font-size: 16px;
    line-height: 1.5;
    font-weight: 400;
}
.bmp-popup a {
    color: #2563eb;
    cursor: pointer;
}
.bmp-popup a:hover {
    opacity: 0.85;
}
.bmp-popup img {
    max-width: 100%;
    height: auto;
    display: block;
    border: none;
}
.bmp-popup button {
    cursor: pointer;
    font-family: inherit;
}
.bmp-popup h1, .bmp-popup h2, .bmp-popup h3, .bmp-popup h4 {
    font-weight: 700;
    line-height: 1.3;
}
.bmp-popup p {
    margin: 0;
    line-height: 1.6;
}

/* ── Overlay ── */
.bmp-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 99997;
    opacity: 0;
    transition: opacity 350ms ease;
}
.bmp-popup-overlay.is-visible {
    opacity: 1;
}

/* ── Base popup ── */
.bmp-popup {
    position: fixed;
    z-index: 99998;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    -webkit-font-smoothing: antialiased;
}

.bmp-popup-inner {
    position: relative;
    background: #fff;
    overflow: hidden;
}

.bmp-popup-content {
    width: 100%;
}

.bmp-popup-content img {
    display: block;
    max-width: 100%;
    height: auto;
}

.bmp-popup-html {
    padding: 28px 24px;
}

/* ── Close button — glass effect, fully theme-independent ── */
.bmp-popup .bmp-popup-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    width: 36px;
    height: 36px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #fff;
    font-size: 20px;
    line-height: 1;
    text-align: center;
    cursor: pointer;
    transition: all 250ms cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    min-width: 36px;
    min-height: 36px;
    max-width: 36px;
    max-height: 36px;
    text-decoration: none;
    text-transform: none;
    letter-spacing: normal;
    font-family: -apple-system, sans-serif;
    font-weight: 400;
    box-shadow: none;
    outline: none;
}
.bmp-popup .bmp-popup-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.15) rotate(90deg);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: none;
    outline: none;
    text-decoration: none;
}
.bmp-popup .bmp-popup-close:active {
    transform: scale(0.95);
}
.bmp-popup .bmp-popup-close:focus {
    outline: none;
    box-shadow: none;
}

/* Dark close button for light content */
.bmp-popup .bmp-popup-html ~ .bmp-popup-close,
.bmp-popup .bmp-popup-content:not(:has(img)) ~ .bmp-popup-close {
    background: rgba(0, 0, 0, 0.06);
    color: #374151;
    border-color: rgba(0, 0, 0, 0.08);
    text-shadow: none;
}
.bmp-popup .bmp-popup-html ~ .bmp-popup-close:hover {
    background: rgba(0, 0, 0, 0.12);
    color: #111;
}

/* ═══════════════════════════════════════
   POSITION: CENTER (modal)
   Premium glass morphism design
   ═══════════════════════════════════════ */
.bmp-popup-pos-center {
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.bmp-popup-pos-center.is-visible {
    display: flex;
}
.bmp-popup-pos-center .bmp-popup-inner {
    border-radius: 16px;
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.04),
        0 8px 16px rgba(0, 0, 0, 0.08),
        0 24px 64px rgba(0, 0, 0, 0.16);
    max-height: 90vh;
    overflow-y: auto;
    opacity: 0;
    transform: scale(0.92) translateY(20px);
    transition: all 400ms cubic-bezier(0.16, 1, 0.3, 1);
}
.bmp-popup-pos-center.is-visible .bmp-popup-inner {
    opacity: 1;
    transform: scale(1) translateY(0);
}

/* Scrollbar styling for modal */
.bmp-popup-pos-center .bmp-popup-inner::-webkit-scrollbar {
    width: 6px;
}
.bmp-popup-pos-center .bmp-popup-inner::-webkit-scrollbar-track {
    background: transparent;
}
.bmp-popup-pos-center .bmp-popup-inner::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 3px;
}

/* Center sizes */
.bmp-popup-size-small .bmp-popup-inner { max-width: 400px; }
.bmp-popup-size-medium .bmp-popup-inner { max-width: 560px; }
.bmp-popup-size-large .bmp-popup-inner { max-width: 720px; }
.bmp-popup-size-fullscreen { padding: 0; }
.bmp-popup-size-fullscreen .bmp-popup-inner {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    border-radius: 0;
    box-shadow: none;
}

/* ═══════════════════════════════════════
   POSITION: RIGHT (slide-in panel)
   ═══════════════════════════════════════ */
.bmp-popup-pos-right {
    top: 0;
    right: 0;
    bottom: 0;
    width: 400px;
    max-width: 100vw;
}
.bmp-popup-pos-right .bmp-popup-inner {
    height: 100%;
    overflow-y: auto;
    box-shadow:
        -1px 0 0 rgba(0, 0, 0, 0.06),
        -8px 0 24px rgba(0, 0, 0, 0.12);
    transform: translateX(100%);
    transition: transform 450ms cubic-bezier(0.16, 1, 0.3, 1);
}
.bmp-popup-pos-right.is-visible .bmp-popup-inner {
    transform: translateX(0);
}

/* ═══════════════════════════════════════
   POSITION: LEFT (slide-in panel)
   ═══════════════════════════════════════ */
.bmp-popup-pos-left {
    top: 0;
    left: 0;
    bottom: 0;
    width: 400px;
    max-width: 100vw;
}
.bmp-popup-pos-left .bmp-popup-inner {
    height: 100%;
    overflow-y: auto;
    box-shadow:
        1px 0 0 rgba(0, 0, 0, 0.06),
        8px 0 24px rgba(0, 0, 0, 0.12);
    transform: translateX(-100%);
    transition: transform 450ms cubic-bezier(0.16, 1, 0.3, 1);
}
.bmp-popup-pos-left.is-visible .bmp-popup-inner {
    transform: translateX(0);
}

/* ═══════════════════════════════════════
   POSITION: BOTTOM (notification bar)
   Modern floating bar with rounded corners
   ═══════════════════════════════════════ */
.bmp-popup-pos-bottom {
    bottom: 16px;
    left: 16px;
    right: 16px;
}
.bmp-popup-pos-bottom .bmp-popup-inner {
    border-radius: 12px;
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.04),
        0 4px 12px rgba(0, 0, 0, 0.08),
        0 16px 48px rgba(0, 0, 0, 0.12);
    transform: translateY(calc(100% + 32px));
    transition: transform 500ms cubic-bezier(0.16, 1, 0.3, 1);
    max-width: 640px;
    margin: 0 auto;
}
.bmp-popup-pos-bottom.is-visible .bmp-popup-inner {
    transform: translateY(0);
}
.bmp-popup-pos-bottom .bmp-popup-close {
    top: 50%;
    transform: translateY(-50%);
    right: 14px;
    width: 28px;
    height: 28px;
    font-size: 16px;
    background: rgba(0, 0, 0, 0.06);
    color: #374151;
    border-color: transparent;
}
.bmp-popup-pos-bottom .bmp-popup-close:hover {
    background: rgba(0, 0, 0, 0.12);
    transform: translateY(-50%) scale(1.1);
}
.bmp-popup-pos-bottom .bmp-popup-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 14px 52px 14px 20px;
}
.bmp-popup-pos-bottom .bmp-popup-content img {
    max-height: 64px;
    width: auto;
    border-radius: 8px;
}

/* ═══════════════════════════════════════
   POSITION: TOP (announcement bar)
   Floating bar with accent border
   ═══════════════════════════════════════ */
.bmp-popup-pos-top {
    top: 16px;
    left: 16px;
    right: 16px;
}
.bmp-popup-pos-top .bmp-popup-inner {
    border-radius: 12px;
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.04),
        0 4px 12px rgba(0, 0, 0, 0.08),
        0 16px 48px rgba(0, 0, 0, 0.12);
    transform: translateY(calc(-100% - 32px));
    transition: transform 500ms cubic-bezier(0.16, 1, 0.3, 1);
    max-width: 640px;
    margin: 0 auto;
    border-top: 3px solid #ffc45e;
}
.bmp-popup-pos-top.is-visible .bmp-popup-inner {
    transform: translateY(0);
}
.bmp-popup-pos-top .bmp-popup-close {
    top: 50%;
    transform: translateY(-50%);
    right: 14px;
    width: 28px;
    height: 28px;
    font-size: 16px;
    background: rgba(0, 0, 0, 0.06);
    color: #374151;
    border-color: transparent;
}
.bmp-popup-pos-top .bmp-popup-close:hover {
    background: rgba(0, 0, 0, 0.12);
    transform: translateY(-50%) scale(1.1);
}
.bmp-popup-pos-top .bmp-popup-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 14px 52px 14px 20px;
}
.bmp-popup-pos-top .bmp-popup-content img {
    max-height: 64px;
    width: auto;
    border-radius: 8px;
}

/* ═══════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════ */
@media (max-width: 768px) {
    .bmp-popup-pos-right,
    .bmp-popup-pos-left {
        width: 100vw;
    }

    .bmp-popup-pos-center {
        padding: 12px;
    }
    .bmp-popup-size-small .bmp-popup-inner,
    .bmp-popup-size-medium .bmp-popup-inner,
    .bmp-popup-size-large .bmp-popup-inner {
        max-width: 95vw;
    }

    .bmp-popup-pos-bottom,
    .bmp-popup-pos-top {
        left: 8px;
        right: 8px;
    }
    .bmp-popup-pos-bottom { bottom: 8px; }
    .bmp-popup-pos-top { top: 8px; }

    .bmp-popup-pos-bottom .bmp-popup-inner,
    .bmp-popup-pos-top .bmp-popup-inner {
        max-width: none;
    }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
    .bmp-popup-overlay,
    .bmp-popup-inner,
    .bmp-popup-close {
        transition: none !important;
    }
    .bmp-popup-pos-center .bmp-popup-inner {
        transform: none;
    }
}

/* ── Image styling ── */
.bmp-popup-img {
    display: block;
    max-width: 100%;
    height: auto;
}

/* ── Links ── */
.bmp-popup-content a {
    display: block;
    text-decoration: none;
    transition: opacity 200ms;
}
.bmp-popup-content a:hover {
    opacity: 0.92;
}

/* ── HTML content styling — defaults only, inline styles take priority ── */
.bmp-popup-html h1, .bmp-popup-html h2, .bmp-popup-html h3 {
    margin-top: 0;
}
.bmp-popup-html p {
    line-height: 1.6;
}
.bmp-popup-html a {
    color: #2563eb;
    display: inline;
}

/* ── Entry animation for images ── */
.bmp-popup-pos-center .bmp-popup-img {
    animation: bmpImgReveal 600ms cubic-bezier(0.16, 1, 0.3, 1) 200ms both;
}
@keyframes bmpImgReveal {
    from { opacity: 0; transform: scale(1.02); }
    to { opacity: 1; transform: scale(1); }
}

/* ═══════════════════════════════════════
   POST CARD — Article type popup
   ═══════════════════════════════════════ */
.bmp-popup-post-card {
    overflow: hidden;
}

.bmp-popup-post-thumb {
    position: relative;
    overflow: hidden;
    max-height: 220px;
}
.bmp-popup-post-thumb img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    transition: transform 400ms ease;
}
.bmp-popup-post-card:hover .bmp-popup-post-thumb img {
    transform: scale(1.03);
}

.bmp-popup-post-body {
    padding: 24px 28px 28px;
}

.bmp-popup-post-card .bmp-popup-post-body,
.bmp-popup-post-full .bmp-popup-post-body {
    color: #111827;
}

.bmp-popup-post-title {
    margin: 0 0 10px;
    font-size: 20px;
    font-weight: 800;
    line-height: 1.3;
    color: #111827;
    letter-spacing: -0.02em;
}

.bmp-popup-post-excerpt {
    margin: 0 0 20px;
    font-size: 14px;
    line-height: 1.65;
    color: #6b7280;
}

.bmp-popup .bmp-popup-post-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #111827;
    color: #fff;
    padding: 11px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 200ms cubic-bezier(0.16, 1, 0.3, 1);
    border: none;
    outline: none;
    box-shadow: none;
    text-transform: none;
    letter-spacing: normal;
    line-height: 1.4;
    cursor: pointer;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.bmp-popup .bmp-popup-post-btn:hover {
    filter: brightness(1.15);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    text-decoration: none;
    color: #fff;
    border: none;
    outline: none;
}
.bmp-popup .bmp-popup-post-btn:focus {
    outline: none;
    box-shadow: none;
}

/* Side panels — post card adjusts */
.bmp-popup-pos-right .bmp-popup-post-thumb,
.bmp-popup-pos-left .bmp-popup-post-thumb {
    max-height: 180px;
}
.bmp-popup-pos-right .bmp-popup-post-body,
.bmp-popup-pos-left .bmp-popup-post-body {
    padding: 20px 24px 24px;
}
.bmp-popup-pos-right .bmp-popup-post-title,
.bmp-popup-pos-left .bmp-popup-post-title {
    font-size: 18px;
}

/* Bottom/Top bars — post card inline */
.bmp-popup-pos-bottom .bmp-popup-post-card,
.bmp-popup-pos-top .bmp-popup-post-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 50px 12px 12px;
}
.bmp-popup-pos-bottom .bmp-popup-post-thumb,
.bmp-popup-pos-top .bmp-popup-post-thumb {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    max-height: none;
    border-radius: 8px;
    overflow: hidden;
}
.bmp-popup-pos-bottom .bmp-popup-post-thumb img,
.bmp-popup-pos-top .bmp-popup-post-thumb img {
    width: 80px;
    height: 80px;
    object-fit: cover;
}
.bmp-popup-pos-bottom .bmp-popup-post-body,
.bmp-popup-pos-top .bmp-popup-post-body {
    padding: 0;
    flex: 1;
}
.bmp-popup-pos-bottom .bmp-popup-post-title,
.bmp-popup-pos-top .bmp-popup-post-title {
    font-size: 15px;
    margin-bottom: 4px;
}
.bmp-popup-pos-bottom .bmp-popup-post-excerpt,
.bmp-popup-pos-top .bmp-popup-post-excerpt {
    font-size: 12px;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.bmp-popup-pos-bottom .bmp-popup-post-btn,
.bmp-popup-pos-top .bmp-popup-post-btn {
    padding: 6px 14px;
    font-size: 12px;
}

@media (max-width: 768px) {
    .bmp-popup-post-body { padding: 20px; }
    .bmp-popup-post-title { font-size: 18px; }
    .bmp-popup-pos-bottom .bmp-popup-post-card,
    .bmp-popup-pos-top .bmp-popup-post-card {
        flex-direction: column;
        text-align: center;
    }
    .bmp-popup-pos-bottom .bmp-popup-post-thumb,
    .bmp-popup-pos-top .bmp-popup-post-thumb {
        width: 100%;
        height: 120px;
    }
    .bmp-popup-pos-bottom .bmp-popup-post-thumb img,
    .bmp-popup-pos-top .bmp-popup-post-thumb img {
        width: 100%;
        height: 120px;
    }
}

/* ── Close button color variants ── */
.bmp-popup .bmp-popup-close.bmp-close-light {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
}
.bmp-popup .bmp-popup-close.bmp-close-light:hover {
    background: rgba(255, 255, 255, 0.4);
}
.bmp-popup .bmp-popup-close.bmp-close-dark {
    background: rgba(0, 0, 0, 0.08);
    color: #374151;
    border-color: rgba(0, 0, 0, 0.1);
    text-shadow: none;
}
.bmp-popup .bmp-popup-close.bmp-close-dark:hover {
    background: rgba(0, 0, 0, 0.15);
    color: #111;
}

/* ── Full post content mode ── */
.bmp-popup-post-full .bmp-popup-post-body {
    padding: 28px 32px 32px;
}
.bmp-popup-post-full .bmp-popup-post-content {
    font-size: 15px;
    line-height: 1.8;
    color: #374151;
}
.bmp-popup-post-full .bmp-popup-post-content p {
    margin-bottom: 16px;
}
.bmp-popup-post-full .bmp-popup-post-content h2,
.bmp-popup-post-full .bmp-popup-post-content h3 {
    color: #111827;
    margin: 24px 0 12px;
}
.bmp-popup-post-full .bmp-popup-post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 16px 0;
}
.bmp-popup-post-full .bmp-popup-post-content a {
    color: #2563eb;
    display: inline;
}
.bmp-popup-post-full .bmp-popup-post-content ul,
.bmp-popup-post-full .bmp-popup-post-content ol {
    padding-left: 24px;
    margin-bottom: 16px;
}
.bmp-popup-post-full .bmp-popup-post-content blockquote {
    border-left: 4px solid #ffc45e;
    padding: 12px 20px;
    margin: 16px 0;
    background: #fffbeb;
    border-radius: 0 8px 8px 0;
}

/* Side panels — full content scrollable */
.bmp-popup-pos-right .bmp-popup-post-full .bmp-popup-post-body,
.bmp-popup-pos-left .bmp-popup-post-full .bmp-popup-post-body {
    padding: 24px;
    overflow-y: auto;
}
