* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #1890ff;
    --success-color: #52c41a;
    --danger-color: #ff4d4f;
    --warning-color: #faad14;
    --bg-color: #f0f2f5;
    --card-bg: #ffffff;
    --text-primary: #262626;
    --text-secondary: #8c8c8c;
    --border-color: #d9d9d9;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB',
        'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: var(--text-primary);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* Header */
.header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
    padding: 20px;
}

.header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 1.1em;
    opacity: 0.9;
}

/* Main Content */
.main-content {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 20px;
    margin-bottom: 20px;
}

/* Video Section */
.video-section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
}

.video-container {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    margin-bottom: 15px;
}

.video-container video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

.video-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #666;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
}

.video-placeholder svg {
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 15px;
}

.video-placeholder p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.1em;
    margin: 5px 0;
}

.video-placeholder .hint {
    font-size: 0.9em;
    color: rgba(255, 255, 255, 0.6);
}

/* Status Bar */
.status-bar {
    display: flex;
    gap: 20px;
    padding: 15px;
    background: var(--bg-color);
    border-radius: 8px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-label {
    font-weight: 500;
    color: var(--text-secondary);
}

.status-value {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.9em;
    font-weight: 500;
}

.status-idle {
    background: #f0f0f0;
    color: #8c8c8c;
}

.status-active {
    background: var(--success-color);
    color: white;
}

.status-error {
    background: var(--danger-color);
    color: white;
}

.status-warning {
    background: var(--warning-color);
    color: white;
}

/* Control Panel */
.control-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

.panel-section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
}

.panel-section h2 {
    font-size: 1.3em;
    margin-bottom: 15px;
    color: var(--text-primary);
    border-bottom: 2px solid var(--bg-color);
    padding-bottom: 10px;
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

.input-field,
.select-field {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1em;
    transition: all 0.3s;
}

.input-field:focus,
.select-field:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
}

.input-field:read-only {
    background: var(--bg-color);
    cursor: not-allowed;
    color: var(--text-secondary);
}

.form-hint {
    display: block;
    margin-top: 5px;
    font-size: 0.85em;
    color: var(--text-secondary);
}

/* Device Controls */
.device-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.device-item {
    padding: 12px;
    background: var(--bg-color);
    border-radius: 8px;
    transition: all 0.3s;
}

.device-item:hover {
    background: #e6f7ff;
}

.device-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.device-checkbox {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    cursor: pointer;
}

.device-name {
    font-size: 1.1em;
    font-weight: 500;
}

/* Buttons */
.button-group {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: var(--shadow);
}

.btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.btn:active:not(:disabled) {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #40a9ff;
}

.btn-secondary {
    background: #8c8c8c;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #a6a6a6;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #73d13d;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #ff7875;
}

.btn-small {
    width: 100%;
    padding: 8px;
    font-size: 0.9em;
    background: var(--bg-color);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-small:hover:not(:disabled) {
    background: #e6e6e6;
}

.btn-icon {
    font-size: 1.2em;
}

/* Log Container */
.log-container {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 15px;
    border-radius: 6px;
    max-height: 200px;
    overflow-y: auto;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.85em;
    line-height: 1.6;
    margin-bottom: 10px;
}

.log-item {
    margin-bottom: 5px;
    word-wrap: break-word;
}

.log-info {
    color: #4ec9b0;
}

.log-success {
    color: #4ec9b0;
}

.log-error {
    color: #f48771;
}

.log-warning {
    color: #dcdcaa;
}

/* Footer */
.footer {
    text-align: center;
    color: white;
    padding: 20px;
    opacity: 0.8;
}

/* Scrollbar */
.control-panel::-webkit-scrollbar,
.log-container::-webkit-scrollbar {
    width: 8px;
}

.control-panel::-webkit-scrollbar-track,
.log-container::-webkit-scrollbar-track {
    background: var(--bg-color);
    border-radius: 4px;
}

.control-panel::-webkit-scrollbar-thumb,
.log-container::-webkit-scrollbar-thumb {
    background: #bfbfbf;
    border-radius: 4px;
}

.control-panel::-webkit-scrollbar-thumb:hover,
.log-container::-webkit-scrollbar-thumb:hover {
    background: #8c8c8c;
}

/* Responsive */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .control-panel {
        max-height: none;
    }
}

@media (max-width: 768px) {
    .header h1 {
        font-size: 2em;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .status-bar {
        flex-direction: column;
        gap: 10px;
    }
}
