/**
 * 远程桌面控制UI样式
 * 包含顶部状态栏、音频控制、焦点管理等现代化界面
 */

/* === 远程桌面容器 === */
.remote-desktop-container {
    position: relative;
    width: 100%;
    height: 100vh;
    background: #1a1a1a;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
}

/* === 顶部固定状态栏 === */
.remote-status-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(135deg, #2d3748 0%, #4a5568 100%);
    backdrop-filter: blur(10px);
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.remote-status-bar.connected {
    border-bottom-color: rgba(72, 187, 120, 0.5);
    background: linear-gradient(135deg, #1a365d 0%, #2c5282 100%);
}

.remote-status-bar.disconnected {
    border-bottom-color: rgba(245, 101, 101, 0.5);
    background: linear-gradient(135deg, #742a2a 0%, #c53030 100%);
}

/* === 状态栏左侧 - 连接信息 === */
.status-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.1);
    font-weight: 600;
    font-size: 14px;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-indicator.connected {
    background: #48bb78;
    box-shadow: 0 0 10px rgba(72, 187, 120, 0.5);
}

.status-indicator.connecting {
    background: #ed8936;
    box-shadow: 0 0 10px rgba(237, 137, 54, 0.5);
}

.status-indicator.disconnected {
    background: #f56565;
    box-shadow: 0 0 10px rgba(245, 101, 101, 0.5);
    animation: none;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* === 状态栏中间 - 性能指标 === */
.performance-metrics {
    display: flex;
    align-items: center;
    gap: 24px;
}

.metric-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 60px;
}

.metric-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-value {
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
}

.metric-value.good { color: #48bb78; }
.metric-value.warning { color: #ed8936; }
.metric-value.bad { color: #f56565; }

/* === 协议指示器 === */
.protocol-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.protocol-indicator.webtransport {
    background: rgba(72, 187, 120, 0.2);
    color: #48bb78;
    border: 1px solid rgba(72, 187, 120, 0.3);
}

.protocol-indicator.webrtc {
    background: rgba(237, 137, 54, 0.2);
    color: #ed8936;
    border: 1px solid rgba(237, 137, 54, 0.3);
}

/* === 状态栏右侧 - 控制按钮 === */
.status-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.control-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 16px;
}

.control-button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.control-button.active {
    background: rgba(72, 187, 120, 0.3);
    color: #48bb78;
}

.control-button.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* === 音频控制面板 === */
.audio-controls {
    position: absolute;
    top: 65px;
    right: 20px;
    width: 300px;
    background: rgba(26, 32, 44, 0.95);
    backdrop-filter: blur(15px);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transform: translateY(-10px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 999;
}

.audio-controls.visible {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

.audio-section {
    margin-bottom: 20px;
}

.audio-section:last-child {
    margin-bottom: 0;
}

.audio-section-title {
    font-size: 14px;
    font-weight: 600;
    color: #e2e8f0;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 12px;
}

.volume-slider {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
    cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #48bb78;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.volume-value {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    min-width: 35px;
    text-align: right;
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
}

.device-select {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
    color: white;
    font-size: 14px;
    cursor: pointer;
}

.device-select option {
    background: #2d3748;
    color: white;
}

/* === 模式切换控制 === */
.mode-selector {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 4px;
    gap: 2px;
}

.mode-option {
    flex: 1;
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
}

.mode-option.active {
    background: rgba(72, 187, 120, 0.3);
    color: #48bb78;
}

.mode-option:hover:not(.active) {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* === 视频容器调整 === */
.remote-video-wrapper {
    margin-top: 60px; /* 为状态栏留出空间 */
    width: 100%;
    height: calc(100vh - 60px);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

.remote-video-wrapper video,
.remote-video-wrapper canvas {
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

/* === 焦点状态指示 === */
.remote-video-wrapper.focused {
    outline: 3px solid rgba(72, 187, 120, 0.6);
    outline-offset: -3px;
}

.remote-video-wrapper.unfocused {
    outline: 2px solid rgba(255, 255, 255, 0.2);
    outline-offset: -2px;
}

/* === 焦点提示 === */
.focus-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 20px 30px;
    border-radius: 12px;
    font-size: 16px;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 100;
}

.focus-hint.visible {
    opacity: 1;
    visibility: visible;
}

/* === 全屏模式 === */
.remote-desktop-container.fullscreen .remote-status-bar {
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

.remote-desktop-container.fullscreen .remote-status-bar:hover {
    transform: translateY(0);
}

.remote-desktop-container.fullscreen .remote-video-wrapper {
    margin-top: 0;
    height: 100vh;
}

/* === 响应式设计 === */
@media (max-width: 1024px) {
    .performance-metrics {
        gap: 16px;
    }
    
    .metric-item {
        min-width: 50px;
    }
    
    .metric-value {
        font-size: 14px;
    }
}

@media (max-width: 768px) {
    .remote-status-bar {
        padding: 0 15px;
        height: 50px;
    }
    
    .remote-video-wrapper {
        margin-top: 50px;
        height: calc(100vh - 50px);
    }
    
    .performance-metrics {
        gap: 12px;
    }
    
    .audio-controls {
        width: 250px;
        right: 15px;
    }
}

/* === 动画效果 === */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.remote-status-bar {
    animation: slideIn 0.5s ease;
}

/* === 工具提示 === */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: -35px;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    font-size: 12px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 1001;
}

.tooltip:hover::after {
    opacity: 1;
    visibility: visible;
}
