/* CSS Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

/* Header */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    color: #333;
    font-size: 1.8rem;
    font-weight: 700;
}

.header h1 i {
    color: #667eea;
    margin-right: 0.5rem;
}

/* Main Content */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    min-height: calc(100vh - 80px);
}

/* Screen Management */
.screen {
    display: none;
}

.screen.active {
    display: block;
}

/* Start Screen */
.start-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

.start-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 3rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    text-align: center;
    max-width: 500px;
    width: 100%;
}

.start-card h2 {
    margin-bottom: 2rem;
    color: #333;
    font-size: 2rem;
}

.input-group {
    margin-bottom: 2rem;
    text-align: left;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #555;
}

.input-group input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.input-group input:focus {
    outline: none;
    border-color: #667eea;
}

.button-group {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.features {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 2rem;
}

.feature {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #666;
    font-size: 0.9rem;
}

.feature i {
    color: #667eea;
    width: 16px;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    flex: 1;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.8);
    color: #333;
    border: 2px solid #e1e5e9;
    flex: 1;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 1);
    border-color: #667eea;
}

.btn-small {
    padding: 0.5rem;
    font-size: 0.8rem;
}

.btn-close {
    background: none;
    color: #999;
    padding: 0.5rem;
}

.btn-close:hover {
    color: #333;
}

/* Stream Screen */
.stream-container {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 2rem;
    height: calc(100vh - 140px);
}

.video-area {
    background: rgba(0, 0, 0, 0.8);
    border-radius: 15px;
    overflow: hidden;
    position: relative;
}

.video-wrapper {
    position: relative;
    width: 100%;
    height: 70%;
}

.video-element {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000;
}

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 1rem;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.6), transparent);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.status-indicator {
    color: white;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-indicator.live {
    color: #ff4444;
}

.status-indicator.live i {
    animation: pulse 2s infinite;
}

.viewer-count {
    color: white;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.remote-videos {
    height: 30%;
    display: flex;
    gap: 10px;
    padding: 10px;
    overflow-x: auto;
}

.remote-video {
    min-width: 200px;
    height: 100%;
    background: #333;
    border-radius: 8px;
    overflow: hidden;
}

.remote-video video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Control Panel */
.control-panel {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    height: fit-content;
}

.controls-section h3,
.info-section h3,
.chat-section h3 {
    margin-bottom: 1rem;
    color: #333;
    font-size: 1.1rem;
}

.controls-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.control-btn {
    padding: 0.75rem;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8rem;
}

.control-btn.active {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

.control-btn.stop {
    border-color: #ff4444;
    color: #ff4444;
}

.control-btn.stop:hover {
    background: rgba(255, 68, 68, 0.1);
}

.control-btn:hover {
    transform: translateY(-2px);
}

.info-item {
    margin-bottom: 1rem;
}

.info-item label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #555;
    font-size: 0.9rem;
}

.copy-field {
    display: flex;
    gap: 0.5rem;
}

.copy-field input {
    flex: 1;
    padding: 0.5rem;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 0.8rem;
    background: rgba(0, 0, 0, 0.05);
}

/* Chat */
.chat-messages {
    height: 200px;
    overflow-y: auto;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    background: rgba(0, 0, 0, 0.02);
}

.chat-message {
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 8px;
    font-size: 0.85rem;
}

.chat-message .user {
    font-weight: 600;
    color: #667eea;
}

.chat-message .time {
    color: #999;
    font-size: 0.75rem;
}

.chat-input {
    display: flex;
    gap: 0.5rem;
}

.chat-input input {
    flex: 1;
    padding: 0.5rem;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 0.9rem;
}

.chat-input input:focus {
    outline: none;
    border-color: #667eea;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    backdrop-filter: blur(5px);
}

.modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e1e5e9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid #e1e5e9;
    text-align: right;
}

.setting-group {
    margin-bottom: 1.5rem;
}

.setting-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #555;
}

.setting-group select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 1rem;
}

/* Loading Overlay */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 3000;
    justify-content: center;
    align-items: center;
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    text-align: center;
    color: white;
}

.loading-spinner i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.loading-spinner p {
    font-size: 1.2rem;
}

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

/* Responsive Design */
@media (max-width: 1024px) {
    .stream-container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .control-panel {
        order: -1;
    }
    
    .video-area {
        height: 400px;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 1rem;
    }
    
    .header-content {
        padding: 0 1rem;
    }
    
    .start-card {
        padding: 2rem;
        margin: 1rem;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .features {
        grid-template-columns: 1fr;
    }
    
    .controls-grid {
        grid-template-columns: 1fr;
    }
}
