/* --- RESET, VARIABLES & GLOBAL STYLES --- */
:root {
    --bg-dark: #181818;
    --sidebar-bg: #181818;
    --button-bg: #1E1E1E;
    --button-hover-bg: #f90;
    --text-primary: #ffffff;
    --text-secondary: #b6b6b6;
    --border-color: #333333;
    --font-family: 'Poppins', sans-serif;
    --sidebar-left-width: 220px;
    --sidebar-right-width: 320px;
    --header-height: 77px;
    --mobile-header-height: 70px;
    --transition-duration: 0.35s;
    --app-height: 100vh;
    /* Variabel untuk tinggi viewport mobile */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
    user-select: none;
}

html,
body {
    height: 100%;
    overflow: hidden;
    font-family: var(--font-family);
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 400;
}

html {
    height: -webkit-fill-available;
}

body {
    min-height: var(--app-height);
}


.hidden {
    display: none !important;
}

/* --- INTRO & GLOBE EFFECT --- */
#map-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    filter: brightness(1.2) blur(4px);
    transition: filter 2s ease-out;
}

#map-background.start-animation {
    filter: brightness(1) blur(0px);
}

#intro-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, rgba(10, 10, 10, 0.2) 0%, rgba(10, 10, 10, 0.8) 70%, #111 100%);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    transition: opacity 1.5s ease-out;
}

.intro-content {
    animation: fadeInContent 2s ease-in-out;
}

@keyframes fadeInContent {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.intro-title {
    font-size: 3.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #f90, #ffc566);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.intro-subtitle {
    font-size: 1.25rem;
    font-weight: 300;
    color: var(--text-primary);
    margin-bottom: 2.5rem;
    letter-spacing: 0.5px;
}

#start-btn {
    font-family: var(--font-family);
    background-color: transparent;
    border: 2px solid var(--button-hover-bg);
    color: var(--button-hover-bg);
    padding: 14px 40px;
    font-size: 1rem;
    font-weight: 500;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#start-btn:hover {
    background-color: var(--button-hover-bg);
    color: var(--bg-dark);
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(255, 153, 0, 0.2);
}

/* --- MAIN APP WRAPPER LAYOUT --- */
#app-wrapper {
    display: flex;
    flex-direction: column;
    height: var(--app-height);
    opacity: 1;
    transition: opacity 1.2s ease-in;
}

#app-wrapper.hidden {
    opacity: 0;
    pointer-events: none;
}


/* --- DESKTOP HEADER --- */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 25px 0 15px;
    background-color: var(--sidebar-bg);
    z-index: 100;
    height: var(--header-height);
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.app-title {
    font-size: 25px;
    font-weight: 500;
    background: linear-gradient(to right, #f90, #ff6);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    cursor: pointer;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 19px;
}

.header-button {
    background-color: #464646;
    color: var(--text-primary);
    border: none;
    padding: 8px 16px;
    border-radius: 18px;
    cursor: pointer;
    font-family: var(--font-family);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s ease;
    font-weight: 500;
}

.header-button:hover {
    background-color: var(--button-hover-bg);
}

.header-button:disabled {
    background-color: #2a2a2a;
    color: #666;
    cursor: not-allowed;
}

.header-nav {
    display: flex;
    gap: 24px;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 400;
    transition: color 0.2s ease;
}

.nav-link.active,
.nav-link:hover {
    color: var(--text-primary);
}

.nav-link i {
    font-size: 12px;
}

/* --- MOBILE HEADER --- */
.mobile-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 0 15px;
    height: var(--mobile-header-height);
    background-color: var(--bg-dark);
    flex-shrink: 0;
    z-index: 100;
}

.mobile-header-btn {
    background-color: var(--bg-dark);
    border: 1px solid var(--bg-dark);
    color: var(--text-secondary);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.2s, color 0.2s;
    flex-shrink: 0;
}

#mobile-download-btn {
    flex-grow: 1;
    height: 48px;
    background-color: #282828;
    border-radius: 30px;
    justify-content: center;
}

.is-mobile-hidden {
    display: none !important;
}

/* --- MAIN LAYOUT GRID (DESKTOP) --- */
#app-container {
    flex: 1;
    display: grid;
    height: 100%;
    grid-template-rows: 1fr;
    grid-template-columns: var(--sidebar-left-width) 1fr var(--sidebar-right-width);
    grid-template-areas: "sidebar-left main sidebar-right";
    transition: grid-template-columns var(--transition-duration) ease-in-out;
    position: relative;
    overflow: hidden;
}

#app-container.left-collapsed {
    grid-template-columns: 0 1fr var(--sidebar-right-width);
}

#app-container.right-collapsed {
    grid-template-columns: var(--sidebar-left-width) 1fr 0;
}

#app-container.both-collapsed {
    grid-template-columns: 0 1fr 0;
}

/* --- SIDEBARS --- */
.sidebar {
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.sidebar-left {
    grid-area: sidebar-left;
    background-color: var(--sidebar-bg);
    padding: 15px;
    padding-top: 35px;
    transition: transform var(--transition-duration) ease-in-out;
}

.sidebar-left-content {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}

.main-nav ul {
    list-style: none;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    margin-bottom: 8px;
    border-radius: 50px;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
    font-weight: 500;
    color: var(--text-secondary);
}

.nav-item.active,
.nav-item:hover {
    background-color: var(--button-bg);
    color: var(--text-primary);
}

.nav-item img {
    transition: filter 0.2s ease;
    filter: brightness(0) saturate(100%) invert(60%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(100%) contrast(100%);
}

.nav-item.active img,
.nav-item:hover img {
    filter: brightness(0) saturate(100%) invert(100%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(100%) contrast(100%);
}

.sidebar-right {
    grid-area: sidebar-right;
    background-color: #1E1E1E;
    border-radius: 20px;
    margin: 0 10px;
    transition: transform var(--transition-duration) ease-in-out;
}

.sidebar-right-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 12px 0 25px;
    height: 56px;
    flex-shrink: 0;
}

.sidebar-title {
    font-size: 16px;
    font-weight: 500;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 18px;
    padding: 8px;
    border-radius: 8px;
    transition: color 0.2s, background-color 0.2s;
}

.icon-btn:hover {
    color: var(--text-primary);
    background-color: #333;
}

#close-right-sidebar-btn,
#download-lightbox-close {
    font-size: 22px;
}

.sidebar-right-content {
    padding: 0 25px;
    overflow-y: auto;
    height: 100%;
    margin-bottom: 20px;
}

.sidebar-right-content::-webkit-scrollbar {
    width: 8px;
}

.sidebar-right-content::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-right-content::-webkit-scrollbar-thumb {
    background: #424242;
    border-radius: 4px;
}

.mobile-sidebar-header {
    display: none;
}


/* --- MAP & CONTENT CONTAINER --- */
#map-container {
    grid-area: main;
    position: relative;
    overflow: hidden;
    border-radius: 20px;
    transition: border-radius var(--transition-duration) ease-in-out;
}

#map {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.mapboxgl-ctrl-bottom-left,
.mapboxgl-ctrl-bottom-right {
    display: none !important;
}

.content-section {
    width: 100%;
    height: 100%;
    position: relative;
    overflow-y: auto;
}

.content-section:not(#map-section) {
    background-color: #1E1E1E;
    border-radius: 20px;
}

#data-content-wrapper,
#media-content-wrapper,
.about-content-wrapper {
    padding: 24px 32px;
}


/* --- SIDEBAR TOGGLE & MAP CONTROLS --- */
.sidebar-toggle-btn {
    position: absolute;
    z-index: 500;
    background-color: var(--sidebar-bg);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform var(--transition-duration) ease-in-out, background-color 0.2s, color 0.2s;
}

.sidebar-toggle-btn.left-toggle {
    top: 95%;
    left: 20px;
    transform: translateY(-50%) rotate(0deg);
}

#app-container.left-collapsed .sidebar-toggle-btn.left-toggle {
    transform: translateY(-50%) rotate(180deg);
}

.sidebar-toggle-btn:hover {
    background-color: #2f2f2f;
    color: var(--text-primary);
}

.map-control-btn {
    background-color: rgba(30, 30, 30, 0.9);
    border: 1px solid var(--button-bg);
    color: var(--text-secondary);
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s ease;
}

.map-control-btn:hover {
    background-color: var(--sidebar-bg);
    color: var(--text-primary);
}

.map-control-btn.active {
    background-color: #343434;
    color: var(--text-primary);
    border-color: #343434;
}

.map-controls-top-right {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 40;
    transition: opacity var(--transition-duration);
}

#app-container.right-collapsed .map-controls-top-right {
    opacity: 1;
}

#app-container:not(.right-collapsed) .map-controls-top-right {
    opacity: 0;
    pointer-events: none;
}

.map-controls-bottom-right {
    position: absolute;
    bottom: 24px;
    right: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    z-index: 40;
}

.zoom-controls {
    display: flex;
    flex-direction: column;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--button-bg);
}

.zoom-controls .zoom-btn {
    border-radius: 0;
    border: none;
    background-color: rgba(30, 30, 30, 0.9);
}

.zoom-controls .zoom-btn:first-child {
    border-bottom: 1px solid #343434;
}


/* --- FORM & LEGEND CONTROLS IN SIDEBAR --- */
.control-group {
    margin-bottom: 24px;
}

.control-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 500;
    font-size: 13px;
    color: var(--text-secondary);
}

.custom-select {
    width: 100%;
    padding: 10px 14px;
    background-color: #1E1E1E;
    border: 1px solid #4f4f4f;
    color: var(--text-secondary);
    border-radius: 8px;
    font-family: var(--font-family);
    font-weight: 400;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23B0B0B0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 1em;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 16px;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    flex-grow: 1;
    height: 5px;
    background: #333;
    border-radius: 3px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--text-primary);
    cursor: pointer;
    border-radius: 50%;
    border: 3px solid var(--sidebar-bg);
    box-shadow: 0 0 0 1px #555;
}

#pitch-value {
    background-color: var(--button-bg);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    min-width: 30px;
    text-align: center;
}

.divider {
    border: none;
    height: 1px;
    background-color: #333;
    margin-bottom: 24px;
}

.divider-bottom {
    border: none;
    height: 1px;
    background-color: #333;
    margin-top: 24px;
}

.toggle-control {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.toggle-control>label {
    margin-bottom: 0;
}

.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #424242;
    transition: .4s;
}

.switch .slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
}

input:checked+.slider {
    background-color: var(--button-hover-bg);
}

input:checked+.slider:before {
    transform: translateX(20px);
}

.switch .slider.round {
    border-radius: 24px;
}

.switch .slider.round:before {
    border-radius: 50%;
}

/* LEGEND */
#legend-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.legend-group h3 {
    font-weight: 500;
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.legend-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.legend-item input[type="checkbox"] {
    opacity: 0;
    width: 0;
    height: 0;
}

.legend-item .checkbox-slider {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    background-color: #424242;
    border-radius: 20px;
    transition: .4s;
    flex-shrink: 0;
}

.legend-item .checkbox-slider::before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: .4s;
}

.legend-item input:checked+.checkbox-slider {
    background-color: #f90;
}

.legend-item input:checked+.checkbox-slider::before {
    transform: translateX(16px);
}

.legend-symbol {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.legend-symbol.line {
    height: 3px;
    border-radius: 2px;
    width: 25px;
}

.legend-symbol.fill {
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.2);
}

.legend-item .icon-3d {
    color: #E67E22;
    font-size: 18px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}


/* --- SISA SECTION-SPECIFIC STYLES --- */
#data-section,
#media-section,
#about-studio-section {
    padding: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

#data-section::-webkit-scrollbar,
#media-section::-webkit-scrollbar,
#about-studio-section::-webkit-scrollbar {
    width: 8px;
}

#data-section::-webkit-scrollbar-track,
#media-section::-webkit-scrollbar-track,
#about-studio-section::-webkit-scrollbar-track {
    background: transparent;
}

#data-section::-webkit-scrollbar-thumb,
#media-section::-webkit-scrollbar-thumb,
#about-studio-section::-webkit-scrollbar-thumb {
    background: #424242;
    border-radius: 4px;
}

#data-loader,
#media-loader {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    color: var(--text-secondary);
}

.spinner {
    border: 4px solid rgba(255, 255, 255, 0.1);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border-left-color: #f59e0b;
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.data-header {
    margin-bottom: 24px;
}

.data-header h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.data-header p {
    font-size: 15px;
    color: var(--text-secondary);
}

#media-content-wrapper .data-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

/* Summary Cards */
.summary-grid-2-col {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.summary-grid-4-col {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.summary-card {
    background-color: #282828;
    border: 1px solid #383838;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.summary-card i {
    font-size: 22px;
    color: #f59e0b;
    background-color: #383838;
    min-width: 44px;
    height: 44px;
    border-radius: 8px;
    display: grid;
    place-items: center;
}

.summary-text {
    display: flex;
    flex-direction: column;
}

.summary-value {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}

.summary-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.summary-card-tooltip-wrapper {
    position: relative;
    display: inline-block;
}

.tooltip-content {
    visibility: hidden;
    opacity: 0;
    width: 280px;
    background-color: #444;
    color: #fff;
    text-align: left;
    border-radius: 8px;
    padding: 12px 16px;
    position: absolute;
    z-index: 10;
    bottom: 110%;
    left: 50%;
    margin-left: -140px;
    transition: opacity 0.3s, visibility 0.3s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    font-size: 13px;
    line-height: 1.6;
}

.tooltip-content::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #444 transparent transparent transparent;
}

.summary-card-tooltip-wrapper:hover .tooltip-content {
    visibility: visible;
    opacity: 1;
}

.tooltip-content p {
    margin-bottom: 8px;
    font-weight: 500;
}

.tooltip-content ul {
    list-style-position: inside;
    padding-left: 4px;
}

.tooltip-content li {
    color: var(--text-secondary);
}

.tooltip-content li strong {
    color: var(--text-primary);
}

/* Chart Styling */
.chart-card {
    background-color: #282828;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    border: 1px solid #383838;
    min-width: 0;
    margin-bottom: 24px;
}

.chart-card.large {
    grid-column: span 2;
}

.chart-card h3 {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
    flex-shrink: 0;
}

p.chart-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 20px;
    flex-shrink: 0;
}

.chart-wrapper {
    position: relative;
    flex-grow: 1;
    min-height: 250px;
}

.chart-wrapper.tall-chart {
    min-height: 350px;
}

.chart-wrapper canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
}

/* Land Use Chart Specific */
.land-use-container {
    display: flex;
    flex-grow: 1;
    gap: 24px;
    min-width: 0;
}

.land-use-chart-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    min-width: 0;
}

.chart-center-text {
    position: absolute;
    text-align: center;
}

.chart-center-text .value {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
    display: block;
}

.chart-center-text .label {
    font-size: 14px;
    color: var(--text-secondary);
}

.land-use-legend {
    flex-basis: 320px;
    overflow-y: auto;
    padding-right: 10px;
}

.land-use-legend-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 13px;
}

.legend-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.legend-color-box {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    flex-shrink: 0;
}

.legend-label {
    color: var(--text-secondary);
}

.legend-value {
    font-weight: 500;
    color: var(--text-primary);
    text-align: right;
}

.legend-percentage {
    font-size: 12px;
    color: #f59e0b;
    margin-left: 8px;
    font-weight: 500;
}

/* Composite Chart Container */
.composite-chart-container {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 20px;
}

.composite-chart-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    min-width: 160px;
}

.composite-chart-item h4 {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.chart-wrapper.small-chart {
    min-height: 150px;
    height: 150px;
    width: 150px;
    flex-grow: 0;
}

.custom-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 16px;
    margin-top: 16px;
    font-size: 12px;
    max-width: 100%;
}

.custom-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.custom-legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.custom-legend-label {
    color: var(--text-secondary);
}

/* Scrollable Legends */
.scrollable-legend,
.land-use-legend {
    overflow-y: auto;
    padding-right: 8px;
    scrollbar-width: thin;
    scrollbar-color: #555 #282828;
}

.scrollable-legend {
    max-height: 50px;
}

.scrollable-legend::-webkit-scrollbar,
.land-use-legend::-webkit-scrollbar {
    width: 6px;
}

.scrollable-legend::-webkit-scrollbar-track,
.land-use-legend::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 10px;
}

.scrollable-legend::-webkit-scrollbar-thumb,
.land-use-legend::-webkit-scrollbar-thumb {
    background-color: #555;
    border-radius: 10px;
    border: 2px solid transparent;
}

.scrollable-legend::-webkit-scrollbar-thumb:hover,
.land-use-legend::-webkit-scrollbar-thumb:hover {
    background-color: #777;
}

/* MEDIA SECTION */
.tabs {
    display: flex;
    background-color: #282828;
    border-radius: 8px;
    padding: 4px;
    border: 1px solid #383838;
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 8px 20px;
    font-size: 14px;
    font-weight: 500;
    font-family: var(--font-family);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    background-color: #3f3f3f;
    color: var(--text-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-wrapper i {
    position: absolute;
    left: 15px;
    color: var(--text-secondary);
    font-size: 14px;
}

#media-search {
    background-color: #282828;
    border: 1px solid #383838;
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 14px;
    padding: 10px 15px 10px 40px;
    width: 300px;
    transition: border-color 0.3s, box-shadow 0.3s;
}

#media-search:focus {
    outline: none;
    border-color: var(--button-hover-bg);
    box-shadow: 0 0 0 2px rgba(255, 153, 0, 0.3);
}

.media-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

#video-gallery {
    border-top: 1px solid #2d2d2d;
    padding-top: 17px;
}

.media-card {
    background-color: #282828;
    border: 1px solid #383838;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.media-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.media-card-img-wrapper {
    position: relative;
    width: 100%;
    padding-top: 75%;
    background-color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
}

.media-card-img-wrapper .card-spinner {
    border: 3px solid rgba(255, 255, 255, 0.2);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border-left-color: var(--button-hover-bg);
    animation: spin 1s ease-in-out infinite;
    position: absolute;
}

.media-card img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.media-card img.loaded {
    opacity: 1;
}

.media-card-info {
    padding: 16px;
}

.media-card-info h4 {
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.media-card-info p {
    color: var(--text-secondary);
    font-size: 13px;
}

.media-filter-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 16px 0;
    border-top: 1px solid #2d2d2d;
    border-bottom: 1px solid #2d2d2d;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.filter-wrapper {
    display: flex;
    align-items: center;
    gap: 16px;
}

.media-filter-controls label {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.media-filter-controls .custom-select {
    width: 250px;
    background-color: #282828;
}

#pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 32px;
    padding: 10px 0;
    user-select: none;
}

.page-btn {
    background-color: #282828;
    border: 1px solid #383838;
    color: var(--text-secondary);
    font-family: var(--font-family);
    font-weight: 500;
    font-size: 14px;
    min-width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-btn:hover:not(:disabled) {
    background-color: #1E1E1E;
    color: var(--text-primary);
}

.page-btn.active {
    background-color: var(--button-hover-bg);
    color: var(--bg-dark);
    border-color: var(--button-hover-bg);
    font-weight: 700;
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* LIGHTBOXES */
.lightbox-overlay {
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.4s ease;
}

.lightbox-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.lightbox-content {
    max-width: 90%;
    max-height: 80%;
    object-fit: contain;
    animation: zoomIn 0.4s ease;
}

@keyframes zoomIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

#lightbox-caption {
    margin-top: 15px;
    color: #ccc;
    font-size: 16px;
    text-align: center;
    position: absolute;
    bottom: 5%;
    width: 100%;
}

.lightbox-close {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
}

.lightbox-close:hover {
    color: #bbb;
}

.lightbox-prev,
.lightbox-next {
    cursor: pointer;
    position: absolute;
    top: 50%;
    width: auto;
    padding: 16px;
    margin-top: -50px;
    color: white;
    font-weight: bold;
    font-size: 24px;
    transition: 0.3s ease;
    border-radius: 0 3px 3px 0;
    user-select: none;
    background-color: rgba(0, 0, 0, 0.3);
}

.lightbox-prev:hover,
.lightbox-next:hover {
    background-color: rgba(0, 0, 0, 0.6);
}

.lightbox-prev {
    left: 0;
    border-radius: 3px 0 0 3px;
}

.lightbox-next {
    right: 0;
    border-radius: 3px 0 0 3px;
}

.lightbox-download {
    position: absolute;
    top: 20px;
    right: 90px;
    color: #f1f1f1;
    font-size: 24px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
    background-color: rgba(0, 0, 0, 0.3);
    padding: 12px 14px;
    border-radius: 8px;
    text-decoration: none;
}

.lightbox-download:hover {
    background-color: rgba(0, 0, 0, 0.6);
    color: #fff;
}

/* DOWNLOAD LIGHTBOX */
.download-lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(10, 10, 10, 0.7);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 3000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.download-lightbox-overlay:not(.hidden) {
    opacity: 1;
    visibility: visible;
}

.download-lightbox-container {
    background-color: #282828;
    border: 1px solid #383838;
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transform: scale(0.95);
    transition: transform 0.3s ease;
    max-height: 90vh;
}

.download-lightbox-overlay:not(.hidden) .download-lightbox-container {
    transform: scale(1);
}

.download-lightbox-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid #383838;
}

.download-lightbox-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.download-lightbox-list {
    padding: 16px 24px;
    overflow-y: auto;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.download-lightbox-list::-webkit-scrollbar {
    width: 6px;
}

.download-lightbox-list::-webkit-scrollbar-track {
    background: transparent;
}

.download-lightbox-list::-webkit-scrollbar-thumb {
    background: #4f4f4f;
    border-radius: 3px;
}

.download-item {
    display: block;
    position: relative;
    padding: 12px 12px 12px 50px;
    background-color: #1e1e1e;
    border: 1px solid #383838;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
    user-select: none;
}

.download-item:hover {
    background-color: #2f2f2f;
}

.download-item input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.download-item .checkmark {
    position: absolute;
    top: 50%;
    left: 15px;
    transform: translateY(-50%);
    height: 22px;
    width: 22px;
    background-color: #333;
    border: 1px solid #555;
    border-radius: 6px;
    transition: all 0.2s;
}

.download-item:hover input~.checkmark {
    border-color: #777;
}

.download-item input:checked~.checkmark {
    background-color: var(--button-hover-bg);
    border-color: var(--button-hover-bg);
}

.download-item .checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 7px;
    top: 3px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 3px 3px 0;
    transform: rotate(45deg);
}

.download-item input:checked~.checkmark:after {
    display: block;
}

.download-item span {
    color: var(--text-primary);
    font-weight: 500;
}

.download-lightbox-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-top: 1px solid #383838;
    background-color: #222222;
    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 16px;
}

.download-status-text {
    font-size: 13px;
    color: var(--text-secondary);
    transition: color 0.3s;
}

/* VIDEO LIGHTBOX */
.media-card.video-card .media-card-img-wrapper::after {
    content: '\f144';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 48px;
    color: rgba(255, 255, 255, 0.8);
    text-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
    transition: color 0.3s, transform 0.3s;
    pointer-events: none;
}

.media-card.video-card:hover .media-card-img-wrapper::after {
    color: white;
    transform: translate(-50%, -50%) scale(1.1);
}

#video-lightbox .video-lightbox-container {
    display: flex;
    flex-direction: column;
    width: 90%;
    max-width: 960px;
    background-color: #1E1E1E;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    animation: zoomIn 0.4s ease;
}

#video-lightbox .video-lightbox-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background-color: #282828;
    flex-shrink: 0;
}

#video-lightbox #video-lightbox-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#video-lightbox .video-lightbox-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

#video-lightbox .lightbox-download {
    position: static;
    padding: 8px 10px;
    font-size: 18px;
    background-color: transparent;
}

#video-lightbox .lightbox-download:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

#video-lightbox #video-lightbox-close {
    position: static;
    background: none;
    border: none;
    padding: 8px;
    line-height: 1;
}

#video-lightbox .video-wrapper {
    position: relative;
    padding-top: 56.25%;
    background-color: #000;
}

#video-lightbox #video-player {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#video-lightbox #video-player iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

/* ABOUT SECTION */
.about-subtitle {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 48px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #383838;
}

.about-subtitle i {
    color: var(--button-hover-bg);
}

.about-prose {
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.7;
    margin-bottom: 24px;
}

.about-prose p {
    margin-bottom: 1em;
}

.about-prose strong {
    color: var(--text-primary);
    font-weight: 500;
}

.workflow-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

.workflow-step {
    background-color: #282828;
    border: 1px solid #383838;
    border-radius: 12px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.workflow-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #333;
    display: grid;
    place-items: center;
    margin-bottom: 16px;
    font-size: 24px;
    color: var(--button-hover-bg);
}

.workflow-step h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.workflow-step p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.feature-list {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.feature-list-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    background-color: #282828;
    padding: 16px;
    border-radius: 8px;
    border: 1px solid #383838;
}

.feature-list-item i {
    font-size: 20px;
    color: var(--text-secondary);
    margin-top: 4px;
    width: 24px;
    text-align: center;
}

.feature-list-item div {
    color: var(--text-secondary);
    line-height: 1.6;
}

.feature-list-item strong {
    color: var(--text-primary);
    font-weight: 500;
}

.tileset-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
}

.tileset-item {
    background-color: #282828;
    border: 1px solid #383838;
    border-radius: 8px;
    padding: 16px 20px;
    min-width: 0;
}

.tileset-item h4 {
    color: var(--text-primary);
    margin-bottom: 4px;
}

.tileset-item p {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 12px;
}

.tileset-item pre {
    background-color: #1a1a1a;
    padding: 8px 12px;
    border-radius: 6px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    color: #a5d6ff;
    word-break: break-all;
    border: 1px solid #333;
    white-space: pre-wrap;
    word-break: break-all;
}

.credits-box {
    text-align: center;
    background-color: #282828;
    padding: 32px;
    border-radius: 12px;
    margin-top: 48px;
}

.credits-box h3 {
    margin: 0;
    font-size: 18px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.credits-box p {
    color: var(--text-secondary);
    max-width: 650px;
    margin: 16px auto 0 auto;
    line-height: 1.6;
}

.team-names {
    margin-top: 16px;
    color: var(--text-primary);
    font-weight: 500;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 12px;
}

.credit-divider {
    border: none;
    height: 1px;
    background-color: #383838;
    margin: 24px auto;
    width: 80%;
}

.acknowledgement {
    font-style: italic;
    font-size: 14px;
    margin-top: 0;
}

/* ================================================== */
/* ====== RESPONSIVE & MOBILE STYLES (768px) ====== */
/* ================================================== */
@media (max-width: 768px) {

    /* --- Sembunyikan Elemen Desktop --- */
    .main-header,
    .sidebar-toggle-btn,
    .map-controls-top-right {
        display: none;
    }

    /* --- Tampilkan Elemen Mobile --- */
    .mobile-header {
        display: flex;
    }

    .intro-title {
        font-size: 2.2rem;
    }

    .intro-subtitle {
        font-size: 1rem;
    }

    .mobile-sidebar-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0 12px 0 25px;
        height: 70px;
        border-bottom: 1px solid var(--border-color);
        flex-shrink: 0;
    }

    /* --- Atur Ulang Layout Utama --- */
    #app-container {
        display: block;
        /* Hapus grid layout */
    }

    #map-container {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
    }

    .content-section:not(#map-section) {
        border-radius: 0;
    }

    /* --- Styling Sidebar sebagai Overlay --- */
    .sidebar {
        position: fixed;
        top: 0;
        height: var(--app-height);
        z-index: 2000;
        transition: transform 0.35s ease-in-out;
        box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
        border-radius: 0;
        margin: 0;
    }

    .sidebar-left {
        left: 0;
        width: 260px;
        background-color: var(--sidebar-bg);
        transform: translateX(-100%);
        padding: 0;
        z-index: 50000;
    }

    .sidebar-left.is-open {
        transform: translateX(0);
    }

    .sidebar-left-content {
        padding: 15px;
    }

    .sidebar-right {
        right: 0;
        width: 260px;
        background-color: #1E1E1E;
        transform: translateX(100%);
        border-radius: 20px 0 0 20px;
    }

    .sidebar-right.is-open {
        transform: translateX(0);
    }

    .sidebar-right-header {
        height: 70px;
    }

    /* ===== START: PERUBAHAN UNTUK BACKDROP ===== */
    #mobile-overlay-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.6);
        z-index: 1999;
        opacity: 0;
        transition: opacity var(--transition-duration) ease;
        pointer-events: none;
    }

    #mobile-overlay-backdrop.is-visible {
        opacity: 1;
        pointer-events: auto;
    }

    /* ===== END: PERUBAHAN UNTUK BACKDROP ===== */


    body.no-scroll {
        overflow: hidden;
    }

    #data-content-wrapper,
    #media-content-wrapper,
    .about-content-wrapper {
        padding: 16px;
    }

    .map-controls-bottom-right {
        bottom: 16px;
        right: 16px;
    }

    /* Perubahan untuk chart penggunaan lahan di mobile */
    .land-use-container {
        flex-direction: column;
    }

    #landUseLegend {
        order: -1;
        /* Pindahkan legenda ke atas */
        flex-basis: auto;
        /* Hapus lebar tetap */
        overflow-y: visible;
        /* Tidak perlu scroll vertikal */
        max-height: none;
        /* Hapus batas tinggi */
        margin-bottom: 24px;
        /* Beri jarak ke chart */
        padding-right: 0;
        /* Hapus padding */
    }

    .land-use-chart-wrapper {
        min-height: 250px;
        /* Pastikan chart punya tinggi minimal */
        width: 100%;
    }

    .tileset-list {
        grid-template-columns: 1fr;
    }
}