/**
 * St. Xavier's Cathedral - Home Video Modal Popup Styling
 * Fully responsive across all devices (Desktop, Laptops 768p/900p, Tablets, Mobiles, Landscape)
 */

/* ==========================================================================
   Modal Backdrop
   ========================================================================== */
.stx-video-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 999999;
    background: rgba(10, 7, 5, 0.78);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.35s ease;
}

.stx-video-modal-backdrop.is-active {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

/* ==========================================================================
   Modal Card (Flex column, never exceeds viewport, fully scrollable if needed)
   ========================================================================== */
.stx-video-modal-card {
    position: relative;
    width: 100%;
    max-width: 820px;
    max-height: calc(100vh - 36px);
    background: linear-gradient(145deg, rgba(28, 18, 12, 0.98) 0%, rgba(18, 12, 8, 0.99) 100%);
    border: 1px solid rgba(212, 167, 86, 0.45);
    border-radius: 16px;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.85),
        0 0 35px rgba(212, 167, 86, 0.16),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    padding: 18px 22px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    transform: scale(0.94) translateY(18px);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(212, 167, 86, 0.4) transparent;
}

/* Custom Sleek Scrollbar */
.stx-video-modal-card::-webkit-scrollbar {
    width: 5px;
}

.stx-video-modal-card::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
}

.stx-video-modal-card::-webkit-scrollbar-thumb {
    background: rgba(212, 167, 86, 0.4);
    border-radius: 8px;
}

.stx-video-modal-card::-webkit-scrollbar-thumb:hover {
    background: rgba(212, 167, 86, 0.7);
}

.stx-video-modal-backdrop.is-active .stx-video-modal-card {
    transform: scale(1) translateY(0);
}

/* Modal Inner Decorative Top Glow */
.stx-video-modal-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 15%;
    right: 15%;
    height: 1px;
    background: linear-gradient(90deg, transparent, #e5c378, #d4a756, transparent);
    opacity: 0.9;
    pointer-events: none;
}

/* ==========================================================================
   Header Section (Never shrinks)
   ========================================================================== */
.stx-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
    margin-bottom: 8px;
}

.stx-modal-header-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

/* Live Badge */
.stx-badge-live {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(220, 38, 38, 0.16);
    border: 1px solid rgba(239, 68, 68, 0.55);
    color: #fca5a5;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 3px 10px;
    border-radius: 999px;
    width: fit-content;
}

.stx-pulse-dot {
    width: 7px;
    height: 7px;
    background-color: #ef4444;
    border-radius: 50%;
    animation: stxDotPulse 1.6s infinite ease-in-out;
}

@keyframes stxDotPulse {
    0% {
        transform: scale(0.9);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }

    70% {
        transform: scale(1.1);
        box-shadow: 0 0 0 7px rgba(239, 68, 68, 0);
    }

    100% {
        transform: scale(0.9);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

/* Promo Badge */
.stx-badge-promo {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(212, 167, 86, 0.14);
    border: 1px solid rgba(212, 167, 86, 0.45);
    color: #e5c378;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 3px 10px;
    border-radius: 999px;
    width: fit-content;
}

.stx-badge-promo svg {
    color: #e5c378;
    flex-shrink: 0;
}

/* Titles */
.stx-modal-title {
    font-family: 'Cinzel', serif, system-ui;
    font-size: clamp(16px, 2.2vw, 20px);
    font-weight: 700;
    color: #f8f3ea;
    margin: 2px 0 0 0;
    line-height: 1.25;
    letter-spacing: 0.4px;
}

.stx-modal-subtitle {
    font-size: clamp(11.5px, 1.4vw, 13px);
    color: #c9bbaa;
    margin: 0;
    line-height: 1.35;
}

/* Close Button */
.stx-modal-close-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(212, 167, 86, 0.35);
    color: #e5c378;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
    transition: all 0.25s ease;
}

.stx-modal-close-btn:hover {
    background: rgba(212, 167, 86, 0.25);
    border-color: #d4a756;
    color: #ffffff;
    transform: rotate(90deg) scale(1.05);
}

.stx-modal-close-btn svg {
    width: 15px;
    height: 15px;
}

/* ==========================================================================
   Video Player Wrapper
   Dynamically bounded by viewport height to guarantee zero clipping
   ========================================================================== */
.stx-video-player-container {
    position: relative;
    width: 100%;
    /* Bounded by both viewport height and maximum comfortable width */
    max-height: min(60vh, 440px);
    max-width: calc(min(60vh, 440px) * 16 / 9);
    aspect-ratio: 16 / 9;
    background: #000000;
    border-radius: 12px;
    overflow: hidden;
    margin: 8px auto 12px auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7),
        inset 0 0 0 1px rgba(212, 167, 86, 0.25);
    flex-shrink: 1;
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stx-video-player-container video,
.stx-video-player-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    display: block;
    object-fit: cover;
    background: #000;
}

/* ==========================================================================
   Footer Section (Never shrinks or gets pushed out)
   ========================================================================== */
.stx-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 10px;
    border-top: 1px solid rgba(212, 167, 86, 0.15);
    flex-shrink: 0;
}

.stx-modal-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #9f9182;
}

.stx-modal-hint svg {
    opacity: 0.7;
    flex-shrink: 0;
}

.stx-modal-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Primary "Continue to Website" Button */
.stx-btn-proceed {
    background: linear-gradient(135deg, #d4a756 0%, #b8860b 100%);
    color: #120c08;
    border: 1px solid #ffd584;
    padding: 8px 20px;
    border-radius: 7px;
    font-size: 13.5px;
    font-weight: 700;
    letter-spacing: 0.4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    transition: all 0.25s ease;
    box-shadow: 0 4px 15px rgba(212, 167, 86, 0.35);
    white-space: nowrap;
}

.stx-btn-proceed:hover {
    background: linear-gradient(135deg, #e5c378 0%, #c49219 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(212, 167, 86, 0.55);
    color: #000000;
}

.stx-btn-proceed svg {
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.stx-btn-proceed:hover svg {
    transform: translateX(3px);
}

/* Secondary "Watch on Full Live Page" Button */
.stx-btn-live-page {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(212, 167, 86, 0.45);
    color: #f5eedb;
    padding: 8px 16px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    transition: all 0.25s ease;
    white-space: nowrap;
}

.stx-btn-live-page:hover {
    background: rgba(212, 167, 86, 0.22);
    border-color: #d4a756;
    color: #ffffff;
    text-decoration: none;
    transform: translateY(-1px);
}

.stx-btn-live-page svg {
    flex-shrink: 0;
}

/* ==========================================================================
   Floating Re-open Button (Stacked above .music-toggle-btn)
   Circular icon by default, expands horizontally with text on hover
   ========================================================================== */
.stx-floating-reopen-btn {
    position: fixed;
    bottom: 92px;
    /* Positioned 12px above .music-toggle-btn (bottom:30px + height:50px) */
    right: 31px;
    /* Horizontally centered with .music-toggle-btn (50px width at right:30px) */
    z-index: 99990;
    width: 48px;
    height: 48px;
    padding: 0 12px;
    box-sizing: border-box;
    border-radius: 50px;
    background: linear-gradient(135deg, rgba(28, 19, 13, 0.96) 0%, rgba(18, 12, 8, 0.98) 100%);
    border: 1.5px solid rgba(212, 167, 86, 0.55);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #f7f1e4;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55), 0 0 16px rgba(212, 167, 86, 0.22);
    overflow: hidden;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transform: translateY(15px);
    transition: width 0.38s cubic-bezier(0.16, 1, 0.3, 1),
        border-color 0.3s ease,
        box-shadow 0.3s ease,
        background 0.3s ease,
        opacity 0.35s ease,
        visibility 0.35s ease,
        transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.stx-floating-reopen-btn.is-visible {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
    pointer-events: auto !important;
}

.stx-floating-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.stx-floating-icon-promo svg {
    margin-left: 2px;
    /* Optically centers the play triangle inside the 48px circle */
    width: 17px;
    height: 17px;
    fill: #e5c378;
}

.stx-floating-live-dot {
    width: 10px;
    height: 10px;
    background-color: #ef4444;
    border-radius: 50%;
    display: inline-block;
    animation: stxDotPulse 1.6s infinite ease-in-out;
}

.stx-floating-label {
    display: inline-block;
    opacity: 0;
    margin-left: 8px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.3px;
    color: #f7f1e4;
    white-space: nowrap;
    pointer-events: none;
    transition: opacity 0.22s ease 0.08s;
}

/* Hover Expansion: Width smoothly animates from 48px to 188px */
.stx-floating-reopen-btn:hover,
.stx-floating-reopen-btn.is-visible:hover {
    width: 188px;
    border-color: #d4a756;
    background: linear-gradient(135deg, rgba(38, 26, 17, 0.98) 0%, rgba(24, 16, 10, 0.99) 100%);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.7),
        0 0 24px rgba(212, 167, 86, 0.45);
}

.stx-floating-reopen-btn:hover .stx-floating-label,
.stx-floating-reopen-btn.is-visible:hover .stx-floating-label {
    opacity: 1;
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */
/* Medium screens & Laptops (e.g. 1366x768, height <= 760px) */
@media (max-height: 760px) {
    .stx-video-modal-backdrop {
        padding: 12px;
    }

    .stx-video-modal-card {
        padding: 14px 18px;
        max-height: calc(100vh - 24px);
    }

    .stx-video-player-container {
        max-height: 46vh;
        max-width: calc(46vh * 16 / 9);
        margin: 6px auto 10px auto;
    }

    .stx-modal-header {
        margin-bottom: 6px;
    }

    .stx-modal-footer {
        padding-top: 8px;
    }
}

/* Tablets and Mobile Phones (Width <= 768px) */
@media (max-width: 768px) {
    .stx-video-modal-backdrop {
        padding: 10px;
    }

    .stx-video-modal-card {
        padding: 14px 14px;
        border-radius: 14px;
        max-height: calc(100vh - 20px);
    }

    .stx-modal-header {
        gap: 8px;
        margin-bottom: 8px;
    }

    .stx-modal-close-btn {
        width: 32px;
        height: 32px;
    }

    .stx-modal-close-btn svg {
        width: 14px;
        height: 14px;
    }

    .stx-video-player-container {
        margin: 6px auto 10px auto;
        min-height: 160px;
        border-radius: 10px;
    }

    .stx-modal-footer {
        flex-direction: column-reverse;
        align-items: stretch;
        gap: 10px;
        padding-top: 8px;
    }

    .stx-modal-actions {
        flex-direction: column;
        width: 100%;
        gap: 8px;
    }

    .stx-btn-proceed,
    .stx-btn-live-page {
        width: 100%;
        justify-content: center;
        padding: 9px 14px;
        font-size: 13px;
    }

    .stx-modal-hint {
        justify-content: center;
        font-size: 11px;
    }

    .stx-floating-reopen-btn {
        bottom: 88px;
        right: 31px;
        width: 44px;
        height: 44px;
        padding: 0 12px;
    }
}

/* Extra Small Phones (Width <= 420px) */
@media (max-width: 420px) {
    .stx-video-modal-card {
        padding: 12px 10px;
    }

    .stx-badge-live,
    .stx-badge-promo {
        font-size: 10px;
        padding: 2px 8px;
    }

    .stx-modal-title {
        font-size: 15px;
    }

    .stx-modal-subtitle {
        font-size: 11px;
    }

    .stx-video-player-container {
        min-height: 140px;
    }
}

/* Landscape on Short Phones (Height <= 500px) */
@media (max-height: 500px) {
    .stx-video-modal-card {
        padding: 10px 14px;
    }

    .stx-modal-subtitle {
        display: none;
        /* Hide subtitle to preserve essential video & buttons in landscape */
    }

    .stx-video-player-container {
        max-height: 48vh;
        max-width: calc(48vh * 16 / 9);
        min-height: 120px;
        margin: 4px auto 6px auto;
    }

    .stx-modal-footer {
        padding-top: 6px;
    }

    .stx-modal-hint {
        display: none;
    }
}