/* --- assets/css/components/pages/rr-tv/rr-tv-page.css --- */
/* Resource Recovery TV Monitor — single-screen layout (like Gas Analyzer) */
:root {
    --rr-primary: #0d9668;
    --rr-primary-light: #e6f7f1;
    --rr-heading: #0f3d2e;
    --rr-text: #2d3d36;
    --rr-text-muted: #5c6e66;
    --rr-border: #c8e6d8;
    --rr-border-light: #e8f5ef;
    --rr-bg: #f0f9f5;
    --rr-card-bg: #ffffff;
    --rr-shadow: 0 2px 12px rgba(13, 150, 104, 0.08);
}

body.page-rr-tv {
    background:
        radial-gradient(1200px 420px at 12% 8%, rgba(46, 211, 174, 0.18), transparent 60%),
        radial-gradient(900px 360px at 88% 16%, rgba(13, 150, 104, 0.12), transparent 55%),
        linear-gradient(135deg, #effafb 0%, #e6f7f1 55%, #f0f9f5 100%);
    margin: 0;
    padding: 0;
    color: var(--rr-text);
    min-height: 100vh;
    max-height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

body.page-rr-tv .header {
    flex-shrink: 0;
}

.rr-tv-main {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    padding: 20px clamp(20px, 3vw, 36px) 20px;
    display: flex;
    flex-direction: column;
}

.rr-tv-container {
    width: 100%;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.rr-tv-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: nowrap;
    margin-bottom: clamp(12px, 2vw, 24px);
    flex-shrink: 0;
}

.rr-tv-site-name {
    margin: 0;
    min-width: 0;
    font-size: clamp(1.15rem, 1rem + 0.7vw, 1.6rem);
    font-weight: 850;
    color: var(--rr-heading);
    letter-spacing: -0.03em;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rr-tv-badge {
    font-size: 12px;
    color: var(--rr-text-muted);
    background: var(--rr-primary-light);
    padding: 4px 13px;
    border-radius: 999px;
    font-weight: 600;
}

/* 2x2 grid — equal columns and rows, consistent card sizing */
.rr-tv-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: clamp(16px, 2vw, 24px);
    flex: 1;
    min-height: 0;
    width: 100%;
    align-items: stretch;
}

.rr-tv-grid > .rr-tv-card {
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
}

/* Card styling — uniform sizing */
.rr-tv-card {
    background: rgba(255, 255, 255, 0.76);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 18px;
    padding: clamp(12px, 1.5vw, 18px);
    box-shadow:
        0 10px 26px rgba(15, 41, 66, 0.10),
        0 1px 0 rgba(255, 255, 255, 0.55) inset;
    border: 1px solid rgba(13, 150, 104, 0.14);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
}

.rr-tv-total {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 0;
    padding: 10px 14px;
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(230, 247, 241, 0.95) 0%, rgba(255, 255, 255, 0.55) 100%);
    border: 1px solid rgba(13, 150, 104, 0.18);
}

.rr-tv-total-label {
    font-size: 0.72rem;
    font-weight: 750;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--rr-text-muted);
}

.rr-tv-total-value {
    margin-top: 2px;
    font-size: clamp(1.45rem, 1.1rem + 1.1vw, 2.15rem);
    font-weight: 850;
    letter-spacing: -0.04em;
    line-height: 1.05;
    color: #0d9668;
    font-variant-numeric: tabular-nums;
}

.rr-tv-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    flex-shrink: 0;
}

.rr-tv-metric {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1px;
    min-width: 0;
    padding: 8px 10px;
    border-radius: 12px;
    background: rgba(244, 250, 253, 0.82);
    border: 1px solid rgba(15, 41, 66, 0.06);
}

.rr-tv-metric-value {
    font-size: 1.05rem;
    font-weight: 850;
    letter-spacing: -0.03em;
    line-height: 1.1;
    color: var(--rr-heading);
    font-variant-numeric: tabular-nums;
}

.rr-tv-metric-label {
    font-size: 0.62rem;
    font-weight: 750;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--rr-text-muted);
}

@keyframes rr-site-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: none; }
}

.rr-tv-site-name.is-changing {
    animation: rr-site-in 0.4s ease;
}

.rr-tv-card-header {
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(15, 41, 66, 0.08);
    flex-shrink: 0;
}

.rr-tv-card-header h2 {
    font-size: clamp(0.9rem, 0.85rem + 0.3vw, 1.05rem);
    font-weight: 850;
    color: var(--rr-heading);
    letter-spacing: -0.01em;
    margin: 0;
}

.rr-tv-card-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.rr-tv-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: rgba(244, 250, 253, 0.72);
    border-radius: 16px;
    border: 1px solid rgba(15, 41, 66, 0.06);
}

.rr-tv-stat-label {
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--rr-text-muted);
    max-width: 58%;
}

.rr-tv-stat-value {
    font-size: clamp(1rem, 0.85rem + 0.8vw, 1.35rem);
    font-weight: 900;
    color: #0d9668;
    letter-spacing: -0.03em;
    text-align: right;
}

.rr-tv-chart-wrap {
    position: relative;
    flex: 1;
    min-height: 0;
    width: 100%;
    overflow: hidden;
}

.rr-tv-chart-wrap canvas {
    max-width: 100% !important;
    max-height: 100% !important;
    width: 100% !important;
    height: 100% !important;
}

.rr-tv-chart-empty {
    position: absolute;
    margin: 0;
    color: var(--rr-text-muted);
    font-size: 0.9rem;
    text-align: center;
    pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
    .rr-tv-site-name.is-changing {
        animation: none;
    }
}

/* Responsive: tablet and below */
@media (max-width: 1024px) {
    body.page-rr-tv {
        overflow-y: auto;
    }
    .rr-tv-main {
        overflow-y: visible;
        padding: 16px;
        padding-bottom: 32px;
    }
    .rr-tv-grid {
        grid-template-rows: auto auto;
    }
}

/* Mobile: single column */
@media (max-width: 768px) {
    .rr-tv-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        gap: 16px;
    }
    .rr-tv-grid > .rr-tv-card {
        min-height: 240px;
    }
}

@media (max-width: 600px) {
    body.page-rr-tv {
        overflow-y: auto;
    }
    .rr-tv-main {
        padding: 12px;
        padding-bottom: 24px;
    }
    .rr-tv-header {
        margin-bottom: 12px;
    }
    .rr-tv-title {
        font-size: 1.25rem;
    }
    .rr-tv-card {
        padding: 12px 14px;
    }
    .rr-tv-card-header h2 {
        font-size: 0.95rem;
    }
    .rr-tv-stat-value {
        font-size: clamp(1rem, 4.5vw, 1.25rem);
    }
    .rr-tv-stat {
        padding: 8px 10px;
    }
}

/*
 * Short desktop windows around 989×484. The tablet rule below 1024px
 * unlocks page scroll, which cuts off the lower charts on this TV.
 */
@media (min-width: 769px) and (max-height: 640px) {
    body.page-rr-tv {
        height: 100%;
        max-height: 100dvh;
        overflow: hidden;
    }

    body.page-rr-tv .rr-tv-main {
        overflow: hidden;
        flex: 1 1 auto;
        min-height: 0;
        padding: 6px 8px 8px;
    }

    body.page-rr-tv .rr-tv-header {
        align-items: center;
        margin-bottom: 6px;
        gap: 8px;
    }

    body.page-rr-tv .rr-tv-site-name {
        font-size: 1.05rem;
    }

    body.page-rr-tv .rr-tv-badge {
        font-size: 0.68rem;
        padding: 3px 10px;
    }

    body.page-rr-tv .rr-tv-grid {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
        gap: 8px;
        flex: 1 1 auto;
        min-height: 0;
    }

    body.page-rr-tv .rr-tv-grid > .rr-tv-card {
        min-height: 0;
        height: 100%;
    }

    body.page-rr-tv .rr-tv-card {
        padding: 8px 10px 8px;
        border-radius: 14px;
    }

    body.page-rr-tv .rr-tv-card-header {
        margin-bottom: 4px;
        padding-bottom: 4px;
    }

    body.page-rr-tv .rr-tv-card-header h2 {
        font-size: 0.82rem;
    }

    body.page-rr-tv .rr-tv-card-content {
        gap: 4px;
    }

    body.page-rr-tv .rr-tv-total {
        padding: 6px 10px;
        border-radius: 12px;
    }

    body.page-rr-tv .rr-tv-total-label {
        font-size: 0.62rem;
    }

    body.page-rr-tv .rr-tv-total-value {
        font-size: 1.35rem;
    }

    body.page-rr-tv .rr-tv-metrics {
        gap: 6px;
    }

    body.page-rr-tv .rr-tv-metric {
        padding: 5px 7px;
        border-radius: 10px;
    }

    body.page-rr-tv .rr-tv-metric-value {
        font-size: 0.92rem;
    }

    body.page-rr-tv .rr-tv-metric-label {
        font-size: 0.56rem;
    }
}

