/* 1. Base Overlay & Stage */
.d5-popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000000000;
}
.d5-popup-stage {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000000001;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
    /* Changed to allow background clicks */
    padding: 20px;
}
.d5-popup-stage.is-visible {
    display: flex !important;
}
/* 2. Modal Container Logic */
.d5-popup-container {
    display: none !important;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
    position: relative;
    pointer-events: auto;
    width: 100%;
    max-width: 512px;
    /* Fixing the scroll and footer visibility */
    min-height: fit-content;
    max-height: 90vh;
}
.d5-popup-container.d5-active-section {
    display: block !important;
}
.d5-popup-container.d5-active-section .et_pb_text_inner {
    display: flex;
    flex-direction: column;
}
.d5-popup-container.d5-active-section .et_pb_text_inner h1,
.d5-popup-container.d5-active-section .et_pb_text_inner h2,
.d5-popup-container.d5-active-section .et_pb_text_inner h3,
.d5-popup-container.d5-active-section .et_pb_text_inner h4,
.d5-popup-container.d5-active-section .et_pb_text_inner h5,
.d5-popup-container.d5-active-section .et_pb_text_inner p,
.d5-popup-container.d5-active-section .et_pb_text_inner ul {
    padding-top: 0;
    padding-bottom: 0;
    padding-left: 0;
    margin-bottom: 1rem;
}
/* 3. The Structural Wrapper */
.d5-popup-content-wrapper {
    display: flex;
    flex-direction: column;
    height: fit-content;
    /* Matches max-height of container */
    max-height: 90vh;
}
/* 4. Header */
.d5-modal-header {
    display: flex;
    flex-shrink: 0;
    /* Prevents header from squishing */
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}
.d5-modal-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #111827;
    padding-bottom: 0;
}
.d5-popup-close {
    font-size: 1.5rem;
    color: #9ca3af;
    cursor: pointer;
    line-height: 1;
}
/* 5. Body - The Scrollable Area */
.d5-modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    /* Content scrolls here */
    flex-grow: 1;
    /* Takes up remaining space between header/footer */
}
/* 6. Footer - Always Visible */
.d5-modal-footer {
    display: flex;
    flex-shrink: 0;
    /* Prevents footer from disappearing */
    align-items: center;
    padding: 1rem 1.5rem;
    border-top: 1px solid #e5e7eb;
    background-color: #f9fafb;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}
.d5-footer-close-btn {
    color: #374151;
    background-color: #ffffff;
    border: 1px solid #d1d5db;
    font-weight: 500;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    padding: 0.625rem 1.25rem;
    cursor: pointer;
}
/* 7. Body Lock */
body.d5-popup-active {
    overflow: hidden !important;
}