.popup-overlay {
    --ppdb-primary: #667eea;
    --ppdb-primary-rgb: 102, 126, 234;
    --ppdb-secondary: #764ba2;
    --ppdb-navy: #1e3c72;
    --ppdb-image-fit: contain; /* ganti ke 'cover' agar gambar memenuhi tanpa sisa ruang (bisa terpotong) */
    --ppdb-gradient: linear-gradient(135deg, var(--ppdb-primary) 0%, var(--ppdb-secondary) 100%);
    --ppdb-gradient-reverse: linear-gradient(135deg, var(--ppdb-secondary), var(--ppdb-primary));
    --ppdb-pattern: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.popup-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
}

.popup-overlay.active {
    opacity: 1;
    visibility: visible;
}

.popup-container {
    --ppdb-max-h: 88vh;
    --ppdb-w: min(94vw, 960px, calc(var(--ppdb-max-h) * 16 / 9));
    position: relative;
    width: var(--ppdb-w);
    height: calc(var(--ppdb-w) * 9 / 16);
    overflow: hidden;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(255, 255, 255, 0.1);
    transform: scale(0.95) translateY(20px);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    animation: popup-entrance 0.5s ease-out forwards;
}

@supports (height: 1dvh) {
    .popup-container {
        --ppdb-max-h: 88dvh;
    }
}

.popup-scroll {
    height: 100%;
    overflow-y: auto;
    overscroll-behavior: contain;
    scroll-behavior: smooth;
    scroll-snap-type: y proximity;
    -webkit-overflow-scrolling: touch;
}

.popup-overlay.active .popup-container {
    transform: scale(1) translateY(0);
}

@keyframes popup-entrance {
    0% {
        transform: scale(0.7) translateY(50px);
        opacity: 0;
    }
    100% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.popup-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
    color: var(--ppdb-navy);
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.popup-close:hover {
    background: #ff4757;
    box-shadow: 0 6px 20px rgba(255, 71, 87, 0.4);
    color: white;
    transform: rotate(90deg) scale(1.1);
}

.popup-image::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--ppdb-pattern);
}

.popup-image::before {
    z-index: 1;
}

.popup-image {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: var(--ppdb-gradient);
    scroll-snap-align: start;
}

.popup-image img {
    position: relative;
    z-index: 4;
    width: 100%;
    height: 100%;
    border-radius: 0;
    box-shadow: none;
    object-fit: var(--ppdb-image-fit);
    mix-blend-mode: normal;
    opacity: 1;
}

.popup-scroll-hint {
    position: absolute;
    bottom: 16px;
    left: 50%;
    z-index: 5;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 16px;
    border: none;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    color: white;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transform: translateX(-50%);
}

.popup-scroll-hint i {
    animation: popup-hint-bounce 1.6s ease-in-out infinite;
}

@keyframes popup-hint-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(4px); }
}

.popup-body {
    padding: 20px 18px;
    background: #ffffff;
}

.gelombang-section {
    position: relative;
    margin-bottom: 14px;
    padding: 14px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.gelombang-section:hover {
    border-color: var(--ppdb-primary);
    box-shadow: 0 8px 24px rgba(var(--ppdb-primary-rgb), 0.15);
    transform: translateY(-2px);
}

.gelombang-section > p {
    display: inline-block;
    margin-bottom: 12px !important;
    padding: 6px 12px;
    background: #f0f3ff;
    border-radius: 8px;
    color: var(--ppdb-primary) !important;
    font-size: 13px !important;
    font-weight: 700 !important;
}

.gelombang-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding: 8px 14px;
    background: var(--ppdb-gradient);
    border-radius: 8px;
    color: white;
    font-size: 14px;
    font-weight: 700;
}

.gelombang-header i {
    font-size: 16px;
}

.jadwal-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.jadwal-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    margin-bottom: 6px;
    padding: 8px 10px;
    background: white;
    border-left: 3px solid var(--ppdb-primary);
    border-radius: 8px;
    font-size: 12px;
    transition: all 0.3s ease;
}

.jadwal-item:hover {
    background: #f0f3ff;
    box-shadow: 0 2px 8px rgba(var(--ppdb-primary-rgb), 0.15);
    transform: translateX(3px);
}

.jadwal-item i {
    min-width: 16px;
    margin-right: 10px;
    color: var(--ppdb-primary);
    font-size: 14px;
}

.jadwal-item strong,
.jadwal-item span {
    font-size: 13px;
}

.jadwal-item strong {
    color: #2d3748;
    font-weight: 700;
}

.jadwal-item span {
    color: #4a5568;
    font-weight: 600;
}

.warning-box,
.note-box {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 12px;
}

.warning-box {
    margin-top: 12px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.25);
    color: white;
    font-weight: 600;
    text-align: center;
    animation: pulse-warning 2s ease-in-out infinite;
}

.warning-box i {
    margin-right: 6px;
    font-size: 14px;
}

@keyframes pulse-warning {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.01); }
}

.note-box {
    margin-top: 16px;
    background: #e8f5e9;
    border-left: 3px solid #4caf50;
    color: #2e7d32;
    line-height: 1.5;
}

.note-box strong {
    color: #1b5e20;
    font-weight: 700;
}

/* Tombol CTA */
.popup-cta {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
    text-align: center;
}

.btn-ppdb {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    padding: 12px 24px;
    background: var(--ppdb-gradient);
    border-radius: 10px;
    box-shadow: 0 6px 16px rgba(var(--ppdb-primary-rgb), 0.3);
    color: white;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.3s ease;
}

.btn-ppdb::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.5s, height 0.5s;
}

.btn-ppdb:hover {
    box-shadow: 0 12px 28px rgba(var(--ppdb-primary-rgb), 0.5);
    transform: translateY(-2px);
}

.btn-ppdb:hover::before {
    width: 300px;
    height: 300px;
}

.btn-ppdb i {
    font-size: 16px;
}

.popup-scroll {
    scrollbar-width: thin;
    scrollbar-color: var(--ppdb-primary) #f1f3f5;
}

.popup-scroll::-webkit-scrollbar {
    width: 6px;
}

.popup-scroll::-webkit-scrollbar-track {
    background: #f1f3f5;
    border-radius: 10px;
}

.popup-scroll::-webkit-scrollbar-thumb {
    background: var(--ppdb-gradient-reverse);
    border-radius: 10px;
}

.popup-scroll::-webkit-scrollbar-thumb:hover {
    background: var(--ppdb-gradient);
}

@media (min-width: 601px) {
    .popup-body {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 14px;
        padding: 24px;
    }

    .popup-body .gelombang-section {
        margin-bottom: 0;
    }

    .popup-body .note-box,
    .popup-body .popup-cta {
        grid-column: 1 / -1;
    }

    .popup-body .note-box {
        margin-top: 0;
    }

    .popup-body .popup-cta {
        margin-top: 6px;
    }
}

@media (max-width: 768px) {
    .gelombang-section {
        margin-bottom: 14px;
        padding: 16px;
    }
}

@media (max-width: 600px) {
    .popup-container {
        width: 94%;
        height: auto;
        border-radius: 18px;
    }

    .popup-scroll {
        height: auto;
        max-height: var(--ppdb-max-h);
        scroll-snap-type: none;
    }

    .popup-image {
        height: auto;
        aspect-ratio: 16 / 9;
    }

    .popup-image img {
        position: absolute;
        inset: 0;
    }

    .popup-scroll-hint {
        display: none;
    }

    .popup-header {
        padding: 20px 20px 16px;
    }

    .popup-header h2 {
        font-size: 20px;
    }

    .popup-header p {
        font-size: 12px;
    }

    .popup-body {
        padding: 16px;
    }

    .gelombang-header {
        padding: 9px 14px;
    }

    .jadwal-item {
        padding: 10px;
    }

    .jadwal-item strong,
    .jadwal-item span {
        font-size: 12px;
    }

    .btn-ppdb {
        width: 100%;
        justify-content: center;
        padding: 13px 28px;
    }
}

@media (max-width: 480px) {
    .popup-close {
        top: 10px;
        right: 10px;
        width: 30px;
        height: 30px;
        font-size: 14px;
    }

    .popup-header {
        padding: 16px 16px 12px;
    }

    .popup-header h2 {
        font-size: 18px;
    }

    .popup-header p {
        font-size: 11px;
    }

    .popup-body {
        padding: 18px 14px;
    }

    .gelombang-section {
        margin-bottom: 12px;
        padding: 14px;
    }

    .gelombang-header {
        padding: 8px 12px;
        font-size: 13px;
    }

    .jadwal-item {
        padding: 9px;
    }

    .jadwal-item strong,
    .jadwal-item span {
        font-size: 11px;
    }

    .warning-box,
    .note-box {
        padding: 10px 12px;
        font-size: 11px;
    }

    .btn-ppdb {
        padding: 12px 24px;
        font-size: 13px;
    }
}

@media (max-height: 520px) {
    .popup-container {
        --ppdb-max-h: 94vh;
    }
}

@supports (height: 1dvh) {
    @media (max-height: 520px) {
        .popup-container {
            --ppdb-max-h: 94dvh;
        }
    }
}

@media (prefers-reduced-motion: reduce) {
    .popup-scroll {
        scroll-behavior: auto;
    }

    .popup-scroll-hint i {
        animation: none;
    }
}