/* 现代化交易数据分析仪表盘主题 */

/* ==================== 扩展颜色系统 ==================== */
:root {
    /* 新增主题色彩 - 黑灰色系 */
    --gradient-primary: linear-gradient(135deg, #1f2937 0%, #374151 100%);
    --gradient-success: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    --gradient-warning: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    --gradient-card: linear-gradient(145deg, #ffffff 0%, #f9fafb 100%);
    
    /* 状态色彩扩展 */
    --info-color: #6b7280;
    --light-color: #f9fafb;
    --dark-color: #111827;
    
    /* 新增阴影系统 */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);
    --shadow-glow: 0 0 20px rgba(31, 41, 55, 0.2);
    
    /* 网格系统 */
    --grid-gap: 1.5rem;
    --grid-gap-sm: 1rem;
    --grid-gap-lg: 2rem;
    
    /* 动画 */
    --animation-fast: 0.15s;
    --animation-normal: 0.3s;
    --animation-slow: 0.5s;
    
    /* 圆角系统 */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
}

/* ==================== Hero 仪表板区域 ==================== */
.hero-dashboard {
    background: var(--gradient-primary);
    color: white;
    padding: 2rem 0;
    margin-bottom: 2rem;
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
    box-shadow: var(--shadow-xl);
}

.hero-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--grid-gap);
    align-items: center;
}

.hero-kpi-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-align: center;
    transition: all var(--animation-normal) ease;
}

.hero-kpi-card:hover {
    transform: translateY(-4px);
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

.hero-kpi-value {
    font-size: 1.875rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.hero-kpi-label {
    font-size: 0.75rem;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.hero-kpi-trend {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

/* ==================== 现代化卡片系统 ==================== */
.modern-card {
    background: var(--gradient-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(255, 255, 255, 0.8);
    transition: all var(--animation-normal) ease;
    position: relative;
    overflow: hidden;
}

.modern-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity var(--animation-normal) ease;
}

.modern-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
    border-color: rgba(31, 41, 55, 0.2);
}

.modern-card:hover::before {
    opacity: 1;
}

/* ==================== 增强的统计卡片 ==================== */
.enhanced-stat-card {
    background: var(--gradient-card);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    position: relative;
    overflow: hidden;
    transition: all var(--animation-normal) ease;
    border: 1px solid rgba(255, 255, 255, 0.8);
    min-height: 200px;
    height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.enhanced-stat-card::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(31, 41, 55, 0.1) 0%, transparent 70%);
    opacity: 0;
    transition: opacity var(--animation-normal) ease;
}

.enhanced-stat-card:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-glow);
    border-color: rgba(31, 41, 55, 0.3);
}

.enhanced-stat-card:hover::after {
    opacity: 1;
}

.stat-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    font-size: 1.25rem;
    color: white;
    box-shadow: var(--shadow-md);
}

.stat-icon i {
    font-size: 1.25rem;
    line-height: 1;
}

.stat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.stat-trend {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 999px;
    font-weight: 600;
}

.stat-trend.positive {
    background-color: #dcfce7;
    color: #166534;
}

.stat-trend.negative {
    background-color: #fef2f2;
    color: #dc2626;
}

.enhanced-stat-value-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-height: 3.5rem;
    margin-bottom: 0.5rem;
}

.enhanced-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
    word-break: break-all;
    hyphens: auto;
    overflow-wrap: break-word;
    margin-bottom: 0.25rem;
}

.stat-unit {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.125rem;
}

/* ==================== 微型图表组件 ==================== */
.mini-chart {
    width: 100%;
    height: 40px;
    margin-top: 1rem;
    position: relative;
}

.mini-chart canvas {
    width: 100% !important;
    height: 100% !important;
}

/* ==================== 12列网格系统 ==================== */
.grid-12 {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: var(--grid-gap);
    margin-bottom: 2rem;
}

.col-1 { grid-column: span 1; }
.col-2 { grid-column: span 2; }
.col-3 { grid-column: span 3; }
.col-4 { grid-column: span 4; }
.col-5 { grid-column: span 5; }
.col-6 { grid-column: span 6; }
.col-7 { grid-column: span 7; }
.col-8 { grid-column: span 8; }
.col-9 { grid-column: span 9; }
.col-10 { grid-column: span 10; }
.col-11 { grid-column: span 11; }
.col-12 { grid-column: span 12; }

/* ==================== 间距系统 ==================== */
.spacing-system {
    --space-1: 0.25rem;  /* 4px */
    --space-2: 0.5rem;   /* 8px */
    --space-3: 0.75rem;  /* 12px */
    --space-4: 1rem;     /* 16px */
    --space-5: 1.25rem;  /* 20px */
    --space-6: 1.5rem;   /* 24px */
    --space-8: 2rem;     /* 32px */
    --space-10: 2.5rem;  /* 40px */
    --space-12: 3rem;    /* 48px */
    --space-16: 4rem;    /* 64px */
}

/* ==================== 悬停效果和工具提示 ==================== */
.tooltip {
    position: relative;
    cursor: pointer;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--dark-color);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all var(--animation-fast) ease;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
}

.tooltip::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    border: 4px solid transparent;
    border-top-color: var(--dark-color);
    opacity: 0;
    visibility: hidden;
    transition: all var(--animation-fast) ease;
}

.tooltip:hover::after,
.tooltip:hover::before {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-4px);
}

/* ==================== 可折叠区域 ==================== */
.collapsible {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 1rem;
}

.collapsible-header {
    background: var(--background-color);
    padding: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all var(--animation-fast) ease;
    border-bottom: 1px solid transparent;
}

.collapsible-header:hover {
    background: var(--light-color);
}

.collapsible-toggle {
    transition: transform var(--animation-normal) ease;
}

.collapsible.expanded .collapsible-toggle {
    transform: rotate(180deg);
}

.collapsible.expanded .collapsible-header {
    border-bottom-color: var(--border-color);
}

.collapsible-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--animation-normal) ease;
}

.collapsible.expanded .collapsible-content {
    max-height: 2000px;
}

/* ==================== 骨架屏动画 ==================== */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius-md);
}

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
}

.skeleton-text:last-child {
    width: 60%;
}

.skeleton-card {
    height: 120px;
    margin-bottom: 1rem;
}

@keyframes skeleton-loading {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* ==================== 数值变化动画 ==================== */
.animate-value {
    transition: all var(--animation-slow) ease;
}

.animate-value.updating {
    transform: scale(1.1);
    color: var(--primary-color);
}

/* ==================== 响应式网格优化 ==================== */
.sortable-ghost {
    opacity: 0.5;
}

.sortable-chosen {
    transform: scale(1.02);
    box-shadow: var(--shadow-glow);
}

.drag-handle {
    cursor: grab;
    padding: 0.5rem;
    color: var(--text-secondary);
    transition: color var(--animation-fast) ease;
}

.drag-handle:hover {
    color: var(--primary-color);
}

.drag-handle:active {
    cursor: grabbing;
}

/* ==================== 现代化表格增强 ==================== */
.modern-table-wrapper {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.8);
    margin-top: 0.5rem;
}

.modern-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.modern-table th {
    background: var(--gradient-primary);
    color: white;
    padding: 1rem;
    font-weight: 600;
    text-align: left;
    position: sticky;
    top: 0;
    z-index: 10;
}

.modern-table th:first-child {
    border-top-left-radius: var(--radius-lg);
}

.modern-table th:last-child {
    border-top-right-radius: var(--radius-lg);
}

.modern-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    transition: background-color var(--animation-fast) ease;
}

.modern-table tbody tr:hover td {
    background-color: rgba(31, 41, 55, 0.05);
}

/* ==================== 增强的图表样式 ==================== */
.chart-container {
    position: relative;
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(255, 255, 255, 0.8);
    margin-bottom: 2rem;
}

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

.chart-title {
    font-size: 1.125rem;
    font-weight: 600;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.chart-controls {
    display: flex;
    gap: 0.5rem;
}

.chart-control-btn {
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all var(--animation-fast) ease;
}

.chart-control-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* ==================== 响应式网格优化 ==================== */
@media (max-width: 1200px) {
    .grid-12 {
        grid-template-columns: repeat(10, 1fr);
    }
    
    .col-2 { grid-column: span 2; }
    .col-3 { grid-column: span 5; }
    .col-4 { grid-column: span 5; }
    .col-6 { grid-column: span 10; }
}

@media (max-width: 768px) {
    .grid-12 {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .col-1, .col-2, .col-3, .col-4, .col-6 { 
        grid-column: span 1; 
    }
    
    .hero-dashboard {
        padding: 1.5rem 0;
        margin-bottom: 1.5rem;
    }
    
    .hero-content {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .hero-kpi-value {
        font-size: 1.5rem;
    }
    
    .enhanced-stat-card {
        min-height: 180px;
        height: 180px;
        padding: 1.5rem;
    }
    
    .enhanced-stat-value-container {
        min-height: 3rem;
    }
    
    .enhanced-stat-value {
        font-size: 1.25rem;
    }
    
    .stat-unit {
        font-size: 0.7rem;
    }
}

@media (max-width: 480px) {
    .grid-12 {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        margin-bottom: 1.25rem;
    }
    
    .hero-content {
        grid-template-columns: 1fr;
    }
    
    .enhanced-stat-card {
        min-height: 160px;
        height: 160px;
        padding: 1.25rem;
    }
    
    .enhanced-stat-value-container {
        min-height: 2.5rem;
    }
    
    .enhanced-stat-value {
        font-size: 1.125rem;
        line-height: 1.1;
    }
    
    .stat-unit {
        font-size: 0.65rem;
    }
}

/* ==================== 性能优化 ==================== */
.panel,
.modern-card,
.enhanced-stat-card {
    contain: layout style paint;
}

/* GPU 加速 */
.hero-kpi-card,
.modern-card,
.enhanced-stat-card {
    will-change: transform;
}

/* ==================== 悬浮操作按钮 ==================== */
.floating-actions {
    position: fixed;
    right: 2rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    padding: 0.75rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.floating-btn {
    width: 40px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: all var(--animation-fast) ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 600;
    color: #6b7280;
    background: #f3f4f6;
    position: relative;
}

.floating-btn i {
    font-size: 1rem;
    line-height: 1;
}

.floating-btn.refresh-btn {
    background: #f3f4f6;
    color: #6b7280;
}

.floating-btn.cache-btn {
    background: #f3f4f6;
    color: #6b7280;
}

.floating-btn:hover {
    background: #e5e7eb;
    color: #374151;
    transform: scale(1.05);
}

.floating-btn:active {
    transform: scale(0.98);
    background: #d1d5db;
}

.floating-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.floating-btn.loading {
    animation: spin 1s linear infinite;
}

/* 移动设备上的悬浮按钮调整 */
@media (max-width: 768px) {
    .floating-actions {
        right: 1rem;
        bottom: 2rem;
        top: auto;
        transform: none;
        flex-direction: row;
        justify-content: flex-end;
        padding: 0.5rem;
        gap: 0.5rem;
    }
    
    .floating-btn {
        width: 36px;
        height: 28px;
        font-size: 0.75rem;
    }
}

/* ==================== 无障碍优化 ==================== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}