* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Inter', sans-serif; background: #1e1f22; color: #f2f3f5; }

.focus-container { height: 100%; display: flex; flex-direction: column; gap: 16px; padding: 16px; transition: opacity 0.3s ease; }
.focused-stream-wrapper { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
.focused-stream { width: 100%; max-width: 1400px; aspect-ratio: 16 / 9; max-height: 100%; transition: all 0.3s ease; }
.thumbnails-container { display: flex; gap: 12px; overflow-x: auto; overflow-y: hidden; padding: 8px 0; justify-content: center; }
.thumbnail-wrapper { flex-shrink: 0; width: 240px; cursor: pointer; transition: transform 0.2s; }
.thumbnail-wrapper:hover { transform: scale(1.02); }
.thumbnail-stream { width: 100%; aspect-ratio: 16 / 9; pointer-events: none; }

.grid-container { height: 100%; padding: 16px; overflow-y: auto; transition: opacity 0.3s ease; }
.streams-grid { display: grid; gap: 16px; align-items: center; justify-items: center; align-content: center; }
.streams-grid.count-1 { grid-template-columns: 1fr; max-width: 1600px; margin: 0 auto; }
.streams-grid.count-2 { grid-template-columns: repeat(2, 1fr); }
.streams-grid.count-3, .streams-grid.count-4 { grid-template-columns: repeat(2, 1fr); }
.streams-grid.count-5, .streams-grid.count-6 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 1024px) { .streams-grid { grid-template-columns: repeat(2, 1fr) !important; } }
@media (max-width: 640px) { .streams-grid { grid-template-columns: 1fr !important; } }

.stream-widget { background: #000; border-radius: 8px; overflow: hidden; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4); border: 2px solid #2b2d31; transition: border-color 0.2s ease; display: flex; flex-direction: column; position: relative; aspect-ratio: 16 / 9; width: 100%; height: auto; max-height: 100%; }
.stream-widget:hover, .stream-widget.focused { border-color: #5865f2; }
.grid-stream { cursor: pointer; }

.widget-header { background: linear-gradient(to bottom, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0) 100%); padding: 12px 14px 30px 14px; display: flex; justify-content: space-between; align-items: flex-start; position: absolute; top: 0; left: 0; right: 0; z-index: 10; pointer-events: none; }
.widget-header > * { pointer-events: auto; }
.widget-title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.username { color: #f2f3f5; font-weight: 600; text-shadow: 0 1px 4px rgba(0,0,0,0.9); }

.live-indicator { width: 8px; height: 8px; background: #eb4034; border-radius: 50%; animation: pulse 2s ease-in-out infinite; box-shadow: 0 0 4px rgba(0,0,0,0.5); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.status-indicator { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.status-indicator.online { background: #23a55a; }
.status-indicator.offline { background: #80848e; }

.widget-btn { background: rgba(0,0,0,0.4); border: none; color: #f2f3f5; padding: 6px; border-radius: 4px; cursor: pointer; transition: all 0.2s ease; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(4px); border: 1px solid rgba(255,255,255,0.1); }
.widget-btn:hover { background: rgba(88, 101, 242, 0.8); border-color: #5865f2; }
.widget-btn.danger:hover { background: rgba(237, 66, 69, 0.8); border-color: #ed4245; }

.view-toggle { position: fixed; bottom: 24px; right: 24px; z-index: 100; display: flex; gap: 8px; background: #2b2d31; padding: 8px; border-radius: 8px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4); border: 1px solid #3f4147; }
.view-btn { background: transparent; border: none; color: #b5bac1; padding: 8px 12px; border-radius: 6px; cursor: pointer; transition: all 0.2s ease; display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; }
.view-btn:hover { background: #404249; color: #f2f3f5; }
.view-btn.active { background: #5865f2; color: white; }
.btn-primary { background: #5865f2; color: white; padding: 10px 20px; border-radius: 6px; font-weight: 600; font-size: 14px; border: none; cursor: pointer; transition: background 0.2s ease; }
.btn-primary:hover { background: #4752c4; }
.btn-secondary { background: #4e5058; color: white; padding: 10px 20px; border-radius: 6px; font-weight: 600; font-size: 14px; border: none; cursor: pointer; transition: background 0.2s ease; }
.btn-secondary:hover { background: #6d6f78; }

.video-container { position: absolute; inset: 0; width: 100%; height: 100%; background: #000; display: flex; align-items: center; justify-content: center; }
video { width: 100%; height: 100%; object-fit: contain; }
video::-webkit-media-controls { display: none !important; }

.modal-overlay { background: rgba(0, 0, 0, 0.85); backdrop-filter: blur(4px); transition: opacity 0.2s; }
.modal-content { background: #2b2d31; border-radius: 8px; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5); transform: scale(0.95); transition: transform 0.2s ease; max-height: 90vh; overflow-y: auto; border: 1px solid #3f4147; }
.modal-overlay:not(.hidden) .modal-content { transform: scale(1); }
.modal-header { background: #1e1f22; padding: 16px 20px; border-bottom: 1px solid #3f4147; position: sticky; top: 0; z-index: 10; }
.modal-body { padding: 24px; }
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: #b5bac1; text-transform: uppercase; margin-bottom: 8px; }
.form-input { width: 100%; padding: 10px 12px; background: #1e1f22; border: 1px solid #3f4147; border-radius: 6px; color: #f2f3f5; font-size: 14px; transition: border-color 0.2s ease; }
.form-input:focus { outline: none; border-color: #5865f2; }

.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; text-align: center; padding: 48px; }
.empty-state svg { opacity: 0.3; margin-bottom: 16px; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #1e1f22; }
::-webkit-scrollbar-thumb { background: #4e5058; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #6d6f78; }
.participants-badge { background: #2b2d31; padding: 6px 12px; border-radius: 6px; font-size: 13px; color: #b5bac1; transition: background 0.2s ease; border: 1px solid transparent; }
.participants-badge:hover { background: #404249; border-color: #4e5058; }

.select-none { user-select: none; }
.volume-control { display: flex; align-items: center; gap: 8px; background: rgba(0,0,0,0.4); padding: 4px 8px; border-radius: 4px; backdrop-filter: blur(4px); border: 1px solid rgba(255,255,255,0.1); height: 30px; }
.volume-control:hover { border-color: #5865f2; }
.volume-btn { background: none; border: none; color: #f2f3f5; cursor: pointer; padding: 0; display: flex; align-items: center; justify-content: center; transition: color 0.2s; }
.volume-btn:hover { color: #5865f2; }

.volume-slider { -webkit-appearance: none; width: 60px; height: 4px; border-radius: 2px; outline: none; cursor: pointer; background: #4e5058; }
.volume-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%; background: #ffffff; cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,0.5); }

.loading-bar-anim { animation: loading-bar 1.5s infinite ease-in-out; }
@keyframes loading-bar { 0% { left: -50%; } 100% { left: 100%; } }

#toast-container { position: fixed; bottom: 24px; left: 24px; display: flex; flex-direction: column; gap: 8px; z-index: 9999; pointer-events: none; }
.toast { background: #2b2d31; border: 1px solid #3f4147; color: #f2f3f5; padding: 12px 16px; border-radius: 6px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4); font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 8px; transform: translateX(-120%); transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); opacity: 0; }
.toast.show { transform: translateX(0); opacity: 1; }
.toast.info .icon { color: #5865f2; }

/* Custom toggle switch peer checks */
input:checked + .peer > div { transform: translateX(20px); }
