/* =========================================
   BASE STYLES
   ========================================= */
body {
    overflow-x: hidden;
    background: #F9FAFB;
}

#immersive-layer {
    display: none;
}

/* =========================================
   LOADING SCREEN
   ========================================= */
.loading-screen {
    position: fixed;
    inset: 0;
    background: #0A2E26;
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
}

.loading-screen.active {
    display: flex;
}

.loading-content {
    text-align: center;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(197, 160, 89, 0.2);
    border-top-color: #C5A059;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    color: white;
    font-size: 16px;
    margin-bottom: 20px;
    font-family: 'Cinzel', serif;
    letter-spacing: 2px;
}

.loading-progress {
    width: 200px;
    height: 4px;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    overflow: hidden;
    margin: 0 auto 10px;
}

.loading-progress-bar {
    height: 100%;
    background: #C5A059;
    width: 0%;
    transition: width 0.3s ease;
}

.loading-percent {
    color: rgba(255,255,255,0.6);
    font-size: 12px;
}

/* Intro Section */
#intro-section {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #F9FAFB;
    position: relative;
    z-index: 10;
    transition: opacity 1s ease;
}

.btn-immersive {
    background: #0A2E26;
    color: #C5A059;
    border: 1px solid #C5A059;
    padding: 15px 40px;
    font-family: 'Cinzel', serif;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.btn-immersive:hover {
    background: #C5A059;
    color: #0A2E26;
}

/* =========================================
   IMMERSIVE LAYER & SWIPER
   ========================================= */
#immersive-layer {
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 1s ease;
    display: flex;
    flex-direction: column;
}

.swiper-container {
    width: 100%;
    height: 100%;
}

.swiper-slide {
    position: relative;
    overflow: hidden;
    background: #000;
}

/* Gambar Full Screen */
.diorama-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 10s ease-out, opacity 1s ease;
    transform: scale(1.1);
    opacity: 0; /* Hidden sebelum loaded */
    z-index: 2;
    position: relative;
}

.diorama-img.loaded {
    opacity: 1;
}

.swiper-slide-active .diorama-img {
    transform: scale(1);
}

/* Gradient Overlay */
.gradient-overlay {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle, transparent 50%, rgba(0, 0, 0, 0.8) 100%);
    pointer-events: none;
    z-index: 3;
}

/* =========================================
   UI CONTROLS & ELEMENTS
   ========================================= */
.ui-element {
    transition: opacity 0.5s ease;
    opacity: 1;
    pointer-events: auto;
}

.ui-hidden .ui-element {
    opacity: 0;
    pointer-events: none;
}

/* Control Bar (Top Right) */
.control-bar-left {
    position: absolute;
    top: 30px;
    left: 30px;
    z-index: 100;
    display: flex;
    gap: 12px;
}

.control-bar-right {
    position: absolute;
    top: 30px;
    right: 30px;
    z-index: 100;
    display: flex;
    gap: 12px;
}

.ctrl-btn {
    height: 40px;
    padding: 0 15px;
    border-radius: 30px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.ctrl-btn:hover {
    background: #C5A059;
    color: #000;
    border-color: #C5A059;
}

.icon-only {
    width: 40px;
    padding: 0;
}

/* Navigation Arrows */
.nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 60px;
    height: 60px;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    opacity: 0.6;
    cursor: pointer;
    transition: all 0.3s;
    background: rgba(0,0,0,0.2);
    border-radius: 50%;
}

.nav-arrow:hover {
    opacity: 1;
    background: #C5A059;
    color: black;
}

.nav-prev { left: 20px; }
.nav-next { right: 20px; }

/* =========================================
   INFO PANEL & FLEXIBLE POSITIONS
   ========================================= */
.info-panel {
    position: absolute;
    z-index: 50;
    color: white;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.9);
    max-width: 700px;
    padding: 30px;
    background: radial-gradient(at center, rgba(0, 0, 0, 0.6), transparent 80%);
    border-radius: 20px;
    transform: translateY(30px);
    opacity: 0;
    transition: all 0.8s ease 0.3s;
}

.swiper-slide-active .info-panel {
    transform: translateY(0);
    opacity: 1;
}

/* --- Posisi Variants --- */
.pos-bottom-left { bottom: 60px; left: 60px; text-align: left; }
.pos-bottom-left .header-wrapper { justify-content: flex-start; }

.pos-bottom-right { bottom: 60px; right: 60px; text-align: right; }
.pos-bottom-right .header-wrapper { justify-content: flex-end; flex-direction: row-reverse; }
.pos-bottom-right .audio-bars { margin-left: auto; margin-right: 0; }

.pos-bottom-center { bottom: 60px; left: 50%; transform: translateX(-50%) translateY(30px); text-align: center; width: 80%; }
.swiper-slide-active .pos-bottom-center { transform: translateX(-50%) translateY(0); }
.pos-bottom-center .header-wrapper { justify-content: center; }
.pos-bottom-center .audio-bars { margin: 0 auto 15px auto; }

.pos-top-left { top: 120px; left: 60px; text-align: left; }
.pos-top-left .header-wrapper { justify-content: flex-start; }

.pos-top-right { top: 120px; right: 60px; text-align: right; }
.pos-top-right .header-wrapper { justify-content: flex-end; flex-direction: row-reverse; }
.pos-top-right .audio-bars { margin-left: auto; margin-right: 0; }

/* Header Content */
.header-wrapper {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
    margin-bottom: 12px;
}

.diorama-title { margin: 0; line-height: 1.2; }

.time-badge {
    display: inline-block;
    background: #C5A059;
    color: #000;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    white-space: nowrap;
}

/* Audio Visualizer */
.audio-bars {
    display: flex;
    gap: 3px;
    height: 20px;
    align-items: flex-end;
    margin-bottom: 15px;
    width: fit-content;
}

.bar {
    width: 4px;
    background: #C5A059;
    animation: bounce 1s infinite;
}

.bar:nth-child(2) { animation-delay: 0.1s; }
.bar:nth-child(3) { animation-delay: 0.2s; }

@keyframes bounce {
    0%, 100% { height: 20%; }
    50% { height: 100%; }
}

/* =========================================
   LOADING & PROGRESS
   ========================================= */
/* Progress Bar (Timer) */
.autoplay-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 4px;
    background: #C5A059;
    width: 0%;
    z-index: 100;
    transition: width 0.1s linear;
}

/* Spinner Loader */
.image-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #C5A059;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 1;
}

/* =========================================
   PLAYLIST SIDEBAR
   ========================================= */
.playlist-sidebar {
    position: fixed;
    top: 0;
    left: -320px;
    width: 320px;
    height: 100%;
    background: rgba(10, 46, 38, 0.98);
    backdrop-filter: blur(10px);
    z-index: 200;
    transition: left 0.3s ease;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255,255,255,0.1);
}

.playlist-sidebar.open {
    left: 0;
}

.playlist-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 150;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.playlist-overlay.open {
    opacity: 1;
    visibility: visible;
}

.playlist-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}

.playlist-header h3 {
    font-size: 16px;
}

.playlist-items {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}

.playlist-items::-webkit-scrollbar {
    width: 6px;
}

.playlist-items::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.05);
}

.playlist-items::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 3px;
}

.playlist-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.playlist-item:hover {
    background: rgba(255,255,255,0.1);
}

.playlist-item.active {
    background: rgba(197, 160, 89, 0.2);
    border-left-color: #C5A059;
}

.playlist-number {
    font-size: 12px;
    color: #C5A059;
    font-weight: 600;
    min-width: 24px;
}

.playlist-title {
    font-size: 13px;
    color: rgba(255,255,255,0.8);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.playlist-item.active .playlist-title {
    color: white;
    font-weight: 500;
}

/* =========================================
   MOBILE RESPONSIVE
   ========================================= */
@media (max-width: 768px) {
    /* Image handling - fill screen, crop sides for landscape images */
    .diorama-img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: center;
        transform: none !important;
    }
    
    .swiper-slide-active .diorama-img {
        transform: none !important;
    }
    
    /* Info panel - full width at bottom */
    .info-panel {
        top: auto !important;
        right: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        transform: translateY(100%) !important;
        text-align: left !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 16px !important;
        border-radius: 20px 20px 0 0 !important;
        background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.7) 70%, transparent 100%) !important;
        max-height: 50vh;
        overflow-y: auto;
    }
    
    .swiper-slide-active .info-panel {
        transform: translateY(0) !important;
    }
    
    .header-wrapper {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 8px;
        margin-bottom: 8px;
    }
    
    .time-badge {
        order: -1;
        font-size: 10px;
        padding: 3px 8px;
    }
    
    .diorama-title { 
        font-size: 1.3rem !important; 
        line-height: 1.2;
    }
    
    .info-panel p {
        font-size: 12px !important;
        line-height: 1.4;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    
    .audio-bars { 
        margin: 0 0 8px 0 !important; 
        height: 16px;
    }
    
    .bar { width: 3px; }
    
    /* Control buttons */
    .control-bar-left { 
        top: 16px; 
        left: 16px; 
        z-index: 100;
    }
    
    .control-bar-right { 
        top: 16px; 
        right: 16px; 
        z-index: 100;
    }
    
    .ctrl-btn {
        height: 36px;
        font-size: 12px;
        padding: 0 10px;
    }
    
    .icon-only {
        width: 36px;
        padding: 0;
    }
    
    /* Hide nav arrows on mobile - use swipe */
    .nav-arrow { 
        display: none !important;
    }
    
    /* Playlist sidebar */
    .playlist-sidebar {
        width: 85%;
        max-width: 300px;
        left: -85%;
    }
    
    .playlist-items {
        padding: 8px 0;
    }
    
    .playlist-item {
        padding: 10px 16px;
    }
    
    .playlist-title {
        font-size: 12px;
    }
    
    /* Timer bar */
    .autoplay-progress {
        height: 3px;
    }
}

/* Force landscape on mobile hint */
@media (max-width: 768px) and (orientation: portrait) {
    .diorama-img {
        object-position: center 30%;
    }
}