/* Video Control Bar Styles */
.video-control-bar {
    position: absolute;
    padding: 12px 16px;
    background: rgba(28, 28, 30, 0.7);
    /* backdrop-filter: blur(8px); */
    /* -webkit-backdrop-filter: blur(8px); */
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: opacity 0.3s ease;
    opacity: 0.7;
    width: auto;
    min-width: 300px;
    max-width: 70%;
}

.video-control-bar:hover {
    opacity: 0.95; /* Still slightly transparent even on hover */
}

.video-control-bar.hidden {
    opacity: 0;
    pointer-events: none;
    display: none !important;
}

/* Control buttons */
.control-btn {
    background: none;
    border: none;
    color: white;
    font-size: 16px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
    position: relative;
}

.control-btn:hover {
    background-color: rgba(255, 255, 255, 0.7);
}

.control-btn svg {
    width: 24px;
    height: 24px;
    fill: white;
}

/* 添加键盘过滤按钮激活状态样式 */
#keyboard-filter-btn.active {
    background-color: rgba(76, 175, 80, 0.3); /* 绿色背景 */
    border: 2px solid #4CAF50;
}

#keyboard-filter-btn.active svg {
    fill: #4CAF50; /* 绿色图标 */
}

/* 添加光标锁定按钮激活状态样式 */
#cursor-lock-btn.active {
    background-color: rgba(76, 175, 80, 0.3); /* 绿色背景 */
    border: 2px solid #4CAF50;
}

#cursor-lock-btn.active svg {
    fill: #4CAF50; /* 绿色图标 */
}

/* 添加同步显示器按钮激活状态样式 */
#sync-display-btn.active {
    background-color: rgba(76, 175, 80, 0.3); /* 绿色背景 */
    border: 2px solid #4CAF50;
}

#sync-display-btn.active svg {
    fill: #4CAF50; /* 绿色图标 */
}

#original-size-mode-btn.active {
    background-color: rgba(76, 175, 80, 0.3);
    /* 绿色背景 */
    border: 2px solid #4CAF50;
}

#original-size-mode-btn.active svg {
    fill: #4CAF50;
    /* 绿色图标 */
}


/* Control groups */
.control-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Dropdown menus */
.dropdown-menu {
    position: absolute;
    bottom: 50px;
    background: rgba(28, 28, 30, 0.7); /* Increased transparency from 0.9 to 0.7 */
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 8px;
    padding: 8px 0;
    min-width: 150px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    display: none;
    z-index: 101;
    transform-origin: bottom center;
    animation: dropdown-appear 0.2s ease forwards;
}

@keyframes dropdown-appear {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.dropdown-menu.show {
    display: block;
}

.dropdown-item {
    padding: 8px 16px;
    color: white;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 14px;
    white-space: nowrap;
    display: flex;
    align-items: center;
}

.dropdown-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.dropdown-item.active {
    background-color: rgba(59, 130, 246, 0.5);
}

/* Divider */
.control-divider {
    width: 1px;
    height: 24px;
    background-color: rgba(255, 255, 255, 0.3);
    margin: 0 8px;
}

/* Tooltip */
.tooltip {
    position: absolute;
    bottom: 50px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}

.control-btn:hover .tooltip {
    opacity: 1;
}

/* Show controls button */
.show-controls-btn {
    position: absolute;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(40, 40, 45, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    display: flex !important;
    align-items: center;
    justify-content: center;
    cursor: move; /* Indicate it's draggable */
    z-index: 200;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
    touch-action: none; /* Prevent default touch actions for better drag experience */
    opacity: 0.9;
}

.show-controls-btn:hover {
    background: rgba(60, 60, 65, 0.9);
    transform: scale(1.1);
    opacity: 1;
}

.show-controls-btn svg {
    width: 20px;
    height: 20px;
    fill: white;
    display: block;
}

/* TURN Configuration Dialog */
.turn-config-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.7) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 9999 !important;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    visibility: visible !important;
    opacity: 1 !important;
}

.turn-config-dialog {
    background: rgba(40, 40, 45, 0.95);
    border-radius: 12px;
    width: 90%;
    max-width: 480px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
    transition: max-width 0.3s ease;
}

.turn-config-dialog.expanded {
    max-width: 800px;
}

.turn-config-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.turn-config-header h3 {
    margin: 0;
    color: white;
    font-size: 18px;
    font-weight: 600;
}

.turn-config-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.turn-config-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.turn-config-content {
    padding: 20px;
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.turn-config-fields {
    flex: 1;
    min-width: 300px;
}

.turn-config-field {
    margin-bottom: 20px;
}

.turn-config-field:last-child {
    margin-bottom: 0;
}

.turn-config-field label {
    display: block;
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
}

.turn-config-field input[type="text"],
.turn-config-field input[type="password"] {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    font-size: 14px;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.turn-config-field select {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    font-size: 14px;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.turn-config-field select:focus {
    outline: none;
    border-color: rgba(59, 130, 246, 0.6);
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.host-config-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
}

.host-config-row label {
    display: inline-block;
    width: 140px;
    min-width: 140px;
    margin-bottom: 0 !important;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 500;
}

.host-config-row select,
.host-config-row .host-range,
.host-config-row input[type="text"],
.host-config-row input[type="password"] {
    flex: 1;
}

.host-config-row input[type="checkbox"] {
    margin-left: auto;
}

.host-range {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.host-range input[type="range"] {
    flex: 1;
}

.host-range .host-range-value {
    width: 60px;
    min-width: 80px;
    text-align: right;
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    white-space: nowrap;
}

.password-input-container {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-container input {
    padding-right: 48px;
}

.password-toggle-btn {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    color: rgba(255, 255, 255, 0.7);
}

.password-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
}

.password-toggle-icon {
    width: 16px;
    height: 16px;
    stroke-width: 2;
}

/* 保存配置行样式 */
.turn-config-save-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.turn-config-save-row .turn-config-checkbox {
    flex: 1;
}

/* 测试按钮样式 */
.turn-config-test {
    background-color: #007bff;
    color: white;
    padding: 8px 16px;
    font-size: 14px;
    min-width: 100px;
    white-space: nowrap;
}

.turn-config-test:hover {
    background-color: #0056b3;
}

.turn-config-test:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

/* 测试结果区域样式 */
.turn-config-test-results {
    flex: 1;
    min-width: 300px;
    padding: 15px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    overflow-y: auto;
    margin-left: 0;
    opacity: 0;
    transform: translateX(20px);
    transition: all 0.3s ease;
    width: 0;
    min-width: 0;
    padding: 0;
    border: none;
    overflow: hidden;
    align-self: stretch;
}

.turn-config-test-results.visible {
    opacity: 1;
    transform: translateX(0);
    width: auto;
    min-width: 300px;
    padding: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-height: 400px;
    overflow-y: auto;
    background: rgba(30, 30, 35, 0.95);
}

.turn-config-test-results h4 {
    margin: 0 0 10px 0;
    color: white;
    font-size: 16px;
    font-weight: 600;
}

.test-results-content {
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.9);
}

.test-result-item {
    margin-bottom: 8px;
    padding: 6px 10px;
    border-radius: 4px;
    background-color: rgba(50, 50, 55, 0.8);
    border-left: 4px solid #28a745;
    color: rgba(255, 255, 255, 0.9);
}

.test-result-item.error {
    border-left-color: #dc3545;
    background-color: rgba(40, 40, 45, 0.8);
    color: #ffb3b3;
}

.test-result-item.warning {
    border-left-color: #ffc107;
    background-color: rgba(40, 40, 45, 0.8);
    color: #ffe066;
}

.test-result-item.info {
    border-left-color: #17a2b8;
    background-color: rgba(40, 40, 45, 0.8);
    color: #87ceeb;
}

.test-result-timestamp {
    color: rgba(255, 255, 255, 0.6);
    font-size: 11px;
    margin-right: 8px;
}

.test-result-message {
    color: rgba(255, 255, 255, 0.9);
}

.turn-config-field input[type="text"]:focus,
.turn-config-field input[type="password"]:focus {
    outline: none;
    border-color: rgba(59, 130, 246, 0.6);
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.turn-config-field input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.turn-config-checkbox {
    display: flex !important;
    align-items: center;
    cursor: pointer;
    margin-bottom: 0 !important;
}

.turn-config-checkbox input[type="checkbox"] {
    display: none;
}

.turn-config-checkbox .checkmark {
    width: 20px;
    height: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    margin-right: 12px;
    position: relative;
    transition: all 0.2s ease;
}

.turn-config-checkbox input[type="checkbox"]:checked + .checkmark {
    background: rgba(59, 130, 246, 0.8);
    border-color: rgba(59, 130, 246, 1);
}

.turn-config-checkbox input[type="checkbox"]:checked + .checkmark::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.turn-config-footer {
    padding: 20px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.turn-config-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 80px;
}

.turn-config-cancel {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.turn-config-cancel:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.turn-config-save {
    background: rgba(59, 130, 246, 0.8);
    color: white;
    border: 1px solid rgba(59, 130, 246, 1);
}

.turn-config-save:hover {
    background: rgba(59, 130, 246, 1);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .video-control-bar {
        width: 95%;
        padding: 10px;
    }
    
    .control-btn {
        width: 36px;
        height: 36px;
    }
    
    .control-group {
        gap: 4px;
    }
    
    .control-divider {
        margin: 0 4px;
    }
    
    .turn-config-dialog {
        width: 95%;
        margin: 20px;
    }
    
    .turn-config-header,
    .turn-config-content,
    .turn-config-footer {
        padding: 16px 20px;
    }
    
    .turn-config-footer {
        flex-direction: column;
    }
    
    .turn-config-btn {
        width: 100%;
    }
}
