/* 主样式文件 */

/* 全局样式 */
:root {
    --primary-color: #007bff;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-bg: #f8f9fa;
    --border-color: #dee2e6;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--light-bg);
    padding-top: 70px; /* 为固定导航栏留出空间 */
}

/* 导航栏 */
.navbar {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* 股票卡片 */
.stock-card {
    transition: all 0.3s ease;
    border: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.stock-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.stock-card.stock-up {
    border-left: 4px solid var(--danger-color);
}

.stock-card.stock-down {
    border-left: 4px solid var(--success-color);
}

.stock-card .card-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
}

/* 价格显示 */
.price-display {
    font-size: 2.5rem;
    font-weight: bold;
}

.price-display-large {
    text-align: center;
    padding: 20px;
}

.price-display.stock-up,
.change-percent.stock-up,
.stock-up {
    color: var(--danger-color) !important;
}

.price-display.stock-down,
.change-percent.stock-down,
.stock-down {
    color: var(--success-color) !important;
}

/* 信息项 */
.info-item {
    padding: 10px;
    background-color: rgba(0,0,0,0.02);
    border-radius: 5px;
}

/* 徽章 */
.badge {
    font-weight: normal;
    padding: 6px 12px;
}

/* 页脚 */
footer {
    background-color: #343a40;
    color: white;
    padding: 20px 0;
    margin-top: 40px;
}

footer a {
    color: #adb5bd;
    text-decoration: none;
}

footer a:hover {
    color: white;
}

/* 响应式 */
@media (max-width: 768px) {
    .price-display {
        font-size: 2rem;
    }
    
    .stock-card {
        margin-bottom: 15px;
    }
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0,0,0,.1);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

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

/* 表格样式 */
.table-hover tbody tr:hover {
    background-color: rgba(0,123,255,0.05);
}

/* 图表容器 */
#klineChart {
    background-color: white;
    border-radius: 5px;
}

/* ========================
   排行榜专用样式
   ======================== */
.rank-table {
    font-size: 0.95rem;
}
.rank-table th {
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6c757d;
    position: sticky;
    top: 0;
    z-index: 10;
    white-space: nowrap;
}
.rank-table td {
    vertical-align: middle;
}
.rank-table tbody tr {
    transition: background 0.2s;
    cursor: pointer;
}
.rank-table tbody tr:hover {
    background: rgba(0,123,255,0.05);
}

.price-change-up { color: #dc3545; font-weight: 600; }
.price-change-down { color: #28a745; font-weight: 600; }
.price-change-flat { color: #6c757d; }

/* ========================
   股票对比页面样式
   ======================== */
.compare-table {
    font-size: 0.95rem;
}
.compare-table th {
    background: #f8f9fa;
    font-size: 0.85rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 100px;
    vertical-align: middle;
    white-space: nowrap;
}
.compare-table td {
    vertical-align: middle;
    text-align: center;
    min-width: 110px;
    transition: background 0.2s;
}
.compare-table .best-value {
    background: rgba(220, 53, 69, 0.08);
}
.compare-table .worst-value {
    background: rgba(40, 167, 69, 0.08);
}

/* ========================
   统计卡片
   ======================== */
.stat-card {
    background: white;
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}
.stat-card .stat-value {
    font-size: 1.6rem;
    font-weight: 700;
}
.stat-card .stat-label {
    font-size: 0.8rem;
    color: #6c757d;
    margin-top: 4px;
}

/* ========================
   筛选区域
   ======================== */
.filter-section {
    background: white;
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.filter-section .form-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: #495057;
}

/* ========================
   表格容器
   ======================== */
.table-container {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}
.table-container .table {
    margin-bottom: 0;
}

.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: white;
    border-top: 1px solid #dee2e6;
    flex-wrap: wrap;
    gap: 10px;
}

/* ========================
   对比输入框
   ======================== */
.stock-input {
    border: 2px dashed #dee2e6;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    position: relative;
    transition: all 0.3s;
    background: white;
}
.stock-input:hover {
    border-color: #667eea;
    background: #f8f9ff;
}
.stock-input input {
    border: none;
    border-bottom: 2px solid #dee2e6;
    border-radius: 0;
    padding: 8px 4px;
    text-align: center;
    font-size: 1.1rem;
    width: 120px;
    outline: none;
    transition: border-color 0.3s;
    background: transparent;
}
.stock-input input:focus {
    border-bottom-color: #667eea;
}
.stock-input input::placeholder {
    color: #ced4da;
}

/* ========================
   对比摘要徽章
   ======================== */
.summary-badge {
    padding: 12px;
    border-radius: 10px;
    background: #f8f9fa;
    text-align: center;
    height: 100%;
    transition: transform 0.3s;
}
.summary-badge:hover {
    transform: translateY(-2px);
}
.summary-badge .best-label {
    font-size: 0.8rem;
    color: #6c757d;
    margin-bottom: 6px;
}
.summary-badge .best-name {
    font-weight: 600;
    font-size: 1.1rem;
}

/* ========================
   雷达图容器
   ======================== */
.radar-chart-container {
    width: 100%;
    height: 350px;
}

/* ========================
   排行榜导航
   ======================== */
.rank-nav .btn-group .btn {
    padding: 10px 20px;
    font-weight: 500;
    border-radius: 12px !important;
    margin: 0 4px;
    transition: all 0.3s ease;
}
.rank-nav .btn-group .btn.active {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* ========================
   排名徽章
   ======================== */
.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: bold;
    color: white;
}
.rank-badge.top1 {
    background: linear-gradient(135deg, #FFD700, #FFA500);
}
.rank-badge.top2 {
    background: linear-gradient(135deg, #C0C0C0, #A8A8A8);
}
.rank-badge.top3 {
    background: linear-gradient(135deg, #CD7F32, #B87333);
}
.rank-badge.normal {
    background: #e9ecef;
    color: #495057;
}

/* ========================
   进度条
   ======================== */
.progress-bar-thin {
    height: 4px;
    border-radius: 2px;
}

@media (max-width: 768px) {
    .rank-table {
        font-size: 0.85rem;
    }
    .stat-card .stat-value {
        font-size: 1.2rem;
    }
    .compare-table td {
        min-width: 80px;
        font-size: 0.85rem;
    }
    .compare-table th {
        min-width: 60px;
        font-size: 0.75rem;
    }
    .stock-input input {
        width: 90px;
        font-size: 0.95rem;
    }
    .radar-chart-container {
        height: 280px;
    }
}
