/**
 * Spiritual Popup Styles - OPTIMIZED VERSION
 * Version: 1.1.0
 */

/* ========================================================================
   OVERLAY - Fast display with smooth fade
   ======================================================================== */
#spiritual-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

#spiritual-popup-overlay.is-visible {
    display: flex !important;
    opacity: 1;
    pointer-events: auto;
}

/* ========================================================================
   POPUP CONTAINER
   ======================================================================== */
.spiritual-popup-container {
    position: relative;
    background: #ffffff;
    border-radius: 12px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.2s ease;
}

#spiritual-popup-overlay.is-visible .spiritual-popup-container {
    transform: scale(1);
}

/* ========================================================================
   IMAGE SECTION - Optimized for 1080x600 banner
   ======================================================================== */
.spiritual-popup-image {
    width: 100%;
    border-radius: 12px 12px 0 0;
    overflow: hidden;
    background: #f8f7f4;
    max-height: 333px;
}

.spiritual-popup-image img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: center center;
    max-height: 333px;
    min-height: 250px;
}

/* ========================================================================
   CONTENT SECTION
   ======================================================================== */
.spiritual-popup-content {
    padding: 36px 32px 40px;
    text-align: center;
}

/* Heading */
.spiritual-popup-heading {
    margin: 0 0 16px;
    font-size: 26px;
    font-weight: 600;
    color: #2c3e50;
    line-height: 1.3;
}

/* Body text */
.spiritual-popup-text {
    margin: 0 0 28px;
    font-size: 16px;
    line-height: 1.6;
    color: #5a6c7d;
    white-space: pre-line;
}

/* ========================================================================
   BUTTONS - Side by side layout
   ======================================================================== */
.spiritual-popup-buttons {
    display: flex;
    gap: 14px;
    justify-content: center;
    align-items: center;
    flex-wrap: nowrap;
    margin-bottom: 20px;
}

.spiritual-popup-button {
    display: inline-block;
    padding: 14px 32px;
    background: #8b22af;
    color: #ffffff;
    text-decoration: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    text-align: center;
    min-width: 150px;
    flex: 1;
    max-width: 200px;
}

.spiritual-popup-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 34, 175, 0.4);
    background: #a02bc4;
    color: #ffffff;
}

.spiritual-popup-button:active {
    transform: translateY(0);
}

/* Cancel button - now using button element */
.spiritual-popup-cancel {
    display: inline-block;
    color: #8b22af;
    text-decoration: underline;
    font-size: 14px;
    cursor: pointer;
    padding: 8px;
    transition: color 0.2s ease;
    background: none;
    border: none;
    font-family: inherit;
    outline: none;
    margin: 0;
    line-height: inherit;
}

.spiritual-popup-cancel:hover {
    color: #a02bc4;
    text-decoration: none;
}

.spiritual-popup-cancel:focus {
    outline: none;
    box-shadow: none;
}

.spiritual-popup-cancel:active {
    outline: none;
}

/* ========================================================================
   BODY SCROLL LOCK - CRITICAL FIX
   ======================================================================== */
body.spiritual-popup-active {
    overflow: hidden !important;
}

/* When popup is closed, make SURE body is scrollable */
body:not(.spiritual-popup-active) {
    overflow: visible !important;
}

/* ========================================================================
   MOBILE RESPONSIVE
   ======================================================================== */
@media (max-width: 600px) {
    #spiritual-popup-overlay {
        padding: 16px;
    }

    .spiritual-popup-container {
        max-width: 100%;
        border-radius: 10px;
    }

    .spiritual-popup-image {
        max-height: 220px;
    }

    .spiritual-popup-image img {
        max-height: 220px;
        min-height: 160px;
    }

    .spiritual-popup-content {
        padding: 28px 24px 32px;
    }

    .spiritual-popup-heading {
        font-size: 22px;
        margin-bottom: 14px;
    }

    .spiritual-popup-text {
        font-size: 15px;
        margin-bottom: 24px;
    }

    .spiritual-popup-buttons {
        flex-direction: column;
        gap: 10px;
        margin-bottom: 16px;
    }

    .spiritual-popup-button {
        width: 100%;
        min-width: auto;
        max-width: none;
        padding: 13px 24px;
    }

    .spiritual-popup-cancel {
        font-size: 13px;
    }
}

/* ========================================================================
   ACCESSIBILITY - Keyboard focus
   ======================================================================== */
.spiritual-popup-button:focus,
.spiritual-popup-cancel:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* ========================================================================
   SMOOTH SCROLLBAR (if content overflows)
   ======================================================================== */
.spiritual-popup-container::-webkit-scrollbar {
    width: 8px;
}

.spiritual-popup-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 0 12px 12px 0;
}

.spiritual-popup-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.spiritual-popup-container::-webkit-scrollbar-thumb:hover {
    background: #555;
}