:root {
    --bg-primary: #090c15;
    --bg-secondary: #0f1422;
    --bg-card: rgba(17, 24, 39, 0.75);
    --bg-card-hover: rgba(26, 36, 56, 0.85);
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-accent: rgba(0, 242, 254, 0.4);

    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;

    --accent-cyan: #00f2fe;
    --accent-blue: #3b82f6;
    --accent-emerald: #10b981;
    --accent-amber: #f59e0b;
    --accent-red: #ef4444;
    --accent-purple: #8b5cf6;

    --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.6), 0 0 1px 1px rgba(255, 255, 255, 0.05);
    --shadow-glow: 0 0 20px -5px rgba(0, 242, 254, 0.3);

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}

/* ---------------- App Header ---------------- */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-subtle);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, rgba(0, 242, 254, 0.2), rgba(59, 130, 246, 0.2));
    border: 1px solid var(--border-accent);
    border-radius: var(--radius-md);
    color: var(--accent-cyan);
}

.pulse-dot {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background: var(--accent-emerald);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--accent-emerald);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.4);
        opacity: 0.6;
    }
}

.brand-text h1 {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.badge-accent {
    font-size: 0.65rem;
    padding: 2px 6px;
    background: rgba(0, 242, 254, 0.15);
    border: 1px solid rgba(0, 242, 254, 0.3);
    color: var(--accent-cyan);
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.subtitle {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

/* ---------------- Header Stats Bar ---------------- */
.header-stats {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.stat-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    font-size: 0.8rem;
}

.stat-label {
    color: var(--text-muted);
}

.stat-value {
    font-weight: 600;
    font-family: var(--font-mono);
}

.stat-value.highlight {
    color: var(--accent-cyan);
}

.stat-value.active {
    color: var(--accent-emerald);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
}

.status-indicator.online {
    background: var(--accent-emerald);
    box-shadow: 0 0 8px var(--accent-emerald);
}

.status-indicator.reconnecting {
    background: var(--accent-amber);
    box-shadow: 0 0 8px var(--accent-amber);
    animation: pulse 1s infinite;
}

.status-indicator.offline {
    background: var(--accent-red);
}

/* ---------------- Header Actions ---------------- */
.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    font-size: 0.82rem;
    font-weight: 500;
    font-family: var(--font-sans);
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn:disabled,
.btn[disabled] {
    opacity: 0.35 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
    transform: none !important;
    box-shadow: none !important;
    filter: grayscale(0.7);
}

.btn-primary {
    background: linear-gradient(135deg, #00c6ff, #0072ff);
    color: #fff;
    box-shadow: 0 2px 10px rgba(0, 114, 255, 0.3);
}

.btn-primary:hover:not(:disabled) {
    box-shadow: 0 4px 16px rgba(0, 114, 255, 0.5);
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.14);
}

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
}

.btn-outline:hover:not(:disabled) {
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-outline.active {
    background: rgba(0, 242, 254, 0.12);
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
}

.btn-icon {
    padding: 7px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
}

.btn-icon:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
}

/* ---------------- Filter & Toolbar Bar ---------------- */
.filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 24px;
    background: rgba(15, 20, 34, 0.6);
    border-bottom: 1px solid var(--border-subtle);
    flex-wrap: wrap;
}

.filter-tabs {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
}

.tab-btn {
    padding: 5px 12px;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
}

.tab-btn.active {
    color: var(--accent-cyan);
    background: rgba(0, 242, 254, 0.1);
    border-color: rgba(0, 242, 254, 0.3);
}

.grid-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ---------------- Custom Select Dropdown ---------------- */
.custom-select-wrapper {
    position: relative;
    user-select: none;
}

.custom-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    font-size: 0.78rem;
    font-family: var(--font-sans);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 115px;
}

.custom-select-trigger:hover,
.custom-select-wrapper.open .custom-select-trigger {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--border-accent);
}

.custom-select-arrow {
    transition: transform 0.2s ease;
    color: var(--text-muted);
}

.custom-select-wrapper.open .custom-select-arrow {
    transform: rotate(180deg);
    color: var(--accent-cyan);
}

.custom-select-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: #0f1523;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
    padding: 4px;
    list-style: none;
    z-index: 100;
    min-width: 130px;
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
    transition:
        opacity 0.2s ease,
        transform 0.2s ease;
    backdrop-filter: blur(16px);
}

.custom-select-wrapper.open .custom-select-menu {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.custom-select-option {
    padding: 7px 12px;
    font-size: 0.78rem;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.custom-select-option:hover {
    background: rgba(0, 242, 254, 0.1);
    color: var(--accent-cyan);
}

.custom-select-option.selected {
    background: rgba(0, 242, 254, 0.15);
    color: var(--accent-cyan);
    font-weight: 600;
}

/* ---------------- Streamer Dropdown Selector ---------------- */
.streamer-filter-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.streamer-select-trigger {
    min-width: 200px;
    max-width: 380px;
}

.streamer-select-menu {
    left: 0;
    right: auto;
    min-width: 320px;
    max-height: 380px;
    overflow-y: auto;
}

.streamer-select-menu .custom-select-option {
    display: flex;
    align-items: center;
    gap: 8px;
}

.streamer-opt-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.streamer-opt-count {
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 500;
}

/* ---------------- Main Video Grid ---------------- */
.main-content {
    flex: 1;
    padding: 24px;
}

.feeds-grid {
    display: grid;
    gap: 20px;
}

.grid-auto {
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
}

.grid-cols-1 {
    grid-template-columns: 1fr;
}
.grid-cols-2 {
    grid-template-columns: repeat(2, 1fr);
}
.grid-cols-3 {
    grid-template-columns: repeat(3, 1fr);
}
.grid-cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 768px) {
    .grid-auto,
    .grid-cols-2,
    .grid-cols-3,
    .grid-cols-4 {
        grid-template-columns: 1fr;
    }
}

/* ---------------- Feed Card ---------------- */
.feed-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition:
        transform 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease;
    position: relative;
    box-sizing: border-box;
    width: 100%;
}

.feed-card:hover {
    border-color: rgba(255, 255, 255, 0.16);
    box-shadow: 0 14px 40px -10px rgba(0, 0, 0, 0.7);
}

.feed-card.is-active {
    border-color: rgba(0, 242, 254, 0.4);
}

/* Card Header - Pixel-perfect height and overflow containment */
.feed-card-header {
    height: 52px;
    min-height: 52px;
    max-height: 52px;
    padding: 0 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: rgba(0, 0, 0, 0.22);
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
    box-sizing: border-box;
    overflow: hidden;
}

.feed-title-block {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
}

.feed-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    width: 100%;
    line-height: 1.25;
}

.feed-origin {
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    width: 100%;
    line-height: 1.2;
}

.feed-badges {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    flex-wrap: nowrap;
}

.badge {
    font-size: 0.66rem;
    font-weight: 600;
    padding: 3px 6px;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
    flex-shrink: 0;
}

.badge-runtime {
    font-weight: 700;
    letter-spacing: 0.04em;
}

.badge-runtime.badge-go {
    background: rgba(0, 173, 216, 0.18);
    color: #38bdf8;
    border: 1px solid rgba(0, 173, 216, 0.45);
    box-shadow: 0 0 8px rgba(0, 173, 216, 0.2);
}

.badge-runtime.badge-python {
    background: rgba(234, 179, 8, 0.16);
    color: #fde047;
    border: 1px solid rgba(234, 179, 8, 0.4);
    box-shadow: 0 0 8px rgba(234, 179, 8, 0.15);
}

.badge-type-v4l2 {
    background: rgba(139, 92, 246, 0.15);
    color: #c4b5fd;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.badge-type-rtsp {
    background: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-type-synthetic {
    background: rgba(245, 158, 11, 0.15);
    color: #fcd34d;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-mode {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
}

.badge-status {
    display: flex;
    align-items: center;
    gap: 4px;
}

.badge-status.live {
    background: rgba(16, 185, 129, 0.15);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-status.idle {
    background: rgba(107, 114, 128, 0.15);
    color: #9ca3af;
    border: 1px solid rgba(107, 114, 128, 0.3);
}

.badge-status.connecting {
    background: rgba(0, 242, 254, 0.15);
    color: var(--accent-cyan);
    border: 1px solid rgba(0, 242, 254, 0.3);
}

.badge-status.reconnecting {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-amber);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Video Stage Area */
.feed-video-stage {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.feed-video-element {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* Stage Placeholder / Backdrop */
.video-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: radial-gradient(circle at center, #141b2c 0%, #080b13 100%);
    color: var(--text-secondary);
    z-index: 5;
    transition: opacity 0.3s ease;
}

.video-placeholder.hidden {
    opacity: 0;
    pointer-events: none;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent-cyan);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Floating Stage Toolbar (Fullscreen & Hover Controls) */
.stage-floating-toolbar {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 25;
    display: flex;
    align-items: center;
    gap: 6px;
    opacity: 0;
    transform: translateY(-4px);
    transition:
        opacity 0.25s ease,
        transform 0.25s ease;
}

.feed-video-stage:hover .stage-floating-toolbar,
.feed-video-stage:fullscreen .stage-floating-toolbar,
.feed-video-stage:-webkit-full-screen .stage-floating-toolbar {
    opacity: 1;
    transform: translateY(0);
}

.stage-ctrl-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 10px;
    font-size: 0.72rem;
    font-family: var(--font-sans);
    font-weight: 500;
    color: #e5e7eb;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.stage-ctrl-btn:hover {
    background: rgba(30, 41, 59, 0.95);
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
    transform: translateY(-1px);
}

.stage-ctrl-btn.active {
    background: rgba(0, 242, 254, 0.25);
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
}

.stage-ctrl-btn.btn-exit-fs {
    display: none;
    background: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.5);
    color: #fca5a5;
    font-weight: 600;
}

.stage-ctrl-btn.btn-exit-fs:hover {
    background: rgba(239, 68, 68, 0.45);
    color: #fff;
    border-color: var(--accent-red);
}

/* Fullscreen Mode State Controls */
.feed-video-stage:fullscreen .btn-exit-fs,
.feed-video-stage:-webkit-full-screen .btn-exit-fs {
    display: inline-flex;
}

.feed-video-stage:fullscreen .btn-stage-fullscreen,
.feed-video-stage:-webkit-full-screen .btn-stage-fullscreen {
    display: none;
}

/* Compact Popover / Dropdown Analytics HUD */
.analytics-popover {
    position: absolute;
    top: 48px;
    right: 10px;
    width: 290px;
    max-width: calc(100% - 20px);
    background: rgba(11, 17, 31, 0.94);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(0, 242, 254, 0.35);
    border-radius: var(--radius-md);
    box-shadow:
        0 16px 36px -8px rgba(0, 0, 0, 0.8),
        0 0 16px rgba(0, 242, 254, 0.15);
    z-index: 30;
    padding: 10px 12px;
    opacity: 0;
    transform: scale(0.96) translateY(-6px);
    pointer-events: none;
    transition:
        opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: var(--font-mono);
}

.analytics-popover.visible {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
}

.popover-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 6px;
    margin-bottom: 8px;
}

.popover-title {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent-cyan);
    display: flex;
    align-items: center;
    gap: 6px;
}

.popover-close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0 4px;
    border-radius: 4px;
    transition: all 0.15s;
}

.popover-close-btn:hover {
    color: var(--accent-red);
    background: rgba(255, 255, 255, 0.1);
}

.hud-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 5px 8px;
    margin: 6px 0;
}

.hud-item {
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.04);
    padding: 4px 6px;
    border-radius: 4px;
    border-left: 2px solid var(--border-accent);
}

.hud-label {
    font-size: 0.62rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.hud-val {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hud-val.good {
    color: var(--accent-emerald);
}
.hud-val.warn {
    color: var(--accent-amber);
}
.hud-val.bad {
    color: var(--accent-red);
}

.hud-footer {
    font-size: 0.64rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-subtle);
    padding-top: 6px;
    margin-top: 6px;
    display: flex;
    justify-content: space-between;
}

/* Mini overlay badge on top of video when HUD is closed */
.mini-stats-chip {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 6;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 8px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: #e5e7eb;
    pointer-events: none;
}

/* Card Controls Footer - Strict fixed height and anti-shift */
.feed-card-footer {
    height: 50px;
    min-height: 50px;
    max-height: 50px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: rgba(0, 0, 0, 0.28);
    border-top: 1px solid var(--border-subtle);
    flex-shrink: 0;
    box-sizing: border-box;
    flex-wrap: nowrap;
    overflow: hidden;
}

.feed-primary-action {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    flex-wrap: nowrap;
}

.feed-sub-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    flex-wrap: nowrap;
}

.btn-card-toggle {
    min-width: 82px;
    padding: 6px 12px;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.feed-card-footer .btn-icon {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ---------------- Empty State ---------------- */
.empty-state {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 20px;
    background: var(--bg-card);
    border: 1px dashed var(--border-subtle);
    border-radius: var(--radius-lg);
    max-width: 580px;
    margin: 60px auto;
}

.empty-state.visible {
    display: flex;
}

.empty-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-red);
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.empty-code-snippet {
    background: #000;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 10px 16px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--accent-cyan);
}

/* ---------------- Toast Notifications ---------------- */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1000;
}

.toast {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    font-size: 0.82rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 260px;
    animation: slideIn 0.25s ease-out;
}

.toast.info {
    border-left: 3px solid var(--accent-blue);
}
.toast.success {
    border-left: 3px solid var(--accent-emerald);
}
.toast.warn {
    border-left: 3px solid var(--accent-amber);
}
.toast.error {
    border-left: 3px solid var(--accent-red);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ---------------- TV Wall HUD Mode ---------------- */
.btn-tv-mode {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
}

.btn-tv-mode.active {
    background: rgba(0, 242, 254, 0.15);
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
    box-shadow: 0 0 12px rgba(0, 242, 254, 0.3);
}

/* TV HUD Floating Exit Bar (Centered at Top to prevent clashing with feed controls) */
.tv-hud-floating-bar {
    display: none;
    position: fixed;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    align-items: center;
    gap: 12px;
    background: rgba(10, 15, 26, 0.92);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(0, 242, 254, 0.35);
    border-radius: var(--radius-full);
    padding: 6px 16px;
    box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.8),
        0 0 16px rgba(0, 242, 254, 0.2);
    opacity: 0.25;
    transition:
        opacity 0.25s ease,
        transform 0.25s ease;
}

.tv-hud-floating-bar:hover {
    opacity: 1;
    transform: translateX(-50%) translateY(2px);
}

.tv-hud-badge {
    font-size: 0.7rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--accent-cyan);
    letter-spacing: 0.08em;
}

.btn-exit-tv {
    padding: 4px 10px;
    font-size: 0.74rem;
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
    border-radius: var(--radius-full);
}

.btn-exit-tv:hover {
    background: rgba(239, 68, 68, 0.4);
    color: #fff;
    border-color: var(--accent-red);
}

/* Fullscreen on mainContent: TV HUD Mode */
#mainContent:fullscreen,
#mainContent:-webkit-full-screen,
#mainContent.tv-hud-mode {
    position: fixed !important;
    inset: 0 !important;
    z-index: 9999 !important;
    padding: 0 !important;
    margin: 0 !important;
    background: #000 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
}

#mainContent:fullscreen .tv-hud-floating-bar,
#mainContent:-webkit-full-screen .tv-hud-floating-bar,
#mainContent.tv-hud-mode .tv-hud-floating-bar {
    display: flex;
}

#mainContent:fullscreen #feedsGrid,
#mainContent:-webkit-full-screen #feedsGrid,
#mainContent.tv-hud-mode #feedsGrid {
    gap: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    height: 100% !important;
    grid-auto-rows: 1fr !important;
}

/* Zero gaps, zero border-radius on cards */
#mainContent:fullscreen .feed-card,
#mainContent:-webkit-full-screen .feed-card,
#mainContent.tv-hud-mode .feed-card {
    border-radius: 0 !important;
    border: 1px solid rgba(255, 255, 255, 0.07) !important;
    box-shadow: none !important;
    background: #000 !important;
    height: 100% !important;
    width: 100% !important;
    position: relative !important;
    overflow: hidden !important;
}

#mainContent:fullscreen .feed-video-stage,
#mainContent:-webkit-full-screen .feed-video-stage,
#mainContent.tv-hud-mode .feed-video-stage {
    height: 100% !important;
    width: 100% !important;
    aspect-ratio: auto !important;
    background: #000 !important;
}

#mainContent:fullscreen .feed-video-element,
#mainContent:-webkit-full-screen .feed-video-element,
#mainContent.tv-hud-mode .feed-video-element {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
}

/* Sleek overlay header in TV HUD mode */
#mainContent:fullscreen .feed-card-header,
#mainContent:-webkit-full-screen .feed-card-header,
#mainContent.tv-hud-mode .feed-card-header {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 15 !important;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.8) 0%,
        rgba(0, 0, 0, 0.4) 60%,
        transparent 100%
    ) !important;
    border: none !important;
    padding: 8px 14px !important;
    pointer-events: none !important;
}

#mainContent:fullscreen .feed-badges,
#mainContent:-webkit-full-screen .feed-badges,
#mainContent.tv-hud-mode .feed-badges {
    pointer-events: auto !important;
}

/* Minimal footer visible on hover in TV HUD mode */
#mainContent:fullscreen .feed-card-footer,
#mainContent:-webkit-full-screen .feed-card-footer,
#mainContent.tv-hud-mode .feed-card-footer {
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 15 !important;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, transparent 100%) !important;
    border: none !important;
    padding: 8px 14px !important;
    opacity: 0 !important;
    transition: opacity 0.2s ease !important;
}

#mainContent:fullscreen .feed-card:hover .feed-card-footer,
#mainContent:-webkit-full-screen .feed-card:hover .feed-card-footer,
#mainContent.tv-hud-mode .feed-card:hover .feed-card-footer {
    opacity: 1 !important;
}

/* ---------------- Feed Video Recording Engine ---------------- */
.rec-dot-icon {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
    display: inline-block;
    transition: all 0.2s ease;
}

.rec-dot-icon.pulsing {
    animation: pulseRec 1.2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulseRec {
    0%,
    100% {
        opacity: 1;
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }
    50% {
        opacity: 0.4;
        transform: scale(0.85);
        box-shadow: 0 0 8px 3px rgba(239, 68, 68, 0.5);
    }
}

/* Stage Live Recording Badge */
.recording-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 20;
    background: rgba(15, 23, 42, 0.88);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(239, 68, 68, 0.6);
    padding: 4px 10px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 600;
    color: #fca5a5;
    box-shadow: 0 0 14px rgba(239, 68, 68, 0.35);
    pointer-events: none;
    user-select: none;
}

.rec-badge-size {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 0.68rem;
}

/* Recording Buttons Active State */
.btn-record.recording,
.stage-ctrl-btn.btn-stage-record.recording {
    background: rgba(239, 68, 68, 0.25) !important;
    border-color: rgba(239, 68, 68, 0.7) !important;
    color: #fff !important;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.4) !important;
}

.btn-rec-all.recording {
    background: rgba(239, 68, 68, 0.2) !important;
    border-color: rgba(239, 68, 68, 0.6) !important;
    color: #fca5a5 !important;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.3) !important;
}

/* Audio Badges & Controls */
.badge-audio {
    background: rgba(168, 85, 247, 0.16) !important;
    color: #c084fc !important;
    border: 1px solid rgba(168, 85, 247, 0.4) !important;
    letter-spacing: 0.05em;
}

.stage-ctrl-btn.btn-stage-audio.unmuted {
    background: rgba(168, 85, 247, 0.25);
    border-color: #a855f7;
    color: #e9d5ff;
    box-shadow: 0 0 8px rgba(168, 85, 247, 0.35);
}

.stage-ctrl-btn.btn-stage-audio:hover {
    border-color: #c084fc;
    color: #e9d5ff;
}

.btn.btn-audio.unmuted {
    background: rgba(168, 85, 247, 0.2) !important;
    border-color: #a855f7 !important;
    color: #e9d5ff !important;
    box-shadow: 0 0 8px rgba(168, 85, 247, 0.35);
}

/* Recording Configuration Modal & Settings */
.btn-rec-config {
    color: var(--text-secondary);
}

.btn-rec-config:hover {
    color: var(--accent-cyan);
    border-color: var(--accent-cyan);
}

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 15, 30, 0.75);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

.modal-dialog {
    width: 90%;
    max-width: 480px;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), 0 0 20px rgba(0, 242, 254, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-title-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-title-wrap h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: #f8fafc;
}

.modal-close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    transition: color 0.15s;
}

.modal-close-btn:hover {
    color: #fff;
}

.modal-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-control {
    background: rgba(10, 15, 30, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-sm);
    color: #f8fafc;
    font-size: 0.85rem;
    padding: 8px 12px;
    outline: none;
    transition: border-color 0.2s;
}

.form-control:focus {
    border-color: var(--accent-cyan);
}

.form-hint {
    font-size: 0.72rem;
    color: var(--accent-cyan);
    margin-top: 2px;
}

.checkbox-group {
    margin-top: 4px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.82rem;
    color: #e2e8f0;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    accent-color: var(--accent-cyan);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px;
    background: rgba(10, 15, 30, 0.5);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}


