/* Klinika Popup Ads – popup.css */

.kzpa-overlay {
    position: fixed;
    inset: 0;
    background: #000;
    opacity: 0;
    z-index: 99998;
    display: none;
    transition: opacity 0.2s ease;
}
.kzpa-overlay.kzpa-visible { display: block; }
.kzpa-overlay.kzpa-blur {
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    background: rgba(0,0,0,0.4);
}

.kzpa-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 99999;
    background: #000;
    border-radius: 4px;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.2s ease;
    box-sizing: border-box;

    /* Dopasowuje się do zawartości – nie rozciąga się niepotrzebnie */
    width: auto;
    max-width: 96vw;
    max-height: 92vh;
}
.kzpa-modal.kzpa-visible { opacity: 1; }

.kzpa-close {
    position: absolute;
    top: 8px;
    right: 10px;
    background: rgba(0,0,0,0.55);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    touch-action: manipulation;
}
.kzpa-close:focus { outline: 2px solid #fff; outline-offset: 2px; }
.kzpa-close.kzpa-hidden { display: none !important; }

.kzpa-content {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
    width: 100%;
}
.kzpa-content a { display: block; line-height: 0; }

/* Obraz – dopasowuje się do okna */
.kzpa-image {
    display: block;
    max-width: 96vw;
    max-height: 92vh;
    width: auto;
    height: auto;
    object-fit: contain;
}

/* Preview (miniatura wideo) */
.kzpa-preview {
    display: block;
    max-width: 96vw;
    max-height: 92vh;
    width: auto;
    height: auto;
    object-fit: contain;
}

.kzpa-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: 2px solid #fff;
    border-radius: 50%;
    width: 64px;
    height: 64px;
    font-size: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    padding: 0;
    touch-action: manipulation;
}
.kzpa-play-btn:focus { outline: 2px solid #fff; outline-offset: 3px; }

/* Wideo – ograniczone przez szerokość modala i wysokość ekranu */
.kzpa-video {
    display: block;
    width: 100%;
    max-width: 100%;
    max-height: calc(92vh - 47px);
    height: auto;
    object-fit: contain;
}

.kzpa-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: kzpa-spin 0.8s linear infinite;
    z-index: 6;
}
.kzpa-loader.kzpa-hidden { display: none; }

@keyframes kzpa-spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Mobile */
@media (max-width: 768px) {
    .kzpa-modal {
        max-width: 96vw;
        max-height: 88vh;
    }
    .kzpa-image,
    .kzpa-preview {
        width: 100%;
        max-width: 100%;
        max-height: 88vh;
        height: auto;
    }
    .kzpa-video {
        width: 100%;
        max-width: 100%;
        max-height: calc(88vh - 47px);
        height: auto;
    }
    .kzpa-close {
        width: 40px;
        height: 40px;
        font-size: 24px;
        top: 6px;
        right: 6px;
    }
}
