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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* 导航项样式 */
.nav-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: #9CA3AF;
    text-decoration: none;
    border-radius: 0.5rem;
    transition: all 0.2s;
}

.nav-item i {
    margin-right: 0.75rem;
    width: 1.25rem;
}

.nav-item:hover {
    background-color: #374151;
    color: #fff;
}

.nav-item.active {
    background-color: #8B5CF6;
    color: #fff;
}

/* 统计卡片 */
.stat-card {
    background: linear-gradient(135deg, #1F2937 0%, #111827 100%);
    border: 1px solid #374151;
    border-radius: 1rem;
    padding: 1.5rem;
    transition: all 0.3s;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(139, 92, 246, 0.3);
    border-color: #8B5CF6;
}

/* 图表卡片 */
.chart-card {
    background: linear-gradient(135deg, #1F2937 0%, #111827 100%);
    border: 1px solid #374151;
    border-radius: 1rem;
    padding: 1.5rem;
}

/* 按钮样式 */
.btn-primary {
    background: linear-gradient(135deg, #8B5CF6 0%, #7C3AED 100%);
    color: white;
    padding: 0.625rem 1.25rem;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #7C3AED 0%, #6D28D9 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

.btn-secondary {
    background-color: #374151;
    color: white;
    padding: 0.625rem 1.25rem;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-secondary:hover {
    background-color: #4B5563;
}

.btn-danger {
    background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
    color: white;
    padding: 0.625rem 1.25rem;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #DC2626 0%, #B91C1C 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.btn-warning {
    background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
    color: white;
    padding: 0.625rem 1.25rem;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-warning:hover {
    background: linear-gradient(135deg, #D97706 0%, #B45309 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    color: white;
    padding: 0.625rem 1.25rem;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-success:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

/* 禁用按钮通用样式 */
button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
    transform: none !important;
    box-shadow: none !important;
}

/* 市场卡片 */
.market-card {
    background: linear-gradient(135deg, #1F2937 0%, #111827 100%);
    border: 1px solid #374151;
    border-radius: 1rem;
    padding: 1.5rem;
    transition: all 0.3s;
    cursor: pointer;
}

.market-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(139, 92, 246, 0.3);
    border-color: #8B5CF6;
}

/* 策略卡片 */
.strategy-card {
    background: linear-gradient(135deg, #1F2937 0%, #111827 100%);
    border: 1px solid #374151;
    border-radius: 1rem;
    padding: 1.5rem;
    transition: all 0.3s;
}

.strategy-card:hover {
    border-color: #8B5CF6;
}

/* 预警卡片 */
.alert-card {
    background: linear-gradient(135deg, #1F2937 0%, #111827 100%);
    border: 1px solid #374151;
    border-radius: 1rem;
    padding: 1.25rem;
    transition: all 0.3s;
}

.alert-card:hover {
    border-color: #8B5CF6;
}

/* 订单簿项 */
.orderbook-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    position: relative;
    overflow: hidden;
}

.orderbook-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--width);
    opacity: 0.2;
    z-index: 0;
}

.orderbook-item.bid::before {
    background-color: #10B981;
}

.orderbook-item.ask::before {
    background-color: #EF4444;
}

.orderbook-item > span {
    position: relative;
    z-index: 1;
}

/* Tab内容 */
.tab-content {
    display: none;
}

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

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.75);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: linear-gradient(135deg, #1F2937 0%, #111827 100%);
    border: 1px solid #374151;
    border-radius: 1rem;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
}

/* 表单输入 */
.form-input {
    width: 100%;
    background-color: #111827;
    border: 1px solid #374151;
    color: white;
    padding: 0.625rem;
    border-radius: 0.5rem;
    transition: all 0.3s;
}

.form-input:focus {
    outline: none;
    border-color: #8B5CF6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

/* K线间隔按钮 */
.kline-interval-btn {
    padding: 0.5rem 1rem;
    background-color: #374151;
    color: #9CA3AF;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.kline-interval-btn:hover {
    background-color: #4B5563;
    color: white;
}

.kline-interval-btn.active {
    background-color: #8B5CF6;
    color: white;
}

/* 徽章 */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background-color: rgba(16, 185, 129, 0.2);
    color: #10B981;
}

.badge-warning {
    background-color: rgba(245, 158, 11, 0.2);
    color: #F59E0B;
}

.badge-danger {
    background-color: rgba(239, 68, 68, 0.2);
    color: #EF4444;
}

.badge-info {
    background-color: rgba(59, 130, 246, 0.2);
    color: #3B82F6;
}

.badge-purple {
    background-color: rgba(139, 92, 246, 0.2);
    color: #8B5CF6;
}

/* 进度条 */
.progress-bar {
    width: 100%;
    height: 0.5rem;
    background-color: #374151;
    border-radius: 9999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #8B5CF6 0%, #7C3AED 100%);
    transition: width 0.3s;
}

.chip {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    border-radius: 9999px;
    border: 1px solid #374151;
    color: #D1D5DB;
    background-color: #111827;
    font-size: 0.75rem;
    white-space: nowrap;
    cursor: pointer;
}

.chip:hover {
    border-color: #6B7280;
}

.chip-active {
    background-color: #1F2937;
    color: #FFFFFF;
    border-color: #8B5CF6;
}

.outcome-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid transparent;
    font-weight: 600;
    min-width: 72px;
}

.outcome-yes {
    background-color: rgba(16,185,129,0.12);
    border-color: rgba(16,185,129,0.35);
    color: #10B981;
}

.outcome-no {
    background-color: rgba(239,68,68,0.12);
    border-color: rgba(239,68,68,0.35);
    color: #EF4444;
}

.pm-prob-badge {
    background-color: #111827;
    border: 1px solid #374151;
    color: #D1D5DB;
    border-radius: 0.5rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

/* 动画 */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #1F2937;
}

::-webkit-scrollbar-thumb {
    background: #4B5563;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #6B7280;
}

/* 关联分析页面专业样式 */
#correlation-analysisTab .stat-card {
    position: relative;
    overflow: hidden;
}

#correlation-analysisTab .stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #8B5CF6, #EC4899);
    opacity: 0;
    transition: opacity 0.3s;
}

#correlation-analysisTab .stat-card:hover::before {
    opacity: 1;
}

/* 套利机会卡片动画 */
#arbitrageOpportunitiesList > div {
    animation: slideInUp 0.3s ease-out;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 相关性表格样式增强 */
#correlationTableBody tr {
    transition: all 0.2s;
}

#correlationTableBody tr:hover {
    background-color: rgba(139, 92, 246, 0.1);
    transform: scale(1.01);
}

/* 图表容器增强 */
.chart-card {
    position: relative;
}

.chart-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 1rem;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.05) 0%, rgba(236, 72, 153, 0.05) 100%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.chart-card:hover::after {
    opacity: 1;
}

/* 徽章增强 */
.badge {
    transition: all 0.2s;
}

.badge:hover {
    transform: scale(1.1);
}

/* 滚动条美化 */
#arbitrageOpportunitiesList::-webkit-scrollbar,
#correlationTableBody::-webkit-scrollbar {
    width: 6px;
}

#arbitrageOpportunitiesList::-webkit-scrollbar-track,
#correlationTableBody::-webkit-scrollbar-track {
    background: #1F2937;
    border-radius: 3px;
}

#arbitrageOpportunitiesList::-webkit-scrollbar-thumb,
#correlationTableBody::-webkit-scrollbar-thumb {
    background: #8B5CF6;
    border-radius: 3px;
}

#arbitrageOpportunitiesList::-webkit-scrollbar-thumb:hover,
#correlationTableBody::-webkit-scrollbar-thumb:hover {
    background: #7C3AED;
}

/* 输入框和选择器增强 */
#correlation-analysisTab input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: linear-gradient(90deg, #374151 0%, #8B5CF6 100%);
    border-radius: 3px;
    outline: none;
}

#correlation-analysisTab input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #8B5CF6;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.5);
    transition: all 0.2s;
}

#correlation-analysisTab input[type="range"]::-webkit-slider-thumb:hover {
    background: #7C3AED;
    transform: scale(1.2);
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.8);
}

#correlation-analysisTab select {
    transition: all 0.3s;
}

#correlation-analysisTab select:hover {
    border-color: #8B5CF6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

#correlation-analysisTab select:focus {
    border-color: #8B5CF6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

/* 加载动画 */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(139, 92, 246, 0.3);
    border-radius: 50%;
    border-top-color: #8B5CF6;
    animation: spin 1s ease-in-out infinite;
}

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

/* 数据高亮效果 */
.data-highlight {
    position: relative;
    display: inline-block;
}

.data-highlight::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #8B5CF6, #EC4899);
    transform: scaleX(0);
    transition: transform 0.3s;
}

.data-highlight:hover::after {
    transform: scaleX(1);
}

/* 工具提示样式 */
.tooltip {
    position: relative;
    cursor: help;
}

.tooltip::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem 0.75rem;
    background: #1F2937;
    color: #fff;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    z-index: 1000;
}

.tooltip:hover::before {
    opacity: 1;
}

/* 脉冲动画 */
.pulse-animation {
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(139, 92, 246, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(139, 92, 246, 0.8);
    }
}

/* 渐变文字 */
.gradient-text {
    background: linear-gradient(135deg, #8B5CF6 0%, #EC4899 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.75);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    backdrop-filter: blur(4px);
}

.modal-overlay.hidden {
    display: none;
}

.modal-overlay .modal-content {
    background: linear-gradient(135deg, #1F2937 0%, #111827 100%);
    border: 1px solid #374151;
    border-radius: 1rem;
    padding: 1.5rem;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Icon Buttons */
.btn-icon {
    background: none;
    border: none;
    padding: 0.5rem;
    color: #9CA3AF;
    cursor: pointer;
    border-radius: 0.375rem;
    transition: all 0.2s;
}

.btn-icon:hover {
    background-color: #374151;
    color: #fff;
}

/* Form Checkbox */
.form-checkbox {
    width: 1rem;
    height: 1rem;
    background-color: #111827;
    border: 1px solid #374151;
    border-radius: 0.25rem;
    cursor: pointer;
    accent-color: #8B5CF6;
}

/* 响应式 */
@media (max-width: 768px) {
    aside {
        width: 100%;
        height: auto;
    }
    
    .grid {
        grid-template-columns: 1fr !important;
    }
    
    #correlation-analysisTab .stat-card {
        margin-bottom: 1rem;
    }
    
    #correlationTableBody {
        font-size: 0.75rem;
    }
}

/* ═══ periodic_crypto 时间网格组件 ═══ */

.pc-interval-card {
    padding: 1rem;
    border-radius: 0.75rem;
    border: 1px solid rgba(var(--card-color), 0.3);
    background: rgba(var(--card-color), 0.06);
    transition: all 0.2s;
}

.pc-interval-card:hover {
    border-color: rgba(var(--card-color), 0.5);
}

/* 网格快捷操作按钮 */
.pc-grid-quick-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid #4B5563;
    color: #9CA3AF;
    padding: 0.2rem 0.5rem;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 11px;
}

.pc-grid-quick-btn:hover {
    background: rgba(255,255,255,0.1);
    color: #D1D5DB;
    border-color: #6B7280;
}

/* 15m 时间网格 - 按小时行 */
.pc-time-grid-15m {
    display: flex;
    flex-direction: column;
    gap: 1px;
    background: #111827;
    border: 1px solid #374151;
    border-radius: 0.5rem;
    padding: 4px;
    max-height: 360px;
    overflow-y: auto;
}

.pc-grid-hour-row {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pc-grid-hour-label {
    width: 52px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.1;
    font-size: 11px;
    user-select: none;
}

.pc-grid-slots {
    display: flex;
    gap: 2px;
    flex: 1;
}

.pc-grid-slots-wide {
    flex-wrap: wrap;
    gap: 4px;
}

/* 网格单元格 */
.pc-grid-cell {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 1px solid #374151;
    background: #1F2937;
    color: #6B7280;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.1s;
    user-select: none;
    flex: 1;
    min-width: 0;
    padding: 3px 2px;
}

.pc-grid-cell:hover {
    border-color: var(--cell-color, #8B5CF6);
    background: rgba(255,255,255,0.05);
}

.pc-grid-cell-active {
    background: color-mix(in srgb, var(--cell-color, #8B5CF6) 20%, #1F2937);
    border-color: color-mix(in srgb, var(--cell-color, #8B5CF6) 50%, transparent);
    color: var(--cell-color, #8B5CF6);
}

.pc-grid-cell-active:hover {
    background: color-mix(in srgb, var(--cell-color, #8B5CF6) 30%, #1F2937);
}

.pc-cell-et {
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
}

.pc-cell-local {
    font-size: 9px;
    color: #6B7280;
    line-height: 1;
    margin-top: 1px;
}

/* 大尺寸格子 (1h/4h) */
.pc-grid-cell-lg {
    padding: 8px 12px;
    min-width: 72px;
    border-radius: 6px;
    gap: 2px;
}

.pc-grid-cell-lg .pc-cell-et {
    font-size: 13px;
}

.pc-grid-cell-lg .pc-cell-local {
    font-size: 10px;
}

/* 采集计划预览 */
.pc-schedule-preview {
    font-size: 12px;
}

.pc-preview-timeline {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pc-preview-hour-group {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.pc-preview-hour-label {
    font-size: 10px;
    color: #6B7280;
    font-weight: 600;
    padding: 4px 0 2px;
    border-top: 1px solid #1F2937;
}

.pc-preview-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 2px 4px;
    border-radius: 3px;
    transition: background 0.1s;
}

.pc-preview-item:hover {
    background: rgba(255,255,255,0.03);
}

.pc-preview-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.pc-preview-tag {
    font-size: 10px;
    font-weight: 700;
    color: var(--item-color, #8B5CF6);
    width: 24px;
    flex-shrink: 0;
}

.pc-preview-trigger {
    color: #D1D5DB;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.pc-preview-boundary {
    color: #6B7280;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.pc-preview-local {
    color: #4B5563;
    font-size: 10px;
}

/* 15m 网格滚动条 */
.pc-time-grid-15m::-webkit-scrollbar {
    width: 4px;
}

.pc-time-grid-15m::-webkit-scrollbar-track {
    background: #111827;
}

.pc-time-grid-15m::-webkit-scrollbar-thumb {
    background: #374151;
    border-radius: 2px;
}

.pc-time-grid-15m::-webkit-scrollbar-thumb:hover {
    background: #4B5563;
}
