/* ============================================
   IoT设备管理平台 - 主题样式
   ============================================ */

:root {
    --bg-primary: #0f1923;
    --bg-secondary: #1a2a3a;
    --bg-card: #1e3040;
    --bg-hover: #253a4d;
    --bg-input: #162230;
    --text-primary: #e8edf2;
    --text-secondary: #8fa3b8;
    --text-muted: #5a7288;
    --accent-blue: #2196F3;
    --accent-cyan: #00BCD4;
    --accent-green: #4CAF50;
    --accent-orange: #FF9800;
    --accent-red: #F44336;
    --accent-purple: #9C27B0;
    --border-color: #2a3f54;
    --shadow: 0 2px 12px rgba(0,0,0,0.3);
    --sidebar-width: 240px;
    --radius: 8px;
    --radius-sm: 4px;
    --transition: 0.2s ease;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
    overflow: hidden;
}

#app { display: flex; height: 100vh; }

/* ========== 侧边栏 ========== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex; flex-direction: column;
    transition: transform var(--transition);
    flex-shrink: 0;
}

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

.logo-icon {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan));
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; padding: 8px;
}

.sidebar-header h1 { font-size: 16px; font-weight: 600; color: var(--text-primary); }

.sidebar-nav {
    flex: 1; overflow-y: auto; padding: 8px;
}

.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: 6px;
    color: var(--text-secondary); text-decoration: none;
    margin-bottom: 2px; cursor: pointer;
    transition: all var(--transition);
}

.nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }
.nav-item span { font-size: 14px; }

.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active {
    background: rgba(33,150,243,0.15);
    color: var(--accent-blue);
}

.sidebar-footer {
    padding: 16px; border-top: 1px solid var(--border-color);
    text-align: center;
}
.version { font-size: 12px; color: var(--text-muted); }

/* ========== 主内容 ========== */
.main-content {
    flex: 1; display: flex; flex-direction: column;
    min-width: 0;
}

.top-bar {
    display: flex; align-items: center;
    padding: 12px 24px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    gap: 16px;
}

.menu-toggle {
    display: none; background: none; border: none;
    color: var(--text-secondary); cursor: pointer;
    padding: 4px;
}
.menu-toggle svg { width: 24px; height: 24px; }

.page-title { font-size: 18px; font-weight: 600; flex: 1; }
.top-bar-right { display: flex; align-items: center; gap: 16px; }

.server-status {
    display: flex; align-items: center; gap: 6px;
    font-size: 13px; color: var(--text-secondary);
}
.status-dot {
    width: 8px; height: 8px; border-radius: 50%; display: inline-block;
}
.status-dot.green { background: var(--accent-green); box-shadow: 0 0 6px var(--accent-green); }
.status-dot.red { background: var(--accent-red); box-shadow: 0 0 6px var(--accent-red); }
.status-dot.yellow { background: var(--accent-orange); box-shadow: 0 0 6px var(--accent-orange); }

/* 数据表格 */
.data-table {
    width: 100%; border-collapse: collapse; font-size: 14px;
}
.data-table th {
    background: rgba(255,255,255,0.04); padding: 10px 16px;
    text-align: left; font-weight: 500; color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}
.data-table td {
    padding: 10px 16px; border-bottom: 1px solid var(--border-color);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(255,255,255,0.02); }

.content-area {
    flex: 1; padding: 24px; overflow-y: auto;
}

/* ========== 统计卡片 ========== */
.stats-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px; margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card); border-radius: var(--radius);
    padding: 20px; border: 1px solid var(--border-color);
    transition: all var(--transition);
}
.stat-card:hover { border-color: var(--accent-blue); transform: translateY(-2px); box-shadow: var(--shadow); }

.stat-card .stat-icon {
    width: 40px; height: 40px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 12px;
}
.stat-card .stat-icon svg { width: 22px; height: 22px; color: #fff; }

.stat-card .stat-value {
    font-size: 28px; font-weight: 700; margin-bottom: 4px;
}
.stat-card .stat-label { font-size: 13px; color: var(--text-secondary); }

/* ========== 面板 ========== */
.panel {
    background: var(--bg-card); border-radius: var(--radius);
    border: 1px solid var(--border-color); margin-bottom: 20px;
    overflow: hidden;
}

.panel-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color);
}
.panel-header h3 { font-size: 15px; font-weight: 600; }

.panel-body { padding: 20px; }

/* ========== 表格 ========== */
.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%; border-collapse: collapse;
}

th, td {
    text-align: left; padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
}

th {
    color: var(--text-secondary); font-weight: 600;
    background: rgba(0,0,0,0.2);
    font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px;
}

tr:hover td { background: var(--bg-hover); }
tr:last-child td { border-bottom: none; }

/* ========== 标签 ========== */
.tag {
    display: inline-block; padding: 2px 8px;
    border-radius: 10px; font-size: 11px; font-weight: 500;
}

.tag-blue { background: rgba(33,150,243,0.2); color: var(--accent-blue); }
.tag-gray { background: rgba(160,160,160,0.2); color: var(--text-secondary); }
.tag-green { background: rgba(76,175,80,0.2); color: var(--accent-green); }
.tag-orange { background: rgba(255,152,0,0.2); color: var(--accent-orange); }
.tag-red { background: rgba(244,67,54,0.2); color: var(--accent-red); }
.tag-purple { background: rgba(156,39,176,0.2); color: var(--accent-purple); }
.tag-cyan { background: rgba(0,188,212,0.2); color: var(--accent-cyan); }

/* ========== 表单 ========== */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block; font-size: 13px; color: var(--text-secondary);
    margin-bottom: 6px; font-weight: 500;
}
.form-control {
    width: 100%; padding: 8px 12px;
    background: var(--bg-input); border: 1px solid var(--border-color);
    border-radius: var(--radius-sm); color: var(--text-primary);
    font-size: 14px; transition: border-color var(--transition);
}
.form-control:focus { outline: none; border-color: var(--accent-blue); }
.form-control::placeholder { color: var(--text-muted); }
select.form-control { cursor: pointer; }

/* ========== 按钮 ========== */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: var(--radius-sm);
    border: none; cursor: pointer; font-size: 13px; font-weight: 500;
    transition: all var(--transition);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-blue), #1976D2);
    color: #fff;
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }

.btn-success {
    background: linear-gradient(135deg, var(--accent-green), #388E3C);
    color: #fff;
}
.btn-success:hover { opacity: 0.9; transform: translateY(-1px); }

.btn-danger {
    background: linear-gradient(135deg, var(--accent-red), #D32F2F);
    color: #fff;
}
.btn-danger:hover { opacity: 0.9; }

.btn-ghost {
    background: transparent; color: var(--text-secondary);
    border: 1px solid var(--border-color);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-sm { padding: 5px 10px; font-size: 12px; }

.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ========== 模态框 ========== */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
}

.modal {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    width: 90%; max-width: 600px; max-height: 80vh;
    display: flex; flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}
.modal-header h3 { font-size: 16px; font-weight: 600; }

.modal-close {
    background: none; border: none; color: var(--text-secondary);
    font-size: 24px; cursor: pointer; padding: 0 4px;
}
.modal-close:hover { color: var(--text-primary); }

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

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

/* ========== 代码预览 ========== */
.code-block {
    background: #0d1117;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 16px; overflow-x: auto;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 13px; line-height: 1.6;
    max-height: 500px; overflow-y: auto;
    color: #c9d1d9;
}

.code-block .comment { color: #8b949e; font-style: italic; }
.code-block .keyword { color: #ff7b72; }
.code-block .func { color: #d2a8ff; }
.code-block .type { color: #79c0ff; }
.code-block .macro { color: #a5d6ff; }
.code-block .string { color: #a5d6a5; }
.code-block .number { color: #79c0ff; }
.code-block .preprocess { color: #ffa657; }

/* ========== 设备卡片 ========== */
.device-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.device-card {
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: var(--radius); padding: 16px;
    display: flex; flex-direction: column; gap: 8px;
    transition: all var(--transition); cursor: pointer;
}
.device-card:hover { border-color: var(--accent-blue); transform: translateY(-1px); }

.device-card .device-top {
    display: flex; justify-content: space-between; align-items: start;
}
.device-card .device-sn {
    font-size: 14px; font-weight: 600; font-family: monospace;
}
.device-card .device-model {
    font-size: 12px; color: var(--text-muted);
}
.device-card .device-meta {
    display: flex; gap: 12px; font-size: 12px; color: var(--text-secondary);
}

.device-card .btn-del {
    position: absolute; top: 6px; right: 6px;
    width: 24px; height: 24px; border: none; border-radius: 4px;
    background: rgba(248,81,73,0.15); color: #f85149;
    font-size: 16px; line-height: 1; cursor: pointer;
    display: none; align-items: center; justify-content: center;
    padding: 0; z-index: 2;
}
.device-card:hover .btn-del { display: flex; }
.device-card .btn-del:hover { background: rgba(248,81,73,0.3); }
.device-card { position: relative; }

/* ========== 进度条 ========== */
.progress-bar {
    height: 6px; background: var(--bg-input);
    border-radius: 3px; overflow: hidden;
}
.progress-bar .progress-fill {
    height: 100%; background: linear-gradient(90deg, var(--accent-blue), var(--accent-cyan));
    border-radius: 3px; transition: width 0.5s ease;
}

/* ========== 空状态 ========== */
.empty-state {
    text-align: center; padding: 40px 20px;
    color: var(--text-muted);
}
.empty-state svg { width: 48px; height: 48px; margin-bottom: 12px; opacity: 0.5; }
.empty-state p { font-size: 14px; }

/* ========== Toast ========== */
.toast-container {
    position: fixed; top: 20px; right: 20px; z-index: 2000;
    display: flex; flex-direction: column; gap: 8px;
}
.toast {
    padding: 12px 20px; border-radius: var(--radius-sm);
    color: #fff; font-size: 14px;
    animation: slideIn 0.3s ease;
    max-width: 360px; box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.toast-success { background: var(--accent-green); }
.toast-error { background: var(--accent-red); }
.toast-info { background: var(--accent-blue); }

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

/* ========== 加载 ========== */
.loading {
    text-align: center; padding: 40px;
    color: var(--text-muted);
}

.spinner {
    width: 32px; height: 32px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 12px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ========== 内联表格操作 ========== */
.action-btn {
    background: none; border: none; color: var(--text-secondary);
    cursor: pointer; padding: 4px 8px; border-radius: 4px;
    transition: all var(--transition); font-size: 13px;
}
.action-btn:hover { background: var(--bg-hover); }
.action-btn.edit:hover { color: var(--accent-blue); }
.action-btn.delete:hover { color: var(--accent-red); }
.action-btn.download:hover { color: var(--accent-green); }
.action-btn.primary:hover { color: var(--accent-orange); }

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    .sidebar { position: fixed; z-index: 100; height: 100%; transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .menu-toggle { display: block; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .device-grid { grid-template-columns: 1fr; }
}

/* ========== 搜索框 ========== */
.search-wrapper {
    display: flex; gap: 8px; margin-bottom: 16px;
}
.search-wrapper input { flex: 1; }
.search-wrapper select { width: auto; min-width: 120px; }

/* ========== 详细页面样式 ========== */
.detail-header {
    margin-bottom: 20px;
}
.detail-header h2 { font-size: 20px; margin-bottom: 4px; }
.detail-header .detail-meta { color: var(--text-muted); font-size: 13px; }

.info-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px; margin-bottom: 20px;
}

.info-item {
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: var(--radius); padding: 12px 16px;
}
.info-item label { display: block; font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.info-item .info-value { font-size: 14px; font-weight: 600; }

/* ========== Tabs ========== */
.tabs {
    display: flex; border-bottom: 1px solid var(--border-color);
    margin-bottom: 16px;
}
.tab {
    padding: 10px 20px; cursor: pointer;
    color: var(--text-secondary); font-size: 13px; font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: all var(--transition);
}
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--accent-blue); border-bottom-color: var(--accent-blue); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ========== 实时数据 ========== */
.live-data {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}
.live-item {
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: var(--radius); padding: 12px;
    text-align: center;
}
.live-item .live-label { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.live-item .live-value { font-size: 20px; font-weight: 700; font-family: monospace; }

/* ========== 登录页面 ========== */
.login-page {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-primary);
    z-index: 1000;
}

.login-card {
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: 12px; padding: 40px;
    width: 100%; max-width: 400px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.login-card .login-icon {
    text-align: center; margin-bottom: 16px;
}

.login-card .login-icon svg {
    width: 48px; height: 48px; color: var(--accent-blue);
}

.login-card h2 {
    text-align: center; font-size: 22px; margin-bottom: 4px;
}

.login-card .login-subtitle {
    text-align: center; color: var(--text-muted); font-size: 13px;
    margin-bottom: 24px;
}

.login-card .form-group { margin-bottom: 16px; width: 100%; }

.login-card .form-group label {
    display: block; font-size: 12px; color: var(--text-secondary);
    margin-bottom: 4px;
}

.login-card .form-group input {
    width: 100%;
}

.login-error {
    color: var(--accent-red); font-size: 13px;
    text-align: center; margin-bottom: 12px;
}

.login-btn {
    width: 100%; padding: 12px !important;
    font-size: 15px !important; display: block !important;
}

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

/* ========== 用户信息 ========== */
.user-name {
    font-size: 13px; color: var(--text-secondary);
    padding: 4px 10px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

/* ========== UI布局设计器 ========== */
/* 画布内控件 - 小程序风格 */
.canvas-placeholder {
    text-align: center; padding: 60px 20px;
    color: #bbb; font-size: 13px;
    position: absolute; inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 12px; pointer-events: none;
}
.canvas-placeholder svg { opacity: 0.25; }
.canvas-control {
    background: #ffffff; border: 1.5px solid #e8ecf0;
    border-radius: 12px; padding: 10px 14px;
    cursor: grab; position: absolute;
    transition: border-color 0.2s, box-shadow 0.25s;
    min-height: 44px; box-sizing: border-box;
    user-select: none; overflow: visible;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.canvas-control:hover {
    border-color: #6c63ff;
    box-shadow: 0 2px 10px rgba(108,99,255,0.12);
}
.canvas-control.selected {
    border-color: #6c63ff;
    box-shadow: 0 0 0 3px rgba(108,99,255,0.2), 0 2px 10px rgba(108,99,255,0.1);
    cursor: move;
}
.canvas-control .ctrl-label {
    font-size: 12px;
    color: #333;
    margin-bottom: 6px;
    font-weight: 500;
    line-height: 1.4;
}
.canvas-control .ctrl-type-badge {
    position: absolute; top: -8px; right: 8px;
    font-size: 9px; padding: 1px 8px; border-radius: 6px;
    background: #6c63ff; color: #fff;
    font-weight: 500; letter-spacing: 0.3px;
    line-height: 18px; z-index: 5;
    box-shadow: 0 1px 4px rgba(108,99,255,0.3);
}
.canvas-control .ctrl-placeholder {
    font-size: 13px; color: #333;
    min-height: 28px; display: flex; align-items: center;
    gap: 8px;
}

/* 调整大小的拖拽手柄 */
.canvas-control .resize-handle {
    position: absolute; right: -1px; bottom: -1px;
    width: 14px; height: 14px; cursor: nwse-resize;
    background: linear-gradient(135deg, transparent 50%, #6c63ff 50%);
    border-radius: 0 0 10px 0;
    opacity: 0;
    transition: opacity 0.2s;
}
.canvas-control.selected .resize-handle { display: block; opacity: 1; }
.canvas-control .resize-handle { display: none; }

/* 控件预览 - 全新美观设计 */
/* 滑动条 */
.ctrl-preview-slider {
    width: 100%; padding: 4px 0;
    display: flex; align-items: center; gap: 10px;
}
.ctrl-preview-slider-track {
    flex: 1; height: 6px; background: #e8ecf0;
    border-radius: 3px; position: relative;
}
.ctrl-preview-slider-track .fill {
    position: absolute; left: 0; top: 0; height: 100%;
    width: 40%; background: linear-gradient(90deg, #1677ff, #4096ff);
    border-radius: 3px;
}
.ctrl-preview-slider-track .thumb {
    position: absolute; left: 38%; top: -6px;
    width: 18px; height: 18px; border-radius: 50%;
    background: #fff; border: 2px solid #1677ff;
    box-shadow: 0 1px 4px rgba(22,119,255,0.3);
}
.ctrl-preview-slider-val {
    font-size: 12px; font-weight: 600; color: #1677ff;
    min-width: 32px; text-align: right;
}

/* 开关 */
.ctrl-preview-switch {
    width: 40px; height: 22px; border-radius: 11px;
    background: #ccc; position: relative;
    display: inline-block; transition: background 0.3s;
}
.ctrl-preview-switch.on { background: #1677ff; }
.ctrl-preview-switch::after {
    content: ''; position: absolute; top: 2px; left: 20px;
    width: 18px; height: 18px; border-radius: 50%;
    background: white; box-shadow: 0 1px 3px rgba(0,0,0,0.15);
    transition: left 0.3s;
}
.ctrl-preview-switch.on::after { left: 2px; }

/* 按钮 */
.ctrl-preview-btn {
    padding: 8px 20px; background: linear-gradient(135deg, #1677ff, #4096ff);
    color: white; border-radius: 10px; display: inline-block;
    font-size: 13px; font-weight: 500;
    box-shadow: 0 2px 6px rgba(22,119,255,0.3);
    text-align: center; letter-spacing: 0.5px;
    width: 100%; box-sizing: border-box;
}

/* 数值 */
.ctrl-preview-number {
    font-family: 'SF Mono', 'Courier New', monospace;
    font-size: 18px; font-weight: 700; color: #1677ff;
    background: #f0f5ff; padding: 2px 12px;
    border-radius: 6px; display: inline-block;
}

/* 数据显示 */
.ctrl-preview-display {
    font-family: 'SF Mono', 'Courier New', monospace;
    font-size: 18px; font-weight: 700; color: #1677ff;
    background: #f0f5ff; padding: 2px 12px;
    border-radius: 6px; display: inline-block;
}

/* 颜色选择 */
.ctrl-preview-color-wrap {
    display: flex; align-items: center; gap: 10px;
    width: 100%;
}
.ctrl-preview-color {
    width: 30px; height: 30px; border-radius: 50%;
    border: 2px solid #e8ecf0; display: inline-block;
    background: #4CAF50; flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(76,175,80,0.25);
}
.ctrl-picker-row {
    display: flex; gap: 6px; align-items: center;
}
.ctrl-picker-row .picker-color {
    width: 22px; height: 22px; border-radius: 50%;
    display: inline-block; border: 2px solid transparent;
    transition: transform 0.2s; cursor: pointer;
}
.ctrl-picker-row .picker-color:hover { transform: scale(1.15); }
.ctrl-picker-row .picker-color:nth-child(1) { background: #F44336; border-color: #fca; }
.ctrl-picker-row .picker-color:nth-child(2) { background: #FF9800; border-color: #fdb; }
.ctrl-picker-row .picker-color:nth-child(3) { background: #4CAF50; border-color: #afc; }
.ctrl-picker-row .picker-color:nth-child(4) { background: #2196F3; border-color: #acf; }
.ctrl-picker-row .picker-color:nth-child(5) { background: #9C27B0; border-color: #caf; }

/* 文本显示 */
.ctrl-preview-text {
    color: #333; line-height: 1.6; padding: 4px 0;
    font-weight: 400;
}

/* 图片显示 */
.ctrl-preview-image {
    width: 100%; height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px; display: flex; align-items: center;
    justify-content: center; color: rgba(255,255,255,0.85);
    font-size: 12px; letter-spacing: 2px;
    box-shadow: 0 2px 8px rgba(102,126,234,0.25);
}

/* 进度条 */
.ctrl-preview-progress {
    width: 100%; padding: 2px 0;
    display: flex; align-items: center; gap: 10px;
}
.ctrl-preview-progress-track {
    flex: 1; height: 8px; background: #e8ecf0;
    border-radius: 4px; position: relative; overflow: hidden;
}
.ctrl-preview-progress-track .fill {
    position: absolute; left: 0; top: 0; height: 100%;
    width: 60%;
    background: linear-gradient(90deg, #1677ff, #52c41a);
    border-radius: 4px;
    animation: progressPulse 2s ease-in-out infinite;
}
@keyframes progressPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.85; }
}
.ctrl-preview-progress-val {
    font-size: 12px; font-weight: 600; color: #52c41a;
    min-width: 36px; text-align: right;
}

/* 下拉选择 */
.ctrl-preview-select {
    height: 32px; border: 1.5px solid #e0e2e6;
    border-radius: 8px; display: flex; align-items: center;
    padding: 0 10px; color: #999; background: #fafafa;
    width: 100%; box-sizing: border-box;
    font-size: 12px;
}
.ctrl-preview-select::after {
    content: '▾'; margin-left: auto; color: #bbb;
    font-size: 14px;
}

/* ========== UI布局设计器 - 涂鸦Studio风格 ========== */
.studio-layout {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    display: flex; flex-direction: column; background: #1a1a2e;
    z-index: 100;
}
.studio-topbar {
    height: 48px; background: #16162a; display: flex;
    align-items: center; padding: 0 16px; gap: 16px;
    border-bottom: 1px solid #2a2a4a; flex-shrink: 0;
}
.topbar-back {
    display: flex; align-items: center; gap: 4px;
    background: none; border: none; color: #8a8ab8;
    cursor: pointer; font-size: 13px; padding: 6px 10px;
    border-radius: 6px; transition: all 0.2s;
}
.topbar-back:hover { background: #2a2a4a; color: #e0e0f0; }
.topbar-title {
    flex: 1; display: flex; align-items: center; gap: 8px;
    font-size: 15px; font-weight: 600; color: #e0e0f0;
}
.topbar-device-icon { display: flex; align-items: center; color: #6c63ff; }
.topbar-actions { display: flex; gap: 8px; }
.studio-body { flex: 1; display: flex; overflow: hidden; }
/* 左侧 */
.studio-left {
    width: 240px; background: #1e1e36; display: flex;
    flex-direction: column; border-right: 1px solid #2a2a4a; flex-shrink: 0;
}
.studio-left-tabs { display: flex; border-bottom: 1px solid #2a2a4a; flex-shrink: 0; }
.st-tab {
    flex: 1; padding: 10px 0; text-align: center; font-size: 13px;
    color: #8a8ab8; cursor: pointer; transition: all 0.2s;
    border-bottom: 2px solid transparent;
}
.st-tab:hover { color: #c0c0e0; }
.st-tab.active { color: #6c63ff; border-bottom-color: #6c63ff; }
.studio-left-content { flex: 1; overflow-y: auto; padding: 12px; display: none; }
.studio-left-content.active { display: block; }
.st-search {
    display: flex; align-items: center; gap: 8px;
    background: #16162a; border: 1px solid #2a2a4a;
    border-radius: 8px; padding: 8px 12px; margin-bottom: 12px; color: #8a8ab8;
}
.st-search input { background: none; border: none; outline: none; color: #e0e0f0; font-size: 13px; width: 100%; }
.st-search input::placeholder { color: #5a5a8a; }
.st-section { margin-bottom: 16px; }
.st-section-title {
    font-size: 11px; color: #6a6a9a; text-transform: uppercase;
    letter-spacing: 0.5px; margin-bottom: 8px; font-weight: 600;
}
.st-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.st-item {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 10px 6px; background: #16162a; border: 1px solid #2a2a4a;
    border-radius: 10px; cursor: grab; user-select: none; font-size: 11px;
    color: #a0a0c0; transition: all 0.2s;
}
.st-item:hover { border-color: #6c63ff; background: #1e1e3e; color: #e0e0f0; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(108,99,255,0.15); }
.st-item:active { cursor: grabbing; transform: scale(0.95); }
.st-item-icon { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 8px; }
.st-item-icon svg { width: 20px; height: 20px; }
.slider-icon { background: rgba(33,150,243,0.15); color: #2196F3; }
.switch-icon { background: rgba(76,175,80,0.15); color: #4CAF50; }
.number-icon { background: rgba(255,152,0,0.15); color: #FF9800; }
.button-icon { background: rgba(156,39,176,0.15); color: #9C27B0; }
.display-icon { background: rgba(0,188,212,0.15); color: #00BCD4; }
.color-icon { background: rgba(244,67,54,0.15); color: #F44336; }
.select-icon { background: rgba(63,81,181,0.15); color: #3F51B5; }
.text-icon { background: rgba(233,30,99,0.15); color: #E91E63; }
.image-icon { background: rgba(139,195,74,0.15); color: #8BC34A; }
.progress-icon { background: rgba(0,150,136,0.15); color: #009688; }
.fp-list { font-size: 12px; }
.fp-list .fp-item { padding: 6px 10px; color: #a0a0c0; border-bottom: 1px solid #2a2a4a; font-size: 12px; }
.fp-list .fp-item:last-child { border: none; }
.layers-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 12px; color: #8a8ab8; }
.layers-clear { background: none; border: none; color: #f44336; cursor: pointer; font-size: 11px; padding: 2px 8px; border-radius: 4px; }
.layers-clear:hover { background: rgba(244,67,54,0.1); }
.layer-list { font-size: 12px; }
.layer-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 6px; cursor: pointer; color: #a0a0c0; transition: all 0.2s; border: 1px solid transparent; margin-bottom: 2px; }
.layer-item:hover { background: #2a2a4a; }
.layer-item.active { background: #2a2a4a; border-color: #6c63ff; color: #e0e0f0; }
.layer-item .layer-color { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }
.layer-item .layer-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layer-item .layer-type { font-size: 10px; color: #6a6a9a; }
/* 中间画布 */
.studio-center {
    flex: 1; display: flex; align-items: center; justify-content: center;
    background: #12122a; padding: 20px; overflow: auto;
    background-image: radial-gradient(circle, #1e1e3e 1px, transparent 1px);
    background-size: 20px 20px;
}
.studio-phone-bg {
    background: linear-gradient(135deg, #2a1a3e, #1a2a4e);
    padding: 20px; border-radius: 36px;
    box-shadow: 0 16px 60px rgba(0,0,0,0.5);
}
/* 微信小程序模拟页面 */
.phone-frame {
    width: 375px; min-height: 700px;
    background: #ffffff; border-radius: 24px;
    overflow: hidden; display: flex; flex-direction: column;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.1);
    position: relative;
}
.phone-statusbar {
    height: 44px; background: #ffffff;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 20px; font-size: 12px; color: #333;
    flex-shrink: 0; border-bottom: 1px solid #f0f0f0;
}
.phone-statusbar svg { width: 16px; height: 12px; color: #333; }
.phone-header {
    height: 44px; background: #ffffff;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; font-weight: 600; color: #333;
    flex-shrink: 0; border-bottom: 1px solid #eee;
    position: sticky; top: 0; z-index: 10;
}
.phone-content {
    flex: 1; min-height: 560px;
    position: relative; overflow-y: auto;
    background: #f5f5f5;
    padding: 6px;
}
.phone-homebar {
    height: 34px; background: #ffffff;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; border-top: 1px solid #f0f0f0;
}
.phone-homebar::after {
    content: ''; width: 134px; height: 5px;
    background: #333; border-radius: 3px;
    opacity: 0.3;
}
/* 右侧属性面板 */
.studio-right {
    width: 260px; background: #1e1e36; display: flex;
    flex-direction: column; border-left: 1px solid #2a2a4a; flex-shrink: 0;
}
.studio-right-header {
    padding: 14px 16px; font-size: 14px; font-weight: 600;
    color: #e0e0f0; border-bottom: 1px solid #2a2a4a; flex-shrink: 0;
}
.props-empty {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; padding: 40px 20px; color: #5a5a8a;
    font-size: 13px; text-align: center; gap: 12px; flex: 1;
}
.props-form { padding: 12px 16px; overflow-y: auto; flex: 1; }
.props-section { margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid #2a2a4a; }
.props-section:last-of-type { border-bottom: none; }
.props-section-title {
    font-size: 11px; color: #6a6a9a; text-transform: uppercase;
    letter-spacing: 0.5px; margin-bottom: 10px; font-weight: 600;
}
.props-form .form-group { margin-bottom: 8px; }
.props-form .form-group:last-child { margin-bottom: 0; }
.props-form label { font-size: 11px; color: #8a8ab8; display: block; margin-bottom: 4px; font-weight: 500; }
.form-row { display: flex; gap: 8px; }
.form-row .form-group { flex: 1; }
.st-input { width: 100%; padding: 6px 10px; background: #16162a; border: 1px solid #2a2a4a; border-radius: 6px; color: #e0e0f0; font-size: 12px; outline: none; transition: border-color 0.2s; box-sizing: border-box; }
.st-input:focus { border-color: #6c63ff; }
.st-input::placeholder { color: #5a5a8a; }
.st-select { width: 100%; padding: 6px 10px; background: #16162a; border: 1px solid #2a2a4a; border-radius: 6px; color: #e0e0f0; font-size: 12px; outline: none; cursor: pointer; transition: border-color 0.2s; box-sizing: border-box; }
.st-select:focus { border-color: #6c63ff; }
.props-form .prop-color-row { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; }
.props-form .prop-color-swatch { width: 26px; height: 26px; border-radius: 6px; cursor: pointer; border: 2px solid transparent; transition: all 0.2s; box-sizing: border-box; }
.props-form .prop-color-swatch:hover { border-color: #6c63ff; transform: scale(1.1); }
.props-form .prop-color-swatch.active { border-color: #6c63ff; box-shadow: 0 0 0 2px rgba(108,99,255,0.3); }
.props-actions { padding: 12px 0; display: flex; gap: 8px; }
.props-actions .btn-danger { background: rgba(244,67,54,0.15); color: #f44336; border: 1px solid rgba(244,67,54,0.3); }
.props-actions .btn-danger:hover { background: rgba(244,67,54,0.25); }

/* 拖拽幽灵元素 */
.drag-ghost {
    position: fixed; pointer-events: none; z-index: 9999;
    padding: 6px 16px; background: #6c63ff; color: #fff;
    border-radius: 6px; font-size: 13px; font-weight: 500;
    box-shadow: 0 4px 16px rgba(108,99,255,0.4);
    opacity: 0.95; white-space: nowrap;
}

/* ============================================
   大屏全屏监控
   ============================================ */
.dashboard-full {
    display: flex; flex-direction: column;
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    z-index: 2000;
    background: linear-gradient(135deg, #0a1628 0%, #1a2a4a 50%, #0d1b2a 100%);
    overflow: hidden;
}

.df-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 20px 40px;
    background: rgba(0,0,0,0.3);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}

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

.df-title {
    font-size: 28px; font-weight: 700;
    background: linear-gradient(135deg, #2196F3, #00BCD4);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}

.df-datetime {
    font-size: 16px; color: rgba(255,255,255,0.6);
    font-family: 'Courier New', monospace;
}

.df-header-right { display: flex; gap: 12px; }

.df-refresh-btn, .df-close-btn {
    padding: 8px 20px; border: 1px solid rgba(255,255,255,0.2);
    border-radius: 6px; background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.8); font-size: 14px; cursor: pointer;
    transition: all 0.2s;
}
.df-refresh-btn:hover, .df-close-btn:hover {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.4);
}

.df-body {
    flex: 1; padding: 30px 40px 20px;
    display: flex; flex-direction: column;
    overflow: hidden;
}

/* 统计卡片 */
.df-stats {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px;
    margin-bottom: 30px;
    flex-shrink: 0;
}

.df-stat-card {
    display: flex; align-items: center; gap: 20px;
    padding: 28px 24px;
    border-radius: 16px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    transition: all 0.3s;
}
.df-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.df-stat-total { border-left: 4px solid #2196F3; }
.df-stat-online { border-left: 4px solid #4CAF50; }
.df-stat-offline { border-left: 4px solid #9E9E9E; }
.df-stat-fault { border-left: 4px solid #F44336; }

.df-stat-icon {
    font-size: 48px; line-height: 1;
}

.df-stat-info { display: flex; flex-direction: column; }

.df-stat-value {
    font-size: 48px; font-weight: 800;
    font-family: 'Courier New', monospace;
    letter-spacing: -1px;
}
.df-stat-total .df-stat-value { color: #64B5F6; }
.df-stat-online .df-stat-value { color: #81C784; }
.df-stat-offline .df-stat-value { color: #BDBDBD; }
.df-stat-fault .df-stat-value { color: #E57373; }

.df-stat-label {
    font-size: 14px; color: rgba(255,255,255,0.6);
    margin-top: 4px; letter-spacing: 1px;
    text-transform: uppercase;
}

/* 故障区域 */
.df-fault-section {
    flex: 1; display: flex; flex-direction: column;
    background: rgba(255,255,255,0.03);
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.08);
    overflow: hidden;
}

.df-fault-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 24px;
    background: rgba(255,255,255,0.05);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}

.df-fault-title {
    font-size: 18px; font-weight: 600; color: rgba(255,255,255,0.9);
}

.df-fault-count {
    font-size: 14px; color: rgba(255,255,255,0.5);
    font-family: 'Courier New', monospace;
}

.df-fault-list {
    flex: 1; overflow: hidden;
    position: relative;
}

.df-fault-loading, .df-fault-empty {
    display: flex; align-items: center; justify-content: center;
    height: 100%;
    font-size: 18px; color: rgba(255,255,255,0.4);
}

.df-fault-empty { font-size: 20px; }

/* 故障滚动轨道 */
.df-fault-track {
    animation: dfScroll 40s linear infinite;
    will-change: transform;
}

@keyframes dfScroll {
    0% { transform: translateY(0); }
    100% { transform: translateY(-50%); }
}

.df-fault-track:hover {
    animation-play-state: paused;
}

/* 每行故障项 */
.df-fault-item {
    display: flex; align-items: center; gap: 16px;
    padding: 12px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    cursor: pointer;
    transition: background 0.2s;
}
.df-fault-item:hover {
    background: rgba(33,150,243,0.1);
}

.df-fault-sn {
    font-family: 'Courier New', monospace;
    font-size: 14px; font-weight: 600;
    color: #64B5F6; min-width: 120px;
}

.df-fault-func {
    font-size: 14px; color: rgba(255,255,255,0.8);
    flex: 1;
}

.df-fault-type {
    font-size: 12px; font-weight: 500;
    padding: 3px 12px; border-radius: 12px;
    min-width: 52px; text-align: center;
}
.df-fault-badge-alarm {
    background: rgba(244,67,54,0.2);
    color: #E57373;
}
.df-fault-badge-recover {
    background: rgba(76,175,80,0.2);
    color: #81C784;
}

.df-fault-time {
    font-size: 13px; color: rgba(255,255,255,0.5);
    font-family: 'Courier New', monospace;
    min-width: 120px;
}

.df-fault-value {
    font-size: 13px; color: rgba(255,255,255,0.5);
    font-family: 'Courier New', monospace;
    min-width: 80px; text-align: right;
}

/* 退出全屏后的导航高亮修复 */
.nav-item[data-page="dashboardfull"].active {
    background: linear-gradient(135deg, rgba(33,150,243,0.25), rgba(76,175,80,0.25)) !important;
    border-left: 3px solid var(--accent-blue) !important;
}