/* Popup Overlay */
.nsp-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* Popup Container */
.nsp-popup-container {
    position: relative;
    background: #fff;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    border-radius: 4px;
}

/* Wider popup for side image layouts */
.nsp-popup-container:has(.nsp-image-left),
.nsp-popup-container:has(.nsp-image-right) {
    max-width: 750px;
}

/* Close Button */
.nsp-popup-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.85);
    border: none;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: #333;
    padding: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nsp-popup-close:hover {
    background: rgba(255, 255, 255, 1);
    color: #000;
}

/* Content - Top Image Layout */
.nsp-popup-content {
    display: flex;
    flex-direction: column;
}

/* Image Top */
.nsp-popup-image.nsp-image-top {
    width: 100%;
    height: 280px;
    overflow: hidden;
}

.nsp-popup-image.nsp-image-top img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Text area for top image - centered */
.nsp-image-top + .nsp-popup-body .nsp-popup-text,
.nsp-popup-content > .nsp-popup-body:only-child .nsp-popup-text {
    text-align: left;
}

.nsp-popup-content:has(.nsp-image-top) .nsp-popup-text {
    text-align: center;
}

/* Body */
.nsp-popup-body {
    display: flex;
    gap: 0;
    align-items: stretch;
}

/* Text container */
.nsp-popup-text {
    flex: 1;
    padding: 30px;
}

/* Side Image Layout */
.nsp-popup-body:has(.nsp-image-left),
.nsp-popup-body:has(.nsp-image-right) {
    flex-direction: row;
}

.nsp-popup-image.nsp-image-left,
.nsp-popup-image.nsp-image-right {
    flex: 0 0 50%;
    min-height: 380px;
    overflow: hidden;
}

.nsp-popup-image.nsp-image-left img,
.nsp-popup-image.nsp-image-right img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Side image text - left aligned */
.nsp-popup-body:has(.nsp-image-left) .nsp-popup-text,
.nsp-popup-body:has(.nsp-image-right) .nsp-popup-text {
    text-align: left;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Title */
.nsp-popup-title {
    margin: 0 0 10px;
    font-size: 24px;
    line-height: 1.3;
    color: #000;
}

/* Description */
.nsp-popup-description {
    margin: 0 0 20px;
    font-size: 14px;
    line-height: 1.5;
    color: #666;
}

/* Form */
.nsp-popup-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.nsp-popup-input {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    width: 100%;
    box-sizing: border-box;
}

.nsp-popup-input:focus {
    outline: none;
    border-color: #000;
}

.nsp-popup-button {
    padding: 12px 20px;
    background: #000;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    font-weight: 500;
}

.nsp-popup-button:hover {
    background: #333;
}

.nsp-popup-button:disabled {
    background: #999;
    cursor: not-allowed;
}

/* Message */
.nsp-popup-message {
    margin-top: 15px;
    padding: 12px;
    font-size: 14px;
    border-radius: 4px;
}

.nsp-popup-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.nsp-popup-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Loading State */
.nsp-popup-form.loading .nsp-popup-button {
    opacity: 0.6;
    cursor: wait;
}

/* Mobile */
@media (max-width: 600px) {
    .nsp-popup-container {
        max-width: 100%;
    }

    .nsp-popup-text {
        padding: 25px 20px;
    }

    .nsp-popup-title {
        font-size: 20px;
    }

    .nsp-popup-body {
        flex-direction: column;
    }

    .nsp-popup-image.nsp-image-left,
    .nsp-popup-image.nsp-image-right {
        flex: 0 0 auto;
        min-height: 180px;
        width: 100%;
    }

    /* Center text on mobile for all layouts */
    .nsp-popup-text {
        text-align: center !important;
    }
}
