:root {
    --tv-bg: #090d16;
    --tv-card-bg: rgba(22, 30, 46, 0.85);
    --tv-border: rgba(255, 255, 255, 0.12);
    --tv-primary: #38bdf8;
    --tv-primary-glow: rgba(56, 189, 248, 0.3);
    --tv-accent: #818cf8;
    --tv-text-bright: #ffffff;
    --tv-text-main: #f1f5f9;
    --tv-text-sub: #94a3b8;
    --tv-header-height: 80px;
    --tv-top-margin: 30px;
}

.d-none {
    display: none !important;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    height: 100vh;
    height: 100dvh;
    background-color: var(--tv-bg);
    color: var(--tv-text-main);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    overflow: hidden;
    user-select: none;
}

/* Kiosk container */
.tv-viewport {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    width: 100vw;
    position: relative;
    padding-top: var(--tv-top-margin, max(30px, env(safe-area-inset-top, 30px)));
    padding-bottom: max(20px, env(safe-area-inset-bottom, 20px));
    padding-left: max(25px, env(safe-area-inset-left, 25px));
    padding-right: max(25px, env(safe-area-inset-right, 25px));
    box-sizing: border-box;
    overflow: hidden;
}

/* Header bar */
.tv-header {
    height: var(--tv-header-height);
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid var(--tv-border);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 25px;
    z-index: 100;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    flex-shrink: 0;
}

.tv-brand {
    display: flex;
    align-items: center;
    gap: 15px;
}

.tv-brand-logo-container {
    display: flex;
    align-items: center;
}

.tv-brand-logo {
    max-height: 52px;
    max-width: 200px;
    object-fit: contain;
}

.tv-brand-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #0284c7 0%, #4f46e5 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #fff;
    box-shadow: 0 0 15px var(--tv-primary-glow);
}

.tv-brand-title {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--tv-text-bright);
}

.tv-sheet-badge {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--tv-border);
    padding: 8px 20px;
    border-radius: 30px;
}

.tv-sheet-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--tv-primary);
}

.tv-sheet-counter {
    font-size: 14px;
    background: rgba(56, 189, 248, 0.15);
    color: var(--tv-primary);
    padding: 3px 10px;
    border-radius: 12px;
    font-weight: 600;
}

.tv-clock-box {
    text-align: right;
    display: flex;
    align-items: center;
    gap: 20px;
}

.tv-clock-time {
    font-size: 32px;
    font-weight: 700;
    font-family: 'Courier New', Courier, monospace;
    color: var(--tv-text-bright);
    letter-spacing: 1px;
}

.tv-clock-date {
    font-size: 14px;
    color: var(--tv-text-sub);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Status Indicator Beacon */
.status-beacon {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #22c55e;
    box-shadow: 0 0 10px #22c55e;
    animation: pulseBeacon 2s infinite;
}

.status-beacon.offline {
    background-color: #ef4444;
    box-shadow: 0 0 10px #ef4444;
}

@keyframes pulseBeacon {
    0% { opacity: 0.6; transform: scale(0.95); }
    50% { opacity: 1; transform: scale(1.15); }
    100% { opacity: 0.6; transform: scale(0.95); }
}

/* Main Content Area */
.tv-main {
    flex: 1;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.tv-table-card {
    background: var(--tv-card-bg);
    border: 1px solid var(--tv-border);
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    backdrop-filter: blur(16px);
}

.tv-table-header-wrapper {
    background: #0f172a;
    border-bottom: 2px solid var(--tv-primary);
    padding: 0 10px;
}

.tv-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.tv-table th {
    padding: 18px 20px;
    text-align: left;
    font-size: 18px;
    font-weight: 700;
    color: var(--tv-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Scrollable Container */
.tv-table-scroll-container {
    flex: 1;
    overflow-y: hidden; /* Scroll controlled by JS */
    position: relative;
}

.tv-table-body-content {
    position: relative;
    top: 0;
    transition: top 0.3s ease-out;
}

.tv-table td {
    padding: 18px 20px;
    font-size: 20px;
    color: var(--tv-text-main);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tv-table tr:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.02);
}

.tv-table tr:hover {
    background-color: rgba(56, 189, 248, 0.08);
}

/* Dynamic Status Badges */
.tv-badge {
    display: inline-block;
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tv-badge-success {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.4);
}

.tv-badge-warning {
    background: rgba(234, 179, 8, 0.2);
    color: #fde047;
    border: 1px solid rgba(234, 179, 8, 0.4);
}

.tv-badge-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.tv-badge-info {
    background: rgba(56, 189, 248, 0.2);
    color: #7dd3fc;
    border: 1px solid rgba(56, 189, 248, 0.4);
}

/* Progress Footer Bar */
.tv-progress-bar-wrapper {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    width: 100%;
}

.tv-progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--tv-primary) 0%, var(--tv-accent) 100%);
    width: 0%;
    transition: width 0.1s linear;
}

/* Access Denied / Offline Screen */
.tv-error-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 40px;
}

.tv-error-icon {
    font-size: 80px;
    color: #ef4444;
    margin-bottom: 20px;
    text-shadow: 0 0 25px rgba(239, 68, 68, 0.5);
}

.tv-error-title {
    font-size: 36px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 10px;
}

.tv-error-desc {
    font-size: 20px;
    color: #94a3b8;
    max-width: 600px;
    line-height: 1.6;
}
