.custom-popup {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    overflow: auto; /* Allow scroll within popup if content is too long */
    place-items: center;
}

/* When popup is shown, block body scroll */
body.popup-open {
    overflow: hidden;
}

.popup-content {
    background-color: #fefefe;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 600px;
    position: relative;
    border-radius: 5px;
    display: flex;
    flex-direction: column;
    min-height: 200px;
}

.popup-body {
    margin-top: 20px;
    line-height: 1.6;
    white-space: normal;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    flex-grow: 1;
}

/* Remove the problematic style and add proper text alignment */
.popup-body p[style*="text-align: center"] {
    text-align: center !important;
}

.popup-body p[style*="text-align: right"] {
    text-align: right !important;
}

.popup-body p[style*="text-align: left"] {
    text-align: left !important;
}

/* Add OK button styles */
.popup-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.popup-ok-button {
    background: #e70046;
    color: white;
    border: none;
    padding: 10px 30px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    text-transform: uppercase;
    transition: all 0.2s ease;
}

.popup-ok-button:hover {
    background: #c9003c;
}

/* Text alignment classes that TinyMCE might add */
.popup-body .text-center,
.popup-body [style*="text-align: center"] {
    text-align: center !important;
}

.popup-body .text-right,
.popup-body [style*="text-align: right"] {
    text-align: right !important;
}

.popup-body .text-left,
.popup-body [style*="text-align: left"] {
    text-align: left !important;
}

/* Bold text */
.popup-body b,
.popup-body strong {
    font-weight: 700;
}

/* Links styling */
.popup-body a {
    color: #e70046;
    text-decoration: underline;
    transition: all 0.2s ease;
}


.popup-body a:hover {
    color: #c9003c;
    text-decoration: none;
}

/* Preserve other common text formatting */
.popup-body em,
.popup-body i {
    font-style: italic;
}

.popup-body u {
    text-decoration: underline;
}

/* Lists */
.popup-body ul, 
.popup-body ol {
    margin-left: 20px;
    margin-bottom: 1em;
    padding-left: 15px;
}

.popup-body ul li,
.popup-body ol li {
    margin-bottom: 0.5em;
}

/* Headers */
.popup-body h1, 
.popup-body h2, 
.popup-body h3, 
.popup-body h4 {
    margin-bottom: 0.5em;
    font-weight: 600;
}

/* Paragraphs */
.popup-body p {
    margin: 0 0 1em 0;
    padding: 0;
    display: block;
}
.popup-body img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}


@media (max-width: 768px) {
    .popup-content {
        width: 95%;
        max-width: none;
        margin: 10px;
        padding: 15px;
    }

    .popup-body {
        font-size: 16px; /* Większy tekst na telefonie */
    }

    .popup-body img {
        max-width: 100%;
        width: 100%;
        height: auto;
        object-fit: contain;
    }
}

@media (max-width: 480px) {
    .popup-content {
        width: 98%;
        margin: 5px;
        padding: 10px;
    }

    .popup-body {
        font-size: 14px;
        margin-top: 15px;
    }

    .popup-body img {
        max-width: 100%;
        width: 100%;
        height: auto;
        max-height: 70vh; /* Maksymalnie 70% wysokości ekranu */
        object-fit: contain;
    }
}