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

/* 全局变量 */
:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --secondary-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border-color: #475569;
    --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-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --transition: all 0.2s ease;
}

/* 基础样式 */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

/* 英雄区样式 */
.hero-section {
    position: relative;
    width: 100%;
    height: 400px;
    overflow: hidden;
    margin-bottom: -1px;
}

.hero-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
}

.hero-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(15, 23, 42, 1) 0%, rgba(15, 23, 42, 0.8) 50%, rgba(15, 23, 42, 0.3) 80%, transparent 100%);
}

.hero-content {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    text-align: center;
    padding: 3rem 1rem;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
}

.hero-content h1 {
    font-size: 4rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    text-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
    overflow: visible;
    line-height: 1.2;
}

.hero-content .subtitle {
    font-size: 1.125rem;
    color: var(--text-muted);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    display: inline-block;
    line-height: 1.5;
    margin: 0.5rem 0 0 0;
    white-space: nowrap;
    overflow: visible;
    position: relative;
    z-index: 10;
    text-align: center;
}

.hero-content .subtitle .subtitle-text {
    white-space: nowrap;
    overflow: visible;
    display: inline-block;
    vertical-align: middle;
}

.hero-content .subtitle .tooltip-container {
    margin: 0 0 0 0.25rem;
    position: relative;
    display: inline-block;
    vertical-align: middle;
    white-space: nowrap;
}

.hero-content .subtitle .tooltip-icon {
    font-size: 0.875rem;
    color: var(--text-muted);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    display: inline-block;
    white-space: nowrap;
    vertical-align: middle;
    line-height: 1;
    cursor: help;
    transition: color var(--transition);
}

.hero-content .subtitle .tooltip-icon:hover {
    color: var(--text-primary);
}

.hero-content .subtitle .tooltip-text {
    position: absolute;
    top: 125%;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    line-height: 1.6;
    width: 280px;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    pointer-events: none;
    z-index: 10000;
    white-space: pre-line;
    overflow-wrap: break-word;
    max-width: calc(100vw - 2rem);
    box-sizing: border-box;
    margin-top: 0.5rem;
}

.hero-content .subtitle .tooltip-text::after {
    content: "";
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-bottom-color: var(--bg-secondary);
}

/* 响应式调整 */
@media (max-width: 768px) {
    .hero-content h1 {
        font-size: 2.5rem;
    }

    .hero-content .subtitle {
        font-size: 1rem;
    }

    .hero-content .subtitle .tooltip-icon {
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .hero-content h1 {
        font-size: 2rem;
    }

    .hero-content .subtitle {
        font-size: 0.875rem;
    }

    .hero-content .subtitle .tooltip-icon {
        font-size: 0.625rem;
    }
}

/* 容器样式调整 */
.container {
    position: relative;
    z-index: 20;
    background-color: var(--bg-primary);
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
    padding-top: 2rem;
}

/* 主内容区域 */
.main {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* 卡片网格布局 */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

/* 卡片样式 */
.card {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.card h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 1.5rem 0;
}

/* Tooltip样式 */
.tooltip-container {
    position: relative;
    display: inline-block;
    vertical-align: middle;
    margin-left: 0.25rem;
}

.tooltip-icon {
    font-size: 0.75rem;
    color: var(--text-muted);
    cursor: help;
    transition: color var(--transition);
    display: inline-block;
    vertical-align: middle;
}

.tooltip-icon:hover {
    color: var(--text-primary);
}

.tooltip-text {
    visibility: hidden;
    width: clamp(200px, 80vw, 280px);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    text-align: left;
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    position: absolute;
    z-index: 10000;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity var(--transition);
    font-size: 0.75rem;
    line-height: 1.6;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    pointer-events: none;
    white-space: pre-line;
    overflow-wrap: break-word;
    box-sizing: border-box;
    margin-bottom: 0.5rem;
    right: auto;
}

.tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: var(--bg-secondary) transparent transparent transparent;
}

/* 移动端弹窗样式 */
.mobile-tooltip-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.mobile-tooltip-content {
    background-color: var(--bg-card);
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 350px;
    font-size: 0.875rem;
    line-height: 1.5;
    z-index: 2100;
}

.mobile-tooltip-close {
    position: absolute;
    right: 0.75rem;
    top: 0.75rem;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: color var(--transition);
    background: none;
    border: none;
    padding: 0;
    line-height: 1;
}

.mobile-tooltip-close:hover {
    color: var(--text-primary);
}

/* 卡片头部样式 */
.card-header {
    margin-bottom: 1.5rem;
    width: 100%;
}

.card-header.with-toggle {
    cursor: pointer;
}

.card-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

/* 切换按钮样式 */
.toggle-btn {
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.5rem;
    margin: 0;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    background: none;
    cursor: pointer;
    transition: var(--transition);
    border-radius: var(--radius-sm);
    background-color: var(--bg-secondary);
    height: 1.75rem;
    width: 1.75rem;
    vertical-align: middle;
    flex-shrink: 0;
}

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

.toggle-btn:hover {
    background-color: var(--primary-color);
    color: var(--text-primary);
    border-color: var(--primary-color);
}

/* 表格容器样式 */
.table-container {
    overflow-x: auto;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    opacity: 1;
}

.table-container.hidden {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
}

/* 周期控制样式 */
.cycle-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: nowrap;
    white-space: nowrap;
    overflow: hidden;
}

.cycle-btn {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cycle-btn:hover:not(:disabled) {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

.cycle-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.cycle-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    min-width: 120px;
    max-width: 250px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

/* 指标行样式 */
.metric-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.metric-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.metric-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: wrap;
    line-height: 1.2;
}

.metric-value {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* 进度条样式 */
.progress-bar {
    width: 100%;
    height: 0.75rem;
    background-color: var(--bg-secondary);
    border-radius: var(--radius-md);
    overflow: visible;
    margin-top: 1rem;
    position: relative;
}

.progress-fill {
    height: 100%;
    background-color: var(--primary-color);
    border-radius: var(--radius-md);
    transition: width 0.3s ease;
}

/* 汽车标志样式 */
.car-marker {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translate(-50%, -50%) scaleX(-1);
    font-size: 1.5rem;
    z-index: 5;
    transition: left 0.3s ease;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    color: #4f46e5;
    filter: none;
    opacity: 1;
}

/* 图表容器 */
.chart-container {
    height: 400px;
    position: relative;
    margin-top: 1rem;
    margin-bottom: 1rem;
}

/* 图表控制区域 */
.chart-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.chart-controls .cycle-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    max-width: 400px;
}

/* 数据表格 */
.table-container {
    overflow-x: auto;
    margin-top: 1rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

th,
td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.75rem;
    background-color: var(--bg-secondary);
    position: sticky;
    top: 0;
}

td {
    color: var(--text-primary);
}

tr:last-child td {
    border-bottom: none;
}

tr:hover {
    background-color: rgba(79, 70, 229, 0.1);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .card-grid {
        grid-template-columns: 1fr;
    }

    .metric-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .metric-value {
        font-size: 1.5rem;
    }

    .chart-container {
        height: 300px;
    }

    .chart-controls {
        padding-top: 0.75rem;
        margin-top: 0.75rem;
    }

    .chart-controls .cycle-controls {
        max-width: 350px;
    }

    .card {
        padding: 1.25rem;
    }

    th,
    td {
        padding: 0.5rem 0.75rem;
        font-size: 0.8125rem;
    }
}

@media (max-width: 480px) {
    .card {
        padding: 1rem;
    }

    .card h2 {
        font-size: 1.125rem;
        margin-bottom: 1.25rem;
    }

    .chart-container {
        height: 250px;
    }

    .chart-controls {
        padding-top: 0.5rem;
        margin-top: 0.5rem;
    }

    .cycle-btn {
        width: 2rem;
        height: 2rem;
        font-size: 0.875rem;
    }

    .cycle-label {
        font-size: 0.75rem;
        min-width: 100px;
        max-width: 150px;
    }
}

/* 平滑滚动 */
html {
    scroll-behavior: smooth;
}

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

.card {
    animation: fadeIn 0.3s ease-out;
}

/* 进度条动画 */
@keyframes progress {
    from {
        width: 0;
    }
}

.progress-fill {
    animation: progress 1s ease-out;
}

/* 文本选择样式 */
::selection {
    background-color: var(--primary-color);
    color: white;
}

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

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: var(--radius-md);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}
