:root {
  --primary-color: #0057FC;
  --primary-text: #0E182D;
  --primary-color-10: #0058fc10;
  --primary-color-50: #0058fc50;
  --primary-color-hover: #003fb4;
  --gray: #606781;
  --gray-300: #b4b4b4;
  --gray-200: #d5d5d5;
  --gray-100: #E2E2E2;
  --gray-80: #e7e7e7;
  --gray-50: #f1f1f1;
  --gray-10: #f4f4f4;
  --gray-5: #f8f8f8;
  --overlay-popup: rgba(0, 0, 0, 0.5);

  --pm25-6-rgb: 126, 0, 35;
  --pm25-5-rgb: 143, 63, 151; 
  --pm25-4-rgb: 255, 0, 0;    
  --pm25-3-rgb: 255, 126, 0;   
  --pm25-2-rgb: 255, 255, 0;  
  --pm25-1-rgb: 0, 228, 0; 

  --pm25-1: rgb(var(--pm25-1-rgb));
  --pm25-2: rgb(var(--pm25-2-rgb));
  --pm25-3: rgb(var(--pm25-3-rgb));
  --pm25-4: rgb(var(--pm25-4-rgb));
  --pm25-5: rgb(var(--pm25-5-rgb));
  --pm25-6: rgb(var(--pm25-6-rgb));

  --bg-opacity: 0.8;
  --pm25-1-bg: rgba(var(--pm25-1-rgb), var(--bg-opacity));
  --pm25-2-bg: rgba(var(--pm25-2-rgb), var(--bg-opacity));
  --pm25-3-bg: rgba(var(--pm25-3-rgb), var(--bg-opacity));
  --pm25-4-bg: rgba(var(--pm25-4-rgb), var(--bg-opacity));
  --pm25-5-bg: rgba(var(--pm25-5-rgb), var(--bg-opacity));
  --pm25-6-bg: rgba(var(--pm25-6-rgb), var(--bg-opacity));

  --side-bar: 340px;
  --color-scale: 60px;
  --col-24: 24px;
  --col-32: 32px;
  --col-48: 48px;
  --col-56: 56px;
  --col-72: 72px;
  --border-radius-A: 1px;
  --border-radius-B: 2px;
  --border-radius-C: 3px;
  --border-radius-D: 4px;
  --border-radius-E: 6px;
  --border-radius-F: 8px;
  --border-radius-G: 16px;
  --border-radius-X: 100px;
  --border-A: 1px solid var(--gray-50);
  --border-B: 1px solid var(--white-20);
  --border-C: 1px solid var(--gray-200);
  --border-D: 1px solid var(--gray-100);
  --white: #fff;
  --white-20: rgba(255, 255, 255, 0.2);
  --white-30: rgba(255, 255, 255, 0.3);
  --white-50: rgba(255, 255, 255, 0.5);
  --white-80: rgba(255, 255, 255, 0.8);
  --padding-A: 2px;
  --padding-B: 4px;
  --padding-C: 8px;
  --padding-D: 10px;
  --padding-E: 12px;
  --padding-F: 16px;
  --padding-G: 18px;
  --padding-H: 20px;
  --padding-K: 32px;
  --padding-CF: 8px 16px 8px 8px;
  --margin-I: 32px;
  --margin-K: 24px;
  --margin-H: 16px;
  --margin-G: 14px;
  --margin-F: 12px;
  --margin-E: 10px;
  --margin-D: 8px;
  --margin-C: 4px;
  --margin-B: 2px;
  --margin-A: 1px;
  --scale-zoom: scale(0.9);
  --font-size-input: 12px;
  --font-size-B: 16px;
  --font-size-A: 14px;
  --font-size-10: 10px;
  --line-height-input: 16px;
  --line-height-input-login: 24px;
  --transition: all ease-in 0.2s;
  --transition-1: all ease-in 0.1s;
  --box-shadow: 0px 20px 70px rgba(0, 0, 0, 0.2);
  --popup-register: 650px;
}

* {
    font-family: 'Roboto', sans-serif;
}

body {
    margin: 0;
    padding: 0;
    overflow: hidden;
}

#map {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: 1;
}

/* control buttons */
.material-icons {
    font-size: 1px;
    line-height: 1;
}

.icon {
    box-sizing: content-box;
    width: 17px;
    height: 17px;;
    background-color: #fff;

    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--padding-D);

    border: var(--border-B);
    border-radius: 20px;
    cursor: pointer;
    transition: var(--transition-1);
}

.icon:hover {
    color: var(--primary-color);
    background-color: var(--primary-color-10);
    border: var(--border-C);
    border-color: var(--primary-color-hover);
}

.controls {
    position: fixed;
    top: 0;
    right: 0;
    margin: var(--margin-K);

    width: auto;
    height: auto;

    background: transparent;
    border-radius: 20px;
    box-shadow: none;

    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.logo {
    width: 100px;
    margin-bottom: 10px;
}

.filler {
    height: 15px;
}

.zoom-controls {
    background: rgba(255, 255, 255);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: left;
    box-sizing: border-box;
    width: 38.6px;
}

.tile-controls, .tile-options {
    display: flex;
    flex-direction: row-reverse;
}

.tile-options {
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s, opacity 0.3s;
}

.tile-controls:hover .tile-options {
    opacity: 1;
    pointer-events: auto;
    transition-delay: 250ms;
}

.tile-options .icon {
    margin-right: 10px;
}

.tile-options .icon:hover {
    color: var(--primary-color);
    background-color: #fff;
    border: var(--border-C);
    border-color: var(--primary-color-hover);
}

.tile-options .icon.selected {
    background-color: #65a3fa;
    color: var(--white-80);
    border-color: var(--white-80);
}


/* popup khi ấn vào nút thông tin (i) */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 5;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.popup-overlay.active {
    opacity: 1;
    visibility: visible;
}

.popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.7);
    background: white;
    border-radius: 16px;
    padding: 24px;
    max-width: 400px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    z-index: 1001;
}

.popup-overlay.active .popup {
    transform: translate(-50%, -50%) scale(1);
}

.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.popup-title {
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

.popup-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #4a90e2;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: background-color 0.2s ease;
}

.popup-close:hover {
    background: #f0f8ff;
}

.popup-content {
    color: #555;
    line-height: 1.6;
}

.section {
    margin-bottom: 24px;
}

.section:last-child {
    margin-bottom: 0;
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
}

.section-content {
    font-size: 14px;
    line-height: 1.6;
}

.source-list {
    list-style: none;
    padding-left: 0;
}

.source-list li {
    position: relative;
    padding-left: 16px;
    margin-bottom: 8px;
}

.source-list li:before {
    content: "•";
    color: #4a90e2;
    font-weight: bold;
    position: absolute;
    left: 0;
}

.highlight {
    color: #4a90e2;
    font-weight: 500;
}

/* side bar */
.sidebar {
    position: fixed;
    box-sizing: border-box;
    width: var(--side-bar);
    height: calc(100vh - 2*var(--margin-K));
    margin: var(--margin-K);
    display: flex;
    flex-direction: column;
    background: var(--white-80);
    backdrop-filter: blur(10px);
    gap: var(--margin-D);

    z-index: 2;
    border-radius: var(--border-radius-E);
    overflow: hidden;
    box-shadow: var(--box-shadow);
    transition: height 0.3s ease;
    overflow-y: scroll;
    scrollbar-width: none;
}

.sidebar-header {
    position: sticky;
    top: 0;

    background-color: rgba(255,255,255,1);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: space-between;
    align-items: center;

    margin: 0;
    z-index: 4;
}

.page-switch {
    height: 80%;
    aspect-ratio: 1 / 1;
    padding: 0;
    margin: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.page-switch:hover {
    background: #f0f0f0;
    border-color: #999;
    color: var(--primary-color);
    background-color: var(--primary-color-10);
}

.dropdown-menu {
    z-index: 5;
    position: fixed;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 220px;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-20px);
    transition: all 0.3s ease;
    z-index: 1000;
}

.dropdown-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(0px);
}

.dropdown-section {
    padding: 12px 16px;
}

.dropdown-section:not(:last-child) {
    border-bottom: 1px solid #eee;
}

.section-label {
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    margin-bottom: 8px;
    font-weight: 600;
}

.language-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s;
}

.language-select:hover {
    border-color: #999;
}

.language-select:focus {
    outline: none;
    border-color: #4CAF50;
}

.nav-button {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 90%;
    padding: 10px 12px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.3s ease;
    text-decoration: none;
}

.nav-button:hover {
    background: #45a049;
}

.nav-button:active {
    transform: scale(0.98);
}

.nav-button .material-icons {
    font-size: 18px;
    color: white;
}

.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.sidebar-content {
    display: flex;
    flex-direction: column;
    gap: var(--margin-D);
    z-index: 3;
}

.sidebar-title {
    font-size: 1.1rem;
    font-weight: bold;
    padding: 4px 0 4px 16px;
}

.sidebar-info, .sidebar-pm25index, .sidebar-message, .sidebar-chart {
    margin: 0 var(--margin-F);
    border-radius: var(--border-radius-E);
    padding: 8px 16px;
}

.sidebar-info {
    background-color: #f5e0dc66;
    display: flex;
    gap: 20px;
    font-size: var(--font-size-A);
}

.sidebar-info > div:first-of-type {
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-pm25index {
    background-color: var(--pm25-1-bg);
    color: #000;

    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sidebar-pm25index > div:first-of-type {
    display: flex;
    flex-direction: row;
    padding: 10px;
    gap: 20px;
    align-items: center;
    justify-content: space-evenly;
    min-width: 60px;
    border-bottom: 2px solid rgba(0, 0, 0, 0.5);
}

.sidebar-pm25index > div:first-of-type > div {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px
}

.info-title {
    font-weight: 100;
    font-size: 12px;
}

.info-text, .info-pm25 {
    font-size: var(--font-size-B);
}

.info-review {
    font-size: var(--font-size-A);
    line-height: 1.5;
    padding: 5px;
}

.sidebar-info {
    background-color: #eee;
}

.sidebar-chart {
    padding: 0;
    background-color: #f5e0dc66;
}

.sidebar-message {
    background-color: #0057FC44;
    color: #000;
    font-size: var(--font-size-A);
    line-height: 1.5;
    padding: 5px 20px;
}
/* slider */
.timeline-control {
    z-index: 3;
    background: var(--white-50);
    backdrop-filter: blur(8px);
    border-radius: 5px;
    margin-right: var(--margin-K);
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    height: 40px;
    width: calc(100vw - 4*var(--padding-K) - var(--side-bar) - var(--color-scale));
    display: flex;
    gap: 10px;
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.play-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: #4a90e2;
    color: white;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.play-btn:hover {
    background: #357abd;
    transform: scale(1.05);
}

.current-time {
    display: none;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    background: #f8f9fa;
    padding: 8px 12px;
    border-radius: 6px;
}

/* Custom Range Slider */
.timeline-slider {
    position: relative;
    width: 100%;
    margin: 15px 0px;
}

.slider-track {
    width: 100%;
    height: 5px;
    background: linear-gradient(to right, #e3f2fd, #2196f3);
    border-radius: 3px;
    position: relative;
}

.slider-input {
    width: 100%;
    height: 6px;
    background: transparent;
    -webkit-appearance: none;
    appearance: none;
    position: absolute;
    top: 0;
    cursor: pointer;
}

.slider-input::-webkit-slider-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #2196f3;
    border: 3px solid white;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    cursor: pointer;
    transition: all 0.2s ease;
}

.slider-input::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 3px 10px rgba(0,0,0,0.3);
}

.slider-input::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #2196f3;
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    cursor: pointer;
}

/* Date Labels */
.date-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
}

.date-label {
    font-size: 13px;
    color: #333;
    text-align: center;
    flex: 1;
}

.date-label.active {
    color: #1b6aaa;
    font-weight: 600;
}

.date-label.today {
    background-color:  #008cff8d;
    border-radius: 15px;
    color: #ffffff;
    font-weight: 600;
}

/* Progress indicator */
.progress-fill {
    height: 100%;
    background: #2196f3;
    border-radius: 3px;
    transition: width 0.3s ease;
    width: 50%;
}

/* Responsive */
@media (max-width: 768px) {
    .timeline-control {
        width: 95%;
        padding: 15px;
    }
    
    .date-label {
        font-size: 10px;
    }
    
    .current-time {
        font-size: 14px;
    }
}

/* note */
.color-scale-container {
    z-index: 3;
    box-sizing: border-box;
    height: 152px;
    width: var(--color-scale);
    background-color: var(--white-50);
    padding: var(--padding-F);
    border-radius: var(--border-radius-E);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
}

.color-bar {
    margin-right: 8px;
    width: 3px;
    height: 120px;
    border-radius: var(--border-radius-G);
    position: relative;
    background: linear-gradient(to top, 
        #7E0023 0% 10%,
        #8F3F97 18% 28%, 
        #FF0000 36% 46%, 
        #FF7E00 54% 64%,  
        #FFFF00 72% 82%, 
        #00E400 90% 100% 
    );
}

.scale-labels {
    display: flex;
    flex-direction: column;
    height: 120px;
    justify-content: space-between;
    align-items: flex-start;
    font-size: 10px;
    font-weight: 500;
    color: #0E182D;
    opacity: 0.6;
}

/* footer */
.footer {
    padding: var(--margin-K);
    position: absolute;
    flex-direction: row-reverse;
    display: flex;
    align-items: flex-end;
    bottom: 0;
    right: 0;
    width: 100vw;
}

/* leaflet elements configuration */ 
.leaflet-tooltip.province-label {
    font-size: 16px;
    font-weight: bold;
    color: black;
    background: transparent;
    border: none;
    box-shadow: none;
    text-shadow: 
        -1px -1px 0 white,
        1px -1px 0 white,
        -1px  1px 0 white,
        1px  1px 0 white;
}

.leaflet-popup-content p {
    margin: 3px 0 !important;
}

/* plotly marker */
.hoverlayer .hovertext {
    padding: 10px !important;
    border-width: 10px !important;
    border-style: solid !important;
}