/* ==================== RESET & BASE ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --danger: #dc2626;
    --danger-dark: #b91c1c;
    --success: #16a34a;
    --warning: #f59e0b;
    --bg: #f8fafc;
    --bg-dark: #1e293b;
    --card: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

/* ==================== HOME PAGE ==================== */
.home-page {
    background: #000;
    min-height: 100vh;
}

.home-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.home-logo {
    width: 200px;
    height: auto;
}

/* ==================== UTILITIES ==================== */
.hidden { display: none !important; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    background: var(--border);
    color: var(--text);
    transition: all 0.2s;
}

.btn:hover { background: #cbd5e1; }

.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:hover { background: var(--primary-dark); }

.btn-danger {
    background: var(--danger);
    color: white;
}
.btn-danger:hover { background: var(--danger-dark); }

.btn-success {
    background: var(--success);
    color: white;
}
.btn-success:hover { background: #15803d; }

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

/* ==================== FORMS ==================== */
.form-group {
    margin-bottom: 10px;
}

.form-group label {
    display: block;
    margin-bottom: 0px;
    font-size: 13px;
    font-weight: 400;
    color: var(--text);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 4px 4px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
}

.form-group input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group-divider {
    margin: 16px 0 8px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* Logo upload */
.logo-upload-container {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.logo-upload-container input[type="file"] {
    flex: 1;
    min-width: 200px;
}

.logo-preview {
    width: 80px;
    height: 80px;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    overflow: hidden;
}

.logo-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
    border-radius: calc(var(--radius) - 2px);
}

.logo-preview:empty::before {
    content: "Aperçu";
    color: var(--text-muted);
    font-size: 11px;
}

/* ==================== MODAL ==================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active { display: flex; }

.modal-content {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-header h3 {
    font-size: 18px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
}

.modal-close:hover { color: var(--text); }

.modal-content form,
.modal-content > div:not(.modal-header) {
    padding: 20px;
}

/* ==================== ADMIN PAGE ==================== */
.admin-page {
    background: var(--bg-dark);
    color: white;
    min-height: 100vh;
}

.admin-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.admin-header {
    text-align: center;
    padding: 30px 0;
}

.admin-header h1 {
    font-size: 28px;
    margin-bottom: 4px;
    color: white;
}

.admin-header .subtitle {
    color: rgba(255,255,255,0.6);
    font-size: 14px;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 8px;
}

.tab {
    padding: 10px 20px;
    background: none;
    border: none;
    font-size: 14px;
    font-weight: 500;
    color: rgba(255,255,255,0.6);
    cursor: pointer;
    border-radius: var(--radius) var(--radius) 0 0;
    transition: all 0.2s;
}

.tab:hover { color: white; }

.tab.active {
    color: var(--primary);
    background: rgba(37, 99, 235, 0.2);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.section-header h2 {
    font-size: 20px;
    color: white;
}

/* Rooms Grid */
.rooms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
}

.room-card {
    background: rgba(255,255,255,0.05);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.1);
}

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

.room-card-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.room-title-link {
    text-decoration: none;
    color: inherit;
}

.room-title-link:hover h3 {
    color: #60a5fa;
}

.status-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* WHIP URL Section */
.whip-url-section {
    margin-bottom: 16px;
    padding: 12px;
    background: rgba(0,0,0,0.3);
    border-radius: var(--radius);
}

.whip-url-section label {
    display: block;
    font-size: 12px;
    color: rgba(255,255,255,0.6);
    margin-bottom: 8px;
}

.copy-field.compact {
    gap: 6px;
}

.copy-field.compact input {
    padding: 6px 10px;
    font-size: 11px;
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.1);
    color: #93c5fd;
}

/* Room Preview */
.room-preview {
    background: rgba(0,0,0,0.3);
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 16px;
}

.preview-video-container {
    display: none;
    margin-bottom: 12px;
    border-radius: var(--radius);
    overflow: hidden;
    background: #000;
}

.preview-video-container.active {
    display: block;
}

.preview-video-container video {
    width: 100%;
    height: auto;
    max-height: 180px;
    object-fit: contain;
    display: block;
}

/* Audio-only mode for admin preview */
.preview-video-container.active.audio-mode {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80px;
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
}

.preview-video-container.audio-mode video {
    display: none;
}

.preview-video-container.audio-mode::after {
    content: '🎵 Audio seul';
    color: var(--text-muted);
    font-size: 14px;
}

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

.preview-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--success);
    color: white;
}

.preview-btn:hover {
    background: #15803d;
}

.preview-btn.playing {
    background: var(--danger);
    color: white;
}

.preview-btn.playing:hover {
    background: var(--danger-dark);
}

.preview-icon {
    font-size: 12px;
}

.preview-status {
    font-size: 12px;
    color: rgba(255,255,255,0.5);
    margin-left: auto;
}

.preview-status.active {
    color: #4ade80;
    font-weight: 500;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge.idle {
    background: #fef3c7;
    color: #92400e;
}

.status-badge.live {
    background: #16a34a;
    color: white;
}

.status-badge.live .status-dot {
    animation: pulse 1s infinite;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.room-card-body {
    padding: 16px;
}

.room-qrcode-logo {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.room-qrcode {
    display: flex;
    justify-content: center;
}

.room-qrcode img {
    width: 120px;
    height: 120px;
    cursor: pointer;
    border-radius: var(--radius);
    transition: transform 0.2s;
}

.room-qrcode img:hover {
    transform: scale(1.05);
}

.room-logo-small {
    width: 120px;
    height: 120px;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.room-logo-small img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.room-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.room-card-actions .btn {
    flex: 1;
    min-width: 45%;
}

/* Servers List */
.servers-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.server-card {
    background: rgba(255,255,255,0.05);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
    border: 1px solid rgba(255,255,255,0.1);
}

.server-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.server-card-header h3 {
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
}

.server-active-badge {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
}

.server-active-badge.active {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
}

.server-active-badge.inactive {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.server-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px;
    font-size: 13px;
    color: rgba(255,255,255,0.6);
}

.server-info code {
    background: rgba(0,0,0,0.3);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    color: #93c5fd;
}

.server-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

/* Stats Tab */
.stats-room-selector {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.stats-room-selector label {
    color: rgba(255,255,255,0.7);
    font-size: 14px;
}

.stats-room-selector select {
    padding: 10px 16px;
    border-radius: var(--radius);
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    font-size: 14px;
    min-width: 250px;
}

.stats-room-selector select option {
    background: #1e293b;
    color: white;
}

.stats-content {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
}

.stat-value {
    font-size: 36px;
    font-weight: 700;
    color: #4ade80;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 13px;
    color: rgba(255,255,255,0.6);
}

.stats-section {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
}

.stats-section h3 {
    font-size: 16px;
    margin-bottom: 16px;
    color: white;
}

.devices-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.device-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0,0,0,0.3);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
}

.device-icon {
    font-size: 18px;
}

.device-count {
    font-weight: 600;
    color: #4ade80;
}

.viewers-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.viewer-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0,0,0,0.3);
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 14px;
}

.viewer-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.viewer-device {
    color: rgba(255,255,255,0.6);
}

.viewer-duration {
    color: #4ade80;
    font-weight: 500;
}

.viewer-ip {
    color: rgba(255,255,255,0.4);
    font-size: 12px;
    font-family: monospace;
}

.stats-empty {
    text-align: center;
    padding: 60px 20px;
    color: rgba(255,255,255,0.5);
}

.stats-empty p {
    font-size: 16px;
}

/* Viewer count badge on room card */
.viewer-count-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(74, 222, 128, 0.2);
    color: #4ade80;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.viewer-count-badge .eye-icon {
    font-size: 14px;
}

/* QR Code Modal */
.modal-qrcode .qrcode-large {
    text-align: center;
    padding: 20px;
}

.modal-qrcode .qrcode-large img {
    max-width: 280px;
    width: 100%;
}

.modal-qrcode .qrcode-actions {
    display: flex;
    gap: 12px;
    padding: 0 20px 20px;
}

.modal-qrcode .qrcode-actions .btn {
    flex: 1;
}

/* Room Details Modal */
.room-details-section {
    margin-bottom: 16px;
}

.room-details-section h4 {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.copy-field {
    display: flex;
    gap: 8px;
}

.copy-field input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 12px;
    font-family: monospace;
    background: var(--bg);
}

.copy-field button {
    padding: 8px 12px;
    font-size: 12px;
}

/* ==================== BROADCAST PAGE ==================== */
.broadcast-page {
    background: var(--bg-dark);
    color: white;
}

.broadcast-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px;
}

.broadcast-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.broadcast-header h1 {
    font-size: 20px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255,255,255,0.1);
    border-radius: 20px;
    font-size: 14px;
}

.status-indicator .status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.status-indicator .status-dot.idle { background: #fbbf24; }
.status-indicator .status-dot.live {
    background: #ef4444;
    animation: pulse 1s infinite;
}

.broadcast-main {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
}

.video-container {
    position: relative;
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
    aspect-ratio: 16/9;
}

.video-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    background: transparent;
}

.video-container video::-webkit-media-controls {
    display: none;
}

/* Ensure local video is visible above any background */
#local-video {
    position: relative;
    z-index: 1;
}

.video-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.7);
    color: white;
}

.video-overlay.hidden { display: none; }

.controls-panel {
    background: rgba(255,255,255,0.05);
    border-radius: var(--radius);
    padding: 20px;
}

.controls-panel .form-group label {
    color: rgba(255,255,255,0.7);
}

.controls-panel select {
    background: #374151;
    border-color: rgba(255,255,255,0.2);
    color: white;
}

.controls-panel select option {
    background: #374151;
    color: white;
}

.controls-panel .checkbox-group label {
    display: flex;
    align-items: center;
    cursor: pointer;
    color: rgba(255,255,255,0.9);
}

.controls-panel .checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 10px;
    cursor: pointer;
    accent-color: var(--primary);
}

/* Gain slider */
.gain-slider {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255,255,255,0.2);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

#input-gain {
    padding: 0;
    border: 0;
}

.gain-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
}

.gain-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: none;
}

#gain-value {
    float: right;
    font-weight: 600;
    color: var(--primary);
}

.audio-meter {
    margin: 4px 0;
}

.audio-meter label {
    display: block;
    font-size: 13px;
    color: rgba(255,255,255,0.7);
    margin-bottom: 8px;
}

.meter-bar {
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
}

.meter-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #22c55e, #eab308, #ef4444);
    transition: width 0.1s;
}

.broadcast-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.btn-live {
    background: var(--success);
    color: white;
    padding: 16px;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-live:hover { background: #15803d; }

.btn-live.connecting {
    background: #6b7280;
}

.btn-live .spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

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

.btn-stop {
    background: var(--danger);
    color: white;
    padding: 16px;
    font-size: 16px;
    font-weight: 600;
}

.btn-stop:hover { background: var(--danger-dark); }

/* Video Section (video + recording) */
.video-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Recording Section */
.recording-section {
    background: rgba(255,255,255,0.05);
    border-radius: var(--radius);
    padding: 12px 16px;
}

.recording-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.recording-options {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap;
}

#record-video-options {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.recording-options .checkbox-inline {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 13px;
    color: rgba(255,255,255,0.8);
}

.recording-options .checkbox-inline input {
    margin-right: 8px;
    cursor: pointer;
    accent-color: var(--primary);
}

.format-select {
    padding: 6px 10px;
    border-radius: var(--radius);
    background: #374151;
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    font-size: 13px;
    cursor: pointer;
}

.format-select:focus {
    outline: none;
    border-color: var(--primary);
}

.format-select option {
    background: #374151;
    color: white;
}

.recording-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-record {
    background: #22c55e;
    color: white;
    padding: 10px 16px;
    font-size: 14px;
}

.btn-record:hover {
    background: #16a34a;
}

.btn-record .record-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    background: white;
    border-radius: 50%;
    margin-right: 6px;
}

.btn-stop-record {
    background: #dc2626;
    color: white;
    padding: 10px 16px;
    font-size: 14px;
}

.btn-stop-record:hover {
    background: #b91c1c;
}

.btn-stop-record .stop-icon {
    display: inline-block;
    width: 10px;
    height: 10px;
    background: white;
    margin-right: 6px;
}

.record-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: transparent;
}

.record-indicator.recording {
    background: #ef4444;
    animation: pulse-record 1s infinite;
}

@keyframes pulse-record {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    50% { opacity: 0.8; box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

.record-timer {
    font-family: monospace;
    font-size: 14px;
    color: #ef4444;
    font-weight: 600;
}

.download-section {
    margin-top: 10px;
    padding: 10px 12px;
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-download {
    background: var(--success);
    color: white;
    padding: 10px 20px;
    text-decoration: none;
}

.btn-download:hover {
    background: #15803d;
}

.download-size {
    font-size: 13px;
    color: rgba(255,255,255,0.6);
}

/* Recordings list */
.recordings-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.recording-item {
    padding: 8px 12px;
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 10px;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.recording-item.fade-out {
    opacity: 0;
    transform: translateX(20px);
}

.recording-filename {
    flex: 1;
    font-size: 12px;
    color: rgba(255,255,255,0.9);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.recording-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.btn-preview {
    background: #3b82f6;
    color: white;
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.btn-preview:hover {
    background: #2563eb;
}

.recording-item .btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.btn-delete {
    background: #dc2626;
    color: white;
}

.btn-delete:hover {
    background: #b91c1c;
}

.recording-item .btn-download {
    font-size: 16px;
    text-decoration: none;
}

/* Broadcast Sidebar */
.broadcast-sidebar {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* QR Code + Preview side by side */
.broadcast-qr-preview {
    display: flex;
    gap: 20px;
    background: rgba(255,255,255,0.05);
    border-radius: var(--radius);
    padding: 20px;
}

.broadcast-qr-preview .broadcast-qrcode {
    background: none;
    padding: 0;
    flex-shrink: 0;
}

.broadcast-qr-preview .broadcast-preview {
    flex: 1;
    background: none;
    padding: 0;
    min-width: 0;
}

.broadcast-qrcode {
    background: rgba(255,255,255,0.05);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
}

.broadcast-qrcode h3 {
    font-size: 14px;
    margin-bottom: 16px;
    color: rgba(255,255,255,0.7);
}

.broadcast-qrcode img {
    width: 200px;
    height: 200px;
    border-radius: var(--radius);
}

.broadcast-qrcode .watch-link {
    display: block;
    font-size: 11px;
    color: #93c5fd;
    word-break: break-all;
    text-decoration: none;
}

.broadcast-qrcode .watch-link:hover {
    text-decoration: underline;
}

/* Broadcast Logo */
.broadcast-logo {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.logo-display {
    width: 180px;
    height: 180px;
    margin: 0 auto 12px;
    border-radius: var(--radius);
    overflow: hidden;
    background: rgba(255,255,255,0.05);
}

.logo-display img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.logo-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px dashed rgba(255,255,255,0.2);
    border-radius: var(--radius);
    color: rgba(255,255,255,0.4);
    cursor: pointer;
    transition: all 0.2s;
}

.logo-placeholder:hover {
    border-color: rgba(255,255,255,0.4);
    color: rgba(255,255,255,0.6);
}

.logo-placeholder span {
    font-size: 28px;
    line-height: 1;
}

.logo-placeholder small {
    font-size: 11px;
    margin-top: 4px;
}

.logo-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.logo-actions .btn {
    font-size: 11px;
    padding: 4px 10px;
}

/* Broadcast Preview */
.broadcast-preview {
    background: rgba(255,255,255,0.05);
    border-radius: var(--radius);
    padding: 20px;
}

.broadcast-preview h3 {
    font-size: 14px;
    margin-bottom: 12px;
    color: rgba(255,255,255,0.7);
}

.preview-container {
    position: relative;
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
    aspect-ratio: 16/9;
    margin-bottom: 12px;
}

.preview-container video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Audio-only mode for broadcast preview */
.preview-container.audio-mode {
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
}

.preview-container.audio-mode video {
    display: none;
}

.preview-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.7);
    font-size: 24px;
}

.preview-overlay.hidden {
    display: none;
}

/* Broadcast notifications */
.broadcast-notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 40px 12px 16px;
    border-radius: var(--radius);
    background: var(--bg-secondary);
    color: var(--text);
    font-size: 14px;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    animation: slideDown 0.3s ease;
}

.broadcast-notification.warning {
    background: #78350f;
    border: 1px solid #f59e0b;
}

.broadcast-notification.error {
    background: #7f1d1d;
    border: 1px solid #ef4444;
}

.broadcast-notification button {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
}

.broadcast-notification button:hover {
    color: var(--text);
}

@keyframes slideDown {
    from { opacity: 0; transform: translateX(-50%) translateY(-20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.preview-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.preview-actions .watch-link {
    margin-left: auto;
    padding-right: 10px;
    font-size: 11px;
    color: #93c5fd;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-actions .watch-link:hover {
    text-decoration: underline;
}

/* Broadcast Stats */
.broadcast-stats {
    background: rgba(255,255,255,0.05);
    border-radius: var(--radius);
    padding: 16px;
}

.broadcast-stats h3 {
    font-size: 14px;
    margin-bottom: 12px;
    color: rgba(255,255,255,0.7);
}

.stats-summary {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.stat-item {
    flex: 1;
    text-align: center;
    padding: 10px 8px;
    background: rgba(0,0,0,0.3);
    border-radius: var(--radius);
}

.stat-item .stat-value {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: #4ade80;
    line-height: 1.2;
}

.stat-item .stat-label {
    display: block;
    font-size: 11px;
    color: rgba(255,255,255,0.5);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.devices-breakdown {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.device-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: rgba(0,0,0,0.3);
    border-radius: 12px;
    font-size: 11px;
    color: rgba(255,255,255,0.7);
}

.viewers-list-container {
    max-height: 150px;
    overflow-y: auto;
}

.viewers-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.viewers-list .viewer-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    background: rgba(0,0,0,0.3);
    border-radius: var(--radius);
    font-size: 12px;
}

.viewers-list .viewer-device {
    color: rgba(255,255,255,0.8);
}

.viewers-list .viewer-country {
    font-size: 14px;
}

.viewers-list .viewer-duration {
    color: #4ade80;
    font-weight: 500;
    font-family: monospace;
}

.viewers-list .no-viewers {
    text-align: center;
    color: rgba(255,255,255,0.4);
    font-size: 12px;
    padding: 12px;
}

.broadcast-info {
    background: rgba(255,255,255,0.05);
    border-radius: var(--radius);
    padding: 20px;
}

.broadcast-info h3 {
    font-size: 14px;
    margin-bottom: 16px;
    color: rgba(255,255,255,0.7);
}

.info-group {
    margin-bottom: 16px;
}

.info-group label {
    display: block;
    font-size: 12px;
    color: rgba(255,255,255,0.5);
    margin-bottom: 6px;
}

.info-group .copy-field input {
    background: rgba(0,0,0,0.3);
    border-color: rgba(255,255,255,0.1);
    color: white;
}

/* ==================== WATCH PAGE ==================== */
.watch-page {
    background: #000;
    min-height: 100vh;
    height: 100vh;
}

/* Hide overflow only in portrait mode to prevent unwanted scroll */
@media (orientation: portrait) {
    .watch-page {
        overflow: hidden;
    }
}

.watch-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Entry screen */
.entry-screen {
    position: fixed;
    inset: 0;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.entry-screen.hidden {
    display: none;
}

.entry-content {
    text-align: center;
    color: white;
}

.entry-content h1 {
    font-size: 24px;
    margin-bottom: 40px;
    font-weight: 400;
}

.entry-logo {
    margin-bottom: 30px;
}

.entry-logo img {
    width: 260px;
    height: 260px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(255, 255, 255, 0.15);
}

.entry-button {
    padding: 20px 60px;
    font-size: 24px;
    font-weight: 600;
    letter-spacing: 2px;
    background: white;
    color: #000;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 30px rgba(255,255,255,0.2);
}

.entry-button:hover,
.entry-button:active {
    transform: scale(1.05);
    box-shadow: 0 6px 40px rgba(255,255,255,0.3);
}

/* Loading overlay */
.loading-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #000;
    color: white;
    z-index: 20;
}

.loading-overlay.hidden {
    display: none;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255,255,255,0.2);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

.loading-overlay p {
    font-size: 16px;
    opacity: 0.8;
}

/* Audio visualizer */
.audio-visualizer {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    z-index: 5;
}

.audio-visualizer.hidden {
    display: none;
}

.visualizer-bars {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 6px;
    height: 150px;
    margin-top: -220px;
}

.visualizer-bars .bar {
    width: 12px;
    background: linear-gradient(to top, #4ade80, #22d3ee, #a78bfa);
    border-radius: 6px;
    animation: visualizer-bar 0.5s ease-in-out infinite alternate;
}

.visualizer-bars .bar:nth-child(1) { height: 40%; animation-delay: 0s; }
.visualizer-bars .bar:nth-child(2) { height: 70%; animation-delay: 0.1s; }
.visualizer-bars .bar:nth-child(3) { height: 50%; animation-delay: 0.2s; }
.visualizer-bars .bar:nth-child(4) { height: 90%; animation-delay: 0.15s; }
.visualizer-bars .bar:nth-child(5) { height: 60%; animation-delay: 0.25s; }
.visualizer-bars .bar:nth-child(6) { height: 80%; animation-delay: 0.05s; }
.visualizer-bars .bar:nth-child(7) { height: 45%; animation-delay: 0.3s; }
.visualizer-bars .bar:nth-child(8) { height: 75%; animation-delay: 0.12s; }
.visualizer-bars .bar:nth-child(9) { height: 55%; animation-delay: 0.22s; }
.visualizer-bars .bar:nth-child(10) { height: 85%; animation-delay: 0.08s; }
.visualizer-bars .bar:nth-child(11) { height: 65%; animation-delay: 0.18s; }
.visualizer-bars .bar:nth-child(12) { height: 50%; animation-delay: 0.28s; }

@keyframes visualizer-bar {
    0% { transform: scaleY(0.3); opacity: 0.7; }
    100% { transform: scaleY(1); opacity: 1; }
}

.watch-message {
    text-align: center;
    color: white;
    padding: 40px;
}

.watch-message .message-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.watch-message .message-icon.pulse {
    animation: pulse 2s infinite;
}

.watch-message h2 {
    font-size: 24px;
    margin-bottom: 8px;
}

.watch-message p {
    color: rgba(255,255,255,0.7);
}

.watch-message .hint {
    font-size: 14px;
    margin-top: 20px;
    color: rgba(255,255,255,0.5);
}

.player-container {
    position: relative;
    width: 100%;
    height: 100vh;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.player-container video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: transparent;
}

/* Portrait mode on mobile - video fixed fullscreen */
@media (orientation: portrait) and (max-width: 768px) {
    .player-container {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        height: 100%;
        align-items: center;
        justify-content: center;
    }

    .player-container video {
        width: 100%;
        height: auto;
        max-height: 60%;
    }

    .qrcode-overlay {
        top: 20px;
        bottom: auto;
        right: auto;
        left: 50%;
        transform: translateX(-50%);
        height: 150px;
        width: 150px;
    }

    .qrcode-overlay img {
        width: 150px;
        height: 150px;
        border-radius: 8px;
    }
}

/* Landscape mode - video fills screen */
@media (orientation: landscape) {
    .player-container video {
        width: 100%;
        height: 100vh;
        object-fit: contain;
    }
}

.player-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.3);
    cursor: pointer;
    padding-bottom: 100px;
    box-sizing: border-box;
}

.player-overlay.hidden { display: none; }

/* Move play button up in audio-only mode */
.player-container.audio-mode .player-overlay {
    padding-bottom: 220px;
}

/* QR Code overlay for sharing */
.qrcode-overlay {
    position: absolute;
    bottom: 120px;
    right: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 10;
    transition: all 0.3s ease;
}

.qrcode-overlay img {
    width: 150px;
    height: 150px;
    border-radius: 8px;
}

.qrcode-overlay .qrcode-title {
    margin-bottom: 8px;
    font-size: 13px;
    color: #333;
    font-weight: 600;
    text-align: center;
}

.qrcode-overlay .qrcode-hint {
    margin-top: 8px;
    font-size: 11px;
    color: #333;
    font-weight: 500;
}

/* Audio-only mode: QR code below visualizer */
.qrcode-overlay.audio-mode {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, 30px);
    bottom: auto;
    right: auto;
    z-index: 15;
}

.qrcode-overlay.audio-mode img {
    width: 140px;
    height: 140px;
}

.qrcode-overlay.audio-mode .qrcode-title {
    display: none;
}

.qrcode-overlay.audio-mode .qrcode-hint {
    display: none;
}

.play-button {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffffff 0%, #e0e0e0 100%);
    border: none;
    font-size: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    -webkit-tap-highlight-color: transparent;
    position: relative;
}

.play-button::after {
    content: '';
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 15px 0 15px 24px;
    border-color: transparent transparent transparent #333;
    margin-left: 6px;
}

.play-button:hover,
.play-button:active {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(0,0,0,0.4);
}

.play-button span {
    display: none;
}

/* Overlay logo (shown when stream is stopped, replaces play button) */
.overlay-logo {
    position: relative;
    cursor: pointer;
    transition: transform 0.2s ease;
    margin-top: -154px;
}

.overlay-logo img {
    max-width: 280px;
    max-height: 280px;
    width: auto;
    height: auto;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.overlay-logo-play {
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #ffffff 0%, #e0e0e0 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #333;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    padding-left: 4px;
}

.overlay-logo:hover {
    transform: scale(1.05);
}

.overlay-logo:hover .overlay-logo-play {
    box-shadow: 0 6px 30px rgba(0,0,0,0.4);
}

/* Adjust overlay-logo in audio mode */
.player-container.audio-mode .overlay-logo {
    margin-bottom: 180px;
}

.player-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    color: white;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 30;
}

/* Always show controls in audio-only mode */
.player-container.audio-mode .player-controls {
    opacity: 1;
    background: rgba(0,0,0,0.5);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
}

/* Hide fullscreen button in audio-only mode */
.player-container.audio-mode #btn-fullscreen {
    display: none;
}

.player-container:hover .player-controls,
.player-container:active .player-controls {
    opacity: 1;
}

/* Always show controls on touch devices */
@media (hover: none) {
    .player-controls {
        opacity: 1;
    }
}

/* Watch page VU meter */
.watch-meter {
    position: fixed;
    bottom: 2px;
    left: 0;
    right: 0;
    z-index: 9999;
    display: none;
    padding: 0 10px;
    box-sizing: border-box;
}

.watch-meter.active {
    display: block;
}

/* iOS safe area */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .watch-meter {
        bottom: calc(2px + env(safe-area-inset-bottom));
    }
}

.watch-meter .meter-bar {
    height: 6px;
    border-radius: 3px;
}

.watch-meter .meter-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #22c55e, #eab308, #ef4444);
    border-radius: 3px;
    transition: width 0.05s;
}

.room-name-centered {
    font-weight: 500;
    text-align: center;
    margin-bottom: 12px;
    font-size: 16px;
}

.controls-buttons {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.control-btn {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    opacity: 0.8;
    transition: opacity 0.2s;
    min-width: 36px;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-btn span {
    font-size: 20px;
    line-height: 1;
}

/* Play/Stop button with CSS icons */
#btn-playpause {
    position: relative;
}

#btn-playpause #playpause-icon {
    display: none;
}

#btn-playpause::after {
    content: '';
    display: block;
}

/* Stop icon (square) */
#btn-playpause.is-playing::after {
    width: 14px;
    height: 14px;
    background: white;
}

/* Play icon (triangle) */
#btn-playpause:not(.is-playing)::after {
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 8px 0 8px 14px;
    border-color: transparent transparent transparent white;
    background: transparent;
}

.control-btn:hover,
.control-btn:active { opacity: 1; }

.volume-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.volume-control input[type="range"] {
    width: 80px;
    height: 4px;
    -webkit-appearance: none;
    background: rgba(255,255,255,0.3);
    border-radius: 2px;
}

.volume-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
}

.watch-error {
    text-align: center;
    color: white;
    padding: 40px;
}

.watch-error .message-icon {
    font-size: 48px;
    color: #f59e0b;
    margin-bottom: 16px;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .broadcast-main {
        grid-template-columns: 1fr;
    }

    .broadcast-qr-preview {
        flex-direction: column;
    }

    .rooms-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .room-card-actions {
        flex-direction: column;
    }

    .room-card-actions .btn {
        min-width: 100%;
    }

    .admin-container {
        padding: 12px;
    }

    .tabs {
        overflow-x: auto;
    }
}

/* Hide QR code in fullscreen */
:fullscreen .qrcode-overlay,
:-webkit-full-screen .qrcode-overlay {
    display: none;
}

/* Hide QR code and controls in landscape orientation on mobile (except audio mode) */
@media (orientation: landscape) and (max-width: 1024px) {
    .qrcode-overlay:not(.audio-mode),
    .qrcode-overlay.force-show:not(.audio-mode) {
        display: none !important;
    }

    .player-controls {
        display: none;
    }

    /* Keep controls visible in audio-only mode */
    .player-container.audio-mode .player-controls {
        display: flex;
    }
}

/* Fake fullscreen for landscape - keeps VU meter visible */
.player-container.fake-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9998 !important;
    background: #000 !important;
}

.player-container.fake-fullscreen video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.player-container.fake-fullscreen .watch-meter {
    position: fixed;
    bottom: 2px;
    left: 0;
    right: 0;
    z-index: 9999;
}

.player-container.fake-fullscreen .qrcode-overlay,
.player-container.fake-fullscreen .player-controls,
.player-container.fake-fullscreen .player-overlay,
.player-container.fake-fullscreen .loading-overlay {
    display: none !important;
}

/* Keep elements visible in audio mode fullscreen */
.player-container.fake-fullscreen.audio-mode .audio-visualizer {
    display: flex !important;
    position: fixed;
    inset: 0;
    z-index: 9998;
}

.player-container.fake-fullscreen.audio-mode .qrcode-overlay.audio-mode {
    display: flex !important;
    z-index: 9999;
}

.player-container.fake-fullscreen.audio-mode .player-controls {
    display: flex !important;
    z-index: 9999;
}

.player-container.fake-fullscreen.audio-mode .room-logo {
    z-index: 9999;
}

.player-container.fake-fullscreen.audio-mode .watch-meter {
    display: block !important;
    z-index: 10000;
}

/* Show toggle button on mobile to show/hide QR */
.qrcode-toggle {
    display: none;
}

@media (max-width: 768px) {
    .qrcode-toggle {
        display: inline-block;
    }
}

/* Force show/hide QR code via toggle button */
.qrcode-overlay.force-show {
    display: flex !important;
}

.qrcode-overlay.force-hide {
    display: none !important;
}

/* ==================== DEBUG PANEL ==================== */
.debug-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.9);
    color: #0f0;
    font-family: monospace;
    font-size: 11px;
    z-index: 10000;
    max-height: 50vh;
    display: flex;
    flex-direction: column;
}

.debug-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #333;
    cursor: pointer;
    user-select: none;
}

.debug-header span:first-child {
    font-weight: bold;
    color: #0f0;
}

.debug-content {
    overflow-y: auto;
    max-height: 40vh;
    padding: 8px 12px;
}

.debug-content.collapsed {
    display: none;
}

#debug-log {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-all;
    line-height: 1.4;
}

.debug-log-ice { color: #0ff; }
.debug-log-state { color: #ff0; }
.debug-log-error { color: #f00; }
.debug-log-info { color: #0f0; }

/* Disabled controls (when live) */
.form-group.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.form-group.disabled label {
    color: #888;
}

.form-group.disabled select,
.form-group.disabled input:not([type="range"]) {
    background-color: #2a2a2a;
    cursor: not-allowed;
}

.form-group.disabled input[type="checkbox"] {
    cursor: not-allowed;
}

/* Checkbox group disabled state */
.form-group.checkbox-group.disabled {
    opacity: 0.5;
}

.form-group.checkbox-group.disabled label {
    cursor: not-allowed;
}

/* ==================== WATCH PRO ==================== */
.watch-pro-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.watch-pro-config {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    padding: 20px;
}

.watch-pro-config .config-content {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    backdrop-filter: blur(10px);
}

.watch-pro-config h2 {
    color: white;
    text-align: center;
    margin-bottom: 30px;
    font-size: 28px;
}

.watch-pro-config .form-group {
    margin-bottom: 20px;
}

.watch-pro-config label {
    color: rgba(255, 255, 255, 0.8);
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
}

.watch-pro-config select,
.watch-pro-config input[type="text"] {
    width: 100%;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    font-size: 16px;
}

.watch-pro-config select:focus,
.watch-pro-config input:focus {
    outline: none;
    border-color: var(--primary);
}

.watch-pro-config .checkbox-group label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.watch-pro-config .checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

.watch-pro-config .btn-live {
    width: 100%;
    padding: 16px;
    font-size: 18px;
    margin-top: 20px;
}

/* Watch Pro Player */
.watch-pro-container .player-container {
    flex: 1;
    position: relative;
    background: #000;
    min-height: 100vh;
}

.watch-pro-container #sldp-player {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.watch-pro-container #sldp-player video {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain;
}

.watch-pro-container #sldp-player.audio-only-mode {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

.watch-pro-container #whep-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Player mode badge */
.player-mode-badge {
    background: var(--primary);
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
}

.stream-info {
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    margin-left: 10px;
}

.controls-left {
    display: flex;
    align-items: center;
}

/* Watch Pro Controls */
.watch-pro-container .player-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    opacity: 0;
    transition: opacity 0.3s;
}

.watch-pro-container .player-container:hover .player-controls {
    opacity: 1;
}

/* Stream name in audio visualizer */
.audio-visualizer .stream-name {
    margin-top: 20px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
}

/* Room logo in audio visualizer */
.room-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: -260px;
}

.room-logo img {
    max-width: 280px;
    max-height: 280px;
    width: auto;
    height: auto;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: logo-pulse 3s ease-in-out infinite;
}

@keyframes logo-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

/* Waiting logo */
.waiting-logo {
    margin-bottom: 24px;
}

.waiting-logo img {
    width: 180px;
    height: 180px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: logo-pulse 3s ease-in-out infinite;
}

/* Landscape mode: logo and QR code side by side */
@media (orientation: landscape) {
    .player-container.audio-mode .room-logo {
        position: fixed;
        top: 35%;
        left: calc(50% - 20px);
        transform: translate(-100%, -50%);
        margin-top: 0;
    }

    .player-container.audio-mode .room-logo img {
        max-width: 200px;
        max-height: 200px;
    }

    .qrcode-overlay.audio-mode {
        position: fixed;
        top: 35%;
        left: calc(50% + 20px);
        transform: translateY(-50%);
        bottom: auto;
        right: auto;
    }

    .qrcode-overlay.audio-mode img {
        width: 200px;
        height: 200px;
    }

    .player-container.audio-mode .watch-meter {
        bottom: 2px;
    }

    /* Overlay logo in landscape audio mode */
    .player-container.audio-mode .overlay-logo {
        position: fixed;
        top: 35%;
        left: 50%;
        transform: translate(-50%, -50%);
        margin-bottom: 0;
    }

    .player-container.audio-mode .overlay-logo img {
        max-width: 200px;
        max-height: 200px;
    }
}

/* Secondary button */
.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    margin-left: 10px;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Watch Pro Error */
.watch-pro-container .watch-error {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: white;
}

.watch-pro-container .watch-error .btn {
    margin-top: 20px;
}

/* ==================== LEAVE WARNING MODAL ==================== */
.leave-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.leave-modal.visible {
    opacity: 1;
    visibility: visible;
}

.leave-modal-content {
    background: white;
    border-radius: 16px;
    padding: 32px 40px;
    max-width: 420px;
    width: 90%;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: scale(0.9) translateY(-20px);
    transition: transform 0.3s ease;
}

.leave-modal.visible .leave-modal-content {
    transform: scale(1) translateY(0);
}

.leave-modal-icon {
    font-size: 64px;
    margin-bottom: 16px;
    line-height: 1;
    animation: pulse-warning 2s infinite;
}

@keyframes pulse-warning {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.leave-modal-content h2 {
    font-size: 24px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 12px;
}

.leave-modal-content p {
    color: #64748b;
    font-size: 15px;
    margin-bottom: 8px;
    line-height: 1.5;
}

.leave-modal-warning {
    color: var(--danger) !important;
    font-weight: 600;
    font-size: 14px !important;
    margin-bottom: 24px !important;
}

.leave-modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 24px;
}

.leave-modal-buttons .btn {
    min-width: 120px;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.leave-modal-buttons .btn-danger {
    background: var(--danger);
    color: white;
    border: none;
}

.leave-modal-buttons .btn-danger:hover {
    background: var(--danger-dark);
    transform: translateY(-1px);
}

.leave-modal-buttons .btn:not(.btn-danger) {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.leave-modal-buttons .btn:not(.btn-danger):hover {
    background: #e2e8f0;
}
