/* ========================================
   POPUP OVERLAY
   ======================================== */
.ip-popup-overlay,
.ip-popup-overlay * {
    box-sizing: border-box;
}

.ip-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    backdrop-filter: blur(4px);
    padding: 16px; /* prevents overflow on very small screens */
    box-sizing: border-box;
    max-width: 100vw;
    overflow: auto;
}

/* ========================================
   POPUP CONTAINER
   ======================================== */
.ip-popup {
    background: #ffffff;
    width: min(1140px, calc(100vw - 32px));
    height: min(780px, calc(100dvh - 32px));
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.25);
    animation: ipFadeUp 0.3s ease;
    margin: auto;
    display: flex;
}

@keyframes ipFadeUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ip-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #e5e5e5;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    color: #333;
    transition: 0.2s ease;
    z-index: 9999;
}

    .ip-close-btn:hover {
        background: #ccc;
    }

.ip-popup-content {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    width: 100%;
    height: 100%;
}

.ip-popup-img,
.ip-popup-video {
    display: block;
    height: 100%;
    width: auto;
    max-width: 100%;
    object-fit: contain;
}

.ip-text {
    flex: 1 1 320px;
    width: auto;
    min-width: 0;
    min-height: 0;
    padding: 24px 28px 20px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    overflow: hidden;
}

.ip-text-body {
    min-height: 0;
    overflow-y: auto;
    text-align: center;
}

.ip-text-body h2,
.ip-text-body h6,
.ip-text-body .ip-text-content,
.ip-text-body .ip-text-content * {
    text-align: center !important;
}

.ip-popup-actions {
    margin-top: auto;
    flex-shrink: 0;
    padding-top: 12px;
}

.ip-popup-actions .btn.btn-primary,
.ip-popup-actions .btn.btn-primary:hover,
.ip-popup-actions .btn.btn-primary:focus,
.ip-popup-actions .btn.btn-primary:active {
    width: 100%;
    background: linear-gradient(90deg, rgba(33, 103, 93, 1) 0%, rgba(211, 150, 49, 1) 100%);
    border: 0;
    border-radius: 30px;
    color: #fff;
}

.ip-popup-actions .btn.btn-primary:hover {
    box-shadow: 4px 7px 14px rgba(33, 103, 93, .3);
}

    .ip-text h2 {
        font-size: 26px;
        margin: 0 0 10px;
        color: #136a6a;
    }

    .ip-text h6 {
        margin: 0;
        color: #666;
    }

    .ip-text p {
        font-size: 14px;
        margin-bottom: 20px;
        color: #555;
    }

.ip-form {
    display: flex;
    flex-direction: column;
}

    .ip-form input {
        padding: 12px;
        border-radius: 8px;
        border: 1px solid #ccc;
        font-size: 14px;
        margin-bottom: 12px;
    }

.ip-text-content {
    text-align: center;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    line-height: 1.5;
    margin: 10px 0;
}

.text-wrap-fix {
    word-break: break-word;
    hyphens: auto;
    max-width: 100%;
}

.ip-media-container {
    flex: 0 0 auto;
    width: auto;
    max-width: 58%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ip-email-error {
    color: red;
    font-size: 13px;
}

/* ========================================
   RESPONSIVE LAYOUT
   ======================================== */
@media (max-width: 1100px) {
    .ip-popup {
        width: min(1000px, calc(100vw - 24px));
        height: min(720px, calc(100dvh - 24px));
    }

    .ip-text {
        flex-basis: 280px;
        padding: 20px 22px 16px;
    }

    .ip-text h2 {
        font-size: 22px;
    }
}

@media (max-width: 899px) {
    .ip-popup-overlay {
        padding: 12px;
        align-items: center;
    }

    .ip-popup {
        width: min(560px, calc(100vw - 24px));
        height: calc(100dvh - 24px);
        max-height: calc(100dvh - 24px);
    }

    .ip-popup-content {
        flex-direction: column;
        height: 100%;
        min-height: 0;
    }

    .ip-media-container {
        flex: 1 1 auto;
        align-self: stretch;
        width: 100%;
        max-width: none;
        height: auto;
        min-height: 0;
        max-height: none;
    }

    .ip-popup-img,
    .ip-popup-video {
        width: 100%;
        height: 100%;
        max-width: none;
        max-height: none;
        object-fit: contain;
    }

    .ip-text {
        flex: 0 1 auto;
        align-self: stretch;
        width: auto;
        max-height: 46%;
        padding: 16px 18px 16px;
    }
}

@media (max-width: 480px) {
    .ip-popup-overlay {
        padding: 8px;
    }

    .ip-popup {
        width: calc(100vw - 16px);
        border-radius: 12px;
    }

    .ip-text {
        padding: 14px 14px 12px;
    }

    .ip-text h2 {
        font-size: 20px;
    }

    .ip-text p {
        font-size: 13px;
    }
}
