/* Realtime Revenue TV Dashboard Styles */
body,
html {
    margin: 0;
    padding: 0;
    width: 100vw;
    height: 100vh;
    box-sizing: border-box;
    background-color: #050505;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #e2e8f0;
    /* Smart TV specific overrides */
    font-size: 14px;
    /* Default browser fonts on TV are massive */
    -webkit-font-smoothing: antialiased;
}

.realtime-dashboard {
    height: 100vh;
    width: 100vw;
    display: flex;
    flex-direction: column;
    padding: 16px;
    /* Reduced from 24px for TV real estate */
    box-sizing: border-box;
    overflow: hidden;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-shrink: 0;
}

.dashboard-title {
    font-size: 2.5rem;
    font-weight: 900;
    color: #fff;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.dashboard-timer {
    font-size: 1.2rem;
    font-weight: 600;
    color: #94a3b8;
    background: rgba(30, 41, 59, 0.8);
    backdrop-filter: blur(10px);
    padding: 10px 20px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.pulse-dot {
    width: 14px;
    height: 14px;
    background-color: #10b981;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

.dashboard-content {
    display: grid;
    /* Force 3:1 column layout strictly, don't let it stack. TV viewport width can be unpredictable */
    grid-template-columns: minmax(0, 3fr) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    gap: 24px;
    flex: 1;
    overflow-y: hidden;
    min-height: 0;
}

.main-column {
    display: flex;
    flex-direction: column;
    gap: 24px;
    overflow: hidden;
    /* Parent hides overflow, grid scrolls */
}

.side-column {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Consolidated Panel */
.consolidated-panel {
    background: linear-gradient(135deg, rgba(20, 20, 20, 1) 0%, rgba(10, 10, 10, 1) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 24px;
    flex: 0 0 auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.3);
}

.consolidated-title {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 24px;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 2px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.kpi-grid {
    display: grid;
    /* Force exactly 4 columns */
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
}

.kpi-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    backdrop-filter: blur(10px);
}

.kpi-card.highlight {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.15) 0%, rgba(14, 165, 233, 0.02) 100%);
    border-color: rgba(56, 189, 248, 0.4);
    box-shadow: 0 4px 20px rgba(56, 189, 248, 0.1);
}

.kpi-label {
    font-size: 1.1rem;
    font-weight: 600;
    color: #94a3b8;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.kpi-value {
    font-size: 2.8rem;
    font-weight: 900;
    color: #fff;
    line-height: 1;
}

.kpi-sub {
    font-size: 0.95rem;
    font-weight: 500;
    color: #cbd5e1;
    margin-top: 12px;
    display: flex;
    justify-content: center;
    gap: 12px;
}

.kpi-sub span {
    background: rgba(255, 255, 255, 0.08);
    padding: 4px 12px;
    border-radius: 12px;
}

/* Facilities Grid - This one scrolls */
.facilities-grid {
    display: grid;
    /* Force 2 columns per row instead of relying on unpredictable auto-fit logic on TV */
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    flex: 1;
    overflow-y: auto;
    padding-right: 10px;
    align-content: start;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.facility-card {
    background: rgba(20, 20, 20, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border-left: 5px solid #ffffff;
    transition: transform 0.2s ease;
}

.facility-card:hover {
    transform: translateY(-2px);
    background: rgba(30, 30, 30, 0.9);
}

.facility-name {
    font-size: 1.3rem;
    font-weight: 800;
    color: #f1f5f9;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.fac-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.fac-stat {
    display: flex;
    flex-direction: column;
}

.fac-stat-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.fac-stat-value {
    font-size: 1.4rem;
    font-weight: 800;
    color: #e2e8f0;
    margin-top: 4px;
}

.fac-stat-value.rev {
    color: #34d399;
    /* emerald-400 */
    font-size: 1.25rem;
}

/* Top Agents Panel */
.agents-panel {
    background: linear-gradient(135deg, rgba(20, 20, 20, 0.8) 0%, rgba(5, 5, 5, 0.9) 100%);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 20px;
    padding: 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 25px -5px rgba(245, 158, 11, 0.15);
    height: 100%;
    box-sizing: border-box;
}

.agents-title {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 24px;
    color: #fbbf24;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.agent-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex: 1;
    justify-content: flex-start;
}

.agent-card {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all 0.3s ease;
}

.agent-card:hover {
    transform: scale(1.02);
}

.agent-card.gold {
    border: 1px solid rgba(251, 191, 36, 0.4);
    background: linear-gradient(90deg, rgba(251, 191, 36, 0.1) 0%, transparent 100%);
}

.agent-card.silver {
    border: 1px solid rgba(156, 163, 175, 0.4);
    background: linear-gradient(90deg, rgba(156, 163, 175, 0.1) 0%, transparent 100%);
}

.agent-card.bronze {
    border: 1px solid rgba(180, 83, 9, 0.4);
    background: linear-gradient(90deg, rgba(180, 83, 9, 0.1) 0%, transparent 100%);
}

.agent-medal {
    font-size: 3rem;
    line-height: 1;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3));
}

.agent-info {
    flex: 1;
}

.agent-name {
    font-size: 1.5rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 8px;
}

.agent-sales {
    font-size: 1.6rem;
    font-weight: 900;
    color: #34d399;
}

/* Utilities */
.text-curr {
    font-size: 0.5em;
    font-weight: 600;
    color: #94a3b8;
    margin-right: 4px;
    vertical-align: super;
}