/* ============================================================
   style.css — OpenClaw Web 管理面板深色主题
   ============================================================ */

:root {
    --bg-primary: #1a1a2e;
    --bg-card: #16213e;
    --bg-highlight: #0f3460;
    --accent: #e94560;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0b0;
    --text-dim: #666;
    --border: #2a2a4a;
    --success: #4caf50;
    --warning: #ff9800;
    --danger: #f44336;
    --info: #2196f3;
    --sidebar-width: 240px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
}

/* ---- 登录页 ---- */
.auth-body {
    display: block;
}
.auth-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 28px;
}
.auth-brand {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 18px;
}
.auth-logo {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-highlight);
    border: 1px solid var(--border);
    font-size: 22px;
}
.auth-title {
    font-size: 16px;
    font-weight: 700;
}
.auth-subtitle {
    margin-top: 2px;
    font-size: 13px;
    color: var(--text-secondary);
}
.auth-btn {
    width: 100%;
    justify-content: center;
}
.auth-hint {
    margin-top: 12px;
    font-size: 13px;
    color: var(--text-secondary);
    min-height: 18px;
}
.auth-hint-error { color: var(--danger); }
.auth-hint-success { color: var(--success); }
.auth-footer {
    margin-top: 16px;
    color: var(--text-dim);
    font-size: 12px;
}

/* ---- 顶栏 ---- */
.topbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: 56px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 100;
}

.topbar h1 { font-size: 18px; font-weight: 600; }

.topbar-actions {
    display: flex;
    align-items: center;
}

.topbar .gateway-link {
    background: var(--accent);
    color: #fff;
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    transition: opacity 0.2s;
}
.topbar .gateway-link:hover { opacity: 0.85; }

/* ---- 侧栏 ---- */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 200;
}

.sidebar .logo {
    padding: 20px;
    font-size: 20px;
    font-weight: 700;
    border-bottom: 1px solid var(--border);
    text-align: center;
}

.sidebar nav { flex: 1; padding: 12px 0; }

.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 15px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}
.sidebar nav a:hover { background: var(--bg-highlight); color: var(--text-primary); }
.sidebar nav a.active {
    background: var(--bg-highlight);
    color: var(--accent);
    border-left-color: var(--accent);
}

/* ---- 主内容 ---- */
.main {
    margin-left: var(--sidebar-width);
    margin-top: 56px;
    padding: 24px;
    flex: 1;
    min-height: calc(100vh - 56px);
}

.page { display: none; }
.page.active { display: block; }

/* ---- 卡片 ---- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
}
.card h3 {
    font-size: 16px;
    margin-bottom: 16px;
    color: var(--text-primary);
}

/* ---- 状态指示 ---- */
.status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 6px;
}
.status-dot.online { background: var(--success); }
.status-dot.offline { background: var(--danger); }

/* ---- 统计格子 ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--bg-highlight);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
}
.stat-card .value { font-size: 28px; font-weight: 700; color: var(--accent); }
.stat-card .label { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

/* ---- 表单 ---- */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

input[type="text"], input[type="password"], select, textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }

textarea { resize: vertical; min-height: 100px; font-family: monospace; }

/* ---- 按钮 ---- */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.btn:hover { opacity: 0.85; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-warning { background: var(--warning); color: #000; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-secondary { background: var(--border); color: var(--text-primary); }

/* ---- 开关 ---- */
.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
    position: absolute;
    inset: 0;
    background: var(--border);
    border-radius: 26px;
    cursor: pointer;
    transition: 0.3s;
}
.switch .slider:before {
    content: '';
    position: absolute;
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: 0.3s;
}
.switch input:checked + .slider { background: var(--success); }
.switch input:checked + .slider:before { transform: translateX(22px); }

/* ---- Tab ---- */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}
.tab {
    padding: 10px 20px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

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

/* ---- 日志 ---- */
.log-viewer {
    background: #0d0d1a;
    border-radius: 8px;
    padding: 16px;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 13px;
    line-height: 1.5;
    max-height: 600px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
    color: #b0b0c0;
}

/* ---- 进度条 ---- */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 12px;
}
.progress-bar .fill {
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
    transition: width 0.3s;
}

/* ---- 警告文字 ---- */
.text-danger { color: var(--danger); font-weight: 600; }
.text-warning { color: var(--warning); }
.text-success { color: var(--success); }
.text-dim { color: var(--text-dim); }

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

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 32px;
    max-width: 500px;
    width: 90%;
}
.modal h2 { margin-bottom: 8px; }
.modal .step-indicator {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 24px;
}
.modal .actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

/* ---- 响应式 ---- */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .topbar { left: 0; }
    .main { margin-left: 0; }
    .stats-grid { grid-template-columns: 1fr; }
}
