/* rbnd-pulse.css — widget "Biến động giá khu vực" (Market Pulse) ở trang chủ.
   Markup: templates/index/index.php · Hành vi: assets/js_pages/market-pulse.js
   Máy tính là mặc định; điện thoại/máy tính bảng (< 992px) ghi đè ở cuối tệp. */

.pulse__card {
    background: #fff;
    border: 1px solid var(--rbnd-border);
    border-radius: var(--rbnd-radius);
    padding: 18px 20px 14px;
}

/* ---------- Bộ lọc ---------- */
.pulse__filters {
    display: flex; flex-wrap: wrap; align-items: center;
    gap: 10px; margin-bottom: 18px;
}

/* Hai thẻ Mua bán / Cho thuê: radio thật (bàn phím + trình đọc màn hình dùng được), ẩn bằng cách thu nhỏ chứ không display:none */
.pulse__seg {
    position: relative; display: inline-flex;
    background: #eef1f3; border-radius: 999px; padding: 3px;
}
.pulse__seg input {
    position: absolute; width: 1px; height: 1px; opacity: 0; margin: 0; pointer-events: none;
}
.pulse__seg label {
    margin: 0; padding: 7px 18px; border-radius: 999px;
    font-size: .9rem; font-weight: 600; color: #495057; cursor: pointer; white-space: nowrap;
}
.pulse__seg input:checked + label { background: var(--rbnd-primary); color: #fff; }
.pulse__seg input:focus-visible + label { outline: 2px solid var(--rbnd-primary); outline-offset: 2px; }

.pulse__select { flex: 1 1 200px; max-width: 280px; min-width: 0; font-size: .92rem; }
.pulse__select:disabled { background-color: #f4f5f6; color: #8a9199; }

/* ---------- Thân: số liệu bên trái, biểu đồ bên phải ---------- */
.pulse__body {
    display: grid; grid-template-columns: minmax(230px, 310px) minmax(0, 1fr);
    gap: 26px; align-items: start;
    transition: opacity .15s;
}
.pulse__body[aria-busy="true"] .pulse__plot,
.pulse__body[aria-busy="true"] .pulse__nums { opacity: .45; }

.pulse__scope { margin: 0 0 4px; font-weight: 700; color: #212529; line-height: 1.35; }

.pulse__delta {
    margin: 0; font-size: 2.7rem; font-weight: 800; line-height: 1.1;
    font-variant-numeric: tabular-nums; letter-spacing: -.02em; color: #212529;
}
.pulse__delta i { font-size: .62em; margin-right: 6px; vertical-align: .12em; }
/* Màu + mũi tên + dấu +/− + chữ: hướng đi không phụ thuộc riêng vào màu */
.pulse__delta.is-up   { color: #006300; }
.pulse__delta.is-down { color: #c0392b; }
.pulse__delta.is-flat { color: #6c757d; }
.pulse__delta.is-na   { font-size: 1.35rem; font-weight: 700; color: #6c757d; letter-spacing: 0; padding: 8px 0; }

.pulse__vs   { margin: 6px 0 0; font-size: .9rem; color: #495057; }
.pulse__conf { margin: 4px 0 0; font-size: .8rem; color: var(--rbnd-muted); }

/* Hai ô cạnh nhau, nhãn trên – số dưới: cột 310px (máy tính) hay màn hình hẹp đều không bị gãy dòng giữa số và đơn vị */
.pulse__nums { margin: 16px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pulse__nums > div {
    display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
    padding: 9px 12px; border-radius: 10px; background: #f6f8f7; min-width: 0;
}
.pulse__nums > div:first-child { background: #e6f4ec; }
.pulse__nums dt { font-size: .78rem; font-weight: 500; color: #495057; line-height: 1.3; }
.pulse__nums dd { margin: 0; text-align: left; font-weight: 700; font-size: .98rem; font-variant-numeric: tabular-nums; }
.pulse__nums dd small { display: block; font-weight: 400; color: var(--rbnd-muted); font-size: .75rem; }

/* ---------- Biểu đồ ---------- */
.pulse__chart { position: relative; min-width: 0; }
.pulse__chart-title { font-size: .85rem; color: #495057; margin-bottom: 6px; }
.pulse__plot { min-height: 190px; }
.pulse__plot svg { display: block; max-width: 100%; overflow: visible; }
.pulse__empty {
    display: flex; align-items: center; justify-content: center; min-height: 170px;
    color: var(--rbnd-muted); font-size: .9rem; text-align: center; padding: 0 12px;
}

.pulse-grid  { stroke: #e9ecef; stroke-width: 1; }
.pulse-tick  { fill: #6c757d; font-size: 11px; font-variant-numeric: tabular-nums; }
.pulse-xlab  { fill: #6c757d; font-size: 11px; }
.pulse-xlab.is-cur { fill: #212529; font-weight: 700; }
.pulse-area  { fill: var(--rbnd-primary); fill-opacity: .10; stroke: none; }
.pulse-line  { fill: none; stroke: var(--rbnd-primary); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pulse-dot   { fill: var(--rbnd-primary); stroke: #fff; stroke-width: 2; }
.pulse-val   { fill: #212529; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pulse-hit   { fill: transparent; cursor: pointer; }
.pulse-hit:hover, .pulse-hit:focus { fill: rgba(10, 96, 61, .06); outline: none; }
.pulse-hit:focus-visible { stroke: var(--rbnd-primary); stroke-width: 2; }

.pulse__tip {
    position: absolute; z-index: 3; pointer-events: none; transform: translateX(-50%);
    background: #212529; color: #fff; border-radius: 8px; padding: 7px 11px;
    font-size: .8rem; line-height: 1.4; white-space: nowrap; box-shadow: 0 4px 14px rgba(0, 0, 0, .18);
}
.pulse__tip strong { display: block; font-size: .82rem; }
.pulse__tip span { color: #cfd6da; }

/* ---------- Thông báo + ghi chú ---------- */
.pulse__msg {
    margin: 14px 0 0; padding: 10px 14px; border-radius: 10px;
    background: #fff8e1; border: 1px solid #ffe08a; color: #664d03; font-size: .9rem;
}
.pulse__msg.is-error { background: #fdecea; border-color: #f5c2c0; color: #842029; }
.pulse__msg button {
    margin-left: 8px; padding: 0; border: 0; background: none;
    color: var(--rbnd-primary); font-weight: 700; text-decoration: underline; cursor: pointer;
}
.pulse__note { margin: 14px 0 0; font-size: .78rem; line-height: 1.5; color: var(--rbnd-muted); }
.pulse__note i { margin-right: 4px; }

/* ---------- Khung chờ ---------- */
.pulse__skeleton {
    display: inline-block; width: 150px; height: 2.6rem; border-radius: 8px; vertical-align: middle;
    background: linear-gradient(90deg, #eceff1 25%, #f6f7f8 50%, #eceff1 75%); background-size: 200% 100%;
    animation: pulse-shimmer 1.2s linear infinite;
}
@keyframes pulse-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) {
    .pulse__skeleton { animation: none; }
    .pulse__body { transition: none; }
}

/* =========================================================================
 *  Điện thoại / máy tính bảng (< 992px) — giao diện máy tính giữ nguyên
 * ====================================================================== */
@media (max-width: 991.98px) {
    .pulse__card { padding: 14px 14px 12px; }

    .pulse__filters { flex-direction: column; align-items: stretch; gap: 8px; margin-bottom: 14px; }
    .pulse__seg { display: flex; }
    .pulse__seg label { flex: 1 1 50%; text-align: center; padding: 9px 8px; }
    .pulse__select { flex: none; max-width: none; width: 100%; min-height: 44px; }

    .pulse__body { grid-template-columns: minmax(0, 1fr); gap: 16px; }
    .pulse__delta { font-size: 2.3rem; }
    .pulse__tip { font-size: .78rem; }
}
