* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    background: #f5f5f5;
}

h1 {
    color: #333;
    margin-bottom: 20px;
}

h3 {
    margin-top: 0;
    color: #444;
}

.card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

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

input[type="text"] {
    flex: 1;
    min-width: 300px;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

input[type="text"]:focus {
    outline: none;
    border-color: #007bff;
}

button {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-connect {
    background: #28a745;
    color: white;
}

.btn-connect:hover {
    background: #218838;
}

.btn-disconnect {
    background: #dc3545;
    color: white;
}

.btn-disconnect:hover {
    background: #c82333;
}

.video-container {
    position: relative;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
}

video {
    width: 100%;
    display: block;
}

.btn-fullscreen {
    position: absolute;
    bottom: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 18px;
    transition: background 0.2s;
    z-index: 10;
}

.btn-fullscreen:hover {
    background: rgba(0, 0, 0, 0.8);
}

.video-container:fullscreen .btn-fullscreen,
.video-container:-webkit-full-screen .btn-fullscreen,
.video-container:-moz-full-screen .btn-fullscreen,
.video-container:-ms-fullscreen .btn-fullscreen {
    background: rgba(0, 0, 0, 0.7);
}

/* Use Flexbox for robust centering and scaling in fullscreen */
.video-container:fullscreen,
.video-container:-webkit-full-screen,
.video-container:-moz-full-screen,
.video-container:-ms-fullscreen {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: #000; /* Explicitly set background for letterboxing */
}

.video-container:fullscreen video,
.video-container:-webkit-full-screen video,
.video-container:-moz-full-screen video,
.video-container:-ms-fullscreen video {
    /* Auto-size to fit container while maintaining aspect ratio */
    flex: 0 0 auto; /* Do not grow or shrink */
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain; /* Fallback */
}

.status-bar {
    padding: 10px 15px;
    border-radius: 4px;
    font-weight: 500;
    margin-bottom: 15px;
}

.status-bar.connected {
    background: #d4edda;
    color: #155724;
}

.status-bar.error {
    background: #f8d7da;
    color: #721c24;
}

.status-bar.info {
    background: #cce5ff;
    color: #004085;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
}

.stat-item {
    text-align: center;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
}

.stat-label {
    font-size: 11px;
    color: #666;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.stat-value.warning {
    color: #dc3545;
}

.stat-value.good {
    color: #28a745;
}

.logs-container {
    max-height: 250px;
    overflow-y: auto;
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    font-size: 11px;
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 15px;
    border-radius: 4px;
    line-height: 1.4;
}

.log-entry {
    margin: 2px 0;
    word-break: break-word;
}

.log-entry.error {
    color: #f48771;
}

.log-entry.success {
    color: #89d185;
}

.log-entry.info {
    color: #9cdcfe;
}

.log-entry.warn {
    color: #dcdcaa;
}

.hidden {
    display: none !important;
}

.browser-info {
    font-size: 12px;
    color: #666;
    margin-bottom: 10px;
}
