/* ============================================
   PP Popup Framework - Auto-fit Content Size (Fixed)
   Version: 2.2 - Mobile visibility fix
   ============================================ */

/* ==========================================
   BASE STRUCTURE
   ========================================== */

/* ----- Main popup container ----- */
.pp-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.pp-popup-hidden {
    display: none !important;
}

/* ----- Overlay backdrop ----- */
.pp-popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.pp-popup:not(.pp-popup-hidden) .pp-popup-overlay {
    opacity: 1;
}

/* ----- Popup container (auto-size to content) ----- */
.pp-popup-container {
    position: relative;
    width: auto;
    min-width: 320px;
    max-width: min(1050px, calc(100vw - 40px));
    height: auto;
    max-height: calc(100vh - 40px);
    z-index: 1;
    transform: scale(0.8);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    will-change: transform;
    /* Ensure container stays within viewport */
    margin: auto;
}

.pp-popup:not(.pp-popup-hidden) .pp-popup-container {
    transform: scale(1);
    opacity: 1;
}

/* ----- Dialog box ----- */
.pp-popup-dialog {
    position: relative;
    background: #fff;
    border-radius: 8px;
    width: 100%;
    height: auto;
    overflow: hidden;
    isolation: isolate;
    transform: translateZ(0);
    box-shadow: 0 0 25px 0 #BBC1CC;
    backdrop-filter: blur(12.5px);
}

/* ----- Close button ----- */
.pp-popup-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.pp-popup-close:hover {
    transform: scale(1.1);
}

.pp-popup-close:active {
    transform: scale(0.95);
}

.pp-popup-close svg {
    width: 20px;
    height: 20px;
    color: #333;
}

/* ----- Content area ----- */
.pp-popup-content {
    position: relative;
    height: auto;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0;
    z-index: 1;
    display: block;
}

/* ==========================================
   PPQUOTE FORM AUTO-SIZING
   ========================================== */

.pp-popup-content section[class*="pp"],
.pp-popup-content .floatLayer,
.pp-popup-content .sectionContainer,
.pp-popup-content .contentGroup,
.pp-popup-content .formContent,
.pp-popup-content form {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    transform: none !important;
    z-index: auto !important;
}

.pp-popup-content section[class*="pp"] {
    margin: 0;
    padding: 0;
    display: block;
}

.pp-popup-content input,
.pp-popup-content select,
.pp-popup-content textarea {
    position: relative !important;
    width: 100% !important;
    box-sizing: border-box;
}

/* ==========================================
   SCROLLBAR STYLING
   ========================================== */

.pp-popup-content {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.3) transparent;
    scroll-behavior: smooth;
}

.pp-popup-content::-webkit-scrollbar {
    width: 8px;
}

.pp-popup-content::-webkit-scrollbar-track {
    background: transparent;
}

.pp-popup-content::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.pp-popup-content::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.5);
}

/* ==========================================
   PREVENT BODY SCROLL
   ========================================== */

body.pp-modal-active {
    overflow: hidden;
}

/* ==========================================
   SIZE VARIANTS
   ========================================== */
/* 
.pp-popup[data-width="small"] .pp-popup-container {
    max-width: min(600px, calc(100vw - 40px));
}

.pp-popup[data-width="medium"] .pp-popup-container {
    max-width: min(800px, calc(100vw - 40px));
}

.pp-popup[data-width="large"] .pp-popup-container {
    max-width: min(1050px, calc(100vw - 40px));
}

.pp-popup[data-width="xlarge"] .pp-popup-container {
    max-width: min(1200px, calc(100vw - 40px));
}

.pp-popup[data-width="full"] .pp-popup-container {
    width: calc(100vw - 40px);
    max-width: none;
}

.pp-popup[data-width="auto"] .pp-popup-container {
    width: auto;
    min-width: 320px;
    max-width: calc(100vw - 40px);
} */

/* ==========================================
   POSITION VARIANTS
   ========================================== */

.pp-popup[data-position="top"] {
    align-items: flex-start;
    padding-top: 40px;
}

.pp-popup[data-position="bottom"] {
    align-items: flex-end;
    padding-bottom: 40px;
}

.pp-popup[data-position="center"] {
    align-items: center;
}

/* ==========================================
   ANIMATIONS
   ========================================== */

.pp-popup.pp-closing .pp-popup-overlay {
    opacity: 0;
}

.pp-popup.pp-closing .pp-popup-container {
    transform: scale(0.8);
    opacity: 0;
}

@keyframes pp-fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes pp-scaleUp {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes pp-slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes pp-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==========================================
   LOADING STATE
   ========================================== */

.pp-popup-loading .pp-popup-content {
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pp-popup-loading .pp-popup-content::before {
    content: '';
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: pp-spin 1s linear infinite;
}

/* ==========================================
   RESPONSIVE DESIGN
   ========================================== */

/* Large tablets and small desktops (992px - 1199px) */
@media (max-width: 1199px) {
    .pp-popup-container {
        max-width: calc(100vw - 40px);
    }
}

/* Tablets landscape (768px - 991px) */
@media (max-width: 991px) {
    .pp-popup {
        padding: 15px;
    }
    
    .pp-popup-container {
        max-width: calc(100vw - 30px);
        max-height: calc(100vh - 30px);
    }
    
    .pp-popup-content {
        max-height: calc(100vh - 30px);
    }
    
    .pp-popup-content section[class*="pp"] .floatLayer {
        padding: 30px;
    }
}

/* Tablets portrait (576px - 767px) */
@media (max-width: 767px) {
    .pp-popup {
        padding: 10px;
    }
    
    .pp-popup-container {
        min-width: 280px;
        max-width: calc(100vw - 20px);
        max-height: calc(100vh - 20px);
    }
    
    .pp-popup-content {
        max-height: calc(100vh - 20px);
    }
    
    .pp-popup-close {
        top: 5px;
        right: 5px;
        width: 36px;
        height: 36px;
    }
    
    .pp-popup-close svg {
        width: 18px;
        height: 18px;
    }
    
    .pp-popup-content section[class*="pp"] .floatLayer {
        padding: 25px;
    }
}

/* Mobile devices (320px - 575px) */
@media (max-width: 575px) {
    /* Remove padding to allow full width */
    .pp-popup {
        padding: 0;
        align-items: stretch;
    }
    
    /* Full width and height on mobile */
    .pp-popup-container {
        width: 100%;
        min-width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100vh;
        /* Remove scaling animation on mobile for better performance */
        transform: scale(1);
    }
    
    .pp-popup:not(.pp-popup-hidden) .pp-popup-container {
        transform: scale(1);
    }
    
    /* Remove border radius on mobile */
    .pp-popup-dialog {
        border-radius: 0;
        display: flex;
        flex-direction: column;
    }
    
    /* Make content fill available space */
    .pp-popup-content {
        flex: 1;
        max-height: 100vh;
        height: 100%;
    }
    
    .pp-popup-close {
        top: 10px;
        right: 10px;
        width: 36px;
        height: 36px;
        /* Ensure close button is always visible */
        background: rgba(255, 255, 255, 0.98);
    }
    
    .pp-popup-content section[class*="pp"] .floatLayer {
        padding: 20px;
        min-height: 100%;
    }
}

/* Extra small mobile (max 375px) */
@media (max-width: 375px) {
    .pp-popup-content section[class*="pp"] .floatLayer {
        padding: 15px;
    }
    
    .pp-popup-close {
        top: 8px;
        right: 8px;
        width: 32px;
        height: 32px;
    }
    
    .pp-popup-close svg {
        width: 16px;
        height: 16px;
    }
}

/* Very small screens (max 320px) */
@media (max-width: 320px) {
    .pp-popup-content section[class*="pp"] .floatLayer {
        padding: 12px;
    }
}

/* ==========================================
   LANDSCAPE ORIENTATION (Mobile)
   ========================================== */

@media (max-width: 767px) and (orientation: landscape) {
    .pp-popup {
        padding: 10px;
    }
    
    .pp-popup-container {
        max-height: 95vh;
    }
    
    .pp-popup-content {
        max-height: 95vh;
    }
}

@media (max-width: 575px) and (orientation: landscape) {
    .pp-popup {
        padding: 5px;
    }
    
    .pp-popup-container {
        width: calc(100vw - 10px);
        max-width: calc(100vw - 10px);
        height: auto;
        max-height: calc(100vh - 10px);
    }
    
    .pp-popup-dialog {
        border-radius: 4px;
        height: auto;
    }
    
    .pp-popup-content {
        max-height: calc(100vh - 10px);
    }
    
    .pp-popup-content section[class*="pp"] .floatLayer {
        padding: 15px;
    }
}

/* ==========================================
   ACCESSIBILITY
   ========================================== */

.pp-popup-close:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

.pp-popup-close:focus:not(:focus-visible) {
    outline: none;
}

.pp-popup[aria-hidden="true"] {
    display: none;
}

/* Ensure touch targets are at least 44x44px */
@media (pointer: coarse) {
    .pp-popup-close {
        min-width: 44px;
        min-height: 44px;
    }
}

/* ==========================================
   REDUCED MOTION
   ========================================== */

@media (prefers-reduced-motion: reduce) {
    .pp-popup-overlay,
    .pp-popup-container,
    .pp-popup-close {
        transition: none;
    }
    
    .pp-popup-content {
        scroll-behavior: auto;
    }
    
    /* Remove scale animation */
    .pp-popup-container {
        transform: scale(1);
    }
    
    .pp-popup.pp-closing .pp-popup-container {
        transform: scale(1);
    }
}

/* ==========================================
   PRINT STYLES
   ========================================== */

@media print {
    .pp-popup {
        display: none;
    }
}

/* ==========================================
   HIGH CONTRAST MODE
   ========================================== */

@media (prefers-contrast: high) {
    .pp-popup-overlay {
        background: rgba(0, 0, 0, 0.9);
    }
    
    .pp-popup-close {
        background: #fff;
        border: 2px solid #000;
    }
    
    .pp-popup-dialog {
        border: 2px solid #000;
    }
}

/* ==========================================
   UTILITY CLASSES
   ========================================== */

.pp-popup-invisible {
    visibility: hidden;
    pointer-events: none;
}

.pp-popup-disabled {
    pointer-events: none;
    opacity: 0.6;
}

.pp-popup-force-modal .pp-popup-overlay {
    pointer-events: all;
}

.pp-popup-no-animation .pp-popup-container,
.pp-popup-no-animation .pp-popup-overlay {
    transition: none;
}

/* Force show (for debugging) */
.pp-popup-force-show {
    display: flex !important;
}

.pp-popup-force-show .pp-popup-container {
    transform: scale(1) !important;
    opacity: 1 !important;
}

.pp-popup-force-show .pp-popup-overlay {
    opacity: 1 !important;
}

/* ==========================================
   LEGACY TEMPLATE COMPATIBILITY
   ppPDPInsurerPageBannerForm - Insurer Page Banner Form
   ========================================== */

/* Override framework styles for this specific template */
.pp-popup[data-template="ppPDPInsurerPageBannerForm"] .pp-popup-container {
    max-width: 574px;
}

/* Restore original floatLayer styling */
.pp-popup-content .ppPDPInsurerPageBannerForm .floatLayer {
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 0 25px 0 #BBC1CC;
    backdrop-filter: blur(12.5px);
}

/* Restore original container padding */
.pp-popup-content .ppPDPInsurerPageBannerForm .container {
    padding: 35px 35px 12px;
    background-color: transparent;
}

@media screen and (max-width: 479px) {
    .pp-popup-content .ppPDPInsurerPageBannerForm .container {
        padding: 25px 25px 12px;
    }
}

/* Icon/Image styling */
.pp-popup-content .ppPDPInsurerPageBannerForm .icon {
    width: 100%;
    height: auto;
    border-radius: 8px;
}

/* Title styling */
.pp-popup-content .ppPDPInsurerPageBannerForm .titleGroup {
    margin: 2em 0 1em 0;
    padding: 0;
    text-align: left;
}

@media screen and (max-width: 479px) {
    .pp-popup-content .ppPDPInsurerPageBannerForm .titleGroup .title,
    .pp-popup-content .ppPDPInsurerPageBannerForm h2.popup-title {
        font-size: 28px;
    }
}

.pp-popup-content .ppPDPInsurerPageBannerForm h2 {
    font-size: 14px;
    line-height: 20px;
    letter-spacing: -0.8px;
    font-weight: 600;
    color: #19759C;
}

.pp-popup-content .ppPDPInsurerPageBannerForm h2 strong {
    font-size: 20px;
    line-height: 20px;
    color: #19709C;
}

/* Content Group */
.pp-popup-content .ppPDPInsurerPageBannerForm .contentGroup {
    margin: 0;
    padding: 0;
    font-size: 16px;
}

/* Form Field Rows */
.pp-popup-content .ppPDPInsurerPageBannerForm form .fieldRow {
    display: flex !important;
    flex-direction: row;
    padding: 4px 0 0 0;
    width: 100% !important;
}

@media screen and (max-width: 479px) {
    .pp-popup-content .ppPDPInsurerPageBannerForm form .fieldRow {
        flex-direction: column !important;
    }
    
    .pp-popup-content .ppPDPInsurerPageBannerForm form .fieldRow.mpt0 {
        padding-top: 0;
    }
}

/* Labels */
.pp-popup-content .ppPDPInsurerPageBannerForm form .fieldRow label {
    color: #333;
    font-size: 14px;
    user-select: none;
}

.pp-popup-content .ppPDPInsurerPageBannerForm form .fieldRow .labelText {
    display: flex !important;
    align-items: center;
    width: 36% !important;
}

@media screen and (max-width: 479px) {
    .pp-popup-content .ppPDPInsurerPageBannerForm form .fieldRow .labelText {
        display: none !important;
    }
}

/* Input Fields */
.pp-popup-content .ppPDPInsurerPageBannerForm form .fieldRow .inputField {
    width: 64% !important;
}

.pp-popup-content .ppPDPInsurerPageBannerForm form .fieldRow .inputField.fullWidth {
    width: 100% !important;
}

@media screen and (max-width: 479px) {
    .pp-popup-content .ppPDPInsurerPageBannerForm form .fieldRow .inputField {
        width: 100% !important;
    }
}

.pp-popup-content .ppPDPInsurerPageBannerForm form .fieldRow .inputField input,
.pp-popup-content .ppPDPInsurerPageBannerForm form .fieldRow .inputField select,
.pp-popup-content .ppPDPInsurerPageBannerForm form .fieldRow .inputField textarea {
    width: 100% !important;
}

/* Form Controls Styling */
.pp-popup-content .ppPDPInsurerPageBannerForm form input,
.pp-popup-content .ppPDPInsurerPageBannerForm form select,
.pp-popup-content .ppPDPInsurerPageBannerForm form textarea {
    padding: 12px 20px !important;
    border: 1px solid #E8E8E8 !important;
    border-radius: 10px !important;
    background: #FFF !important;
    box-shadow: 0 1px 1px 0 rgba(207, 223, 231, 0.7) !important;
    font-size: 16px;
    color: #333;
    width: 100% !important;
    box-sizing: border-box;
}

.pp-popup-content .ppPDPInsurerPageBannerForm form input[type="checkbox"] {
    width: auto !important;
    box-shadow: none !important;
}

.pp-popup-content .ppPDPInsurerPageBannerForm form textarea {
    height: 60px;
}

/* Field Columns */
.pp-popup-content .ppPDPInsurerPageBannerForm form .fieldRow .fieldCol {
    display: flex;
    flex-direction: row;
    gap: 0.5rem;
    margin-top: 0.2rem;
}

.pp-popup-content .ppPDPInsurerPageBannerForm form .fieldRow .fieldCol input,
.pp-popup-content .ppPDPInsurerPageBannerForm form .fieldRow .fieldCol select {
    flex-basis: content;
    flex-shrink: 0;
}

/* Button Styling */
.pp-popup-content .ppPDPInsurerPageBannerForm form .fieldRow.buttonSide {
    flex-direction: column;
    align-items: center;
}

.pp-popup-content .ppPDPInsurerPageBannerForm form .fieldRow.buttonSide .butFrame {
    padding-top: 10px;
    width: 55% !important;
}

@media screen and (max-width: 479px) {
    .pp-popup-content .ppPDPInsurerPageBannerForm form .fieldRow.buttonSide .butFrame {
        width: 100% !important;
    }
}

.pp-popup-content .ppPDPInsurerPageBannerForm form .butFrame button {
    width: 100% !important;
    border: 0;
    border-radius: 10px;
    background: linear-gradient(90deg, #F1B93E 0.04%, #F27622 99.93%);
    box-shadow: 0 2px 4px 0 rgba(177, 106, 0, 0.7);
    height: 40px;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
}

@media screen and (max-width: 479px) {
    .pp-popup-content .ppPDPInsurerPageBannerForm form .butFrame button {
        height: 50px;
    }
}

.pp-popup-content .ppPDPInsurerPageBannerForm form .butFrame button:hover {
    opacity: 0.9;
}

.pp-popup-content .ppPDPInsurerPageBannerForm form .butFrame button span {
    vertical-align: top;
    width: 90%;
    display: inline-block;
}

/* Required Reminder */
.pp-popup-content .ppPDPInsurerPageBannerForm form .required-remind {
    font-size: 12px;
    text-align: left;
    color: #CCC;
    margin-top: 12px;
}

/* Error Message */
.pp-popup-content .ppPDPInsurerPageBannerForm form .errMsg {
    text-align: center;
    color: red;
    padding-top: 20px;
}

/* Success Message */
.pp-popup-content .ppPDPInsurerPageBannerForm .descLower {
    display: none;
    text-align: center;
    font-size: 28px;
    padding: 2rem 0;
}

.pp-popup-content .ppPDPInsurerPageBannerForm .descLower.active {
    display: block;
}

.pp-popup-content .ppPDPInsurerPageBannerForm .descLower h2 {
    font-size: 22px;
    color: #0079C5;
    font-weight: 600;
    line-height: 30px;
}

.pp-popup-content .ppPDPInsurerPageBannerForm .descLower p {
    margin: 5px 0;
    font-size: 14px;
    color: #333;
}

/* Cover Images */
.pp-popup-content .ppPDPInsurerPageBannerForm .cover-image {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.pp-popup-content .ppPDPInsurerPageBannerForm .cover-image > img {
    width: 100%;
    height: auto;
}

/* Plan Container (Form 1 specific) */
.pp-popup-content .ppPDPInsurerPageBannerForm form.formBlk1 .plan-container,
.pp-popup-content .ppPDPInsurerPageBannerForm form.formBlk1 .plan-continer {
    width: 100%;
}

/* Form 2 specific styles */
.pp-popup-content .ppPDPInsurerPageBannerForm form.formBlk2 .fieldRow.covers {
    margin-left: 36%;
}

@media screen and (max-width: 479px) {
    .pp-popup-content .ppPDPInsurerPageBannerForm form.formBlk2 .fieldRow.covers {
        margin-left: 0;
    }
    
    .pp-popup-content .ppPDPInsurerPageBannerForm form.formBlk2 .fieldRow .labelText {
        display: block !important;
        width: 100% !important;
        margin: 0.2rem 0;
    }
}

.pp-popup-content .ppPDPInsurerPageBannerForm form.formBlk2 .fieldRow .fieldCol {
    width: 50%;
}

@media screen and (max-width: 479px) {
    .pp-popup-content .ppPDPInsurerPageBannerForm form.formBlk2 .fieldRow .fieldCol {
        width: auto;
    }
}

/* Hidden field container */
.pp-popup-content .ppPDPInsurerPageBannerForm .hidden-field {
    display: none;
}

/* Ensure forms are visible by default */
.pp-popup-content .ppPDPInsurerPageBannerForm form.formBlk1 {
    display: block;
}

.pp-popup-content .ppPDPInsurerPageBannerForm form.formBlk2 {
    display: none;
}

.pp-popup-content .ppPDPInsurerPageBannerForm form.formBlk2.active {
    display: block;
}

/* Mobile optimizations */
@media screen and (max-width: 575px) {
    .pp-popup-content .ppPDPInsurerPageBannerForm .floatLayer {
        border-radius: 0;
    }
}

.ppPDPInsurerPageBannerForm .floatLayer .container .contentGroup {
    margin: 0;
    padding: 0;
    font-size: 16px;
}

.ppPDPInsurerPageBannerForm .floatLayer .container .contentGroup h2 {
    font-size: 14px;
    line-height: 20px;
    letter-spacing: -.8px;
    font-weight: 600;
    color: #19759C;
}

.ppPDPInsurerPageBannerForm {
    font-family: Segoe UI;
}


/* ==========================================
   Popup scroll fix
   ========================================== */

/* 1. The popup container itself is fixed and does not scroll */
.pp-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden; /* ✅ the popup itself does not scroll */
}

/* 2. Popup overlay covers the entire screen and prevents background scrolling */
.pp-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1;
}

/* 3. Popup container is centered */
.pp-popup-container {
    position: relative;
    z-index: 2;
    /* width: 90%; */
    /* max-width: 600px; */
    max-height: 90vh; /* ✅ limit the maximum height */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 4. Popup dialog is the actual content container */
.pp-popup-dialog {
    position: relative;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-height: 90vh; /* ✅ limit the maximum height */
    display: flex;
    flex-direction: column;
    overflow: hidden; /* ✅ the dialog itself does not scroll */
}

/* 5. Close button is fixed at the top */
.pp-popup-close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: #666;
    transition: color 0.2s;
}

.pp-popup-close:hover {
    color: #000;
}

/* 6. Popup content is scrollable */
.pp-popup-content {
    flex: 1;
    overflow-y: auto; /* ✅ only the content area can scroll */
    overflow-x: hidden;
    max-height: calc(90vh - 20px); /* ✅ ensure scrollbar appears */
}

/* 7. Style the scrollbar */
.pp-popup-content::-webkit-scrollbar {
    width: 8px;
}

.pp-popup-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.pp-popup-content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.pp-popup-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* 8. Prevent body scrolling */
body.pp-modal-active {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
}

/* 9. z-index for Select2 dropdown (ensure it appears above the popup) */
.select2-container {
    z-index: 10000 !important;
}

.select2-dropdown {
    z-index: 10001 !important;
}

/* 10. Responsive adjustments */
@media (max-width: 768px) {
    .pp-popup-container {
        width: 95%;
        max-height: 95vh;
    }
}

/* ==========================================
   MOBILE SCROLL FIX
   Problem: An inline <style> tag inside the DOM sets
   overflow: visible !important on .pp-popup-dialog and .pp-popup-content.
   Solution: Use a higher specificity selector to override it.
   ========================================== */

/* Higher specificity (.pp-popup .pp-popup-dialog) beats (.pp-popup-dialog)
   When both use !important, the higher specificity wins. */
.pp-popup .pp-popup-dialog {
    overflow: hidden !important;
}

.pp-popup .pp-popup-content {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
}

/* ==========================================
   MOBILE SPECIFIC LAYOUT FIX (≤575px)
   ========================================== */
@media (max-width: 575px) {

    /* Reset to centered modal instead of full-screen stretch */
    .pp-popup {
        padding: 16px 12px !important;
        align-items: center !important;
    }

    /* Constrain container height */
    .pp-popup-container {
        width: 100% !important;
        min-width: unset !important;
        max-width: calc(100vw - 24px) !important;
        height: auto !important;
        max-height: 92vh !important;
        display: flex !important;
        flex-direction: column !important;
        transform: scale(1) !important;
    }

    /* Dialog: limited height + flex column layout */
    .pp-popup .pp-popup-dialog {
        border-radius: 12px !important;
        height: auto !important;
        max-height: 92vh !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
    }

    /* Content area: flex grow + scrollable */
    .pp-popup .pp-popup-content {
        flex: 1 1 auto !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        max-height: none !important;
        height: auto !important;
    }

    /* Ensure close button stays on top of scrollable content */
    .pp-popup-close {
        position: sticky !important;
        top: 10px !important;
        float: right !important;
        z-index: 100 !important;
        margin: 10px 10px -46px auto !important;
        background: rgba(255, 255, 255, 0.95) !important;
        border-radius: 50% !important;
    }
}

/* ==========================================
   MOBILE LANDSCAPE FIX (≤575px landscape)
   ========================================== */
@media (max-width: 575px) and (orientation: landscape) {
    .pp-popup {
        padding: 8px !important;
        align-items: center !important;
    }

    .pp-popup-container {
        max-height: 90vh !important;
    }

    .pp-popup .pp-popup-dialog {
        max-height: 90vh !important;
        border-radius: 8px !important;
        height: auto !important;
    }
}

:root :where(.is-layout-flow) > * {
    margin-block-start: 0px;
}