﻿/* Hub TV View — Phương án A: 60/40 Hub Split
   Samsung Tizen 2.4 (Chromium 38) compatible.
   Không dùng: CSS Grid gap, flex gap, clamp(), CSS custom property trên pseudo. */

/* ─── Canvas gốc ──────────────────────────────────────────── */
.hub-view {
    display: none;
    position: absolute;
    left: 0;
    top: 0;
    width: 1920px;
    height: 1080px;
    background: #06090e;
    color: #e2e8f0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    z-index: 40;
    overflow: hidden;
}

/* ─── Status Bar (khối 1) ──────────────────────────────────── */
.hub-status-bar {
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    height: 64px;
    padding: 0 36px;
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: center;
    align-items: center;
    -webkit-justify-content: space-between;
    justify-content: space-between;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
}

.hub-pills {
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: center;
    align-items: center;
}

.hub-pill {
    display: -webkit-inline-flex;
    display: inline-flex;
    -webkit-align-items: center;
    align-items: center;
    height: 36px;
    padding: 0 16px 0 12px;
    margin-right: 10px;
    background: rgba(17, 23, 38, 0.9);
    border: 1px solid rgba(45, 58, 84, 0.8);
    border-radius: 18px;
    font-size: 14px;
    font-weight: 500;
    color: #e2e8f0;
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

.hub-pill-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    margin-right: 8px;
    -webkit-box-shadow: 0 0 8px #10b981;
    box-shadow: 0 0 8px #10b981;
    -webkit-flex-shrink: 0;
    flex-shrink: 0;
}
.hub-pill-dot.offline { background: #f59e0b; -webkit-box-shadow: 0 0 8px #f59e0b; box-shadow: 0 0 8px #f59e0b; }

.hub-clock {
    font-family: Consolas, "Courier New", monospace;
    font-size: 22px;
    font-weight: 700;
    color: #e2e8f0;
    letter-spacing: 1px;
}

/* ─── Main 60/40 (khối 2 + 4) ─────────────────────────────── */
.hub-main-grid {
    position: absolute;
    left: 28px;
    top: 76px;
    right: 28px;
    bottom: 28px;
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: stretch;
    align-items: stretch;
}

/* ─── Left pane 60% ────────────────────────────────────────── */
.hub-left {
    width: 58%;
    display: -webkit-flex;
    display: flex;
    -webkit-flex-direction: column;
    flex-direction: column;
    margin-right: 20px;
}

/* ─── Banner (khối 2) ──────────────────────────────────────── */
.hub-banner {
    -webkit-flex-shrink: 0;
    flex-shrink: 0;
    margin-bottom: 16px;
    padding: 18px 24px;
    background: -webkit-linear-gradient(135deg, #111726 0%, #151f33 100%);
    background: linear-gradient(135deg, #111726 0%, #151f33 100%);
    border: 1px solid #232d42;
    border-radius: 16px;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
}

.hub-banner-tag {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #6366f1;
    font-weight: 700;
    margin-bottom: 4px;
}

.hub-banner-title {
    font-size: 22px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.25;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hub-banner-sub {
    font-size: 13px;
    color: #8e9bb0;
    margin-top: 2px;
    margin-bottom: 0;
}

/* ─── Slide stage (khối 3) ─────────────────────────────────── */
.hub-slide-stage {
    -webkit-flex: 1;
    flex: 1;
    position: relative;
    background: #000;
    border: 1px solid #232d42;
    border-radius: 16px;
    overflow: hidden;
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: center;
    align-items: center;
    -webkit-justify-content: center;
    justify-content: center;
    min-height: 0;
}

.hub-slide-img {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.92;
}

.hub-slide-badge {
    position: absolute;
    top: 14px;
    right: 14px;
    padding: 4px 12px;
    background: rgba(6, 9, 14, 0.78);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 14px;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    z-index: 2;
}

.hub-slide-placeholder {
    font-size: 16px;
    color: #5d6b82;
    text-align: center;
    padding: 24px;
}

.hub-progress-track {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: rgba(255,255,255,0.08);
    z-index: 2;
}

.hub-progress-fill {
    height: 100%;
    width: 0;
    background: #6366f1;
    -webkit-box-shadow: 0 0 10px #6366f1;
    box-shadow: 0 0 10px #6366f1;
    -webkit-transition: width 0.4s linear;
    transition: width 0.4s linear;
}

/* ─── Right pane 40% (sensor matrix, khối 4) ──────────────── */
.hub-right {
    -webkit-flex: 1;
    flex: 1;
    display: -webkit-flex;
    display: flex;
    -webkit-flex-direction: column;
    flex-direction: column;
    min-width: 0;
}

.hub-sensor-head {
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: center;
    align-items: center;
    -webkit-justify-content: space-between;
    justify-content: space-between;
    margin-bottom: 12px;
    -webkit-flex-shrink: 0;
    flex-shrink: 0;
}

.hub-sensor-head-title {
    font-size: 15px;
    font-weight: 600;
    color: #e2e8f0;
}

.hub-freshness {
    font-size: 12px;
    color: #8e9bb0;
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: center;
    align-items: center;
}
.hub-freshness.stale { color: #f59e0b; font-weight: 600; }

/* ─── Sensor cards ─────────────────────────────────────────── */
.hub-cards {
    -webkit-flex: 1;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.hub-cards-row {
    display: -webkit-flex;
    display: flex;
    margin-bottom: 12px;
}

.hub-card {
    -webkit-flex: 1;
    flex: 1;
    position: relative;
    background: #111726;
    border: 1px solid #232d42;
    border-radius: 10px;
    padding: 14px;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    display: -webkit-flex;
    display: flex;
    -webkit-flex-direction: column;
    flex-direction: column;
    -webkit-justify-content: space-between;
    justify-content: space-between;
    overflow: hidden;
}
.hub-card + .hub-card { margin-left: 12px; }

.hub-card-wide {
    width: 100%;
}

.hub-card-top {
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: center;
    align-items: center;
    -webkit-justify-content: space-between;
    justify-content: space-between;
    margin-bottom: 4px;
}

.hub-card-label {
    font-size: 12px;
    color: #8e9bb0;
    font-weight: 500;
}

.hub-card-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: #161e31;
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: center;
    align-items: center;
    -webkit-justify-content: center;
    justify-content: center;
    color: #6366f1;
    -webkit-flex-shrink: 0;
    flex-shrink: 0;
}
.hub-card-icon svg { width: 16px; height: 16px; }

.hub-card-val-row {
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: baseline;
    align-items: baseline;
    margin: 2px 0 4px;
}

.hub-card-val {
    font-family: Consolas, "Courier New", monospace;
    font-size: 36px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1;
}

.hub-card-unit {
    font-size: 14px;
    color: #8e9bb0;
    font-weight: 500;
    margin-left: 6px;
}

.hub-card-tag {
    display: -webkit-inline-flex;
    display: inline-flex;
    -webkit-align-items: center;
    align-items: center;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    -webkit-align-self: flex-start;
    align-self: flex-start;
}
.hub-tag-good { background: rgba(16,185,129,0.15); color: #10b981; }
.hub-tag-warn { background: rgba(245,158,11,0.15);  color: #f59e0b; }
.hub-tag-bad  { background: rgba(239,68,68,0.15);   color: #ef4444; }
.hub-tag-norm { background: rgba(99,102,241,0.15);  color: #818cf8; }

.hub-sparkline {
    width: 100%;
    height: 28px;
    display: block;
    margin-top: 4px;
    overflow: visible;
}

/* Wide card */
.hub-card-wide .hub-card-val { font-size: 30px; }

/* ─── Loading / Error states ───────────────────────────────── */
.hub-view.hub-loading .hub-card-val { opacity: 0.25; }
.hub-view.hub-error .hub-freshness  { color: #ef4444; font-weight: 700; }
