/* ==========================================================================
   C-Popup Front-End Modern Responsive Modal Stylesheet
   Full Cover Background Image with Bottom Transparent Overlay
   PN-RED SUITE
   ========================================================================== */

.c-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    z-index: 9999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.c-popup-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

/* Semi-transparent Backdrop with Blur */
.c-popup-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    cursor: pointer;
}

/* Dialog Container (Seamless Card) */
.c-popup-dialog {
    position: relative;
    z-index: 2;
    background: transparent;
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.15);
    width: auto;
    height: auto;
    display: inline-flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: stretch;
    overflow: hidden;
    margin: auto;
    line-height: normal;
    transform: scale(0.92) translateY(15px);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
    box-sizing: border-box;
}

.c-popup-overlay.is-visible .c-popup-dialog {
    transform: scale(1) translateY(0);
}

/* ==========================================================================
   Entrance Animation Presets (Zoom Bounce, Slide Down, Slide Up, Flip 3D)
   ========================================================================== */

/* 1. Zoom Bounce (Default) */
.c-popup-dialog.c-popup-anim-zoom-bounce {
    transform: scale(0.65) translateY(20px);
    opacity: 0;
}

.c-popup-overlay.is-visible .c-popup-dialog.c-popup-anim-zoom-bounce {
    animation: cPopupZoomBounce 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes cPopupZoomBounce {
    0% {
        transform: scale(0.65) translateY(20px);
        opacity: 0;
    }
    65% {
        transform: scale(1.03) translateY(-4px);
        opacity: 1;
    }
    100% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

/* 2. Slide Down (Slide dari Atas) */
.c-popup-dialog.c-popup-anim-slide-down {
    transform: translateY(-120px) scale(0.96);
    opacity: 0;
}

.c-popup-overlay.is-visible .c-popup-dialog.c-popup-anim-slide-down {
    animation: cPopupSlideDown 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes cPopupSlideDown {
    0% {
        transform: translateY(-120px) scale(0.96);
        opacity: 0;
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* 3. Slide Up (Slide dari Bawah) */
.c-popup-dialog.c-popup-anim-slide-up {
    transform: translateY(120px) scale(0.96);
    opacity: 0;
}

.c-popup-overlay.is-visible .c-popup-dialog.c-popup-anim-slide-up {
    animation: cPopupSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes cPopupSlideUp {
    0% {
        transform: translateY(120px) scale(0.96);
        opacity: 0;
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* 4. Flip 3D */
.c-popup-dialog.c-popup-anim-flip {
    transform: perspective(1000px) rotateX(-65deg) scale(0.85);
    transform-origin: top center;
    opacity: 0;
}

.c-popup-overlay.is-visible .c-popup-dialog.c-popup-anim-flip {
    animation: cPopupFlip 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes cPopupFlip {
    0% {
        transform: perspective(1000px) rotateX(-65deg) scale(0.85);
        opacity: 0;
    }
    70% {
        transform: perspective(1000px) rotateX(8deg) scale(1.01);
        opacity: 1;
    }
    100% {
        transform: perspective(1000px) rotateX(0deg) scale(1);
        opacity: 1;
    }
}

/* ==========================================================================
   Orientation-based Exact Sizing (Portrait vs Landscape 1:1 Image Fit)
   ========================================================================== */

/* 1. Portrait Image: Tinggi persis layar - 200px, lebar otomatis 1:1 dengan gambar */
.c-popup-dialog.c-popup-is-portrait {
    height: auto;
    max-height: calc(100vh - 200px);
    max-height: calc(100dvh - 200px);
    width: auto;
    max-width: calc(100vw - 40px);
    max-width: calc(100dvw - 40px);
}

.c-popup-dialog.c-popup-is-portrait .c-popup-bg-wrapper {
    position: relative;
    height: calc(100vh - 200px);
    height: calc(100dvh - 200px);
    max-height: calc(100vh - 200px);
    max-height: calc(100dvh - 200px);
    width: auto;
    max-width: calc(100vw - 40px);
    max-width: calc(100dvw - 40px);
    display: block;
    line-height: 0;
}

.c-popup-dialog.c-popup-is-portrait .c-popup-bg-img {
    height: 100%;
    width: auto;
    max-width: calc(100vw - 40px);
    max-width: calc(100dvw - 40px);
    display: block;
    object-fit: cover;
}

/* 2. Landscape Image: Lebar persis layar - 100px, tinggi otomatis 1:1 dengan gambar */
.c-popup-dialog.c-popup-is-landscape {
    width: calc(100vw - 100px);
    width: calc(100dvw - 100px);
    max-width: calc(100vw - 100px);
    max-width: calc(100dvw - 100px);
    height: auto;
    max-height: calc(100vh - 100px);
    max-height: calc(100dvh - 100px);
}

.c-popup-dialog.c-popup-is-landscape .c-popup-bg-wrapper {
    position: relative;
    width: 100%;
    height: auto;
    max-height: calc(100vh - 100px);
    max-height: calc(100dvh - 100px);
    display: block;
    line-height: 0;
}

.c-popup-dialog.c-popup-is-landscape .c-popup-bg-img {
    width: 100%;
    height: auto;
    max-height: calc(100vh - 100px);
    max-height: calc(100dvh - 100px);
    display: block;
    object-fit: cover;
}

/* 1. Full Cover Background Image Container */
.c-popup-bg-wrapper {
    position: relative;
    overflow: hidden;
    line-height: 0;
}

.c-popup-bg-img {
    display: block;
    object-fit: cover;
}

/* ==========================================================================
   Multi-Popup Slider & Slides Management
   ========================================================================== */

.c-popup-slides-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    display: block;
}

.c-popup-slide {
    position: relative;
    width: 100%;
    height: 100%;
    display: none;
    opacity: 0;
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    transform: scale(0.98);
}

.c-popup-slide.is-active-slide {
    display: block;
    opacity: 1;
    transform: scale(1);
}

/* Navigation Arrows (Prev & Next) */
.c-popup-nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.65);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 12;
    padding: 0;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: background 0.2s ease, transform 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.c-popup-nav-arrow:hover {
    background: #9a2109;
    color: #ffffff;
    box-shadow: 0 6px 18px rgba(154, 33, 9, 0.5);
}

.c-popup-nav-prev {
    left: 14px;
}

.c-popup-nav-prev:hover {
    transform: translateY(-50%) translateX(-2px) scale(1.05);
}

.c-popup-nav-next {
    right: 14px;
}

.c-popup-nav-next:hover {
    transform: translateY(-50%) translateX(2px) scale(1.05);
}

/* Bullet Indicators Dots */
.c-popup-dots-nav {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 15;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    background: rgba(15, 23, 42, 0.6);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.c-popup-dot {
    position: relative;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    border: none;
    cursor: pointer;
    padding: 0;
    margin: 0;
    transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1), background 0.3s ease, border-radius 0.3s ease;
}

.c-popup-dot:hover {
    background: rgba(255, 255, 255, 0.8);
}

.c-popup-dot.is-active-dot {
    width: 26px;
    border-radius: 6px;
    background: #ef4444;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.8);
}

/* Close 'X' Button */
.c-popup-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.7);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 15;
    padding: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    transition: background 0.2s ease, transform 0.25s ease, color 0.2s ease;
}

.c-popup-close:hover,
.c-popup-close:focus {
    background: #9a2109;
    color: #ffffff;
    transform: rotate(90deg) scale(1.08);
    outline: none;
}

/* 2. Bottom Transparent Overlay for Title & Description */
.c-popup-bottom-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2;
    width: 100%;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0) 0%, rgba(15, 23, 42, 0.35) 20%, rgba(15, 23, 42, 0.65) 55%, rgba(15, 23, 42, 0.88) 100%);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    padding: 42px 28px 24px 28px;
    box-sizing: border-box;
    color: #ffffff;
    border: none !important;
    border-top: none !important;
}

.c-popup-is-slider .c-popup-bottom-overlay {
    padding-bottom: 34px;
}

/* Fallback when no image is uploaded (Text only) */
.c-popup-no-image-bg {
    background: linear-gradient(135deg, #1e0604 0%, #3d0d07 50%, #170402 100%);
    min-height: auto;
    max-width: 620px;
}

.c-popup-no-image-bg .c-popup-bottom-overlay {
    position: relative;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-top: none;
    padding: 44px 36px 36px 36px;
}

/* Title Styling */
.c-popup-title {
    margin: 0 0 10px 0 !important;
    font-size: 22px !important;
    font-weight: 700 !important;
    line-height: 1.35 !important;
    color: #ffffff !important;
    letter-spacing: -0.3px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9), 0 0 2px rgba(0, 0, 0, 0.9) !important;
}

/* Description Styling */
.c-popup-desc {
    font-size: 14.5px !important;
    line-height: 1.65 !important;
    color: #f1f5f9 !important;
    margin-bottom: 20px !important;
    max-height: 180px;
    overflow-y: auto;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9), 0 0 2px rgba(0, 0, 0, 0.9) !important;
    padding-right: 6px;
}

.c-popup-desc::-webkit-scrollbar {
    width: 5px;
}

.c-popup-desc::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.c-popup-desc::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.35);
    border-radius: 4px;
}

.c-popup-desc p,
.c-popup-desc span,
.c-popup-desc div,
.c-popup-desc li,
.c-popup-desc strong,
.c-popup-desc em {
    color: #f1f5f9 !important;
    margin: 0 0 10px 0 !important;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9), 0 0 2px rgba(0, 0, 0, 0.9) !important;
}

.c-popup-desc a {
    color: #fca5a5 !important;
    text-decoration: underline !important;
}

.c-popup-desc a:hover {
    color: #ffffff !important;
}

.c-popup-desc p:last-child {
    margin-bottom: 0 !important;
}

/* Action CTA Button */
.c-popup-action {
    padding-top: 4px;
}

.c-popup-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #9a2109 0%, #701402 100%);
    color: #ffffff !important;
    padding: 12px 24px;
    font-size: 14.5px;
    font-weight: 600;
    text-decoration: none !important;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4), 0 0 10px rgba(154, 33, 9, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
    cursor: pointer;
}

.c-popup-btn:hover,
.c-popup-btn:focus {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5), 0 0 15px rgba(239, 68, 68, 0.6);
    filter: brightness(1.15);
    color: #ffffff !important;
}

/* ==========================================================================
   Responsive & Mobile Breakpoints (100% Preserved Image Ratio, No Cut-Off)
   ========================================================================== */

/* Mobile Portrait & Tablets (< 768px) */
@media screen and (max-width: 768px) {
    .c-popup-overlay {
        padding: 12px;
    }

    .c-popup-dialog {
        width: auto !important;
        height: auto !important;
        min-width: 0 !important;
        min-height: 0 !important;
        max-width: calc(100vw - 24px) !important;
        max-width: calc(100dvw - 24px) !important;
        max-height: calc(100vh - 40px) !important;
        max-height: calc(100dvh - 40px) !important;
        border-radius: 16px;
    }

    /* 1. Portrait on Mobile: Fit inside screen height without clipping */
    .c-popup-dialog.c-popup-is-portrait {
        max-height: calc(100vh - 60px) !important;
        max-height: calc(100dvh - 60px) !important;
    }

    .c-popup-dialog.c-popup-is-portrait .c-popup-bg-wrapper {
        height: auto !important;
        max-height: calc(100vh - 60px) !important;
        max-height: calc(100dvh - 60px) !important;
        width: auto !important;
        max-width: calc(100vw - 24px) !important;
        max-width: calc(100dvw - 24px) !important;
    }

    .c-popup-dialog.c-popup-is-portrait .c-popup-bg-img {
        max-height: calc(100vh - 60px) !important;
        max-height: calc(100dvh - 60px) !important;
        max-width: calc(100vw - 24px) !important;
        max-width: calc(100dvw - 24px) !important;
        width: auto !important;
        height: auto !important;
        object-fit: contain !important;
    }

    /* 2. Landscape on Mobile: Fit full width with auto height */
    .c-popup-dialog.c-popup-is-landscape {
        width: calc(100vw - 24px) !important;
        width: calc(100dvw - 24px) !important;
        max-width: calc(100vw - 24px) !important;
        max-width: calc(100dvw - 24px) !important;
        max-height: calc(100vh - 60px) !important;
        max-height: calc(100dvh - 60px) !important;
    }

    .c-popup-dialog.c-popup-is-landscape .c-popup-bg-wrapper {
        width: 100% !important;
        height: auto !important;
        max-height: calc(100vh - 60px) !important;
        max-height: calc(100dvh - 60px) !important;
    }

    .c-popup-dialog.c-popup-is-landscape .c-popup-bg-img {
        width: 100% !important;
        height: auto !important;
        max-height: calc(100vh - 60px) !important;
        max-height: calc(100dvh - 60px) !important;
        object-fit: contain !important;
    }

    /* Bottom Overlay Adaptations on Mobile */
    .c-popup-bottom-overlay {
        padding: 22px 16px 16px 16px;
    }

    .c-popup-is-slider .c-popup-bottom-overlay {
        padding-bottom: 28px;
    }

    .c-popup-title {
        font-size: 16px;
        margin-bottom: 6px;
    }

    .c-popup-desc {
        font-size: 13px;
        line-height: 1.5;
        max-height: 120px;
        margin-bottom: 12px;
    }

    .c-popup-btn {
        width: 100%;
        padding: 10px 16px;
        font-size: 13.5px;
        box-sizing: border-box;
    }

    /* Navigation Arrows on Mobile */
    .c-popup-nav-arrow {
        width: 34px;
        height: 34px;
    }

    .c-popup-nav-prev {
        left: 8px;
    }

    .c-popup-nav-next {
        right: 8px;
    }

    .c-popup-dots-nav {
        bottom: 8px;
        padding: 4px 10px;
    }

    .c-popup-close {
        top: 8px;
        right: 8px;
        width: 30px;
        height: 30px;
    }
}

/* Landscape Orientation on Small Mobile Devices (< 520px height) */
@media screen and (max-height: 520px) and (orientation: landscape) {
    .c-popup-overlay {
        padding: 8px;
    }

    .c-popup-dialog {
        max-height: calc(100vh - 16px) !important;
        max-height: calc(100dvh - 16px) !important;
        max-width: 94vw !important;
    }

    .c-popup-bg-wrapper,
    .c-popup-bg-img {
        max-height: calc(100vh - 16px) !important;
        max-height: calc(100dvh - 16px) !important;
        object-fit: contain !important;
    }

    .c-popup-bottom-overlay {
        padding: 14px 18px;
        max-height: 55%;
    }

    .c-popup-title {
        font-size: 14px;
        margin-bottom: 4px;
    }

    .c-popup-desc {
        font-size: 12px;
        max-height: 70px;
        margin-bottom: 8px;
    }

    .c-popup-btn {
        padding: 6px 14px;
        font-size: 12.5px;
    }
}
