/* ==========================================================================
   PERPUS Beranda Popup Modal / Carousel Announcement
   Matches Figma / Reference Design
   ========================================================================== */

/* Prevent page horizontal overflow that can expose background on mobile */
html.perpus-popup-open,
body.perpus-popup-open {
    overflow: hidden !important;
    overflow-x: hidden !important;
    touch-action: none;
    -webkit-overflow-scrolling: auto;
}

.perpus-popup-overlay {
    position: fixed;
    inset: 0;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    min-width: 100%;
    height: 100%;
    min-height: 100%;
    height: 100dvh;
    margin: 0;
    padding: 16px;
    box-sizing: border-box;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(4, 20, 10, 0.20);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    overflow-x: hidden;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.32s cubic-bezier(0.16, 1, 0.3, 1),
                visibility 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}

.perpus-popup-overlay.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.perpus-popup-backdrop {
    position: fixed;
    inset: 0;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(4, 20, 10, 0.72);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    cursor: pointer;
    z-index: 1;
}

.perpus-popup-modal {
    position: relative;
    z-index: 2;
    width: 450px;
    max-width: min(450px, calc(100vw - 32px), calc(100% - 32px));
    height: 600px;
    max-height: min(600px, calc(100vh - 40px), calc(100dvh - 40px));
    background-color: #ffffff;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 24px 50px rgba(0, 0, 0, 0.42), 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    transform: scale(0.92) translateY(12px);
    transition: transform 0.34s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
}

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

/* --- Upper Slides Area --- */
.perpus-popup-slides-wrapper {
    position: relative;
    flex: 1;
    width: 100%;
    min-height: 0;
    overflow: hidden;
    background-color: #0b1e13;
}

/* Header Controls (Badge & Close Button) */
.perpus-popup-header {
    position: absolute;
    top: 14px;
    left: 14px;
    right: 14px;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    pointer-events: none;
}

.perpus-popup-badge {
    pointer-events: auto;
    background-color: #006535;
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    padding: 4px 16px;
    border-radius: 9999px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
    user-select: none;
    display: inline-flex;
    align-items: center;
    line-height: 1.2;
}

.perpus-popup-close-btn {
    pointer-events: auto;
    margin-left: auto;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: #ffffff;
    border: none;
    outline: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4b5563;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
    transition: transform 0.18s ease, background-color 0.18s ease, color 0.18s ease;
    padding: 0;
}

.perpus-popup-close-btn:hover {
    transform: scale(1.08);
    background-color: #f7f9f8;
    color: #111827;
}

.perpus-popup-close-btn:active {
    transform: scale(0.95);
}

/* Slides List */
.perpus-popup-slides {
    position: relative;
    width: 100%;
    height: 100%;
}

.perpus-popup-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: scale(1.02);
    transition: opacity 0.38s ease, transform 0.38s ease, visibility 0.38s ease;
}

.perpus-popup-slide.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: scale(1);
}

.perpus-popup-img {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    object-position: center center;
    display: block;
}

.perpus-popup-gradient {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(
        to top,
        rgba(5, 18, 10, 0.94) 0%,
        rgba(5, 18, 10, 0.58) 38%,
        rgba(5, 18, 10, 0.12) 65%,
        rgba(0, 0, 0, 0) 100%
    );
}

/* Content Overlay at bottom of Image */
.perpus-popup-content {
    position: absolute;
    bottom: 16px;
    left: 16px;
    right: 16px;
    z-index: 6;
    text-align: left;
    pointer-events: auto;
}

.perpus-popup-content-link {
    text-decoration: none;
    color: inherit;
    display: block;
    transition: opacity 0.2s ease;
}

.perpus-popup-content-link:hover {
    opacity: 0.95;
}

.perpus-popup-title {
    color: #ffffff !important;
    font-size: 20px !important;
    font-weight: 700 !important;
    line-height: 1.3 !important;
    margin: 0 0 5px 0 !important;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.55);
    letter-spacing: -0.2px;
}

.perpus-popup-subtitle {
    color: #4ade80 !important;
    font-size: 11.5px !important;
    font-weight: 600 !important;
    line-height: 1.4 !important;
    margin: 0 !important;
    display: inline-flex !important;
    align-items: center;
    gap: 5px;
    transition: color 0.2s ease;
}

.perpus-popup-subtitle svg {
    transition: transform 0.2s ease;
}

.perpus-popup-content-link:hover .perpus-popup-subtitle {
    color: #86efac !important;
}

.perpus-popup-content-link:hover .perpus-popup-subtitle svg {
    transform: translateX(3px);
}

/* --- Footer Navigation --- */
.perpus-popup-footer {
    height: 56px;
    min-height: 56px;
    background-color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    border-top: 1px solid #f0f3f1;
    z-index: 10;
    box-sizing: border-box;
}

/* "Jangan tampilkan lagi hari ini" */
.perpus-popup-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    font-weight: 500;
    color: #4b5563;
    cursor: pointer;
    user-select: none;
    margin: 0 !important;
    line-height: 1.2;
}

.perpus-popup-checkbox {
    width: 14px;
    height: 14px;
    cursor: pointer;
    accent-color: #006535;
    margin: 0;
    border-radius: 3px;
}

.perpus-popup-checkbox-label:hover span {
    color: #1f2937;
}

/* Carousel Nav Capsule */
.perpus-popup-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #edf7f1;
    border-radius: 9999px;
    padding: 3px 5px;
    border: 1px solid #dceed6;
    box-sizing: border-box;
}

.perpus-popup-nav-btn {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: none;
    outline: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.perpus-popup-prev {
    background-color: transparent;
    color: #006535;
}

.perpus-popup-prev:hover {
    background-color: #ffffff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.perpus-popup-prev:active {
    transform: scale(0.92);
}

.perpus-popup-next {
    background-color: #006535;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(0, 101, 53, 0.32);
}

.perpus-popup-next:hover {
    background-color: #00502a;
    transform: scale(1.05);
}

.perpus-popup-next:active {
    transform: scale(0.92);
}

.perpus-popup-counter {
    font-size: 12px;
    font-weight: 700;
    color: #006535;
    letter-spacing: 0.5px;
    padding: 0 3px;
    min-width: 24px;
    text-align: center;
    user-select: none;
}

/* Mobile & Tablet Responsive */
@media screen and (max-width: 768px) {
    .perpus-popup-overlay {
        padding: 14px;
    }

    .perpus-popup-modal {
        width: 380px;
        max-width: calc(100vw - 28px);
        height: 520px;
        max-height: calc(100dvh - 28px);
    }
}

@media screen and (max-width: 480px) {
    .perpus-popup-overlay {
        padding: 10px;
    }

    .perpus-popup-modal {
        width: 330px;
        max-width: calc(100vw - 20px);
        max-width: min(330px, calc(100% - 10px));
        height: 470px;
        max-height: calc(100dvh - 20px);
        max-height: calc(100vh - 20px);
        border-radius: 18px;
    }

    .perpus-popup-title {
        font-size: 16px !important;
    }

    .perpus-popup-checkbox-label {
        font-size: 10px;
        gap: 5px;
    }

    .perpus-popup-footer {
        padding: 0 10px;
        height: 50px;
        min-height: 50px;
    }
}

