:root {
    --primary-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --background-color: #f9f9f9;
    --panel-background: #ffffff;
    --border-color: #e0e0e0;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --text-color: #333;
    --text-on-dark: #ffffff;
}

body, html {
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
    font-family: var(--primary-font);
    background: radial-gradient(circle at 20% 20%, #f1f5ff, #eef2f7 45%, #e5e7eb 80%);
    overflow: hidden;
    color: var(--text-color);
}

.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

#app-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: #0d1117;
}

#top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 70px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(90deg, rgba(15,23,42,0.9), rgba(15,23,42,0.7));
    backdrop-filter: blur(12px);
    z-index: 1200;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    color: #e5e7eb;
}

#top-bar .brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

#top-bar .dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #38bdf8);
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.6);
}

#top-bar .title {
    font-weight: 700;
    font-size: 16px;
    color: #e5e7eb;
}

#top-bar .subtitle {
    font-size: 12px;
    color: #cbd5e1;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chip {
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    background: rgba(59, 130, 246, 0.2);
    color: #bfdbfe;
    border: 1px solid rgba(59, 130, 246, 0.5);
}

.chip.muted {
    background: rgba(255, 255, 255, 0.14);
    color: #cbd5e1;
    border-color: rgba(255, 255, 255, 0.2);
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
}

button.pill {
    padding: 10px 16px;
    border-radius: 999px;
    border: 1px solid #2563eb;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: white;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.25);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

button.pill:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(37, 99, 235, 0.35);
}

button.ghost {
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    background: rgba(255,255,255,0.8);
    color: #111827;
    transition: background 0.12s ease, border-color 0.12s ease;
}

button.ghost:hover {
    background: white;
    border-color: #d1d5db;
}

#map-container {
    position: fixed;
    top: 80px;
    left: 0;
    right: 0;
    bottom: 0;
    background: #0b1120;
    z-index: 500;
    transition: opacity 0.25s ease, filter 0.25s ease;
    overflow: hidden;
}

#map-container.collapsed {
    filter: grayscale(0.45) brightness(0.75);
}

#map {
    position: absolute;
    inset: 0;
}


/* Map markers now rendered via Mapbox GeoJSON circle layer for smooth zoom */

#viewer-container {
    position: fixed;
    top: 70px;
    right: 0;
    bottom: 0;
    width: 55vw;
    min-width: 480px;
    max-width: 900px;
    background: #000;
    z-index: 900;
    transition: transform 0.35s ease, opacity 0.35s ease;
    transform: translateX(0);
}

#viewer-container.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateX(102%);
}

#viewer-container.full {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    max-width: 100vw;
    min-width: 100vw;
    z-index: 1300;
}

#viewer-container.full #viewer-chrome {
    z-index: 1400;
}

#viewer-container.full #mini-map-container {
    z-index: 1350;
    top: 16px;
}

#panorama {
    width: 100%;
    height: 100%;
}

/* Position compass at top-left */
#panorama .pnlm-compass {
    bottom: auto !important;
    top: 16px !important;
    left: 16px !important;
    right: auto !important;
    z-index: 100;
}

/* Hide Pannellum default zoom controls */
#panorama .pnlm-controls-container {
    display: none !important;
}

#viewer-chrome {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    padding: 14px 20px;
    border-radius: 16px;
    background: linear-gradient(90deg, rgba(15,23,42,0.78), rgba(15,23,42,0.62));
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: white;
    backdrop-filter: blur(8px);
    box-shadow: 0 12px 42px rgba(0,0,0,0.42);
    border: 1px solid rgba(255,255,255,0.05);
    z-index: 1200;
}

/* Hide info in viewer-chrome, keep only buttons */
#viewer-chrome .info {
    display: none;
}

.node-title {
    font-size: 18px;
    font-weight: 700;
}

.node-meta {
    font-size: 11px;
    color: #9ca3af;
    font-family: monospace;
    letter-spacing: 0.02em;
}

#viewer-chrome .controls {
    display: flex;
    gap: 8px;
}

#viewer-chrome .controls button {
    display: flex;
    align-items: center;
    gap: 6px;
}

#viewer-chrome .controls .btn-icon {
    font-size: 18px;
    line-height: 1;
}

#viewer-chrome .controls .btn-text {
    font-size: 14px;
}

/* Hide redundant viewer-info, info already shown in viewer-chrome */
#viewer-info {
    display: none;
}

#mini-map-container {
    position: absolute;
    top: 92px;
    right: 18px;
    width: 230px;
    height: 170px;
    z-index: 1150;
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.45);
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.15);
}

#mini-map {
    width: 100%;
    height: 100%;
}

/* Mini map markers now rendered via Mapbox GeoJSON circle layer */

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: linear-gradient(180deg, #f8fafc, #eef2f7);
    border-bottom: 1px solid #e5e7eb;
}

.panel-header .label {
    font-weight: 700;
    color: #0f172a;
}

.panel-header .hint {
    font-size: 12px;
    color: #6b7280;
}

.panel-header.compact {
    padding: 10px 12px;
    background: rgba(15, 23, 42, 0.85);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    color: #e2e8f0;
}

.card {
    background: white;
    border-radius: 16px;
}

/* Make Mapbox logos less prominent on the mini-map */
#mini-map .mapboxgl-ctrl-logo,
#mini-map .mapboxgl-compact {
    display: none !important;
}

/* Style navigation controls */
.mapboxgl-ctrl-group {
    border-radius: 12px !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
    overflow: hidden;
}

.mapboxgl-ctrl-group button {
    width: 36px !important;
    height: 36px !important;
}

.mapboxgl-ctrl-bottom-left {
    bottom: 24px;
    left: 16px;
}

.mapboxgl-popup-content {
    background: rgba(17, 24, 39, 0.92);
    color: white;
    border-radius: 10px;
    padding: 10px 14px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.35);
}

.mapboxgl-popup-anchor-bottom .mapboxgl-popup-tip {
    border-top-color: rgba(17, 24, 39, 0.92);
}

/* Hotspot styles */
.custom-hotspot {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255,255,255,0.8);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.55);
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease;
    position: relative;
    backdrop-filter: blur(2px);
}

.custom-hotspot::after {
    content: '\2192';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 22px;
    color: white;
    text-shadow: 0 2px 8px rgba(0,0,0,0.6);
}

.custom-hotspot.nav-backward::after {
    content: '\2190';
}

.custom-hotspot.nav-left::after {
    content: '\21BA';
}

.custom-hotspot.nav-right::after {
    content: '\21BB';
}

.custom-hotspot:hover {
    transform: scale(1.08);
    background: rgba(255,255,255,0.35);
}

.custom-tooltip {
    background-color: rgba(0,0,0,0.8);
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 13px;
}

#loading-overlay {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at 30% 30%, rgba(59,130,246,0.12), rgba(15,23,42,0.88));
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 10px;
    z-index: 1500;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#loading-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.spinner {
    width: 44px;
    height: 44px;
    border: 4px solid #e5e7eb;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text {
    font-weight: 600;
    color: #e2e8f0;
}

#hero {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at 20% 20%, rgba(59,130,246,0.22), rgba(15,23,42,0.94));
    overflow: hidden;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 80px 80px 80px 120px;
    color: #e5e7eb;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

#hero.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

#hero-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}

.hero-gradient {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 80% 20%, rgba(14,165,233,0.3), transparent 35%),
                radial-gradient(circle at 20% 80%, rgba(244,114,182,0.22), transparent 45%);
    mix-blend-mode: screen;
    pointer-events: none;
}

.hero-content {
    position: relative;
    max-width: 520px;
    z-index: 5;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.hero-content h1 {
    margin: 0;
    font-size: 36px;
    line-height: 1.2;
    color: #f8fafc;
}

.hero-content p {
    margin: 0;
    color: #cbd5e1;
}

.hero-actions {
    display: flex;
    gap: 10px;
    margin-top: 6px;
}

.eyebrow {
    letter-spacing: 0.16em;
    font-size: 12px;
    text-transform: uppercase;
    color: #93c5fd;
}

#error-banner {
    position: fixed;
    top: 76px;
    left: 50%;
    transform: translateX(-50%);
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
    padding: 10px 16px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    z-index: 1400;
}

#error-banner.hidden {
    display: none;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Media Query for tablets */
@media (max-width: 900px) {
    #map-container {
        width: calc(100% - 32px);
        height: 260px;
        left: 16px;
        right: 16px;
    }

    #mini-map-container {
        width: 180px;
        height: 130px;
    }

    #viewer-container {
        width: 55vw;
        min-width: 320px;
    }

    #viewer-chrome {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    #viewer-chrome .controls {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    #top-bar {
        gap: 10px;
        height: auto;
        padding: 10px 16px;
    }
}

/* Media Query for mobile devices */
@media (max-width: 640px) {
    /* Hide header when viewer is open on mobile */
    body:has(#viewer-container:not(.hidden)) #top-bar,
    body.viewer-open #top-bar {
        display: none;
    }

    #top-bar {
        height: auto;
        padding: 10px 12px;
        gap: 8px;
    }

    #top-bar .brand {
        gap: 8px;
    }

    #top-bar .title {
        font-size: 13px;
    }

    #top-bar .subtitle {
        font-size: 10px;
    }

    .top-actions {
        gap: 6px;
    }

    #status-chip {
        display: none;
    }

    button.ghost {
        padding: 8px 10px;
        font-size: 12px;
    }

    button.pill {
        padding: 8px 12px;
        font-size: 12px;
    }

    /* Map container - full width di mobile */
    #map-container {
        top: 60px;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: auto;
    }

    /* Viewer container - full screen di mobile */
    #viewer-container {
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100vw;
        min-width: 100vw;
        max-width: 100vw;
    }

    /* Mini map - lebih kecil dan di pojok */
    #mini-map-container {
        width: 120px;
        height: 90px;
        top: 10px;
        right: 10px;
    }

    /* Viewer chrome - overlay controls */
    #viewer-chrome {
        left: 50%;
        transform: translateX(-50%);
        bottom: 20px;
        padding: 10px 14px;
        gap: 8px;
        border-radius: 50px;
        width: auto;
    }

    #viewer-chrome .controls {
        display: flex;
        gap: 6px;
    }

    /* Hide text, show only icons on mobile */
    #viewer-chrome .controls .btn-text {
        display: none;
    }

    #viewer-chrome .controls .btn-icon {
        font-size: 18px;
    }

    #viewer-chrome .controls button {
        width: 42px;
        height: 42px;
        padding: 0;
        border-radius: 50%;
        justify-content: center;
        align-items: center;
    }

    #viewer-chrome .controls button.pill {
        background: linear-gradient(135deg, #2563eb, #1d4ed8);
    }

    #viewer-chrome .controls button.ghost {
        background: rgba(255, 255, 255, 0.15);
        border-color: rgba(255, 255, 255, 0.3);
        color: white;
    }

    /* Hero section untuk mobile */
    #hero {
        padding: 40px 24px;
        align-items: flex-end;
        justify-content: center;
        text-align: center;
    }

    .hero-content {
        max-width: 100%;
        align-items: center;
    }

    .hero-content h1 {
        font-size: 24px;
    }

    .hero-content p {
        font-size: 14px;
    }

    .hero-actions {
        flex-direction: column;
        width: 100%;
    }

    .hero-actions button {
        width: 100%;
    }

    /* Hotspots lebih kecil */
    .custom-hotspot {
        width: 40px;
        height: 40px;
    }

    .custom-hotspot::after {
        font-size: 18px;
    }
}

/* Media Query for very small screens */
@media (max-width: 380px) {
    #top-bar .title {
        font-size: 11px;
    }

    #top-bar .subtitle {
        display: none;
    }

    #viewer-chrome .controls {
        grid-template-columns: 1fr 1fr;
    }

    #mini-map-container {
        width: 100px;
        height: 75px;
    }

    .hero-content h1 {
        font-size: 20px;
    }
}
