:root {
  --glass-bg: rgba(255, 255, 255, 0.95);
  --accent: #FFC107; /* kuning aksen */
  --card-radius: 12px;
  --shadow-soft: 0 6px 20px rgba(12, 20, 30, 0.12);
  --frost: rgba(255, 255, 255, 0.55);
  /* Tambahan: Variabel untuk background panel gelap/transparan */
  --dark-glass-bg: linear-gradient(180deg, rgba(0, 0, 0, 0.42), rgba(0, 0, 0, 0.22));
}

/* ======================= */
/* GLOBAL LAYOUT & RESET   */
/* ======================= */
html, body, #map {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  font-family: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial;
}

/* Map container fills viewport */
#map {
  position: fixed;
  inset: 0;
  z-index: 0;
}

/* ======================= */
/* LEFT PANEL              */
/* ======================= */
.left-panel {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: 325px;
  z-index: 1100;
  display: flex;
  flex-direction: row;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.4) transparent;
  background: transparent;
  backdrop-filter: none;
  border-radius: 0 8px 8px 0;
  box-shadow: none;
  padding: 0;
  /* Dihapus: Vendor prefixes yang berlebihan */
  transition: transform 0.28s ease; 
}

.left-panel.collapsed {
  transform: translateX(-295px);
}

.left-panel .location {
  font-weight: 600;
}

/* Kolom 1: Konten */
.panel-content-wrapper {
  width: 295px; 
  flex-shrink: 0; 
  height: 100%;

  display: flex;
  flex-direction: column;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.4) transparent;

  background: linear-gradient(180deg, var(--glass-bg), rgb(243, 242, 242));
  backdrop-filter: blur(8px);
  border-radius: 0 8px 8px 0; 
  box-shadow: var(--shadow-soft);
  padding: 18px 4px;
}

/* Kolom 2: Tombol */
.panel-button-wrapper {
  width: 30px; 
  flex-shrink: 0;
  height: 100%;
  
  background: transparent; 
  
  display: flex;
  align-items: center;
  justify-content: start;
  pointer-events: none;
}

/* ======================= */
/* COLLAPSE BUTTON         */
/* ======================= */
#collapseBtn {
  width: 30px; 
  height: 60px; 

  display: flex;
  align-items: center;
  justify-content: center;

  border: none;
  border-radius: 0 10px 10px 0; 
  /* Menggunakan nilai yang konsisten */
  background: linear-gradient(180deg, var(--glass-bg), rgb(243, 242, 242));
  box-shadow: var(--shadow-soft); 

  cursor: pointer;
  pointer-events: auto;
}

/* Dihapus: Aturan .left-panel.collapsed + #collapseBtn yang tidak efektif */

.no-transition {
  transition: none !important;
}

/* ======================= */
/* MAP SPINNER             */
/* ======================= */
.map-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2000;
  display: none;
}


/* ======================= */
/* TOP ICONS               */
/* ======================= */
.top-icons {
  position: fixed;
  top: 18px;
  z-index: 900;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  left: 315px;
  /* Dihapus: Vendor prefixes yang berlebihan */
  transition: left 0.28s ease, opacity 0.28s ease, visibility 0.28s ease, transform 0.28s ease; 
}

.icon-cluster {
  display: flex;
  gap: 4px;
  background: var(--glass-bg);
  border-radius: 8px;
  padding: 2px 2px;

  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-soft);
}

.icon-btn {
  width: 35px;
  height: 35px;

  display: flex;
  align-items: center;
  justify-content: center;

  border: none;
  border-radius: 8px;
  background: transparent;
  color: #242323;
  font-size: 20px;
  cursor: pointer;
  padding: 0;
  transition: transform .18s, background-color .18s;
}

.icon-btn:hover,
.icon-btn.active {
  background-color: var(--accent);
}

/* ======================= */
/* SEARCH BAR              */
/* ======================= */
.search-bar {
  flex: 1; 
  position: relative; 
}

.search-input {
  background: var(--glass-bg);
  backdrop-filter: blur(6px);
  border-radius: 999px;
  padding: 4px 16px;
  border: 0;
  box-shadow: var(--shadow-soft);
}


/* ======================= */
/* TIME PANEL (BOTTOM)     */
/* ======================= */
.time-panel {
  position: fixed;
  right: 20px;
  left: 315px;
  bottom: 18px;
  height: 82px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 12px;
  /* Menggunakan variabel dark-glass-bg */
  background: var(--dark-glass-bg);
  color: #fff;
  padding: 12px;
  z-index: 1500px;
  /* Dihapus: Vendor prefixes yang berlebihan */
  transition: left 0.28s ease;
}

.time-track {
  flex: 1;
  height: 36px;
  display: flex;
  align-items: center;
  padding: 6px 10px;
  overflow-x: auto;

  background: rgba(255, 255, 255, 0.06);
  border-radius: 12px;
}

.time-step {
  min-width: 84px;
  text-align: center;
  font-size: 13px;
  padding: 6px;
  border-radius: 8px;
}

.time-now {
  background: var(--accent);
  color: #000;
  font-weight: 700;
}


/* ======================= */
/* GRAFIK & RUTE PANEL     */
/* ======================= */

#harianGrafik {
  background: linear-gradient(170deg, #34495e, #2c3e50);
  color: #FFFFFF;
  border-radius: 8px;
}

#rutePanel {
  background: linear-gradient(170deg, #34495e, #2c3e50);
  box-shadow: var(--shadow-soft);
  color: #FFFFFF;
  border-radius: 8px;
  padding: 0;
  position: fixed;
  right: 18px;
  top: 80px;
  z-index: 1000;

  width: 275px;
  max-width: 86vw;
  overflow: auto;
  font-size: 12px;
  
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.4) transparent;
}

.toast-container {
    position: fixed; bottom: 20px; right: 20px; z-index: 9999;
}
.toast-msg {
    background: #333; color: #fff; padding: 12px 20px; margin-top: 10px;
    border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    animation: fadeIn 0.3s, fadeOut 0.5s 2.5s forwards;
}
@keyframes fadeIn { from {opacity:0; transform:translateY(20px);} to {opacity:1; transform:translateY(0);} }
@keyframes fadeOut { from {opacity:1;} to {opacity:0;} }

/* ======================= */
/* LEGEND                  */
/* ======================= */
.legend {
  position: fixed;
  right: 18px;
  bottom: 120px;
  z-index: 1000;

  background: var(--glass-bg);
  padding-left: 10px;
  padding-right: 10px;
  padding-top: 2px;
  padding-bottom: 2px;
  border-radius: 10px;
  box-shadow: var(--shadow-soft);
}

/* ======================= */
/* FORECAST CARDS          */
/* ======================= */
.rec {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 12px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.rec:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.forecast-row::-webkit-scrollbar {
  height: 6px;
}

.forecast-row::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 4px;
}


/* Sembunyikan elemen mobile di DESKTOP */
#mobile-icon-grid,
.time-panel-controls,
#mobile-logo-wrapper { 
  display: none;
}

/* Header mobile diposisikan untuk desktop */
#mobile-header {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 999;
  width: 320px;
  display: flex;
}


/* ROUTING */
.autocomplete-list {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid #ddd;
}
.autocomplete-item {
  padding: 8px 12px;
  cursor: pointer;
}
.autocomplete-item:hover {
  background-color: #f0f0f0;
}

/* Container Utama Timeline - Glassmorphism Effect */
.timeline-container {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 16px;
  padding: 12px 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  width: 100%;      
  transition: all 0.3s ease;
}

/* Tombol Play Kustom */
.btn-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #0d6efd; 
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  transition: transform 0.2s, background 0.2s;
}

.btn-circle:hover {
  background: #0b5ed7;
  transform: scale(1.1);
  color: white;
}

.btn-circle:active {
  transform: scale(0.95);
}

/* --- KUSTOMISASI SLIDER (Kode yang tidak terpakai dihapus) --- */

.timeline-wrapper {
    display: flex;
    align-items: center;
    margin-left: 10px;
    padding: 0 15px; 
    position: relative;
    height: 30px;
    box-sizing: border-box; 
}

/* Container Track (Background Gelap) */
.timeline-track-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #444;
    border-radius: 30px;
    overflow: hidden;
    display: flex;
    pointer-events: none;
}

/* Grid Hari (Layer Teks) */
.timeline-labels-container {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    display: flex;
    z-index: 2; 
}

.day-block {
    border-right: 1px solid rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #ccc;
    white-space: nowrap;
    overflow: hidden;
    text-shadow: 0 1px 2px black;
}

/* Progress Bar (Bar Putih yang jalan) */
.timeline-progress-bar {
    background: rgba(0, 255, 8, 0.677); 
    height: 100%;
    width: 0%;
    z-index: 1;
    transition: width 0.1s linear;
    box-shadow: 0 0 10px rgba(0, 200, 81, 0.5);
}

/* Tooltip Kuning */
.timeline-tooltip {
    position: absolute;
    top: -28px; 
    left: 0;
    transform: translateX(-50%); 
    background: #ffcc00;
    color: #000;
    font-weight: bold;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    opacity: 0; 
    transition: opacity 0.2s, left 0.1s linear;
    pointer-events: none;
    white-space: nowrap;
    z-index: 10;
}

/* Segitiga kecil di bawah tooltip */
.timeline-tooltip::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    margin-left: -4px;
    border-width: 4px;
    border-style: solid;
    border-color: #ffcc00 transparent transparent transparent;
}

/* Slider Transparan (Invisible Touch Area) */
/* Ini adalah elemen yang digunakan untuk interaksi */
.custom-slider-invisible {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    opacity: 0; 
    cursor: pointer;
    margin: 0;
    z-index: 5; 
    -webkit-appearance: none; 
}

/* Tick Marks pada Slider */
.tick-mark {
    position: absolute;
    bottom: 0;
    width: 1px;
    height: 8px; /* Sedikit lebih tinggi dari bar */
    background: rgba(255, 255, 255, 0.4); /* Putih transparan */
    z-index: 1;
    pointer-events: none;
}

/* ======================= */
/* RESPONSIVE TWEAKS       */
/* ======================= */


@media (max-width: 767px) {

  .icon-btn.active {
    background-color: var(--accent);
  }

  .icon-btn:hover {
    background-color: rgba(0, 0, 0, 0.1);
  }

  .icon-btn.active:hover {
    background-color: var(--accent);
  }
  
  /* 1. Panel Kiri */
  .left-panel { width: 100vw; padding: 0; transition: transform 0.28s ease; }
  .panel-content-wrapper { width: 85vw; padding: 14px; }
  .panel-button-wrapper { width: 15vw; }
  .left-panel.collapsed { pointer-events: none; transform: translateX(-85vw); }

  /* 2. Sembunyikan Ikon Desktop */
  .top-icons {
    display: none;
  }

  /* 3. Panel Bawah (Time Panel) */
  .time-panel {
    flex-direction: column;
    height: auto;
    max-height: 50vh;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    border-radius: 12px 12px 0 0;
    padding: 8px;
    gap: 8px;
    background: linear-gradient(180deg, var(--glass-bg), rgb(243, 242, 242));
    transition: max-height 0.28s ease;
    z-index: 1500px;
  }
  body.mobile-grid-collapsed .time-panel {
    max-height: 50px;
  }

  /* Sembunyikan playBtn (Desktop) di mobile */
  #playBtn {
    display: none;
  }

  /* 5. Grid Ikon Mobile */
  #mobile-icon-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    width: 100%;
    max-height: 150px;
    opacity: 1;
    overflow-y: auto;
    transition: all 0.28s ease;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 12px;
    padding: 10px;
  }
  body.mobile-grid-collapsed #mobile-icon-grid {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
    overflow-y: hidden;
  }

  /* 6. Kontrol Panel Bawah */
  .time-panel-controls {
    display: flex;
    flex-direction: row;
    gap: 6px;
    background: var(--glass-bg);
    border-radius: 8px;    
    padding-left: 20px;
    padding-right: 20px;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-soft);
  }
  .time-panel-controls .icon-btn {
    width: 35px;
    height: 35px;
    background: transparent;
    color: #242323;
    font-size: 20px;
  }
  .time-panel-controls .icon-btn:hover,
  .time-panel-controls .icon-btn.active {
    background-color: var(--accent);
  }
  #mobileCollapseBtn .bi-chevron-up { display: none; }
  body.mobile-grid-collapsed #mobileCollapseBtn .bi-chevron-down { display: none; }
  body.mobile-grid-collapsed #mobileCollapseBtn .bi-chevron-up { display: block; }


  /* 7. Posisi Legenda */
  .legend {
    top: auto; 
    right: 10px;
    bottom: 230px; 
    transition: opacity 0.28s, visibility 0.28s, transform 0.28s, bottom 0.28s ease;
    transform: translateX(0);
  }
  body.mobile-grid-collapsed .legend {
    bottom: 60px; 
  }

  /* 6. Header Mobile (PEMBUNGKUS) */
  #mobile-header {
      display: flex; 
      align-items: center;
      gap: 10px;
      position: fixed; 
      z-index: 998;
      top: 20px; 
      left: 5vw; 
      width: 90vw; 
      transition: opacity 0.28s, visibility 0.28s, transform 0.28s;
  }

  #mobile-header .search-bar {
      position: relative; 
      transform: none;
      flex: 1; 
      width: auto; 
      max-width: none; 
  }

  /* 7. Logo (di dalam header) */
  #mobile-logo-wrapper {
    display: block; 
    position: static; 
  }

  #mobile-logo-wrapper img {
    height: 40px;
    box-shadow: var(--shadow-soft);
    border-radius: 8px;
    background: var(--glass-bg);
  }

  .search-input {
    padding: 8px 16px;
    width: 100%; 
  }

  /* 9. Aturan Sembunyikan yang DIPERBAIKI (Menggunakan opacity: 0) */  

  /* Sembunyikan elemen bawah (slide ke bawah) */
  body.panel-expanded-mobile .time-panel,
  body.panel-expanded-mobile .legend {
    opacity: 0;
    visibility: hidden;
    transform: translateY(100%);
    pointer-events: none;
  }

  /* Sembunyikan elemen atas (slide ke atas) */
  body.panel-expanded-mobile #mobile-header {
    opacity: 0; /* FIX: Diubah dari 100% menjadi 0 */
    visibility: hidden;
    transform: translateY(-150%);
    pointer-events: none;
  }

  #rutePanel {
      top: auto;        /* Reset top */
      bottom: 80px;     /* Taruh di atas panel waktu */
      right: 10px;      /* Margin kanan */
      left: 10px;       /* Margin kiri */
      width: auto;      /* Lebar otomatis mengikuti margin */
      max-width: none;  /* Reset max-width */
      max-height: 150px; /* Batasi tinggi agar tidak menutupi peta penuh */
      overflow-y: auto;  /* Scroll jika konten panjang */
      
      /* Opsional: Tambahkan transisi slide */
      transform: translateY(0);
      transition: transform 0.3s ease;
  }
  
  /* Kelas bantuan jika ingin di-hide total via JS toggle */
  #rutePanel.hidden-mobile {
      transform: translateY(200%);
  }
}