/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    overflow: hidden;
    background: #f0f2f6;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* 主容器 - 上中下三层布局 */
.main-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100%;
    background: #f0f2f6;
}

/* 上部区域 - 固定高度 */
.top-section {
    height: 60px;
    min-height: 60px;
    background-color: #1f2d3d;  /* 深蓝灰，更现代 */
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.top-section .logo {
    color: #fff;
    font-size: 18px;
    font-weight: bold;
    letter-spacing: 0.5px;
}

.top-section .nav-links {
    display: flex;
    gap: 10px;
}

.top-section .nav-links a {
    color: #f0f0f0;
    text-decoration: none;
    padding: 8px 15px;
    border-radius: 4px;
    transition: all 0.3s;
}

.top-section .nav-links a:hover,
.top-section .nav-links a.active {
    background-color: #009688;  /* 保持原有 teal 配色 */
}

.top-section .nav-right {
    display: flex;
    gap: 10px;
    align-items: center;
}

.refresh-btn {
    background: linear-gradient(135deg, #1890ff 0%, #0c5ea0 100%);
    border: none;
    color: white;
    transition: all 0.2s;
}

.refresh-btn:hover {
    background: linear-gradient(135deg, #0c5ea0 0%, #084d82 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

/* 下部区域 - 固定高度与上部一致 */
.bottom-section {
    height: 60px;
    min-height: 60px;
    background-color: #1f2d3d;
    color: #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
}

/* 中间内容区域 - 占满剩余空间 */
.middle-section {
    flex: 1;
    overflow: hidden;
    padding: 20px 20px 5px 20px;
}

/* 内容居中容器 - 两边留白 */
.content-container {
    max-width: 1400px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* 系统状态区 - 置顶锁定 */
.status-section {
    flex-shrink: 0;
    margin-bottom: 15px;
}

.status-cards {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
}

.status-card {
    background-color: #fff;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s, box-shadow 0.2s;
}

.status-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.status-card-title {
    color: #5a6874;
    font-size: 14px;
    margin-bottom: 10px;
    font-weight: 500;
}

.status-card-value {
    font-size: 28px;
    font-weight: bold;
}

/* 数值颜色区分，鲜明突出 */
.status-card-value.running {
    color: #1890ff;
}

.status-card-value.online {
    color: #2e7d32;  /* 深绿 */
}

.status-card-value.symbol {
    color: #722ed1;  /* 紫色 */
}

/* 针对 TCP 服务状态和 WebCrawler 状态，其内部 span 颜色单独控制 */
#tcpStatus.status-running,
#webcrawlerXQStatus.status-running,
#webcrawlerRTJStatus.status-running {
    color: white;
}
#tcpStatus.status-stopped,
#webcrawlerXQStatus.status-stopped,
#webcrawlerRTJStatus.status-stopped {
    color: #8c8c8c;
}
#webcrawlerXQStatus.status-webcrawler-disabled,
#webcrawlerRTJStatus.status-webcrawler-disabled {
    color: #a0a0a0;
}

/* WebCrawler服务状态卡片内的布局 */
.webcrawler-status {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.webcrawler-status div {
    display: flex;
    align-items: center;
    gap: 8px;
}

.service-label {
    font-size: 12px;
    color: #666;
    font-weight: 500;
    min-width: 45px;
}

/* 下方内容区域 - 左右布局 */
.content-below-status {
    flex: 1;
    display: flex;
    gap: 15px;
    overflow: hidden;
    min-height: 0;
}

/* 左侧服务商列表 - 置顶锁定 */
.server-list-section {
    width: 280px;
    flex-shrink: 0;
    background-color: #fff;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.server-list-header {
    padding: 12px 15px;
    background-color: #f8fafc;
    border-bottom: 1px solid #eef2f6;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.server-list-title {
    font-weight: bold;
    color: #1f2d3d;
}

.server-list-count {
    color: #2e7d32;
    font-size: 12px;
    font-weight: 500;
}

.server-list-content {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

/* 服务商卡片样式 - 在线/离线颜色加深 */
.server-card {
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    background-color: #fff;
    border: 1px solid #edf2f7;
}

.server-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12);
}

.server-card.online {
    background-color: #2e7d32;  /* 深绿 */
    color: white;
    border-color: #1b5e20;
}

.server-card.offline {
    background-color: #7e8081;  /* 深灰 */
    color: #f0f0f0;
    border-color: #4a5568;
}

.server-card-title {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 5px;
}

.server-card-account {
    font-size: 12px;
    opacity: 0.9;
}

/* 信息展示区 - 填满剩余空间 */
.info-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow: hidden;
    min-height: 0;
}

/* 基差历史（预留区域）- 暂不显示 */
.reserved-area {
    display: none;
}

/* 交易品种信息 - 修复表格显示问题 */
.price-info-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    min-height: 0;
}

.price-info-header {
    padding: 10px 15px;
    border-bottom: 1px solid #eef2f6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    height: 44px;
    background-color: #f8fafc;
}

.price-info-title {
    font-weight: bold;
    color: #1f2d3d;
}

.price-info-body {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    padding: 0;
}

/* 表格视图占满父容器 */
.price-info-body .layui-table-view {
    margin: 0;
    height: 100%;
    border: 1px solid #eef2f6;
    border-radius: 8px;
}

.price-info-body .layui-table-body {
    overflow-x: auto;
}

/* 表格表头样式 - 增强对比 */
.price-info-body .layui-table-header .layui-table th {
    background-color: #f0f4fa;
    color: #1f2d3d !important;
    font-weight: 600;
    border-bottom: 1px solid #e2e8f0;
}

/* 表格行悬停 */
.price-info-body .layui-table tbody tr:hover {
    background-color: #f8fafc;
}

/* 按钮样式 */
.header-btn {
    margin-left: 10px;
}

/* 编辑弹窗样式 */
.edit-dialog-container {
    padding: 0;
}

.edit-dialog-title {
    text-align: center;
    padding: 15px 20px;
    font-size: 18px;
    font-weight: bold;
    color: #fff;
    background: linear-gradient(135deg, #1f2d3d 0%, #2c3e50 100%);
    margin: 0;
    border-radius: 4px 4px 0 0;
}

.edit-dialog-content {
    padding: 20px;
}

.edit-form-item {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    white-space: nowrap;
}

.edit-form-item label {
    width: 70px;
    text-align: right;
    margin-right: 12px;
    font-weight: 500;
    white-space: nowrap;
    color: #5a6874;
}

.edit-form-item .layui-input-block {
    flex: 1;
    min-width: 0;
    margin: 0;
}

.edit-form-item input {
    width: 100%;
    border: 1px solid #dce5f0;
    border-radius: 6px;
    padding: 8px 12px;
}

.edit-form-actions {
    text-align: center;
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px solid #eef2f6;
}

/* 状态标签样式 - 高饱和纯色，易读 */
.status-online {
    background-color: #2e7d32;
    color: white;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-offline {
    background-color: #c62828;
    color: white;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-running {
    background-color: #1890ff;
    color: white;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-stopped {
    background-color: #9e9e9e;
    color: white;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-webcrawler {
    background-color: #722ed1;
    color: white;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-webcrawler-disabled {
    background-color: #8c8c8c;
    color: white;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

/* 滚动条样式优化 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: #f0f2f6;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Layui 按钮覆盖（保持原有风格但增强对比） */
.layui-btn {
    border-radius: 6px;
    transition: all 0.2s;
}
.layui-btn-primary {
    background-color: #1f2d3d;
    border: none;
    color: white;
}
.layui-btn-primary:hover {
    background-color: #2c3e50;
}
.layui-btn-danger {
    background-color: #e53935;
}
.layui-btn-normal {
    background-color: #2e7d32;
}
.layui-layer-btn0 {
    background-color: #1f2d3d;
    border: none;
}
.layui-layer-btn0:hover {
    background-color: #2c3e50;
}