body,
html {
  margin: 0;
  padding: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: #0f172a;
  font-family:
    "Segoe UI",
    system-ui,
    -apple-system,
    sans-serif;
}
.hidden {
  display: none !important;
}
.rv-pill {
  position: relative;
}

.tab-bar {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 50px;
  background: rgba(15, 23, 42, 0.95);
  border-bottom: 1px solid #334155;
  display: flex;
  align-items: center;
  z-index: 9999;
  padding-left: 15px;
}

.app-title {
  font-weight: 800;
  color: #38bdf8;
  margin-right: 30px;
  letter-spacing: 1px;
}

.tab-btn {
  background: none;
  border: none;
  color: #94a3b8;
  height: 100%;
  padding: 0 20px;
  cursor: pointer;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 3px solid transparent;
}

.tab-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
  color: #38bdf8;
  border-bottom: 3px solid #38bdf8;
}

.map-wrapper {
  position: absolute;
  top: 50px;
  left: 0;
  right: 0;
  bottom: 0;
  visibility: hidden;
  opacity: 0;
  z-index: 0;
  transition: opacity 0.25s;
}

.map-wrapper.active {
  visibility: visible;
  opacity: 1;
  z-index: 10;
}

#windy,
#mapbox {
  width: 100%;
  height: 100%;
}
/* =========================
   MOBILE COLLAPSIBLE PANEL
========================= */
@media (max-width: 768px) {
  .panel {
    top: auto;
    left: 10px;
    right: 10px;
    bottom: 10px;

    width: auto;
    max-width: none;

    padding: 0;
    border-radius: 14px;
    overflow: hidden;

    max-height: 55vh;
  }

  /* header nhỏ gọn */
  .panel .panel-header {
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    user-select: none;

    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  /* nội dung panel */
  .panel .panel-body {
    padding: 10px 12px;
    overflow-y: auto;
    max-height: 45vh;
  }

  /* mặc định: collapse */
  .panel.mobile-collapsed .panel-body {
    display: none;
  }
}
.panel {
  position: absolute;
  top: 70px;
  left: 20px;
  width: 380px;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(10px);
  color: #e2e8f0;
  padding: 15px;
  border-radius: 8px;
  z-index: 10000;
  border: 1px solid rgba(255, 255, 255, 0.1);
  max-height: 85vh;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.ai-result {
  margin-top: 15px;
  padding: 12px;
  background: rgba(14, 165, 233, 0.1);
  border-radius: 6px;
  font-size: 0.9em;
  display: none;
  line-height: 1.5;
  border: 1px solid rgba(56, 189, 248, 0.2);
}

.badge {
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: bold;
  text-transform: uppercase;
}

.badge-high {
  background: #ef4444;
  color: #fff;
}

.badge-med {
  background: #eab308;
  color: #000;
}

.badge-low {
  background: #22c55e;
  color: #fff;
}

.small {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 8px;
  line-height: 1.4;
}

/* ===== Windy-like RIGHT SIDEBAR (Mapbox tab only) ===== */
.rv-sidebar {
  position: absolute;
  right: 16px;
  top: 92px;
  z-index: 10001;
  display: none;
  gap: 10px;
  flex-direction: column;
  align-items: flex-end;
  pointer-events: auto !important;
  user-select: none;
}

.rv-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.25);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  color: #e2e8f0;
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition:
    transform 0.12s ease,
    background 0.12s ease,
    border-color 0.12s ease;
}

.rv-pill:hover {
  transform: translateX(-2px);
  border-color: rgba(56, 189, 248, 0.45);
}

.rv-pill .label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2px;
  opacity: 0.9;
}

.rv-pill .dot {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(2, 6, 23, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.22);
  color: #cbd5e1;
  flex: 0 0 34px;
}

.rv-pill.active {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.55);
}

.rv-pill.active .dot {
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.45);
}

.rv-fab {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.25);
  color: #e2e8f0;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
}

.rv-fab.active {
  border-color: rgba(56, 189, 248, 0.6);
  color: #38bdf8;
}

.rv-mini {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 10001;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 12px;
  padding: 10px 12px;
  color: #e2e8f0;
  width: 260px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
  font-size: 12px;
}

.rv-mini .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
}

.rv-mini input[type="range"] {
  width: 100%;
}

.rv-mini .muted {
  opacity: 0.75;
}

.rv-mini .btn {
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(2, 6, 23, 0.45);
  color: #e2e8f0;
  cursor: pointer;
}

/* ===== EVN SEARCH (Mapbox tab) ===== */
.evn-search {
  position: absolute;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15050;
  width: 360px;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(10px);
  color: #e2e8f0;
  padding: 10px;
  display: none;
  pointer-events: auto;
}

.evn-search.show {
  display: block;
}

.evn-search .head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.evn-search .title {
  font-weight: 900;
  color: #38bdf8;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.evn-search .close {
  width: 32px;
  height: 30px;
  border-radius: 10px;
  cursor: pointer;
  background: rgba(2, 6, 23, 0.45);
  border: 1px solid rgba(148, 163, 184, 0.25);
  color: #e2e8f0;
}

.evn-search .inp-wrap {
  display: flex;
  gap: 8px;
  align-items: center;
}

.evn-search input {
  flex: 1;
  width: 100%;
  padding: 9px 10px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(2, 6, 23, 0.45);
  color: #e2e8f0;
  outline: none;
}

.evn-search .meta {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 6px;
  opacity: 0.95;
}

.evn-search .list {
  margin-top: 8px;
  max-height: 38vh;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.evn-search .item {
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(2, 6, 23, 0.35);
  border-radius: 12px;
  padding: 9px 10px;
  cursor: pointer;
  user-select: none;
}

.evn-search .item:hover {
  border-color: rgba(56, 189, 248, 0.45);
  background: rgba(56, 189, 248, 0.08);
}

.evn-search .item .t {
  font-weight: 900;
  color: #e2e8f0;
  margin-bottom: 4px;
  font-size: 12px;
}

.evn-search .item .m {
  font-size: 11px;
  color: #cbd5e1;
  opacity: 0.9;
  line-height: 1.35;
}

/* ===== Bottom Weather Bar (shared for both tabs) ===== */
.weather-bar {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 12000;
  background: rgba(0, 0, 0, 0.86);
  border: 1px solid rgba(0, 150, 255, 0.25);
  border-radius: 12px;
  color: #e5e7eb;
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}

.weather-bar.hidden {
  display: none;
}

.weather-bar__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: linear-gradient(135deg,
      rgba(0, 26, 51, 0.9),
      rgba(0, 61, 102, 0.7));
}

.weather-bar__title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #00ccff;
  font-weight: 600;
  font-size: 13px;
}

.weather-bar__controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.wb-btn {
  background: rgba(0, 150, 255, 0.15);
  border: 1px solid rgba(0, 150, 255, 0.25);
  color: #e5e7eb;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
}

.wb-btn.active {
  background: rgba(0, 150, 255, 0.32);
  border-color: rgba(0, 204, 255, 0.6);
  color: #00ccff;
}

.wb-icon {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #e5e7eb;
  width: 32px;
  height: 30px;
  border-radius: 8px;
  cursor: pointer;
}

.weather-bar__content {
  padding: 10px 12px;
  max-height: 28vh;
  overflow: auto;
}

.weather-bar__footer {
  padding: 8px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 11px;
  color: #94a3b8;
}

.wb-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.wb-card {
  background: rgba(0, 50, 100, 0.25);
  border: 1px solid rgba(0, 150, 255, 0.15);
  border-radius: 10px;
  padding: 10px;
  min-width: 170px;
}

.wb-kv {
  font-size: 12px;
  color: #cbd5e1;
  line-height: 1.6;
}

.wb-kv b {
  color: #00ccff;
}

.wb-hourly {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.wb-chip {
  flex: 0 0 auto;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 8px 10px;
  min-width: 140px;
  font-size: 12px;
}

.wb-chip .t {
  color: #00ccff;
  font-weight: 700;
  margin-bottom: 4px;
}

.wb-chip .m {
  color: #cbd5e1;
  opacity: 0.95;
}

/* ===== Windy Webcams UI ===== */
.wc-fab {
  position: absolute;
  right: 16px;
  top: 70px;
  z-index: 16000;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(15, 23, 42, 0.85);
  color: #e2e8f0;
  cursor: pointer;
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.wc-fab.active {
  border-color: rgba(56, 189, 248, 0.65);
  color: #38bdf8;
}

#webcamsPanel {
  position: absolute;
  right: 16px;
  top: 120px;
  z-index: 16000;
  width: 360px;
  max-height: 60vh;
  overflow: auto;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(10px);
  color: #e2e8f0;
  padding: 10px;
  display: none;
}

.wc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.wc-title {
  font-weight: 800;
  color: #38bdf8;
}

.wc-x {
  width: 32px;
  height: 30px;
  border-radius: 10px;
  cursor: pointer;
  background: rgba(2, 6, 23, 0.45);
  border: 1px solid rgba(148, 163, 184, 0.25);
  color: #e2e8f0;
}

.wc-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
  flex-wrap: wrap;
}

.wc-btn {
  padding: 8px 10px;
  border-radius: 12px;
  cursor: pointer;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #e2e8f0;
  font-weight: 700;
  font-size: 12px;
  user-select: none;
}

.wc-btn:active {
  transform: translateY(1px);
}

.wc-lbl {
  font-size: 12px;
  color: #cbd5e1;
  display: flex;
  gap: 8px;
  align-items: center;
}

.wc-inp {
  width: 80px;
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(2, 6, 23, 0.45);
  color: #e2e8f0;
}

.wc-list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wc-item {
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(2, 6, 23, 0.35);
  border-radius: 12px;
  padding: 10px;
}

.wc-item .t {
  font-weight: 800;
  margin-bottom: 8px;
}

.wc-item img {
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.wc-item a {
  color: #38bdf8;
  text-decoration: none;
  font-weight: 700;
}

.wc-item .m {
  font-size: 12px;
  color: #cbd5e1;
  opacity: 0.9;
  margin-top: 6px;
}

/* ===== Webcam Modal ===== */
#wcModal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 20000;
  background: rgba(0, 0, 0, 0.75);
}

#wcModal .box {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(980px, 94vw);
  height: min(620px, 76vh);
  background: rgba(15, 23, 42, 0.98);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

#wcModal .head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

#wcModalTitle {
  color: #38bdf8;
  font-weight: 800;
  font-size: 14px;
  max-width: 80%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#wcModalBody {
  width: 100%;
  height: calc(100% - 52px);
  background: rgba(2, 6, 23, 0.35);
}


/* =======================
   MOBILE RESPONSIVE FIXES
   ======================= */
:root{
  /* Keep text consistent across devices */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Base sizing (desktop/tablet) */
html{ font-size: 16px; }
body{ font-size: 14px; }

/* Tablet + phone */
@media (max-width: 900px){
  .tab-bar{
    height: 48px;
    padding-left: 10px;
    gap: 2px;
  }
  .map-wrapper{ top: 48px; }
  .app-title{
    margin-right: 12px;
    letter-spacing: 0.5px;
    font-size: 13px;
    white-space: nowrap;
  }
  .tab-btn{
    padding: 0 12px;
    font-size: 12px;
    gap: 6px;
  }

  /* Left panel becomes fluid width */
  .panel{
    left: 10px;
    right: 10px;
    width: auto;
    top: 60px;
    padding: 12px;
    max-height: 52vh;
    font-size: 13px;
  }
  .ai-result{ font-size: 0.92em; }

  /* EVN search center box fits screen */
  .evn-search{
    width: min(520px, 92vw);
    top: 60px;
    padding: 10px;
    border-radius: 14px;
  }

  /* Right sidebar controls move down slightly */
  .rv-sidebar{ top: 86px; right: 10px; }
  .rv-mini{
    right: 10px;
    left: 10px;
    width: auto;
    bottom: 10px;
  }

  /* Weather bar tighter */
  .weather-bar{
    left: 10px;
    right: 10px;
    bottom: 10px;
    border-radius: 12px;
  }
  .weather-bar__title{ font-size: 12px; }
  .wb-btn{ font-size: 11px; padding: 6px 8px; }
  .wb-card{ min-width: 150px; padding: 9px; }
  .wb-chip{ min-width: 130px; font-size: 11px; }

  /* Webcams UI */
  #webcamsPanel{
    width: min(520px, 92vw);
    right: 10px;
  }
}

/* Small phones */
@media (max-width: 480px){
  html{ font-size: 15px; }
  body{ font-size: 13px; }

  .tab-bar{
    height: 46px;
    padding-left: 8px;
  }
  .map-wrapper{ top: 46px; }

  .app-title{
    display: none; /* free space on very small screens */
  }

  .tab-btn{
    padding: 0 10px;
    font-size: 11px;
  }

  .panel{
    top: 56px;
    left: 8px;
    right: 8px;
    padding: 10px;
    max-height: 50vh;
  }

  .rv-pill .label{ font-size: 11px; }
  .rv-pill{ padding: 6px 8px; gap: 8px; }
  .rv-pill .dot{ width: 32px; height: 32px; flex: 0 0 32px; }

  .evn-search .title{ font-size: 12px; }
  .evn-search input{ padding: 8px 9px; border-radius: 12px; }

  .weather-bar__content{ max-height: 26vh; }
  .wb-row{ gap: 8px; }
  .wb-card{ min-width: 140px; padding: 8px; }
}

