/* =========================================================================
   OMNIGUARD - CẢM BIẾN THEO TỈNH (tinh-cam-bien.html)
   Trang cuộn dọc (khác trang bản đồ): dùng token của style.css + sensor-network.css
   ========================================================================= */
html, body.pv-page { overflow: auto; height: auto; min-height: 100%; }
body.pv-page { background: var(--bg); }

/* ---------------- Thanh trên */
.pv-top {
    position: sticky; top: 0; z-index: 50;
    display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap;
    padding: var(--sp-3) var(--sp-5);
    background: rgba(9, 13, 22, 0.92); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
}
.pv-brand { text-decoration: none; color: var(--text); box-shadow: none; }
.pv-search { position: relative; flex: 1; min-width: 240px; max-width: 520px; }
.pv-search > i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.pv-search input {
    width: 100%; height: 44px; padding: 0 14px 0 40px;
    background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-lg); outline: none;
}
.pv-search input:focus { border-color: var(--accent); }
.pv-search-list {
    position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 60; list-style: none;
    max-height: 60vh; overflow-y: auto; padding: 4px;
    background: var(--surface-1); border: 1px solid var(--border-strong); border-radius: var(--r-md); box-shadow: var(--shadow);
}
.pv-search-list li {
    display: flex; justify-content: space-between; gap: var(--sp-2); align-items: center;
    padding: 8px 10px; border-radius: var(--r-sm); cursor: pointer;
}
.pv-search-list li[aria-selected="true"], .pv-search-list li:hover { background: var(--surface-3); }
.pv-search-list .meta { font-size: var(--fs-xs); color: var(--text-3); white-space: nowrap; }
.pv-links { display: flex; gap: var(--sp-2); margin-left: auto; }

/* ---------------- Nội dung */
.pv-main { max-width: 1320px; margin: 0 auto; padding: var(--sp-5); display: flex; flex-direction: column; gap: var(--sp-5); }
.pv-section { display: flex; flex-direction: column; gap: var(--sp-3); }
.pv-section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--sp-3); flex-wrap: wrap; }
.pv-section-head h2 { font-size: var(--fs-lg); font-weight: 700; }
.pv-section-head p { font-size: var(--fs-xs); color: var(--text-3); max-width: 760px; }

.pv-hero { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: var(--sp-4); }
.pv-title { font-size: 28px; font-weight: 800; line-height: 1.15; }
.pv-sub { color: var(--text-2); font-size: var(--fs-sm); margin-top: 4px; }
.pv-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--sp-2); margin-top: var(--sp-4); }
.pv-map { height: 300px; border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--border); position: relative; }
.pv-map #pv-map { position: absolute; inset: 0; }

/* Thanh công cụ bảng */
.pv-toolbar { display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center; }
.pv-toolbar .input-icon { flex: 1; min-width: 200px; max-width: 340px; }
.pv-select {
    height: 34px; padding: 0 10px; background: var(--surface-2); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--r-md); font-size: var(--fs-xs);
}
.pv-check { display: inline-flex; gap: 6px; align-items: center; font-size: var(--fs-xs); color: var(--text-2); }

/* Bảng */
.pv-table-wrap { overflow-x: auto; background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--r-md); }
.pv-table { width: 100%; border-collapse: collapse; font-size: var(--fs-xs); }
.pv-table th { position: sticky; top: 0; text-align: left; font-weight: 600; color: var(--text-3); padding: 10px 10px 8px; border-bottom: 1px solid var(--border); background: var(--surface-1); white-space: nowrap; }
.pv-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.pv-table tbody tr { cursor: pointer; }
.pv-table tbody tr:hover td { background: var(--surface-2); }
.pv-table tr:last-child td { border-bottom: none; }
.pv-table .r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pv-table .nowrap { white-space: nowrap; }
.pv-name { font-weight: 600; font-size: var(--fs-sm); color: var(--text); }
.pv-table--fixed { table-layout: fixed; min-width: 980px; }
.pv-table--fixed .pv-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-strip { display: block; width: 100%; height: 14px; }
.pv-pager { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-2); font-size: var(--fs-xs); color: var(--text-3); }
.pv-pager .btn { height: 30px; }

/* Biểu đồ cột xếp chồng */
.pv-bars { position: relative; }
.pv-bars svg { display: block; width: 100%; }
.pv-bars .axis text { fill: var(--text-3); font-size: 11px; }
.pv-bars .grid line { stroke: var(--grid); }
.pv-bars rect.hl { fill: rgba(255, 255, 255, 0.06); }

.pv-notice { display: flex; gap: var(--sp-2); padding: 10px var(--sp-3); border-radius: var(--r-md); font-size: var(--fs-xs);
    background: rgba(91, 100, 120, 0.18); border: 1px solid rgba(148, 163, 184, 0.3); color: var(--text-2); }

/* Ô lưới 34 tỉnh (khi chưa chọn tỉnh) */
.pv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: var(--sp-2); }
.pv-grid a { text-decoration: none; color: inherit; }

/* Ngăn chi tiết thiết bị */
.pv-drawer-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); z-index: 80; }
.pv-drawer {
    position: fixed; top: 0; right: 0; bottom: 0; width: min(760px, 100vw); z-index: 90;
    display: flex; flex-direction: column; background: var(--surface-1); border-left: 1px solid var(--border-strong); box-shadow: var(--shadow);
}
.pv-drawer-head { display: flex; justify-content: space-between; align-items: center; padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border); }
.pv-drawer-head h2 { font-size: var(--fs-md); }
.pv-drawer-body { flex: 1; overflow-y: auto; padding: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-3); }
.pv-drawer .sn-facts { grid-template-columns: repeat(4, 1fr); }
.pv-strip-big { display: block; width: 100%; height: 22px; }
.pv-axis-row { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-3); margin-top: 4px; }
.pv-float-tip { position: fixed; z-index: 100; }

@media (max-width: 1000px) {
    .pv-hero { grid-template-columns: 1fr; }
    .pv-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pv-main { padding: var(--sp-4); }
    .pv-top { padding: var(--sp-2) var(--sp-4); }
    .pv-links { margin-left: 0; }
    .pv-drawer .sn-facts { grid-template-columns: repeat(2, 1fr); }
}
