:root {
    /* Variabel Warna Tetap (Punya Bapak) */
    --primary-gradient: linear-gradient(135deg, #0f2027 0%, #203a43 50%, #2c5364 100%);
    --bg-color: #eef2f5; 
    
    /* Variabel Layout Baru */
    --header-height: 60px;    
    --footer-height: 40px;    
    --sidebar-width: 380px;   
    --layout-gap: 15px;       
}

/* 1. RESET & KUNCI HALAMAN */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden; 
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-color);
    display: flex; 
    flex-direction: column;
}

/* 2. HEADER BARU */
.app-header {
    min-height: 75px; 
    height: auto; 
    flex-shrink: 0;
    background: linear-gradient(135deg, #0f2027 0%, #203a43 50%, #2c5364 100%);
    color: white;
    display: flex;
    align-items: center;
    padding: 0; 
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    z-index: 1050;
    position: relative;
}

/* 3. WADAH UTAMA */
.main-wrapper {
    flex-grow: 1; 
    display: flex; 
    padding: var(--layout-gap); 
    gap: var(--layout-gap);     
    overflow: hidden; 
    position: relative;
}

/* 4. KOTAK SIDEBAR (DESKTOP KIRI) */
.sidebar-container {
    width: var(--sidebar-width);
    height: 100%; 
    background: white;
    border-radius: 12px; 
    box-shadow: 0 5px 15px rgba(0,0,0,0.05); 
    overflow-y: auto; 
    padding: 20px;
    display: flex;
    flex-direction: column;
    position: relative;
    order: 1; 
}

.bottom-sheet-indicator {
    display: none;
}

/* 5. KOTAK PETA (DESKTOP KANAN) */
.map-container {
    flex-grow: 1; 
    height: 100%;
    background: #e9ecef;
    border-radius: 12px; 
    box-shadow: 0 5px 15px rgba(0,0,0,0.05); 
    overflow: hidden; 
    position: relative;
    order: 2; 
}
#map { width: 100%; height: 100%; z-index: 1; }

/* 6. FOOTER DESKTOP (STATIS DI BAWAH) */
.app-footer-bar {
    min-height: var(--footer-height);
    flex-shrink: 0;
    background: white;
    border-top: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 20px;
    font-size: 0.7rem;
    color: #666;
    z-index: 1050;
}

/* --- ELEMENT PENDUKUNG --- */
.section-badge {
    display: inline-block; color: white; padding: 5px 12px; border-radius: 4px;
    font-size: 0.7rem; font-weight: 700; letter-spacing: 1px;
    text-transform: uppercase;
}
.step-1 { background: var(--primary-gradient); }
.step-2 { background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%); }
.step-3 { background: linear-gradient(135deg, #00b09b 0%, #96c93d 100%); }
.step-4 { background: linear-gradient(135deg, #f857a6 0%, #ff5858 100%); }
.step-5 { background: linear-gradient(135deg, #8E2DE2 0%, #4A00E0 100%); }

.form-floating > .form-control { border-radius: 8px; border: 1px solid #ddd; }
.btn-primary-custom { background: var(--primary-gradient); color: white; border: none; padding: 10px; width: 100%; border-radius: 8px; font-weight: 600; }
.btn-gps { background: #eef2f7; color: #1e3c72; border: none; font-weight: 600; width: 100%; }
.result-box { background: #f8fbff; border: 2px dashed #3498db; border-radius: 12px; padding: 15px; text-align: center; display: none; margin-top: 15px; }
.jarak-big { font-size: 2rem; font-weight: 800; color: #1e3c72; line-height: 1; }

/* MAP OVERLAYS */
.center-pin { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -100%); z-index: 999; pointer-events: none; }
.map-controls-floating { position: absolute; top: 15px; right: 15px; z-index: 1000; }
.map-note-floating { 
    position: absolute; bottom: 25px; left: 50%; transform: translateX(-50%); z-index: 1000; 
    background: white; padding: 8px 16px; border-radius: 50px; 
    box-shadow: 0 4px 10px rgba(0,0,0,0.2); font-size: 0.75rem; font-weight: 600; color: #1e3c72;
}

/* ========================================= */
/* RESPONSIVE (HP) - SPLIT SCREEN GOJEK STYLE*/
/* ========================================= */
@media (max-width: 991px) {
    .map-tooltip-action {
        /* Batalin posisi center bawaan biar gampang diatur lebar penuhya */
        left: 4% !important; 
        right: 4% !important; 
        transform: none !important; 
        
        /* Pindah ke bawah */
        top: auto !important; 
        bottom: 20px !important; /* Dirapatkan ke bawah layar */
        
        /* Reset ukuran & bentuk */
        width: auto !important; 
        max-width: none !important;
        padding: 12px 16px !important; 
        border-radius: 10px !important; 
        
        /* Typography */
        font-size: 0.9rem !important; 
        font-weight: 500 !important; 
        text-align: left !important; 
        
    }

    /* Gunakan 100dvh untuk mengatasi address bar HP */
    html, body { 
        overflow: hidden !important; 
        display: flex !important; 
        flex-direction: column !important; 
        height: 100% !important; 
        height: 100dvh !important; 
    }
    
    /* FIX 1: PERAMPINGAN EKSTREM HEADER AGAR TIDAK NABRAK (DIKECILKAN LAGI) */
    .app-header { 
        min-height: 45px !important; /* Dikecilkan lagi */
        height: auto !important; 
        padding: 4px 5px !important; /* Mepet mentok ke ujung layar */
        flex-wrap: nowrap !important; 
        z-index: 1050; 
        flex-shrink: 0; 
    }
    .app-logo { height: 26px !important; margin-right: 5px !important; }
    .header-title { font-size: 0.85rem !important; margin-bottom: 0 !important; }
    .header-sub { font-size: 0.5rem !important; line-height: 1 !important; margin-top: 1px !important; }
    .header-badge { font-size: 0.45rem !important; padding: 2px 4px !important; margin-top: 2px !important; }
    .btn-panduan-header { font-size: 0.7rem !important; padding: 3px 8px !important; margin-left: auto; }
    
    .main-wrapper { 
        display: flex !important; 
        flex-direction: column !important; 
        padding: 0 !important; 
        gap: 0 !important; 
        height: 100% !important; 
        overflow: hidden !important; 
        flex-grow: 1;
    }
    
    /* Peta Stay di Atas */
    .map-container { 
        order: 1 !important; 
        height: 36dvh !important;
        width: 100% !important; 
        flex-shrink: 0; 
        border-radius: 0 !important; 
        z-index: 1;
    }
    
    /* Bottom Sheet Form */
    .sidebar-container { 
        order: 2 !important; 
        width: 100% !important; 
        height: auto !important; 
        flex-grow: 1 !important; 
        margin-top: 10px !important; 
        border-radius: 20px 20px 0 0 !important; 
        box-shadow: 0 -4px 20px rgba(0,0,0,0.15) !important; 
        z-index: 10 !important; 
        overflow-y: auto !important; 
        padding: 20px 20px 20px 20px !important; 
    }
    
    .app-footer-bar { display: none !important; }

    .bottom-sheet-indicator {
        display: block !important;
        width: 50px;
        height: 6px;
        background-color: #cbd5e1;
        border-radius: 10px;
        margin: 0 auto 20px auto;
    }

    /* Optimalisasi Elemen Peta Versi Mobile */
    .info.legend { padding: 4px 8px !important; font-size: 10px !important; line-height: 1.2 !important; min-width: 100px !important; }
    .info.legend b { font-size: 10px !important; }
    .info.legend img { height: 14px !important; margin-right: 4px !important; }
    .map-controls-floating { top: 10px !important; right: 10px !important; }
    .map-controls-floating .btn-group-sm > .btn { padding: 4px 10px !important; font-size: 10px !important; }
    .map-controls-floating i { font-size: 9px !important; }
    .leaflet-control-attribution { font-size: 8px !important; background: rgba(255, 255, 255, 0.5) !important; }
    .map-note-floating {
        left: auto !important; right: 45px !important; bottom: 18px !important; transform: none !important;
        padding: 4px 10px !important; font-size: 9px !important; white-space: nowrap !important; box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
    }
    .leaflet-bar a { width: 26px !important; height: 26px !important; line-height: 26px !important; font-size: 12px !important; }
    
    /* ======================================================== */
    /* FIX UX KAMERA: NATIVE PORTRAIT VIEW (BLACK BORDER)       */
    /* ======================================================== */
    #video-preview, #photo-result {
        max-height: 30vh !important; /* Diperkecil agar tombol foto tidak terdorong ke luar layar */
        width: 100% !important;
        object-fit: contain !important;
        background-color: #000;
        border-radius: 12px !important;
    }
}

/* ========================================= */
/* UX ENHANCEMENTS: ANIMASI GLOW & TOOLTIP   */
/* ========================================= */
@keyframes pulse-glow {
    0% { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.6); }
    70% { box-shadow: 0 0 0 12px rgba(46, 204, 113, 0); }
    100% { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0); }
}

.glow-active {
    animation: pulse-glow 2s infinite !important;
    border-radius: 8px; 
    position: relative;
    z-index: 10;
    border: 2px solid #2ecc71 !important;
}

/* SMART TOOLTIP */
.map-tooltip-action {
    position: fixed; 
    top: 85px; 
    left: 50%; 
    transform: translateX(-50%); 
    z-index: 9999; 
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%); 
    color: white; 
    padding: 16px 24px; 
    border-radius: 30px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.3); 
    font-size: 1.05rem; 
    font-weight: 700;
    white-space: normal; 
    max-width: 90%;      
    text-align: center;  
    line-height: 1.4;
    border: 2px solid rgba(255,255,255,0.2);
    pointer-events: none; 
}

@keyframes fadeInOutTooltip {
    0% { opacity: 0; transform: translate(-50%, -20px); }
    5% { opacity: 1; transform: translate(-50%, 0); }
    95% { opacity: 1; transform: translate(-50%, 0); }
    100% { opacity: 0; transform: translate(-50%, -20px); }
}

/* ========================================= */
/* GLOW KHUSUS TEMA BIRU & CUSTOM CHECKBOX   */
/* ========================================= */
#box-pernyataan {
    border: 2px solid #2c5364 !important;
    border-radius: 8px;
    transition: all 0.3s ease;
}

@keyframes pulse-glow-blue {
    0% { box-shadow: 0 0 0 0 rgba(44, 83, 100, 0.8); }
    70% { box-shadow: 0 0 0 24px rgba(44, 83, 100, 0); }
    100% { box-shadow: 0 0 0 0 rgba(44, 83, 100, 0); }
}

.glow-active-blue {
    animation: pulse-glow-blue 1.5s infinite !important; 
}

.form-check-input {
    border: 2px solid #2c5364 !important; 
}

.form-check-input:checked {
    background-color: #2c5364 !important;
    border-color: #2c5364 !important;
}

.form-check-input:focus {
    box-shadow: 0 0 0 0.25rem rgba(44, 83, 100, 0.25) !important;
    border-color: #2c5364 !important;
}
    
.btn-outline-theme { color: #2c5364; border-color: #2c5364; }
.btn-outline-theme:hover { background-color: rgba(44, 83, 100, 0.1); color: #2c5364; }
.btn-check:checked + .btn-outline-theme { 
    background-color: #2c5364 !important; 
    color: white !important; 
    border-color: #2c5364 !important; 
}

/* ========================================= */
/* CSS KHUSUS UNTUK KUESIONER BINTANG IN-APP */
/* ========================================= */
.rating-group {
    display: flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
}
.rating-group input {
    display: none;
}
.rating-group label {
    cursor: pointer;
    font-size: 1.8rem;
    color: #dee2e6;
    padding: 0 4px;
    transition: color 0.2s, transform 0.2s;
}
.rating-group label:hover,
.rating-group label:hover ~ label,
.rating-group input:checked ~ label {
    color: #ffc107; /* Warna emas saat menyala */
    transform: scale(1.1);
}
.kuesioner-question {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
    font-size: 0.95rem;
    display: block;
}
/* Animasi Fade In antar Step Kuesioner */
.kuesioner-step {
    animation: fadeIn 0.4s ease-in-out;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========================================= */
/* KUSTOMISASI PREMIUM SELECT NATIVE         */
/* ========================================= */
.select-premium-blue {
    height: 48px;
    border-radius: 10px;
    border: 2px solid #0d6efd !important;
    background-color: #f0f8ff !important;
    color: #0d6efd !important;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
}

.select-premium-green {
    height: 48px;
    border-radius: 10px;
    border: 2px solid #198754 !important;
    background-color: #f0fff4 !important;
    color: #198754 !important;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
}

.select-premium-green:disabled {
    border-color: #6c757d !important;
    background-color: #e9ecef !important;
    color: #6c757d !important;
    cursor: not-allowed;
}