:root {
    --bpccs-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    --bpccs-overlay-default: rgba(15, 23, 42, 0.7);
    --bpccs-transition: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 1. Modal Overlay Base */
.bpccs-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bpccs-overlay-default);
    display: flex;
    z-index: 999999;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--bpccs-transition);
    font-family: var(--bpccs-font);
    box-sizing: border-box;
}

.bpccs-popup-overlay * {
    box-sizing: border-box;
}

.bpccs-popup-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* 2. Position Classes */
.bpccs-pos-center {
    align-items: center;
    justify-content: center;
}

.bpccs-pos-top-left {
    align-items: flex-start;
    justify-content: flex-start;
    padding: 30px;
}

.bpccs-pos-top-center {
    align-items: flex-start;
    justify-content: center;
    padding: 30px;
}

.bpccs-pos-top-right {
    align-items: flex-start;
    justify-content: flex-end;
    padding: 30px;
}

.bpccs-pos-bottom-left {
    align-items: flex-end;
    justify-content: flex-start;
    padding: 30px;
}

.bpccs-pos-bottom-center {
    align-items: flex-end;
    justify-content: center;
    padding: 30px;
}

.bpccs-pos-bottom-right {
    align-items: flex-end;
    justify-content: flex-end;
    padding: 30px;
}

/* 3. Modal Container Box */
.bpccs-popup-container {
    background-color: #ffffff;
    width: 90%;
    max-width: var(--bpccs-width, 700px);
    height: var(--bpccs-height, auto);
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    display: grid;
    grid-template-columns: 1fr;
    overflow: hidden;
    position: relative;
    opacity: 0;
    transition: transform var(--bpccs-transition), opacity var(--bpccs-transition);
}

/* Split Image Layout Column Grid */
.bpccs-popup-container.has-image {
    grid-template-columns: 1fr 1.2fr;
}

/* 4. Animations Triggered by .active Overlay */
/* Zoom/Scale (Default) */
.bpccs-anim-scale .bpccs-popup-container {
    transform: scale(0.92);
}
.bpccs-popup-overlay.active.bpccs-anim-scale .bpccs-popup-container {
    transform: scale(1);
    opacity: 1;
}

/* Slide Up */
.bpccs-anim-slide-up .bpccs-popup-container {
    transform: translateY(60px);
}
.bpccs-popup-overlay.active.bpccs-anim-slide-up .bpccs-popup-container {
    transform: translateY(0);
    opacity: 1;
}

/* Slide Down */
.bpccs-anim-slide-down .bpccs-popup-container {
    transform: translateY(-60px);
}
.bpccs-popup-overlay.active.bpccs-anim-slide-down .bpccs-popup-container {
    transform: translateY(0);
    opacity: 1;
}

/* Fade Only */
.bpccs-anim-fade .bpccs-popup-container {
    transform: none;
}
.bpccs-popup-overlay.active.bpccs-anim-fade .bpccs-popup-container {
    opacity: 1;
}

/* 5. Left Image Panel */
.bpccs-popup-left {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 30px;
    color: #ffffff;
    min-height: 250px;
}

.bpccs-popup-left::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.7) 100%);
    z-index: 1;
}

.bpccs-popup-left-content {
    position: relative;
    z-index: 2;
}

.bpccs-popup-left-title {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0 0 8px 0;
    line-height: 1.2;
    color: #ffffff;
}

.bpccs-popup-left-desc {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.85);
    margin: 0;
    line-height: 1.4;
}

/* 6. Right Content Panel */
.bpccs-popup-right {
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow-y: auto;
    max-height: 90vh;
}

/* Enforce basic formatting inside custom content */
.bpccs-popup-content-inner p {
    margin-top: 0;
    margin-bottom: 16px;
    line-height: 1.6;
}

.bpccs-popup-content-inner h1, 
.bpccs-popup-content-inner h2, 
.bpccs-popup-content-inner h3 {
    margin-top: 0;
    margin-bottom: 12px;
    font-weight: 700;
    line-height: 1.25;
}

/* 7. Close Button Overlay Style */
.bpccs-popup-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 99;
}

.bpccs-popup-close-btn:hover {
    transform: rotate(90deg);
}

.bpccs-popup-close-btn svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* 8. Theme Customizations */

/* LIGHT THEME */
.bpccs-theme-light .bpccs-popup-container {
    background-color: #ffffff;
    color: #1e293b;
    border: 1px solid #e2e8f0;
}
.bpccs-theme-light .bpccs-popup-close-btn {
    color: #64748b;
    background-color: #f1f5f9;
}
.bpccs-theme-light .bpccs-popup-close-btn:hover {
    color: #0f172a;
    background-color: #e2e8f0;
}

/* DARK THEME */
.bpccs-theme-dark .bpccs-popup-container {
    background-color: #0f172a;
    color: #f8fafc;
    border: 1px solid #334155;
}
.bpccs-theme-dark .bpccs-popup-close-btn {
    color: #94a3b8;
    background-color: #1e293b;
}
.bpccs-theme-dark .bpccs-popup-close-btn:hover {
    color: #ffffff;
    background-color: #334155;
}

/* GLASS THEME */
.bpccs-popup-overlay.bpccs-theme-glass {
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
}
.bpccs-theme-glass .bpccs-popup-container {
    background: rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    color: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}
.bpccs-theme-glass .bpccs-popup-close-btn {
    color: #334155;
    background-color: rgba(255, 255, 255, 0.6);
}
.bpccs-theme-glass .bpccs-popup-close-btn:hover {
    color: #000000;
    background-color: rgba(255, 255, 255, 0.9);
}

/* NEON THEME */
.bpccs-theme-neon .bpccs-popup-container {
    background-color: #020617;
    color: #e2e8f0;
    border: 2px solid transparent;
    background-image: linear-gradient(#020617, #020617), linear-gradient(135deg, #a855f7 0%, #6366f1 50%, #06b6d4 100%);
    background-origin: border-box;
    background-clip: padding-box, border-box;
    box-shadow: 0 0 30px rgba(99, 102, 241, 0.25);
}
.bpccs-theme-neon .bpccs-popup-close-btn {
    color: #a855f7;
    background-color: rgba(168, 85, 247, 0.1);
}
.bpccs-theme-neon .bpccs-popup-close-btn:hover {
    color: #ffffff;
    background-color: #a855f7;
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.5);
}

/* 9. Trigger Button Custom Styling */
.bpccs-popup-trigger-btn {
    display: inline-block;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    color: #ffffff;
    background-color: #6366f1;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.15);
}

.bpccs-popup-trigger-btn:hover {
    background-color: #4f46e5;
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(99, 102, 241, 0.25);
}

/* 10. Helper Classes */
body.bpccs-popup-open {
    overflow: hidden;
}

.bpccs-mobile-hide {
    display: none !important;
}

/* 11. Media Queries (Responsive Mobile Stacking) */
@media (max-width: 768px) {
    /* Overlay positioning behaves simpler on mobile */
    .bpccs-popup-overlay {
        align-items: center !important;
        justify-content: center !important;
        padding: 15px !important;
    }

    .bpccs-popup-container {
        grid-template-columns: 1fr !important;
        width: 100% !important;
        max-width: 450px !important;
        height: auto !important;
    }
    
    .bpccs-popup-left {
        height: 160px;
        min-height: auto;
        padding: 20px;
        justify-content: center;
    }
    
    .bpccs-popup-left-title {
        font-size: 1.3rem;
    }
    
    .bpccs-popup-left-desc {
        font-size: 0.8rem;
    }
    
    .bpccs-popup-right {
        padding: 30px 20px;
    }
    
    /* Ensure the close button is visible and high contrast on mobile top-bar */
    .bpccs-popup-close-btn {
        top: 10px;
        right: 10px;
        background-color: rgba(255, 255, 255, 0.95) !important;
        color: #0f172a !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    }
    
    /* Hide popup entirely if mobile_hide attribute is active on body classes */
    body.bpccs-hide-popups-on-mobile .bpccs-popup-overlay {
        display: none !important;
    }
}
