/* BitMart合约交易机器人样式 - 修改版 */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #1a202c;
    color: #e2e8f0;
    font-size: 14px;
    line-height: 1.5;
}

.container {
    padding: 20px;
    max-width: 1600px;
    margin: 0 auto;
}

/* 顶部状态栏 - 浅蓝色，标题居中 */
.status-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #63b3ed 0%, #4299e1 100%);
    padding: 20px 25px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(66, 153, 225, 0.2);
    color: white;
    text-align: center;
}

.status-title {
    font-family: 'Microsoft YaHei', 'PingFang SC', 'Hiragino Sans GB', 'Arial', sans-serif;
    font-weight: bold;
    font-size: 28px;
    margin-bottom: 5px;
    letter-spacing: 1px;
}

.status-subtitle {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 10px;
}

.status-time {
    font-size: 16px;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.15);
    padding: 8px 15px;
    border-radius: 8px;
    display: inline-block;
}

.status-right {
    position: absolute;
    right: 25px;
    top: 20px;
    font-weight: 500;
    font-size: 14px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
}

.status-dot {
    width: 10px;
    height: 10px;
    background-color: #48bb78;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }

    100% {
        opacity: 1;
    }
}

/* 标签导航 - 横向布局 */
.tabs-nav {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    overflow-x: auto;
    padding-bottom: 5px;
}

.tab-btn {
    flex: 0 0 auto;
    padding: 12px 20px;
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    border: 1px solid #4a5568;
    border-radius: 8px;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
}

.tab-btn:hover {
    background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
    color: #e2e8f0;
}

.tab-btn.active {
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
    color: white;
    border-color: #4299e1;
}

/* 标签内容区域 */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

/* 仪表板网格布局 - 三列布局 */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

@media (max-width: 1400px) {
    .dashboard-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 900px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* 账户信息卡片 */
.account-summary-card {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    border-radius: 12px;
    padding: 25px;
    border: 1px solid #4a5568;
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #4a5568;
}

.card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 600;
    color: #e2e8f0;
}

.account-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.account-stat {
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 8px;
    transition: transform 0.2s;
}

.account-stat:hover {
    transform: translateY(-2px);
}

.stat-label {
    color: #94a3b8;
    font-size: 12px;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 18px;
    font-weight: bold;
    color: #e2e8f0;
}

.stat-value.positive {
    color: #48bb78;
}

.stat-value.negative {
    color: #f56565;
}

.btn-action {
    background: #4299e1;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.3s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-action:hover {
    background: #3182ce;
}

/* 统计卡片样式 */
.stats-cards-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin: 20px 0;
}

@media (max-width: 768px) {
    .stats-cards-container {
        grid-template-columns: 1fr;
    }
}

.stat-card {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    border: 1px solid #4a5568;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s;
}

.stat-card:hover {
    border-color: #4299e1;
    transform: translateY(-2px);
}

.stat-icon {
    font-size: 24px;
    color: #4299e1;
    margin-bottom: 10px;
}

.stat-number {
    font-size: 24px;
    font-weight: bold;
    margin: 10px 0;
    color: #e2e8f0;
}

.stat-label {
    color: #94a3b8;
    font-size: 12px;
}

/* 交易控制页面 */
.trading-control-page {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 20px;
}

@media (max-width: 992px) {
    .trading-control-page {
        grid-template-columns: 1fr;
    }
}

/* 交易控制面板 */
.trading-control-panel {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    border-radius: 12px;
    padding: 25px;
    border: 1px solid #4a5568;
    height: fit-content;
}

.trading-control-panel h3 {
    margin-bottom: 20px;
    color: #e2e8f0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.trading-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.trading-btn {
    padding: 15px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.trading-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.trading-btn:active {
    transform: translateY(0);
}

.btn-long {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
}

.btn-short {
    background: linear-gradient(135deg, #f56565 0%, #e53e3e 100%);
    color: white;
}

.btn-close {
    background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%);
    color: white;
}

.btn-reset {
    background: linear-gradient(135deg, #9f7aea 0%, #805ad5 100%);
    color: white;
}

/* 持仓面板 */
.position-panel {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    border-radius: 12px;
    padding: 25px;
    border: 1px solid #4a5568;
}

.position-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
}

.position-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #4a5568;
}

.position-type {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: bold;
}

.position-type.long {
    color: #48bb78;
}

.position-type.short {
    color: #f56565;
}

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

.position-detail {
    display: flex;
    flex-direction: column;
}

.detail-label {
    color: #94a3b8;
    font-size: 12px;
    margin-bottom: 4px;
}

.detail-value {
    font-weight: bold;
    color: #e2e8f0;
}

.btn-small {
    padding: 5px 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    background: #f56565;
    color: white;
}

/* 历史订单横向卡片 */
.history-cards-container {
    display: flex;
    overflow-x: auto;
    padding: 20px 10px;
    gap: 20px;
}

.history-card {
    flex: 0 0 auto;
    width: 300px;
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    border: 1px solid #4a5568;
    border-radius: 10px;
    padding: 20px;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #4a5568;
}

.history-time {
    color: #94a3b8;
    font-size: 12px;
}

.history-symbol {
    font-weight: bold;
    color: #4299e1;
}

.history-body {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.history-item {
    display: flex;
    flex-direction: column;
}

.history-label {
    color: #94a3b8;
    font-size: 11px;
    margin-bottom: 2px;
}

.history-value {
    font-weight: bold;
    font-size: 14px;
}

.long-direction {
    color: #48bb78;
}

.short-direction {
    color: #f56565;
}

.profit-positive {
    color: #48bb78;
}

.profit-negative {
    color: #f56565;
}

/* 日志样式 */
.logs-container {
    max-height: 500px;
    overflow-y: auto;
    padding: 10px;
    background: rgba(30, 41, 59, 0.8);
    border-radius: 8px;
}

.log-entry {
    padding: 10px;
    margin-bottom: 8px;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.log-info {
    background: rgba(59, 130, 246, 0.1);
    border-left: 3px solid #3b82f6;
}

.log-success {
    background: rgba(72, 187, 120, 0.1);
    border-left: 3px solid #48bb78;
}

.log-error {
    background: rgba(245, 101, 101, 0.1);
    border-left: 3px solid #f56565;
}

.log-warning {
    background: rgba(237, 137, 54, 0.1);
    border-left: 3px solid #ed8936;
}

.log-message {
    flex: 1;
    font-size: 13px;
}

.log-time {
    color: #94a3b8;
    font-size: 11px;
    margin-left: 10px;
}

/* 表单样式 */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    color: #94a3b8;
    font-size: 12px;
    margin-bottom: 5px;
}

.form-control {
    padding: 10px;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid #475569;
    border-radius: 6px;
    color: white;
    font-size: 14px;
}

.form-control:focus {
    outline: none;
    border-color: #4299e1;
}

.save-btn {
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.save-btn:hover {
    transform: translateY(-2px);
}

/* Toast通知 */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #48bb78;
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    animation: slideIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 400px;
}

.toast.error {
    background: #f56565;
}

.toast.warning {
    background: #ed8936;
}

.toast.info {
    background: #4299e1;
}

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

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

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* 加载动画 */
.loading-spinner {
    border: 3px solid #4a5568;
    border-top: 3px solid #4299e1;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* 空状态 */
.empty-state,
.empty-position {
    text-align: center;
    padding: 40px;
    color: #94a3b8;
}

.empty-state i,
.empty-position i {
    font-size: 48px;
    opacity: 0.5;
    margin-bottom: 15px;
}

/* 错误状态 */
.error {
    text-align: center;
    padding: 20px;
    color: #f56565;
}

/* 响应式调整 */
@media (max-width: 768px) {

    .dashboard-grid,
    .account-stats,
    .trading-buttons,
    .position-details,
    .history-body,
    .settings-grid {
        grid-template-columns: 1fr;
    }

    .trading-control-page {
        grid-template-columns: 1fr;
    }

    .history-card {
        width: 280px;
    }

    .status-bar {
        padding: 15px;
    }

    .status-title {
        font-size: 22px;
    }

    .status-time {
        font-size: 14px;
    }

    .status-right {
        position: static;
        margin-top: 10px;
    }

    .tabs-nav {
        flex-wrap: nowrap;
        overflow-x: auto;
    }

    .tab-btn {
        padding: 10px 15px;
        font-size: 13px;
    }
}

/* 历史订单卡片样式增强 */
.history-long-profit {
    color: #48bb78 !important;
    background-color: rgba(72, 187, 120, 0.1);
    padding: 3px 8px;
    border-radius: 4px;
    display: inline-block;
}

.history-long-loss {
    color: #f56565 !important;
    background-color: rgba(245, 101, 101, 0.1);
    padding: 3px 8px;
    border-radius: 4px;
    display: inline-block;
}

.history-short-profit {
    color: #48bb78 !important;
    background-color: rgba(72, 187, 120, 0.1);
    padding: 3px 8px;
    border-radius: 4px;
    display: inline-block;
}

.history-short-loss {
    color: #f56565 !important;
    background-color: rgba(245, 101, 101, 0.1);
    padding: 3px 8px;
    border-radius: 4px;
    display: inline-block;
}

.history-neutral {
    color: #a0aec0 !important;
    background-color: rgba(160, 174, 192, 0.1);
    padding: 3px 8px;
    border-radius: 4px;
    display: inline-block;
}

.history-profit {
    font-weight: bold;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.profit-positive {
    color: #48bb78;
}

.profit-negative {
    color: #f56565;
}

/* 杠杆控制样式 */
.leverage-section {
    background: linear-gradient(135deg, rgba(66, 153, 225, 0.1) 0%, rgba(66, 153, 225, 0.05) 100%) !important;
    border: 1px solid #4299e1 !important;
    margin-bottom: 20px !important;
    padding: 15px !important;
    border-radius: 10px !important;
}

/* ====== 滑块轨道（通用） ====== */
.leverage-section input[type="range"] {
    -webkit-appearance: none;
    /* Chrome/Safari */
    appearance: none;
    /* 标准属性 */
    width: 100%;
    height: 8px;
    background: #4a5568;
    border-radius: 4px;
    outline: none;
}

/* ====== 滑块轨道（Firefox） ====== */
.leverage-section input[type="range"]::-moz-range-track {
    height: 8px;
    background: #4a5568;
    border-radius: 4px;
    border: none;
    /* Firefox 默认有边框，去掉 */
}

/* ====== 滑块按钮（Chrome/Safari） ====== */
.leverage-section input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #4299e1;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

/* ====== 滑块按钮（Firefox） ====== */
.leverage-section input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #4299e1;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

/* ====== 数字输入框 ====== */
.leverage-section input[type="number"] {
    background: rgba(30, 41, 59, 0.8) !important;
    border: 1px solid #475569 !important;
    border-radius: 6px !important;
    color: white !important;
    text-align: center !important;
    font-weight: bold !important;
    padding: 8px 12px !important;
}

.leverage-section input[type="number"]:focus {
    border-color: #4299e1 !important;
    outline: none !important;
    box-shadow: 0 0 0 2px rgba(66, 153, 225, 0.3) !important;
}

/* ====== 按钮 ====== */
.leverage-section button {
    transition: all 0.3s ease !important;
}

.leverage-section button:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
}

/* 开关样式 */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #4a5568;
    transition: .3s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: #48bb78;
}

input:checked+.slider:before {
    transform: translateX(26px);
}

/* 在improved_style.css末尾添加 */
.trade-history-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    border-radius: 10px;
    overflow: hidden;
}

.trade-history-table th {
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
    color: white;
    padding: 12px 15px;
    text-align: left;
    font-weight: 500;
    font-size: 13px;
}

.trade-history-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #4a5568;
    font-size: 13px;
    color: #e2e8f0;
}

.trade-history-table tr:hover {
    background: rgba(66, 153, 225, 0.1);
}

.trade-history-table tr:last-child td {
    border-bottom: none;
}

.points-positive {
    color: #48bb78;
    font-weight: bold;
}

.points-negative {
    color: #f56565;
    font-weight: bold;
}

.trade-status {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
}

.status-take-profit {
    background: rgba(72, 187, 120, 0.2);
    color: #48bb78;
}

.status-stop-loss {
    background: rgba(245, 101, 101, 0.2);
    color: #f56565;
}

.status-small-profit {
    background: rgba(66, 153, 225, 0.2);
    color: #63b3ed;
}

.status-small-loss {
    background: rgba(237, 137, 54, 0.2);
    color: #ed8936;
}

/* 让仪表板的三列卡片等高 */
.dashboard-grid .account-summary-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    /* 填充 grid 行高 */
    min-height: 220px;
    /* 保证最小高度一致，防止内容极少时塌陷 */
}

/* 轮次管理卡片内部紧凑 */
#roundStatusCard .account-stats {
    gap: 8px;
    /* 减小统计项间距 */
}

#roundStatusCard .account-stat {
    padding: 8px 12px;
    /* 缩小内边距 */
}

#roundStatusCard .stat-value {
    font-size: 14px;
    /* 数字略小 */
}

#roundStatusCard .stat-label {
    font-size: 11px;
}

#roundStatusCard .progress-bar-wrapper {
    margin: 8px 0;
    /* 进度条上下间距减小 */
}

#roundStatusCard button {
    padding: 4px 10px;
    /* 按钮缩小 */
    font-size: 11px;
}

#roundStatusCard .status-badge {
    font-size: 11px;
    padding: 2px 8px;
}

/* 交易开关小球样式 */
.status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: currentColor;
    vertical-align: middle;
    transition: background-color 0.3s;
}

/* 运行状态呼吸动画 */
.status-dot.running {
    animation: breathe 1.5s ease-in-out infinite;
}

@keyframes breathe {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(0.8);
    }
}