/* 综合分析页面样式 */

/* 主容器 */
.analysis-container {
    max-width: 100%;
    margin: 0 auto;
    animation: fadeIn 0.6s ease-out;
}

/* 主内容区 */
.main-content {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}

/* 左侧自选股导航 */
.watchlist-sidebar {
    width: 250px;
    min-width: 250px;
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 200px);
}

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

.sidebar-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.sidebar-icon {
    font-size: 20px;
    filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.5));
}

.watchlist-count {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

/* 自选股列表 */
.watchlist-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

/* 自定义滚动条 */
.watchlist-list::-webkit-scrollbar {
    width: 6px;
}

.watchlist-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.watchlist-list::-webkit-scrollbar-thumb {
    background: rgba(74, 158, 255, 0.3);
    border-radius: 3px;
}

.watchlist-list::-webkit-scrollbar-thumb:hover {
    background: rgba(74, 158, 255, 0.5);
}

/* 自选股项目 */
.watchlist-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.watchlist-item:hover {
    background: rgba(74, 158, 255, 0.1);
    border-color: rgba(74, 158, 255, 0.3);
    transform: translateX(4px);
}

.watchlist-item.active {
    background: linear-gradient(135deg, rgba(74, 158, 255, 0.2), rgba(157, 78, 221, 0.2));
    border-color: var(--accent-blue);
    box-shadow: 0 0 12px rgba(74, 158, 255, 0.3);
}

.watchlist-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 60%;
    background: linear-gradient(180deg, var(--accent-blue), var(--accent-purple));
    border-radius: 0 2px 2px 0;
}

.stock-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.stock-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.stock-code {
    font-size: 11px;
    color: var(--text-secondary);
    opacity: 0.7;
}

.stock-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
}

.stock-price {
    font-weight: 600;
    color: var(--text-primary);
}

.stock-change {
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.stock-change.up {
    color: var(--accent-red);
    background: rgba(255, 82, 82, 0.1);
}

.stock-change.down {
    color: var(--accent-green);
    background: rgba(76, 175, 80, 0.1);
}

/* 空状态 */
.empty-state {
    padding: 40px 20px;
    text-align: center;
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-text {
    color: var(--text-secondary);
    margin-bottom: 16px;
    font-size: 14px;
}

.empty-link {
    color: var(--accent-blue);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s ease;
}

.empty-link:hover {
    color: var(--accent-purple);
    text-decoration: underline;
}

/* 右侧图表区域 */
.charts-area {
    flex: 1;
    min-width: 0;
}

/* 图表网格 */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

/* 图表面板 */
.chart-panel {
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chart-panel-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
}

.chart-panel-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.chart-icon {
    font-size: 18px;
}

.chart-info {
    display: flex;
    gap: 12px;
    align-items: center;
    font-size: 12px;
}

.current-stock-name {
    color: var(--text-primary);
    font-weight: 600;
}

.current-stock-code {
    color: var(--text-secondary);
    opacity: 0.7;
}

/* 图表容器 */
.chart-container {
    flex: 1;
    position: relative;
    min-height: 350px;
    padding: 12px;
}

.chart {
    width: 100%;
    height: 100%;
    min-height: 350px;
}

/* 图表加载动画 */
.chart-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 14, 39, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 12px;
    z-index: 10;
    border-radius: 0 0 16px 16px;
}

.chart-loading.hidden {
    display: none;
}

/* 刷新按钮动画 */
#refreshAllBtn.refreshing {
    animation: rotate 1s linear infinite;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* 响应式设计 */
@media (max-width: 1400px) {
    .chart-container {
        min-height: 300px;
    }

    .chart {
        min-height: 300px;
    }
}

@media (max-width: 1024px) {
    .watchlist-sidebar {
        width: 200px;
        min-width: 200px;
    }

    .charts-grid {
        gap: 16px;
    }

    .chart-container {
        min-height: 280px;
    }

    .chart {
        min-height: 280px;
    }
}

@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }

    .watchlist-sidebar {
        width: 100%;
        max-width: 100%;
        max-height: 300px;
    }

    .charts-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .chart-container {
        min-height: 400px;
    }

    .chart {
        min-height: 400px;
    }

    .header {
        flex-direction: column;
        gap: 12px;
    }

    .header-right {
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 480px) {
    .chart-panel-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .chart-info {
        width: 100%;
        justify-content: space-between;
    }

    .watchlist-sidebar {
        max-height: 250px;
    }
}

/* 搜索框样式 - 顶部导航栏 */
.header-center {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 20px;
}

.search-container {
    padding: 0;
    position: relative;
    width: 100%;
    max-width: 400px;
    /* 限制最大宽度 */
}

.search-box {
    display: flex;
    gap: 12px;
    background: rgba(255, 255, 255, 0.15);
    /* 稍微亮一点的背景 */
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    /* 更大的圆角 */
    padding: 10px 24px;
    /* 增加内边距，使其变高 */
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    /* 添加阴影增加立体感 */
    min-width: 320px;
    /* 保证最小宽度 */
}

.search-box:focus-within {
    border-color: var(--accent-blue);
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.4);
    /* 更强的发光效果 */
    transform: translateY(-1px);
    /* 微微上浮 */
}

.search-box input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 16px;
    /* 更大的字体 */
    outline: none;
    width: 100%;
    font-weight: 500;
}

.search-box button {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    font-size: 18px;
    /* 更大的图标 */
}

.search-box button:hover {
    color: var(--accent-blue);
    transform: scale(1.2);
}

.search-results {
    position: absolute;
    top: 120%;
    /* 稍微拉开一点距离 */
    left: 0;
    right: 0;
    background: #1a2140;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
    margin-top: 0;
}

.search-result-item {
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: background 0.2s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

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

.search-result-item:hover {
    background: rgba(74, 158, 255, 0.15);
}

.search-result-name {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

.search-result-code {
    font-size: 12px;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
}