/* 全局股票数据网站样式文件 - 合并版本 */

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

body {
    font-family: 'Inter', 'SF Pro Display', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    min-height: 100vh;
    color: #1e293b;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* ===========================================
   头部导航样式 (所有页面通用)
   =========================================== */
.header {
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    padding: 20px 0;
    margin-bottom: 30px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 28px;
    font-weight: 700;
    color: #1e40af;
    letter-spacing: -0.5px;
    text-decoration: none;
}

.nav {
    display: flex;
    gap: 8px;
}

.nav-item {
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 14px;
    color: #64748b;
    text-decoration: none;
}

.nav-item:hover {
    background: #f1f5f9;
    color: #1e40af;
}

.nav-item.active {
    background: #1e40af;
    color: white;
}

.header-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

.search-bar {
    position: relative;
}

.search-input {
    padding: 10px 20px 10px 40px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    width: 250px;
    background: #ffffff;
    font-size: 14px;
    color: #374151;
}

.search-input:focus {
    outline: none;
    border-color: #1e40af;
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
}

.user-menu {
    padding: 10px 20px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #374151;
    font-weight: 500;
    text-decoration: none;
}

.user-menu:hover {
    background: #1e40af;
    color: white;
    border-color: #1e40af;
}

/* ===========================================
   主内容区域布局
   =========================================== */
.main-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 24px;
}

/* ===========================================
   股票详情页样式
   =========================================== */
.stock-header {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.stock-basic-info {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.stock-name-code {
    display: flex;
    align-items: center;
    gap: 12px;
}

.stock-name {
    font-size: 24px;
    font-weight: 700;
    color: #1e293b;
}

.stock-code {
    font-size: 16px;
    font-family: 'JetBrains Mono', monospace;
    color: #64748b;
    background: #f1f5f9;
    padding: 4px 8px;
    border-radius: 6px;
}

.price-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.current-price {
    font-size: 20px;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    color: #1e293b;
}

.price-change {
    display: flex;
    align-items: center;
    gap: 8px;
}

.change-amount {
    font-size: 16px;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
}

.change-percent {
    font-size: 16px;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
}

.positive { 
    color: #059669;
}

.negative { 
    color: #dc2626;
}

.last-update {
    font-size: 14px;
    color: #64748b;
    margin-left: auto;
}

/* 数据和图表区域 */
.data-chart-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

.historical-overview {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* 历史数据详情区域 */
.historical-data-section {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.data-tabs {
    display: flex;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.tab-item {
    flex: 1;
    padding: 16px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    color: #64748b;
    border-right: 1px solid #e2e8f0;
    font-size: 14px;
    text-decoration: none;
}

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

.tab-item:hover {
    background: #f1f5f9;
    color: #1e40af;
}

.tab-item.active {
    background: #1e40af;
    color: white;
}

.tab-content {
    padding: 24px;
}

/* 日期选择器 */
.date-selector {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.date-select {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #ffffff;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
}

.refresh-btn {
    padding: 8px 16px;
    background: #1e40af;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.refresh-btn:hover {
    background: #1e3a8a;
}

.purchase-btn {
    margin-left: 15px;
    padding: 8px 16px;
    background: #dc2626;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}

.purchase-btn:hover {
    background: #b91c1c;
}

/* K线数据表格 */
.kline-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.kline-table th {
    background: #f8fafc;
    color: #374151;
    font-weight: 600;
    padding: 12px 8px;
    text-align: center;
    border-bottom: 1px solid #e2e8f0;
}

.kline-table td {
    padding: 10px 8px;
    border-bottom: 1px solid #f1f5f9;
    text-align: center;
    color: #374151;
    font-family: 'JetBrains Mono', monospace;
}

.kline-table tr:hover {
    background: #f8fafc;
}

/* 图表区域 */
.chart-container {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    height: 308px;
}

.chart-placeholder {
    width: 100%;
    height: 226px;
    background: #f8fafc;
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    font-size: 14px;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

/* 数据网格和统计 */
.data-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.data-item {
    padding: 12px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #f1f5f9;
}

.data-label {
    font-size: 12px;
    color: #1e293b;
    margin-bottom: 8px;
    font-weight: 600;
    text-align: center;
    padding-bottom: 6px;
    border-bottom: 1px solid #e2e8f0;
}

.data-stats-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.stat-box {
    flex: 1;
    text-align: center;
    padding: 6px;
    border-radius: 4px;
    background: #ffffff;
}

.stat-title {
    font-size: 10px;
    color: #64748b;
    margin-bottom: 3px;
    font-weight: 500;
}

.stat-value {
    font-size: 13px;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    color: #1e293b;
    margin-bottom: 2px;
}

.stat-date {
    font-size: 9px;
    color: #9ca3af;
}

.stat-divider {
    width: 1px;
    height: 30px;
    background: linear-gradient(to bottom, transparent, #d1d5db 20%, #d1d5db 80%, transparent);
    flex-shrink: 0;
}

/* 特殊样式 */
.high-stat .stat-value {
    color: #059669;
}

.low-stat .stat-value {
    color: #dc2626;
}

.gain-stat .stat-value {
    color: #059669;
}

.loss-stat .stat-value {
    color: #dc2626;
}

.gain-stat {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
}

.loss-stat {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
}

.high-stat {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
}

.low-stat {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
}

/* API 调用示例 */
.api-examples {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.api-title {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 12px;
}

.api-code {
    background: #1e293b;
    color: #e2e8f0;
    padding: 16px;
    border-radius: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    margin-bottom: 12px;
    overflow-x: auto;
}

.api-description {
    font-size: 14px;
    color: #64748b;
    line-height: 1.5;
}

/* 相关研究 */
.research-list {
    list-style: none;
}

.research-item {
    padding: 16px 0;
    border-bottom: 1px solid #f1f5f9;
}

.research-item:last-child {
    border-bottom: none;
}

.research-link {
    color: #1e40af;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    line-height: 1.5;
}

.research-link:hover {
    text-decoration: underline;
}

.research-date {
    font-size: 12px;
    color: #64748b;
    margin-top: 4px;
}

/* 右侧边栏 */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.sidebar-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.sidebar-title {
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.related-stocks {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stock-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #f8fafc;
    border-radius: 6px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
}

.stock-item:hover {
    background: #f1f5f9;
    border-color: #1e40af;
}

.stock-item-name {
    font-size: 14px;
    font-weight: 500;
    color: #1e293b;
}

.stock-item-code {
    font-size: 12px;
    color: #64748b;
    font-family: 'JetBrains Mono', monospace;
}

.stock-item-change {
    font-size: 12px;
    font-weight: 500;
    font-family: 'JetBrains Mono', monospace;
}

/* 资讯列表 */
.news-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.news-item {
    padding-bottom: 12px;
    border-bottom: 1px solid #f1f5f9;
}

.news-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.news-title {
    font-size: 14px;
    color: #1e40af;
    text-decoration: none;
    line-height: 1.4;
    font-weight: 500;
}

.news-title:hover {
    text-decoration: underline;
}

.news-date {
    font-size: 12px;
    color: #64748b;
    margin-top: 4px;
}

/* 数据统计 */
.data-value {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 4px;
}

.data-value.positive {
    color: #059669;
}

.data-value.negative {
    color: #dc2626;
}

.data-date {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: #64748b;
}

/* ===========================================
   响应式设计
   =========================================== */
@media (max-width: 1400px) {
    .nav { display: none; }
}

@media (max-width: 1200px) {
    .main-layout {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        /* 主内容在上面，侧边栏在下面 */
        flex-direction: row;
        gap: 16px;
    }
    
    .sidebar-card {
        flex: 1;
    }
}

@media (max-width: 968px) {
    .data-chart-section {
        grid-template-columns: 1fr;
    }
    
    .stock-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .last-update {
        margin-left: 0;
    }
    
    .data-tabs {
        flex-wrap: wrap;
    }
    
    .tab-item {
        flex: auto;
        min-width: 120px;
    }
}

@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        gap: 16px;
    }
    
    .search-input {
        width: 100%;
    }
    
    .stock-basic-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .price-info {
        flex-wrap: wrap;
    }
    
    .data-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .data-item {
        padding: 16px;
    }
    
    .data-stats-row {
        gap: 16px;
    }
    
    .chart-container {
        height: auto;
    }
    
    .chart-placeholder {
        height: 240px;
    }
    
    .sidebar {
        flex-direction: column;
    }
}

/* Footer样式 */
.footer {
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    padding: 40px 0 20px;
    margin-top: 60px;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.footer-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 32px;
    margin-bottom: 32px;
    padding-bottom: 32px;
    border-bottom: 1px solid #f1f5f9;
}

.footer-column h3 {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 16px;
}

.footer-column ul {
    list-style: none;
}

.footer-column ul li {
    margin-bottom: 8px;
}

.footer-column ul li a {
    font-size: 14px;
    color: #64748b;
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-column ul li a:hover {
    color: #1e40af;
}

.footer-bottom {
    text-align: center;
    color: #64748b;
    font-size: 14px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.footer-bottom a {
    color: #64748b;
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-bottom a:hover {
    color: #1e40af;
}