/* =================================== */
/* VARIABEL & KONFIGURASI DASAR */
/* =================================== */
:root {
    --bmkg-blue: #0056b3;
    --bmkg-light-blue: #4a86e8;
    --bmkg-dark: #2c3e50;
    --bmkg-light-gray: #e0e0e0;
    --white: #ffffff;
    --loading-overlay-bg: rgba(0, 0, 0, 0.7);
    --shadow: 0 2px 8px rgba(0,0,0,0.15);
    --border-radius: 4px;
    --header-height: 55px; /* Tinggi header dikecilkan menyesuaikan font */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Penyesuaian Body untuk Mode Embed */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.4;
    color: var(--bmkg-dark);
    background-color: #f5f7fa;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
}

/* =================================== */
/* WRAPPER EMBED (FIXED 1000x800) */
/* =================================== */
#embed-wrapper {
    width: 1000px;
    height: 800px;
    background-color: var(--white);
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* =================================== */
/* LOADING OVERLAY */
/* =================================== */
.loading-overlay {
    position: absolute; 
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--loading-overlay-bg);
    backdrop-filter: blur(3px);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.3s ease;
}

.loading-content {
    background: var(--white);
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.3);
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid var(--bmkg-light-gray);
    border-top: 5px solid var(--bmkg-blue);
    border-radius: 50%;
    margin: 0 auto 20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#loading-message {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--bmkg-blue);
}

.period-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(2px);
    z-index: 9999;
    display: none;
    justify-content: center;
    align-items: center;
}

.period-loading-content {
    background: var(--white);
    padding: 20px 30px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 3px 15px rgba(0,0,0,0.3);
    min-width: 220px;
}

.period-loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--bmkg-light-gray);
    border-top: 4px solid var(--bmkg-blue);
    border-radius: 50%;
    margin: 0 auto 15px;
    animation: spin 1s linear infinite;
}

/* =================================== */
/* HEADER DASHBOARD */
/* =================================== */
#dashboard-controls {
    background: var(--white);
    padding: 6px 15px;
    border-bottom: 1px solid var(--bmkg-light-gray);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
    z-index: 2000;
    height: var(--header-height);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Sisi Kiri */
.control-left {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1px;
    flex: 1; 
    min-width: 0;
    margin-right: 15px;
}

#dashboard-title {
    font-size: 1.0rem; /* Direvisi: Dikecilkan lagi */
    font-weight: 600;
    color: var(--bmkg-blue);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#init-info {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.7rem; /* Direvisi: Dikecilkan lagi */
    white-space: nowrap;
}

.init-label {
    font-weight: 500;
    color: var(--bmkg-dark);
}

.init-value {
    font-weight: 600;
    color: var(--bmkg-blue);
}

/* Sisi Kanan: Tiga Filter */
.control-right {
    display: flex;
    align-items: center;
    gap: 5px; 
    flex: 0 1 auto;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 3px; 
    white-space: nowrap;
}

.filter-label {
    font-size: 0.65rem; /* Direvisi: Dikecilkan lagi */
    font-weight: 600;
    color: var(--bmkg-dark);
}

.filter-group {
    min-width: 100px; /* Direvisi: Makin dirampingkan */
}

/* =================================== */
/* CUSTOM DROPDOWN (MULTI-SELECT) */
/* =================================== */
.custom-dropdown {
    position: relative;
    width: 100%;
}

.dropdown-selected {
    background: white;
    border: 1px solid var(--bmkg-light-gray);
    border-radius: var(--border-radius);
    padding: 2px 6px; 
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.65rem; /* Direvisi: Dikecilkan lagi */
}

.dropdown-arrow {
    font-size: 0.55rem; 
    color: #666;
    margin-left: 4px;
}

.dropdown-panel {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--bmkg-light-gray);
    border-radius: var(--border-radius);
    margin-top: 4px;
    box-shadow: var(--shadow);
    z-index: 2100;
    display: none;
    max-height: 250px;
    overflow-y: auto;
}

.dropdown-panel.show {
    display: block;
}

.dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 6px;
    border-bottom: 1px solid var(--bmkg-light-gray);
    position: sticky;
    top: 0;
    background: white;
    font-size: 0.65rem; /* Direvisi: Dikecilkan lagi */
}

.dropdown-list {
    padding: 2px 0;
}

.dropdown-item {
    padding: 3px 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.65rem; /* Direvisi: Dikecilkan lagi */
}

.dropdown-item:hover {
    background: #f0f0f0;
}

.close-btn {
    background: none;
    border: none;
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0 4px;
}

/* =================================== */
/* KONTEN UTAMA PETA */
/* =================================== */
.dashboard-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    height: calc(100% - var(--header-height));
}

.map-container {
    flex: 1; 
    position: relative;
    min-height: 0;
}

#map {
    height: 100%;
    width: 100%;
    background: #e6f0ff;
}

/* =================================== */
/* ELEMEN DI DALAM PETA */
/* =================================== */
#legend {
    position: absolute;
    bottom: 60px;
    right: 10px;
    background: rgba(255, 255, 255, 0.9);
    padding: 10px 12px;
    border-radius: 6px;
    z-index: 1000;
    max-width: 200px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    border: 1px solid var(--bmkg-light-gray);
}

#legend-title {
    margin-bottom: 6px;
    font-size: 0.8rem;
    font-weight: 600;
}

.legend-items {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
}

.legend-color {
    width: 20px;
    height: 12px;
    border-radius: 2px;
}

#reset-zoom-btn {
    position: absolute;
    top: 70px;
    left: 10px;
    background: rgba(255,255,255,0.9);
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 30px;
    height: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 1000;
    font-size: 16px;
}

#logo-container {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
}

#logo-bmkg {
    height: 50px;
    width: auto;
}

/* Tombol Link Baru di dalam Peta */
#btn-open-full {
    position: absolute;
    top: 20px;
    right: 75px; 
    z-index: 1000;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(2px);
    padding: 4px 10px;
    border-radius: 4px;
    color: #777777;
    text-decoration: none;
    font-size: 0.7rem;
    font-weight: 500;
    border: 1px solid rgba(0,0,0,0.1);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

#btn-open-full:hover {
    background: rgba(255, 255, 255, 0.95);
    color: var(--bmkg-blue);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-color: rgba(0,0,0,0.25);
}

.btn-arrow {
    font-weight: bold;
}

.map-copyright {
    position: absolute;
    bottom: 10px;
    right: 10px;
    z-index: 1000;
    font-size: 0.65rem;
    color: #333;
    text-shadow: 1px 1px 1px rgba(255,255,255,0.8);
}
