/* ============================================
   AI-APPUI 自动化测试平台 - Professional UI
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Space+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --primary: #2563EB;
    --primary-hover: #1D4ED8;
    --primary-light: #DBEAFE;
    --secondary: #3B82F6;
    --secondary-light: #EFF6FF;
    --cta: #F97316;
    --cta-hover: #EA580C;
    --success: #10B981;
    --success-light: #D1FAE5;
    --warning: #F59E0B;
    --warning-light: #FEF3C7;
    --danger: #EF4444;
    --danger-light: #FEE2E2;
    --bg-primary: #F8FAFC;
    --bg-secondary: #FFFFFF;
    --bg-tertiary: #F1F5F9;
    --text-primary: #0F172A;
    --text-secondary: #475569;
    --text-muted: #94A3B8;
    --border: #E2E8F0;
    --border-light: #F1F5F9;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --font-heading: 'Space Grotesk', sans-serif;
    --font-body: 'DM Sans', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --border-radius: 8px;
    --border-radius-lg: 12px;
}

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

html {
    font-size: 14px;
}

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-left .logo-icon {
    font-size: 28px;
    color: var(--primary);
}

.header-left h1 {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 600;
}

.header-left .version {
    font-size: 11px;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: 4px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border-radius: 20px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
}

.status-dot.connected {
    background: var(--success);
}

.help-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
}

.help-link:hover {
    background: var(--bg-tertiary);
    color: var(--primary);
}

/* Main Layout - 三栏布局 */
.main-container {
    display: flex;
    margin-top: 56px;
    height: calc(100vh - 56px);
}

.left-panel {
    width: 280px;
    min-width: 280px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.center-panel {
    flex: 1;
    background: var(--bg-primary);
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.right-panel {
    width: 320px;
    min-width: 320px;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border);
    overflow-y: auto;
    padding: 16px;
}

/* Panel Sections */
.panel-section {
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-lg);
    padding: 16px;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
}

.section-header .material-icons-round {
    font-size: 18px;
    color: var(--primary);
    flex-shrink: 0;
}

.section-header h3 {
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 600;
    flex: 1;
    min-width: 0;
}

.section-header .icon-btn {
    flex-shrink: 0;
}

.section-header .platform-badge {
    flex-shrink: 0;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn .material-icons-round {
    font-size: 18px;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-cta {
    background: var(--cta);
    color: white;
}

.btn-cta:hover {
    background: var(--cta-hover);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.btn-outline:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary);
    color: var(--primary);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #DC2626;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-small .material-icons-round {
    font-size: 16px;
}

.btn-large {
    padding: 12px 24px;
    font-size: 14px;
}

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

.icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    cursor: pointer;
}

.icon-btn:hover {
    background: var(--bg-tertiary);
    color: var(--primary);
}

/* Device List */
.device-list {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 12px;
}

.device-item {
    display: grid;
    grid-template-columns: 32px 1fr auto;
    align-items: start;
    gap: 10px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    margin-bottom: 8px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.15s ease;
}

.device-item:hover {
    border-color: var(--primary-light);
    background: var(--secondary-light);
}

.device-item.selected {
    border-color: var(--primary);
    background: var(--primary-light);
}

.device-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.device-info {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.device-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.device-model-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 80px;
}

.device-serial {
    font-size: 10px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 140px;
}

.device-status {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.status-badge {
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 10px;
    font-weight: 600;
    white-space: nowrap;
    background: var(--success-light);
    color: var(--success);
}

.status-badge.off {
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

.status-badge.locked {
    background: var(--danger-light);
    color: var(--danger);
}

.status-badge.ready {
    background: var(--success-light);
    color: var(--success);
}

.platform-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
}

.platform-badge.android {
    background: #C8E6C9;
    color: #2E7D32;
}

.platform-badge.ios {
    background: #BBDEFB;
    color: #1565C0;
}

.device-actions {
    margin-top: 8px;
}

.scrcpy-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 12px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease;
}

.scrcpy-btn:hover {
    background: var(--primary-hover);
}

/* API Config */
.api-config-list {
    max-height: 120px;
    overflow-y: auto;
    margin-bottom: 8px;
}

.api-config-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    margin-bottom: 6px;
}

.config-name {
    font-weight: 500;
    font-size: 13px;
}

.config-model {
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.config-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    font-size: 13px;
    background: var(--bg-secondary);
    cursor: pointer;
}

.config-select:focus {
    outline: none;
    border-color: var(--primary);
}

/* API 配置必选和已选状态 */
.config-select.config-required {
    border-color: var(--danger);
    background: var(--danger-light);
    animation: pulse-required 2s infinite;
}

.config-select.config-selected {
    border-color: var(--success);
    background: var(--success-light);
}

@keyframes pulse-required {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1); }
}

.api-config-item.selected {
    background: var(--primary-light);
    border: 1px solid var(--primary);
    border-radius: var(--border-radius);
}

.selected-badge {
    display: inline-block;
    background: var(--success);
    color: white;
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: 6px;
    font-weight: 500;
}

/* IME Section */
.ime-section {
    display: none;
}

.ime-section .section-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ime-section .section-header h3 {
    flex: 1;
}

.ime-section .section-header .platform-badge {
    margin-left: auto;
}

.ime-control {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    margin-bottom: 8px;
}

.ime-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    font-size: 12px;
    background: var(--bg-secondary);
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.ime-select:focus {
    outline: none;
    border-color: var(--primary);
}

.ime-select:disabled {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    cursor: not-allowed;
}

.ime-control .btn {
    padding: 10px 16px;
    white-space: nowrap;
}

.ime-actions {
    margin-top: 12px;
}

#imeHint {
    font-size: 11px;
    padding: 6px 8px;
    background: var(--success-light);
    color: var(--success);
    border-radius: var(--border-radius);
    margin-top: 8px;
}

/* Scenario List */
.scenario-list {
    max-height: 150px;
    overflow-y: auto;
}

.scenario-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    margin-bottom: 6px;
    cursor: pointer;
}

.scenario-item:hover {
    background: var(--primary-light);
}

.scenario-name {
    font-size: 13px;
    font-weight: 500;
}

.scenario-count {
    font-size: 11px;
    color: var(--text-muted);
}

/* Test Case Section */
.test-case-section {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    padding: 16px;
    border: 1px solid var(--border);
}

.case-actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
}

.test-case-toolbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    margin-bottom: 12px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    cursor: pointer;
}

.checkbox-label input {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.case-count {
    flex: 1;
    font-size: 12px;
    color: var(--text-muted);
}

.test-case-list {
    max-height: 280px;
    overflow-y: auto;
    margin-bottom: 16px;
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
}

.test-case-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
}

.test-case-item:last-child {
    border-bottom: none;
}

.test-case-item:hover {
    background: var(--bg-tertiary);
}

.test-case-item.selected {
    background: var(--primary-light);
}

.case-content {
    flex: 1;
    min-width: 0;
}

.case-name {
    font-weight: 500;
    font-size: 13px;
}

.case-description {
    font-size: 12px;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.run-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.run-controls .btn {
    padding: 8px 12px;
    font-size: 12px;
}

.run-controls .btn .material-icons-round {
    font-size: 16px;
}

/* Status Metrics Row */
.status-metrics-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.status-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 10px;
    text-align: center;
    flex: 1;
    min-width: 70px;
}

.status-card .card-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    margin-bottom: 2px;
}

.status-card .card-header .material-icons-round {
    font-size: 12px;
    color: var(--text-muted);
}

.status-card .card-header span:last-child {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 500;
}

.status-card .card-value {
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 600;
}

.status-card.status .card-value {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 3px;
    background: var(--bg-tertiary);
    display: inline-block;
}

.status-card.status .card-value.running {
    background: var(--primary-light);
    color: var(--primary);
}

.status-card.status .card-value.success {
    background: var(--success-light);
    color: var(--success);
}

.status-card.status .card-value.failed {
    background: var(--danger-light);
    color: var(--danger);
}

/* Logs/History/Reports Tabs */
.logs-history-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 4px;
    background: var(--bg-tertiary);
    padding: 4px;
    border-radius: var(--border-radius);
}

.tab-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
}

.tab-btn .material-icons-round {
    font-size: 18px;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    background: var(--bg-secondary);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.tab-content {
    display: none;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-lg);
    padding: 16px;
    min-height: 200px;
    max-height: 300px;
    overflow-y: auto;
}

.tab-content.active {
    display: block;
}

/* Log Container */
.log-container {
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.6;
    max-height: 240px;
    overflow-y: auto;
    margin-bottom: 12px;
}

.log-entry {
    padding: 6px 10px;
    border-radius: 4px;
    margin-bottom: 4px;
    display: flex;
    gap: 8px;
}

.log-entry .time {
    color: var(--text-muted);
    flex-shrink: 0;
}

.log-entry .content {
    flex: 1;
    word-break: break-word;
}

.log-entry.info {
    background: var(--bg-tertiary);
}

.log-entry.success {
    background: var(--success-light);
    color: var(--success);
}

.log-entry.error {
    background: var(--danger-light);
    color: var(--danger);
}

.log-entry.warning {
    background: var(--warning-light);
    color: var(--warning);
}

.log-entry.thinking {
    background: var(--secondary-light);
    color: var(--secondary);
}

.log-entry.action {
    background: #F3E8FF;
    color: #7C3AED;
}

.log-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: var(--text-muted);
}

.log-placeholder .material-icons-round {
    font-size: 48px;
    margin-bottom: 8px;
    opacity: 0.3;
}

/* History List */
.history-list {
    max-height: 280px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
}

.history-item:hover {
    background: var(--bg-tertiary);
}

.history-actions {
    margin-left: auto;
    display: flex;
    flex-direction: row;
    gap: 6px;
    flex-shrink: 0;
}

.emoji-btn {
    background: transparent;
    border: none;
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s, transform 0.1s;
}

.emoji-btn:hover {
    background: var(--bg-tertiary);
    transform: scale(1.1);
}

.history-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.history-icon.success {
    background: var(--success-light);
    color: var(--success);
}

.history-icon.failed {
    background: var(--danger-light);
    color: var(--danger);
}

.history-icon.stopped {
    background: var(--warning-light);
    color: var(--warning);
}

.history-info {
    flex: 1;
    min-width: 0;
}

.history-time {
    font-size: 12px;
    font-weight: 500;
}

.history-summary {
    font-size: 11px;
    color: var(--text-muted);
}

/* Reports List */
.reports-list {
    max-height: 280px;
    overflow-y: auto;
}

.report-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: background 0.2s;
}

.report-item:hover {
    background: var(--bg-tertiary);
}

.report-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.report-icon .material-icons-round {
    font-size: 18px;
}

.report-info {
    flex: 1;
    min-width: 0;
}

.report-name {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.report-meta {
    font-size: 11px;
    color: var(--text-muted);
}

.report-actions {
    display: flex;
    gap: 6px;
}

/* Screen Section */
.screen-section {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.device-screen-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.device-frame {
    background: #1a1a1a;
    border-radius: 24px;
    padding: 8px;
    box-shadow: var(--shadow-lg);
}

.screen-placeholder {
    width: 260px;
    height: 520px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #666;
    background: #2a2a2a;
    border-radius: 16px;
}

.screen-placeholder .material-icons-round {
    font-size: 64px;
    margin-bottom: 12px;
    opacity: 0.3;
}

.device-screen {
    max-width: 260px;
    max-height: 520px;
    border-radius: 16px;
}

.screen-info {
    margin-top: 12px;
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    color: var(--text-muted);
    text-align: center;
}

.empty-state .material-icons-round {
    font-size: 36px;
    margin-bottom: 8px;
    opacity: 0.3;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
}

.modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    width: 90%;
    max-width: 480px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.modal-content.modal-small {
    max-width: 360px;
}

.modal-content.modal-large {
    max-width: 800px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.modal-content.modal-large .modal-body {
    flex: 1;
    overflow-y: auto;
    max-height: 60vh;
}

/* 历史详情样式 */
.history-detail-case {
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    margin-bottom: 12px;
    background: var(--bg-secondary);
    overflow: hidden;
}

.history-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
    font-weight: 500;
}

.history-detail-body {
    padding: 16px;
}

.history-detail-body p {
    margin-bottom: 8px;
    line-height: 1.6;
    word-break: break-word;
}

.history-detail-body p:last-child {
    margin-bottom: 0;
}

.history-screenshot-preview {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.history-screenshot-preview img {
    width: 80px;
    height: auto;
    border-radius: 4px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: transform 0.2s;
}

.history-screenshot-preview img:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-md);
}

.modal-content.modal-fullscreen {
    width: 95vw;
    max-width: 1200px;
    height: 90vh;
    max-height: none;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    flex: 1;
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-header.error-header {
    background: var(--danger-light);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

/* Form */
.form-group {
    margin-bottom: 16px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    font-size: 13px;
    font-family: var(--font-body);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

/* Remote Control */
.remote-body {
    display: flex;
    gap: 20px;
    padding: 20px;
}

.remote-screen-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1a1a1a;
    border-radius: var(--border-radius-lg);
    min-height: 500px;
    position: relative;
}

#remoteCanvas {
    max-width: 100%;
    max-height: 100%;
    cursor: crosshair;
}

.remote-placeholder {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #666;
}

.remote-placeholder.hidden {
    display: none;
}

.remote-sidebar {
    width: 260px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.remote-info,
.remote-input-section,
.remote-tips {
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    padding: 14px;
}

.remote-info h4,
.remote-input-section h4,
.remote-tips h4 {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 10px;
}

.remote-info p {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.remote-input-section input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    font-size: 12px;
    margin-bottom: 8px;
}

.remote-tips ul {
    list-style: none;
    font-size: 12px;
    color: var(--text-secondary);
}

.remote-tips li {
    padding: 4px 0 4px 16px;
    position: relative;
}

.remote-tips li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--primary);
}

.remote-controls-bar {
    display: flex;
    gap: 8px;
    margin-left: auto;
    margin-right: 12px;
}

.remote-fps {
    font-size: 11px;
    color: var(--text-muted);
    padding: 4px 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
}

/* Toast */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
    min-width: 280px;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast.success {
    border-left: 4px solid var(--success);
}

.toast.error {
    border-left: 4px solid var(--danger);
}

.toast.warning {
    border-left: 4px solid var(--warning);
}

.toast.info {
    border-left: 4px solid var(--primary);
}

.toast .material-icons-round {
    font-size: 20px;
}

.toast.success .material-icons-round {
    color: var(--success);
}

.toast.error .material-icons-round {
    color: var(--danger);
}

.toast.warning .material-icons-round {
    color: var(--warning);
}

.toast.info .material-icons-round {
    color: var(--primary);
}

.toast-content {
    flex: 1;
    font-size: 13px;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Responsive */
@media (max-width: 1200px) {
    .left-panel {
        width: 240px;
        min-width: 240px;
    }

    .right-panel {
        width: 280px;
        min-width: 280px;
    }

    .status-metrics-row {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 992px) {
    .left-panel {
        display: none;
    }

    .right-panel {
        display: none;
    }

    .status-metrics-row {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* Misc */
.system-status {
    display: flex;
    gap: 8px;
}

/* 本地端选择器 */
.local-selector-section {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--secondary-light) 100%);
    border: 1px solid var(--primary);
}

.local-selector-section .section-header {
    border-bottom-color: rgba(37, 99, 235, 0.2);
}

.local-selector-section .section-header h3 {
    color: var(--primary);
}

.local-selector-section .section-header .material-icons-round {
    color: var(--primary);
}

.local-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--primary);
    border-radius: var(--border-radius);
    background: white;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.local-select:hover:not(:disabled) {
    border-color: var(--primary-hover);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.local-select:disabled {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    cursor: not-allowed;
}

.local-status {
    margin-left: auto;
}

.status-badge.online {
    background: var(--success-light);
    color: var(--success);
}

.status-badge.offline {
    background: var(--danger-light);
    color: var(--danger);
}