/* ==================== 首页三栏布局样式 ==================== */

:root {
    /* 颜色系统 */
    --color-primary: #3366cc;
    --color-primary-light: #e8f0fe;
    --color-success: #22c55e;
    --color-warning: #f59e0b;
    --color-danger: #ef4444;
    --color-info: #3b82f6;

    --color-bg: #ffffff;
    --color-surface: #f8fafc;
    --color-border: #e2e8f0;

    --color-text-primary: #0f172a;
    --color-text-secondary: #475569;
    --color-text-muted: #94a3b8;

    /* 尺寸 */
    --sidebar-width: 280px;
    --chat-width: 320px;
    --gap: 20px;

    /* 圆角 */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;

    /* 阴影 */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* ==================== 主布局容器 ==================== */
.home-layout {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr var(--chat-width);
    gap: var(--gap);
    min-height: calc(100vh - 64px - 48px);
    padding: var(--gap);
    max-width: 1920px;
    margin: 0 auto;
}

/* ==================== 左侧导航栏 ==================== */
.home-sidebar {
    display: flex;
    flex-direction: column;
    background: var(--color-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    height: fit-content;
    max-height: calc(100vh - 140px);
    position: sticky;
    top: 84px;
}

.sidebar-header {
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.sidebar-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
}

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

.nav-section {
    margin-bottom: 20px;
}

.nav-section:last-child {
    margin-bottom: 0;
}

.nav-section-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
    padding-left: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--color-text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
    margin-bottom: 4px;
}

.nav-item:hover {
    background: var(--color-surface);
    color: var(--color-primary);
    transform: translateX(4px);
}

.nav-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.nav-text {
    font-size: 14px;
    font-weight: 500;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--color-border);
    background: var(--color-surface);
}

.status-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.status-label {
    font-size: 12px;
    color: var(--color-text-secondary);
}

.status-value {
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
}

/* Regime 状态颜色 */
.status-value.regime-recovery { background: #dcfce7; color: #166534; }
.status-value.regime-overheat { background: #fee2e2; color: #991b1b; }
.status-value.regime-stagflation { background: #fef3c7; color: #92400e; }
.status-value.regime-deflation { background: #dbeafe; color: #1e40af; }
.status-value.regime-unknown { background: #e2e8f0; color: #334155; }

/* 政策档位颜色 */
.status-value.policy-p0 { background: #dcfce7; color: #166534; }
.status-value.policy-p1 { background: #fef3c7; color: #92400e; }
.status-value.policy-p2 { background: #fed7aa; color: #9a3412; }
.status-value.policy-p3 { background: #fee2e2; color: #991b1b; }
.status-value.policy-unknown { background: #e2e8f0; color: #334155; }

/* ==================== 中间主内容区 ==================== */
.home-main {
    display: flex;
    flex-direction: column;
    gap: var(--gap);
}

/* 顶部欢迎区 */
.home-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: var(--radius-lg);
    padding: 24px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-md);
}

.header-welcome {
    flex: 1;
}

.home-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 8px 0;
}

.home-subtitle {
    font-size: 14px;
    opacity: 0.9;
    margin: 0;
}

.header-actions {
    display: flex;
    gap: 32px;
}

.header-stat {
    text-align: right;
}

.header-stat .stat-label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    opacity: 0.8;
    margin-bottom: 4px;
}

.header-stat .stat-value {
    display: block;
    font-size: 24px;
    font-weight: 700;
}

.header-stat .stat-value.positive { color: #86efac; }
.header-stat .stat-value.negative { color: #fca5a5; }

/* 核心指标卡片 */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--gap);
}

.metric-card {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.metric-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.metric-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.metric-icon {
    font-size: 20px;
}

.metric-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-secondary);
}

.metric-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--color-text-primary);
    margin-bottom: 8px;
}

.metric-value.positive { color: var(--color-success); }
.metric-value.negative { color: var(--color-danger); }

.metric-footer {
    font-size: 12px;
    color: var(--color-text-muted);
}

.metric-label {
    font-size: 12px;
    color: var(--color-text-muted);
}

/* Regime 象限区 */
.regime-section {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--color-border);
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0;
}

.section-link {
    font-size: 13px;
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
}

.section-link:hover {
    text-decoration: underline;
}

.regime-matrix {
    display: flex;
    align-items: center;
    gap: 16px;
}

.regime-axis-y {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-muted);
    letter-spacing: 2px;
    transform: rotate(180deg);
}

.regime-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    flex: 1;
}

.regime-quad {
    padding: 24px;
    border-radius: var(--radius-md);
    text-align: center;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    position: relative;
}

.regime-quad:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-md);
}

.regime-quad.active {
    border-color: currentColor;
    box-shadow: 0 0 0 4px currentColor, var(--shadow-lg);
    opacity: 1;
}

.quad-recovery {
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    color: #1e40af;
}

.quad-overheat {
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    color: #991b1b;
}

.quad-deflation {
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    color: #166534;
}

.quad-stagflation {
    background: linear-gradient(135deg, #fefce8, #fef9c3);
    color: #854d0e;
}

.quad-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.quad-prob {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 4px;
}

.quad-hint {
    font-size: 12px;
    opacity: 0.8;
}

/* 内容卡片行 */
.content-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--gap);
}

.content-card {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.content-card.half {
    flex: 1;
}

.card-body {
    padding: 16px 20px;
}

/* 数据表格 */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table thead {
    background: var(--color-surface);
}

.data-table th {
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: var(--color-text-secondary);
    border-bottom: 1px solid var(--color-border);
}

.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--color-surface);
}

.data-table tbody tr:hover {
    background: var(--color-surface);
}

.data-table .positive { color: var(--color-success); }
.data-table .negative { color: var(--color-danger); }

/* 信号列表 */
.signal-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.signal-item {
    padding: 12px;
    background: var(--color-surface);
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    transition: all 0.2s ease;
}

.signal-item:hover {
    box-shadow: var(--shadow-sm);
    border-color: var(--color-primary);
}

.signal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.signal-asset {
    font-weight: 600;
    font-size: 14px;
    color: var(--color-text-primary);
}

.signal-badge {
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.signal-badge.badge-long { background: #dbeafe; color: #1e40af; }
.signal-badge.badge-short { background: #fee2e2; color: #991b1b; }

.signal-logic {
    font-size: 12px;
    color: var(--color-text-secondary);
    line-height: 1.4;
    margin: 0;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 32px;
    color: var(--color-text-muted);
}

.empty-icon {
    font-size: 36px;
    margin-bottom: 12px;
    opacity: 0.5;
}

/* 系统状态 */
.system-status {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.status-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.status-item-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--color-surface);
    border-radius: var(--radius-sm);
}

.status-icon {
    font-size: 24px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: var(--radius-sm);
}

.status-content {
    flex: 1;
}

.status-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-primary);
}

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

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.status-indicator.status-ok {
    background: var(--color-success);
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.2);
}

/* ==================== 右侧 AI 聊天窗口 ==================== */
.home-chat {
    display: flex;
    flex-direction: column;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    height: fit-content;
    max-height: calc(100vh - 140px);
    position: sticky;
    top: 84px;
    overflow: hidden;
}

.chat-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.chat-status {
    width: 8px;
    height: 8px;
    background: #86efac;
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(134, 239, 172, 0.3);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    min-height: 400px;
    max-height: 500px;
    background: var(--color-surface);
}

.message {
    margin-bottom: 16px;
    display: flex;
}

.message-system {
    justify-content: center;
}

.message-user {
    justify-content: flex-end;
}

.message-content {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 13px;
    line-height: 1.5;
}

.message-system .message-content {
    background: white;
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
}

.message-user .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.message-content p {
    margin: 0 0 8px 0;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-content ul {
    margin: 8px 0;
    padding-left: 20px;
}

.chat-input-area {
    padding: 16px;
    border-top: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    resize: none;
    font-family: inherit;
    font-size: 13px;
    transition: all 0.2s ease;
}

.chat-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

.btn-send {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-send:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* AI 建议卡片 */
.ai-suggestions {
    padding: 16px;
    border-top: 1px solid var(--color-border);
    background: var(--color-surface);
}

.suggestions-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-bottom: 12px;
}

.suggestion-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.suggestion-btn {
    padding: 10px 14px;
    background: white;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--color-text-secondary);
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
}

.suggestion-btn:hover {
    background: var(--color-primary-light);
    color: var(--color-primary);
    border-color: var(--color-primary);
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 1600px) {
    :root {
        --sidebar-width: 240px;
        --chat-width: 280px;
    }

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

@media (max-width: 1200px) {
    .home-layout {
        grid-template-columns: 1fr;
    }

    .home-sidebar,
    .home-chat {
        position: static;
        max-height: none;
    }

    .content-row {
        grid-template-columns: 1fr;
    }

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

@media (max-width: 768px) {
    :root {
        --gap: 16px;
    }

    .home-header {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }

    .header-actions {
        justify-content: center;
        width: 100%;
    }

    .header-stat {
        text-align: center;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .regime-axis-y {
        display: none;
    }

    .regime-grid {
        grid-template-columns: 1fr;
    }
}
