/* ============================================
   昌都市电子卖场数据可视化大屏 - 主样式文件
   作者: AI Assistant
   版本: 4.0
   说明: 政府数据大屏风格，深色背景，科技感
   ============================================ */

/* CSS变量定义 */
:root {
    --primary-blue: #1890ff;
    --primary-dark: #001529;
    --primary-darker: #000c17;
    --success-green: #52c41a;
    --warning-orange: #fa8c16;
    --danger-red: #f5222d;
    --info-cyan: #13c2c2;
    --purple: #722ed1;
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.85);
    --text-muted: rgba(255, 255, 255, 0.45);
    --border-color: rgba(24, 144, 255, 0.3);
    --border-glow: rgba(24, 144, 255, 0.6);
    --bg-gradient: linear-gradient(135deg, #001529 0%, #000c17 100%);
    --panel-bg: rgba(0, 21, 41, 0.9);
    --font-number: 'DIN Alternate', 'Roboto Mono', 'Courier New', monospace;
    --font-chinese: 'Source Han Sans CN', 'Microsoft YaHei', 'PingFang SC', sans-serif;
}

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: var(--font-chinese);
    background: var(--bg-gradient);
    color: var(--text-primary);
    font-size: 14px;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 80%, rgba(24, 144, 255, 0.06) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(82, 196, 26, 0.06) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

.grid-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(24, 144, 255, 0.015) 1px, transparent 1px),
        linear-gradient(90deg, rgba(24, 144, 255, 0.015) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
    z-index: -1;
}

/* ============================================
   头部区域
   ============================================ */
.header {
    position: relative;
    height: 60px;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, rgba(0, 21, 41, 0.95) 0%, rgba(0, 12, 23, 0.9) 100%);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 10px rgba(24, 144, 255, 0.15);
    flex-shrink: 0;
}

.header::before, .header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    width: 60px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--primary-blue), transparent);
}

.header::before { left: 20%; }
.header::after { right: 20%; }

.header-title {
    font-size: 22px;
    font-weight: bold;
    background: linear-gradient(90deg, #fff, #1890ff, #fff);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 15px rgba(24, 144, 255, 0.3);
    animation: titleShine 4s linear infinite;
    letter-spacing: 2px;
    white-space: nowrap;
}

@keyframes titleShine {
    0% { background-position: 0% center; }
    100% { background-position: 200% center; }
}

.header-time {
    position: absolute;
    right: 20px;
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.header-time .date { font-size: 13px; color: var(--primary-blue); }

.corner-decoration {
    position: absolute;
    width: 12px;
    height: 12px;
    border: 2px solid var(--primary-blue);
}

.corner-decoration.top-left { top: 8px; left: 8px; border-right: none; border-bottom: none; }
.corner-decoration.top-right { top: 8px; right: 8px; border-left: none; border-bottom: none; }

/* ============================================
   主容器布局
   ============================================ */
.main-container {
    display: flex;
    height: calc(100vh - 60px);
    padding: 8px;
    gap: 8px;
    overflow: hidden;
}

.left-panel, .right-panel {
    width: 23%;
    min-width: 260px;
    max-width: 340px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow: hidden;
}

.center-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    overflow: hidden;
}

/* ============================================
   数据卡片样式
   ============================================ */
.data-card {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 10px;
    position: relative;
    overflow: hidden;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.data-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary-blue), transparent);
}

.card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}

.card-title::before {
    content: '';
    width: 3px;
    height: 12px;
    background: var(--primary-blue);
    border-radius: 2px;
}

.card-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--border-color), transparent);
    margin-left: 5px;
}

.number-display {
    display: flex;
    align-items: baseline;
    gap: 5px;
    margin-bottom: 4px;
    flex-shrink: 0;
}

.number-value {
    font-family: var(--font-number);
    font-size: 22px;
    font-weight: bold;
    color: var(--primary-blue);
    text-shadow: 0 0 6px rgba(24, 144, 255, 0.4);
    white-space: nowrap;
}

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

.sub-data {
    display: flex;
    gap: 12px;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
    flex-shrink: 0;
}

.sub-data-item {
    display: flex;
    align-items: center;
    gap: 3px;
}

.sub-data-item .label { color: var(--text-secondary); }
.sub-data-item .value {
    color: var(--success-green);
    font-family: var(--font-number);
    font-weight: 600;
}

/* ============================================
   图表容器
   ============================================ */
.chart-container {
    flex: 1;
    width: 100%;
    min-height: 60px;
    position: relative;
    overflow: hidden;
}

.chart-container.small { min-height: 50px; }

/* ============================================
   采购方式统计
   ============================================ */
.method-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 5px 0;
}

.method-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    background: rgba(24, 144, 255, 0.08);
    border-radius: 4px;
    border-left: 3px solid var(--primary-blue);
}

.method-item:nth-child(2) { border-left-color: var(--success-green); background: rgba(82, 196, 26, 0.08); }
.method-item:nth-child(3) { border-left-color: var(--warning-orange); background: rgba(250, 140, 22, 0.08); }

.method-name {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.method-count, .method-amount {
    font-size: 11px;
    color: var(--text-muted);
}

.method-count span, .method-amount span {
    font-family: var(--font-number);
    color: var(--text-primary);
    font-weight: 600;
}

/* ============================================
   地图容器
   ============================================ */
.map-container {
    flex: 1;
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.map-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary-blue), transparent);
    z-index: 5;
}

.map-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    overflow: hidden;
}

.map-image {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.map-hotspots {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    bottom: 10px;
    pointer-events: none;
}

.hotspot {
    position: absolute;
    cursor: pointer;
    pointer-events: auto;
    border-radius: 4px;
    transition: all 0.3s ease;
    background: transparent;
}

.hotspot:hover {
    background: rgba(24, 144, 255, 0.25);
    box-shadow: 0 0 15px rgba(24, 144, 255, 0.5);
}

.hotspot.active {
    background: rgba(255, 215, 0, 0.3);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
}

.hotspot.autoplay-active {
    background: rgba(24, 144, 255, 0.3);
    box-shadow: 0 0 25px rgba(24, 144, 255, 0.7);
    animation: autoplayPulse 1s ease-in-out;
}

@keyframes autoplayPulse {
    0% { background: rgba(24, 144, 255, 0.1); box-shadow: 0 0 5px rgba(24, 144, 255, 0.3); }
    50% { background: rgba(24, 144, 255, 0.35); box-shadow: 0 0 30px rgba(24, 144, 255, 0.8); }
    100% { background: rgba(24, 144, 255, 0.3); box-shadow: 0 0 25px rgba(24, 144, 255, 0.7); }
}

.map-info-panel {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(0, 21, 41, 0.95);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 10px;
    min-width: 160px;
    z-index: 10;
    backdrop-filter: blur(4px);
}

.map-info-panel .district-name {
    font-size: 14px;
    font-weight: bold;
    color: var(--primary-blue);
    margin-bottom: 6px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 5px;
}

.map-info-panel .info-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
    font-size: 11px;
}

.map-info-panel .info-item .label { color: var(--text-muted); }
.map-info-panel .info-item .value {
    color: var(--text-primary);
    font-family: var(--font-number);
}

/* ============================================
   底部统计条
   ============================================ */
.bottom-stats {
    height: 55px;
    min-height: 55px;
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 0 10px;
    flex-shrink: 0;
}

.stat-item {
    text-align: center;
    padding: 0 10px;
    border-right: 1px solid var(--border-color);
    flex: 1;
}

.stat-item:last-child { border-right: none; }

.stat-item .label {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 3px;
    white-space: nowrap;
}

.stat-item .value {
    font-family: var(--font-number);
    font-size: 18px;
    font-weight: bold;
    color: var(--primary-blue);
    white-space: nowrap;
}

/* ============================================
   仪表盘样式
   ============================================ */
.gauge-container {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    position: relative;
    min-height: 80px;
}

#smeGauge { width: 100%; height: 100%; }

.gauge-info {
    position: absolute;
    bottom: 10%;
    text-align: center;
}

.gauge-info .percentage {
    font-family: var(--font-number);
    font-size: 24px;
    font-weight: bold;
    color: var(--primary-blue);
}

.gauge-info .label {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ============================================
   动画效果
   ============================================ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.data-card { animation: fadeIn 0.4s ease forwards; }
.data-card:nth-child(1) { animation-delay: 0.05s; }
.data-card:nth-child(2) { animation-delay: 0.1s; }
.data-card:nth-child(3) { animation-delay: 0.15s; }
.data-card:nth-child(4) { animation-delay: 0.2s; }

.scan-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary-blue), transparent);
    animation: scan 5s linear infinite;
    pointer-events: none;
    z-index: 5;
}

@keyframes scan {
    0% { top: 0; opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { top: 100%; opacity: 0; }
}

/* ============================================
   加载动画
   ============================================ */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--primary-darker);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.4s ease;
}

.loading-overlay.hidden { opacity: 0; pointer-events: none; }

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-text {
    margin-top: 12px;
    font-size: 12px;
    color: var(--text-secondary);
}

/* ============================================
   响应式设计
   ============================================ */
@media screen and (min-width: 1920px) {
    .header { height: 70px; min-height: 70px; }
    .header-title { font-size: 26px; }
    .left-panel, .right-panel { min-width: 300px; max-width: 380px; }
    .number-value { font-size: 26px; }
    .card-title { font-size: 14px; }
    .stat-item .value { font-size: 20px; }
}

@media screen and (max-width: 1600px) {
    .header-title { font-size: 20px; }
    .left-panel, .right-panel { min-width: 240px; width: 24%; }
    .number-value { font-size: 20px; }
    .stat-item .value { font-size: 16px; }
}

@media screen and (max-width: 1366px) {
    .header { height: 50px; min-height: 50px; }
    .header-title { font-size: 18px; }
    .main-container { padding: 6px; gap: 6px; }
    .left-panel, .right-panel { min-width: 200px; width: 25%; }
    .data-card { padding: 8px; }
    .card-title { font-size: 12px; margin-bottom: 4px; }
    .number-value { font-size: 18px; }
    .sub-data { font-size: 10px; gap: 8px; }
    .chart-container { min-height: 50px; }
    .chart-container.small { min-height: 40px; }
    .bottom-stats { height: 50px; min-height: 50px; }
    .stat-item .value { font-size: 14px; }
    .stat-item .label { font-size: 10px; }
    .map-info-panel { padding: 8px; min-width: 140px; }
    .map-info-panel .district-name { font-size: 12px; }
    .map-info-panel .info-item { font-size: 10px; }
    .gauge-info .percentage { font-size: 20px; }
    .method-item { padding: 6px 8px; }
    .method-name { font-size: 11px; }
    .method-count, .method-amount { font-size: 10px; }
}

@media screen and (max-width: 1024px) {
    .main-container { flex-direction: column; overflow-y: auto; }
    .left-panel, .right-panel {
        width: 100%;
        max-width: none;
        min-width: auto;
        flex-direction: row;
        flex-wrap: wrap;
    }
    .data-card { flex: 1; min-width: 280px; }
    .center-panel { min-height: 400px; order: -1; }
    .bottom-stats { flex-wrap: wrap; height: auto; padding: 8px; }
    .stat-item { flex: 1 1 45%; border-right: none; border-bottom: 1px solid var(--border-color); padding: 6px; }
    .stat-item:nth-child(3) { border-bottom: none; }
}

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: var(--primary-darker); }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary-blue); }

.text-primary { color: var(--primary-blue) !important; }
.text-success { color: var(--success-green) !important; }
.text-warning { color: var(--warning-orange) !important; }
.text-danger { color: var(--danger-red) !important; }
.text-cyan { color: var(--info-cyan) !important; }
.text-purple { color: var(--purple) !important; }
.hidden { display: none !important; }

/* ============================================
   电子卖场实时订单轮播
   ============================================ */
.order-scroll-wrapper {
    flex: 1;
    overflow: hidden;
    position: relative;
    min-height: 80px;
}

.order-scroll-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: transform 0.6s ease;
}

.order-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: rgba(24, 144, 255, 0.06);
    border-radius: 4px;
    border-left: 3px solid var(--primary-blue);
    flex-shrink: 0;
    min-height: 36px;
}

.order-item:nth-child(2n) {
    border-left-color: var(--success-green);
    background: rgba(82, 196, 26, 0.06);
}

.order-item:nth-child(3n) {
    border-left-color: var(--warning-orange);
    background: rgba(250, 140, 22, 0.06);
}

.order-name {
    flex: 1;
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 10px;
}

.order-budget {
    font-family: var(--font-number);
    font-size: 13px;
    font-weight: 600;
    color: var(--warning-orange);
    white-space: nowrap;
}

.order-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    padding: 30px 0;
}
