/* --- Trigger button (feel free to override in your theme CSS) ---
 * Colors, font size and radius come from the theme's CSS custom properties
 * (theme.json presets). If the theme does not define them, the fallback
 * values after the comma are used, so the button always has a default style. */
.spb-trigger-btn {
    cursor: pointer;
    display: inline-block; 
    transition: color 0.3s ease;
}

.spb-trigger-btn:hover {
    background-color: var(--wp--preset--color--primary, #005177);
    filter: brightness(0.85);
}
.sspb-wrapper-center{
    text-align: center;
}
.sspb-wrapper-left{
    text-align: left;
}
.sspb-wrapper-right{
    text-align: right;
}

/* --- Popup overlay and backdrop --- */
.spb-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.spb-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
}

/* --- Popup window and animation --- */
.spb-modal {
    position: relative;
    background-color: #ffffff;
    min-width: 400px; 
    max-width: 90vw;
    max-height: 85vh;
    overflow-y: auto;
    border-radius: 8px;
    padding: 15px 25px 25px 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    z-index: 1;
    transform: scale(0.85);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* When the popup is open */
.spb-overlay.is-open {
    visibility: visible;
    opacity: 1;
}

.spb-overlay.is-open .spb-modal {
    transform: scale(1);
}

/* Closing animation state */
.spb-overlay.is-closing {
    opacity: 0;
}

.spb-overlay.is-closing .spb-modal {
    transform: scale(0.85);
}

/* --- Close button (X) in the top-right corner ---
 * Fix: the button used to be position: fixed. Because .spb-modal has a
 * transform, the fixed element was positioned relative to the modal content
 * and scrolled out of view in long popups. The button is now sticky: it is the
 * first child of the .spb-modal scroll container and always stays in its
 * top-right corner. The negative margin-bottom removes the space the button
 * would reserve, so the content starts at the same height as before. */
.spb-close-btn {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 2;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    font-size: 28px;
    line-height: 1;
    color: #444;
    cursor: pointer;
    padding: 0;
    margin: -5px -10px -27px auto; /* pushed to the right edge, takes no space from the content */
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s, color 0.2s;
}

.spb-close-btn:hover {
    color: #000;
    background-color: rgba(235, 235, 235, 0.95);
}

/* Make sure the first line of content is not hidden under the X button */
.spb-content {
    padding-right: 30px;
}
.spb-content > :first-child {
    margin-top: 0;
}

/* --- Content area --- */
.spb-content {
    color: #333;
    line-height: 1.6;
}

/* --- Preset trigger button variants ---
 * Selectable on the settings page / block style dropdown. Compound selectors
 * (.spb-trigger-btn.spb-btn-*) beat the base button rule and theme overrides
 * regardless of load order. filter: none cancels the base hover brightness. */

/* Variant: transparent background, white border and text (for dark backgrounds) */

.spb-trigger-btn.spb-btn-dark-bg {
    background-color: transparent;
    border: 3px solid #ffffff;
    color: #ffffff;
}
.spb-trigger-btn.spb-btn-dark-bg:hover {
    background-color: rgba(255, 255, 255, 0.15);
    filter: none;
}

/* Variant: black background, white text */
.spb-trigger-btn.spb-btn-black {
    background-color: #000000;
    color: #ffffff;
    border: none;
}
.spb-trigger-btn.spb-btn-black:hover {
    background-color: #222222;
    filter: none;
}

/* Variant: white background, black text */
.spb-trigger-btn.spb-btn-white {
    background-color: #ffffff;
    color: #000000;
    border: 2px solid #000000;
}
.spb-trigger-btn.spb-btn-white:hover {
    background-color: #000000;
    color: white;
    filter: none;
}
.spb-btn-blck-borders{
    background-color: transparent;
    border: 3px solid black;
    color: black;
}
.spb-btn-blck-borders:hover{
    background-color: black;
    border: 3px solid white;
    color: white;
}