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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    padding: 30px;
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
    font-size: 2.5em;
}

h2 {
    color: #555;
    margin-bottom: 20px;
    font-size: 1.5em;
}

h3 {
    color: #666;
    margin-bottom: 15px;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid #e0e0e0;
}

.tab-button {
    padding: 12px 30px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 16px;
    color: #666;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.tab-button:hover {
    color: #667eea;
}

.tab-button.active {
    color: #667eea;
    border-bottom-color: #667eea;
    font-weight: bold;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 30px;
}

/* Controls Panel */
.controls-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-group label {
    font-weight: 600;
    color: #555;
    font-size: 14px;
}

.control-group input[type="text"],
.control-group input[type="number"],
.control-group select {
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.control-group input[type="text"]:focus,
.control-group input[type="number"]:focus,
.control-group select:focus {
    outline: none;
    border-color: #667eea;
}

.control-group input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    outline: none;
}

#customQuality {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 6px;
}

#customQuality > div {
    margin-bottom: 10px;
}

/* Buttons */
.button-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    flex: 1;
    min-width: 120px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.4);
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #7f8c8d;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(149, 165, 166, 0.4);
}

/* Status Info */
.status-info {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid #667eea;
}

.status-info p {
    margin: 8px 0;
    font-size: 14px;
    color: #555;
}

.status-info span {
    font-weight: 600;
    color: #667eea;
}

/* Video Panel */
.video-panel {
    display: flex;
    flex-direction: column;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
}

.video-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #1a1a1a;
    padding: 15px;
}

.video-panel h3 {
    color: white;
    margin: 0;
}

.btn-icon {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    padding: 8px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.btn-icon svg {
    display: block;
}

#videoContainer {
    position: relative;
    background: #000;
}

#videoContainer:fullscreen {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    width: 100vw;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
}

#videoContainer:-webkit-full-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    width: 100vw;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
}

#videoContainer:-moz-full-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    width: 100vw;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
}

#localVideo,
#remoteCanvas {
    width: 100%;
    height: auto;
    min-height: 400px;
    background: #000;
    display: block;
}

#remoteCanvas {
    max-height: 800px;
    object-fit: contain;
}

/* Fullscreen canvas styling */
#videoContainer:fullscreen #remoteCanvas,
#videoContainer:-webkit-full-screen #remoteCanvas,
#videoContainer:-moz-full-screen #remoteCanvas {
    display: block;
    margin: auto;
    flex-shrink: 0;
}

/* Active Streams */
.active-streams {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
}

.active-streams h3 {
    margin-top: 0;
}

#activeStreamsList {
    list-style: none;
    padding: 0;
}

#activeStreamsList li {
    padding: 10px;
    margin: 5px 0;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

#activeStreamsList li:hover {
    background: #667eea;
    color: white;
    transform: translateX(5px);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .tab-content.active {
        grid-template-columns: 1fr;
    }

    .video-panel {
        order: -1;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    h1 {
        font-size: 1.8em;
    }

    .button-group {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
}
