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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    min-height: 100vh;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    text-align: center;
    margin-bottom: 20px;
    color: white;
}

.header h1 {
    font-size: 24px;
    margin-bottom: 10px;
}

.status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
}

.status-indicator {
    font-size: 20px;
    line-height: 1;
}

.status-online { color: #4CAF50; }
.status-connecting { color: #FF9800; }
.status-error { color: #F44336; }
.status-offline { color: #9E9E9E; }

.main-content {
    flex: 1;
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

/* Stream Type Selector */
.stream-type-selector {
    background: #f0f4ff;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    border: 2px solid #d6e4ff;
}

.stream-type-selector h3 {
    margin-bottom: 15px;
    color: #333;
}

.stream-buttons {
    display: flex;
    gap: 10px;
}

.stream-btn {
    flex: 1;
    padding: 12px;
    background: #e9ecef;
    border: 2px solid transparent;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.stream-btn.active {
    background: #667eea;
    color: white;
    border-color: #5568d4;
}

.stream-btn:hover:not(.active) {
    background: #d6e4ff;
    border-color: #667eea;
}

/* Configuration Section */
.config-section {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    border: 1px solid #e9ecef;
}

.config-section h3 {
    margin-bottom: 15px;
    color: #333;
}

.config-input-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.config-input-group label {
    font-weight: 600;
    color: #555;
}

.config-input-group input {
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

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

.input-with-presets {
    display: flex;
    gap: 10px;
}

.input-with-presets input {
    flex: 1;
}

.full-url-display {
    margin-top: 10px;
    padding: 10px;
    background: #e9ecef;
    border-radius: 6px;
    font-size: 14px;
}

.full-url-display code {
    display: block;
    margin-top: 5px;
    padding: 8px;
    background: white;
    border-radius: 4px;
    word-break: break-all;
    font-family: 'Courier New', monospace;
    font-size: 12px;
}

.stream-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 10px;
    padding: 10px;
    background: #f0f8ff;
    border-radius: 6px;
    font-size: 13px;
}

.info-item {
    display: flex;
    justify-content: space-between;
}

.info-item span:first-child {
    font-weight: 600;
    color: #555;
}

/* Video Container */
.video-container {
    position: relative;
    width: 100%;
    background: #000;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 20px;
    aspect-ratio: 16/9;
}

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

.connection-info {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 8px 12px;
    border-radius: 5px;
    font-size: 13px;
    text-align: center;
}

.video-info {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 12px;
}

/* Controls */
.controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

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

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-secondary {
    background: #f5f5f5;
    color: #333;
    border: 2px solid #ddd;
}

.btn-tertiary {
    background: transparent;
    color: #667eea;
    border: 2px solid #667eea;
}

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

.btn:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

/* Debug Panel */
.debug-panel {
    background: #1a1a1a;
    color: #fff;
    border-radius: 10px;
    margin-bottom: 20px;
    overflow: hidden;
}

.debug-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #2a2a2a;
    border-bottom: 1px solid #444;
}

.debug-header h3 {
    margin: 0;
    color: #fff;
}

.btn-close {
    background: #666;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-close:hover {
    background: #888;
}

.debug-content {
    padding: 15px;
}

.debug-section {
    margin-bottom: 20px;
}

.debug-section h4 {
    color: #ccc;
    margin-bottom: 10px;
    border-bottom: 1px solid #444;
    padding-bottom: 5px;
}

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

.stat {
    display: flex;
    justify-content: space-between;
    padding: 8px;
    background: #2a2a2a;
    border-radius: 5px;
}

.stat span:first-child {
    color: #aaa;
}

.message-log {
    max-height: 200px;
    overflow-y: auto;
    background: #2a2a2a;
    border-radius: 5px;
    padding: 10px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
}

.log-message {
    padding: 5px 0;
    border-bottom: 1px solid #333;
}

.log-message:last-child {
    border-bottom: none;
}

.log-info { color: #4fc3f7; }
.log-warning { color: #ffb74d; }
.log-error { color: #f44336; }
.log-debug { color: #81c784; }

/* Server Info */
.server-info {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 10px;
    border: 1px solid #e9ecef;
}

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

.info-header h3 {
    margin: 0;
    color: #333;
}

.stream-actions {
    display: flex;
    gap: 10px;
}

.btn-save {
    padding: 8px 16px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.3s;
}

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

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

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.stat-label {
    font-size: 14px;
    color: #666;
}

.stat-value {
    font-size: 18px;
    font-weight: bold;
}

.quality-good { color: #4CAF50; }
.quality-fair { color: #FF9800; }
.quality-poor { color: #F44336; }
.quality-neutral { color: #666; }

.footer {
    text-align: center;
    color: white;
    margin-top: 20px;
    padding: 15px;
    font-size: 14px;
    opacity: 0.8;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .header h1 {
        font-size: 20px;
    }
    
    .btn {
        min-width: 100px;
        padding: 10px 15px;
        font-size: 14px;
    }
    
    .controls {
        flex-direction: column;
    }
    
    .stream-buttons {
        flex-direction: column;
    }
    
    .stream-info {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Fullscreen styles */
:fullscreen .video-container {
    height: 100vh;
    border-radius: 0;
}

:fullscreen .controls,
:fullscreen .server-info,
:fullscreen .header,
:fullscreen .footer,
:fullscreen .config-section,
:fullscreen .stream-type-selector {
    display: none;
}

/* Animations */
@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}