
/* ══════════════════════════════════════════════════════════════
   VN-ClimateGIS — Custom CSS
   ══════════════════════════════════════════════════════════════
   ✅ Bỏ ~90% !important — chỉ giữ khi override thư viện ngoài
   ✅ Dark mode dùng .dark (Tailwind) thay prefers-color-scheme
   ✅ Mobile responsive: touch target, font scale, slider
   ✅ Việt hóa comment đầy đủ
   ══════════════════════════════════════════════════════════════ */


/* ═══ 1. FONT HỆ THỐNG ═══ */
#top-filter-bar,
#top-toolbar,
#variable-panel {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}


/* ═══ 2. DROPDOWN Z-INDEX (cao hơn toolbar & map) ═══ */
#dropdown-region,
#dropdown-variable,
#dropdown-scenario,
#dropdown-time {
  z-index: 600;
}


/* ═══ 3. DANH SÁCH KỊCH BẢN (SSP) ═══ */
#scenario-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#scenario-list button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: 1rem;
  border: 1px solid rgba(226, 232, 240, 0.8);
  background-color: rgba(248, 250, 252, 0.5);
  transition: all 0.2s ease;
}

#scenario-list button:hover {
  border-color: #60a5fa;
  background-color: rgba(239, 246, 255, 0.6);
}

#scenario-list button.border-blue-500 {
  border-color: #38bdf8;
  background-color: rgba(224, 242, 254, 0.8);
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

/* Dark mode — kịch bản */
.dark #scenario-list button {
  border-color: rgba(51, 65, 85, 0.8);
  background-color: rgba(30, 41, 59, 0.5);
}

.dark #scenario-list button:hover {
  border-color: #3b82f6;
  background-color: rgba(30, 58, 138, 0.3);
}

.dark #scenario-list button.border-blue-500 {
  border-color: #3b82f6;
  background-color: rgba(30, 58, 138, 0.4);
}


/* ═══ 4. GIAI ĐOẠN (Period buttons) ═══ */
#period-list button {
  padding: 12px;
}

#period-list button div:first-child {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
}

#period-list button div:last-child,
#period-list button p:last-child {
  font-size: 13px;
  font-weight: 500;
  color: #64748b;
  margin-top: 2px;
}

.dark #period-list button div:first-child {
  color: #f1f5f9;
}

.dark #period-list button div:last-child,
.dark #period-list button p:last-child {
  color: #94a3b8;
}


/* ═══ 5. PHÂN KỲ: NĂM / MÙA / THÁNG ═══ */

/* Tab chọn kiểu phân kỳ */
.ttype-btn {
  font-size: 14px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 8px;
}

/* Danh sách mùa */
#season-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 160px;
}

#season-list > button,
#season-list > div {
  width: 100%;
  font-size: 14px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-sizing: border-box;
}


/* ═══ 6. THANH TRƯỢT THÁNG (Range Slider) ═══ */
input[type=range]#month-slider,
.compare-month-range {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 999px;
  outline: none;
  transition: background 0.2s;
  background: linear-gradient(to right, #bfdbfe, #3b82f6, #bfdbfe);
}

/* Webkit thumb (Chrome, Safari, Edge) */
input[type=range]#month-slider::-webkit-slider-thumb,
.compare-month-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #2563eb;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.4);
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.15s ease;
}

input[type=range]#month-slider::-webkit-slider-thumb:hover,
.compare-month-range::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.5);
}

/* Firefox thumb */
input[type=range]#month-slider::-moz-range-thumb,
.compare-month-range::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #2563eb;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.4);
  cursor: pointer;
}

/* Firefox track */
input[type=range]#month-slider::-moz-range-track,
.compare-month-range::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(to right, #bfdbfe, #3b82f6, #bfdbfe);
}

/* Focus ring — accessibility */
input[type=range]#month-slider:focus-visible,
.compare-month-range:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 4px;
  border-radius: 999px;
}

/* Dark mode — slider */
.dark input[type=range]#month-slider,
.dark .compare-month-range {
  background: linear-gradient(to right, #1e3a5f, #3b82f6, #1e3a5f);
}

.dark input[type=range]#month-slider::-webkit-slider-thumb,
.dark .compare-month-range::-webkit-slider-thumb {
  background: #60a5fa;
  border-color: #1e293b;
}

.dark input[type=range]#month-slider::-moz-range-thumb,
.dark .compare-month-range::-moz-range-thumb {
  background: #60a5fa;
  border-color: #1e293b;
}

.dark input[type=range]#month-slider::-moz-range-track,
.dark .compare-month-range::-moz-range-track {
  background: linear-gradient(to right, #1e3a5f, #3b82f6, #1e3a5f);
}


/* ═══ 7. MOBILE RESPONSIVE ═══ */
@media (max-width: 640px) {

  /* Kịch bản — padding nhỏ hơn */
  #scenario-list button {
    padding: 10px 12px;
  }

  /* Giai đoạn — font vừa phải */
  #period-list button div:first-child {
    font-size: 14px;
  }

  /* Tab phân kỳ — touch target đủ 44px */
  .ttype-btn {
    min-height: 44px;
    font-size: 13px;
  }

  /* Danh sách mùa — touch target */
  #season-list > button,
  #season-list > div {
    min-height: 44px;
    padding: 10px 14px;
  }

  /* Slider thumb lớn hơn cho ngón tay */
  input[type=range]#month-slider::-webkit-slider-thumb,
  .compare-month-range::-webkit-slider-thumb {
    width: 24px;
    height: 24px;
  }

  input[type=range]#month-slider::-moz-range-thumb,
  .compare-month-range::-moz-range-thumb {
    width: 24px;
    height: 24px;
  }

  /* Slider track dày hơn — dễ tap */
  input[type=range]#month-slider,
  .compare-month-range {
    height: 8px;
  }
}


/* ═══ 8. SCROLLBAR ẨN (cho dropdown, quick nav) ═══ */
.scrollbar-none {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.scrollbar-none::-webkit-scrollbar {
  display: none;
}


/* ═══ 9. SLIDE-UP ANIMATION (cho modal bottom sheet) ═══ */
@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}


/* ═══ 10. TIỆN ÍCH BỔ SUNG ═══ */

/* Skeleton loading — dùng cho tile/chart đang tải */
.skeleton-pulse {
  animation: pulse 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

/* Ngăn body cuộn khi modal mở */
body.modal-open {
  overflow: hidden;
  touch-action: none;
}

/* Toast notification — fade in/out */
.toast-enter {
  animation: fadeSlideIn 0.3s ease-out;
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ═══════════════════════════════════════
   SCENARIO DROPDOWN — Hover effect
   ═══════════════════════════════════════ */
.scenario-doc-item {
  display: block;
  width: 100%;
  padding: 10px 16px;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: #cbd5e1;
  white-space: nowrap;
  border-left: 2px solid transparent;
  background: transparent;
  transition: all 0.15s ease;
  cursor: pointer;
}

.scenario-doc-item:hover {
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.1);
  border-left-color: #f59e0b;
  padding-left: 20px;
}

.scenario-doc-item:active {
  background: rgba(245, 158, 11, 0.2);
}

#desktop-nav .nav-btn {
  color: #cbd5e1;
  background: transparent;
  border-radius: 0.375rem;
  transition: all 0.15s ease;
}

#desktop-nav .nav-btn:hover {
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.1);
}

#desktop-nav .nav-btn:active {
  background: rgba(245, 158, 11, 0.18);
}
/* ═══ 13. SCENARIO VIEWER — Trang đôi cách nhau ═══ */
#scenario-pages {
  gap: 6px;
}

/* Ẩn badge zoom "100%" */
#scenario-zoom-badge {
  display: none;
}

/* Tab mặc định */
.sv-doc-tab {
  color: #64748b;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
}
.sv-doc-tab:hover {
  color: #0f172a;
  background: #f1f5f9;
}

/* Tab đang chọn — xanh dương nổi bật */
.sv-doc-tab.active {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
  font-weight: 700;
}

.scrollbar-none { -ms-overflow-style: none; scrollbar-width: none; }
.scrollbar-none::-webkit-scrollbar { display: none; }
