/* 收藏页面专属样式 */

/* ===== 配色方案（红黄绿信标） ===== */
:root {
    --fav-primary: #667eea;
    --fav-primary-light: rgba(102, 126, 234, 0.1);
    --signal-red: #dc3545;      /* 红色 - 卖出信号/警告 */
    --signal-yellow: #ffc107;   /* 黄色 - 中性/观望 */
    --signal-green: #28a745;    /* 绿色 - 买入信号/正常 */
    --holding-color: #1565c0;
    --sold-color: #6c757d;
}

/* 页面功能标题（与评分/推荐各页一致：1.25rem） */
.page-type-banner h4 {
    font-size: 1.25rem;
}

/* ===== 信标提醒样式 ===== */
.signal-indicators {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

/* ===== 信标+统计合并行（新设计） ===== */
.signal-stats-bar {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.signal-stat-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: #f8f9fa;
    border-radius: 10px;
    transition: all 0.2s ease;
    height: 100%;
}

.signal-stat-card.has-buy {
    background: linear-gradient(135deg, rgba(40,167,69,0.08), rgba(40,167,69,0.02));
}

.signal-stat-card.has-sell {
    background: linear-gradient(135deg, rgba(220,53,69,0.08), rgba(220,53,69,0.02));
}

.signal-stat-card.has-buy:hover,
.signal-stat-card.has-sell:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.signal-stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    color: #fff;
    flex-shrink: 0;
}

.signal-stat-icon.buy-icon {
    background: var(--signal-green);
}

.signal-stat-icon.sell-icon {
    background: var(--signal-red);
}

.signal-stat-icon.count-icon {
    background: #f0ad4e;
}

.signal-stat-icon.hold-icon {
    background: #1565c0;
}

.signal-stat-icon.sold-icon {
    background: #6c757d;
}

.signal-stat-info {
    flex: 1;
    min-width: 0;
}

.signal-stat-label {
    font-size: 0.7rem;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.signal-stat-count {
    font-size: 1.1rem;
    font-weight: 700;
    white-space: nowrap;
}

.signal-stat-count.buy {
    color: var(--signal-green);
}

.signal-stat-count.sell {
    color: var(--signal-red);
}

.signal-stat-count.neutral {
    color: #999;
}

/* 信号展开详情栏 */
.signal-detail-bar {
    margin-top: 12px;
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 3px solid var(--fav-primary);
}

.signal-detail-bar .signal-detail-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 0.85rem;
    flex-wrap: wrap;
}

.signal-detail-bar .signal-detail-item + .signal-detail-item {
    border-top: 1px dashed #e0e0e0;
    padding-top: 6px;
    margin-top: 2px;
}

/* ===== 原信标卡片（兼容保留） ===== */

.signal-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    flex: 1;
    min-width: 200px;
}

.signal-card .signal-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #fff;
}

.signal-card .signal-icon.buy-signal {
    background: linear-gradient(135deg, var(--signal-green), #1e7e34);
    animation: pulse-buy 2s ease-in-out infinite;
}

.signal-card .signal-icon.sell-signal {
    background: linear-gradient(135deg, var(--signal-red), #c82333);
    animation: pulse-sell 2s ease-in-out infinite;
}

.signal-card .signal-icon.warning-signal {
    background: linear-gradient(135deg, var(--signal-yellow), #d39e00);
    animation: pulse-warning 2s ease-in-out infinite;
}

.signal-card .signal-icon.no-signal {
    background: #e0e0e0;
    animation: none;
}

@keyframes pulse-buy {
    0%, 100% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.4); }
    50% { box-shadow: 0 0 0 10px rgba(40, 167, 69, 0); }
}

@keyframes pulse-sell {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.4); }
    50% { box-shadow: 0 0 0 10px rgba(220, 53, 69, 0); }
}

@keyframes pulse-warning {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.4); }
    50% { box-shadow: 0 0 0 10px rgba(255, 193, 7, 0); }
}

.signal-card .signal-info {
    flex: 1;
}

.signal-card .signal-title {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 4px;
}

.signal-card .signal-count {
    font-size: 1.3rem;
    font-weight: 700;
}

.signal-card .signal-count.buy {
    color: var(--signal-green);
}

.signal-card .signal-count.sell {
    color: var(--signal-red);
}

.signal-card .signal-count.warning {
    color: var(--signal-yellow);
}

.signal-card .signal-count.neutral {
    color: #999;
}

.signal-card .signal-link {
    padding: 6px 12px;
    background: #f0f0f0;
    border-radius: 15px;
    color: #666;
    text-decoration: none;
    font-size: 0.75rem;
    transition: all 0.2s ease;
}

.signal-card .signal-link:hover {
    background: var(--fav-primary);
    color: #fff;
}

/* ===== 收益历史区域 ===== */
.profit-history-section {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.profit-history-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.profit-history-section .section-title {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.profit-history-section .section-title i {
    color: var(--fav-primary);
}

/* 收益统计摘要 */
.profit-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.profit-summary-item {
    text-align: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
}

.profit-summary-item .label {
    font-size: 0.75rem;
    color: #666;
    margin-bottom: 5px;
}

.profit-summary-item .value {
    font-size: 1.2rem;
    font-weight: 700;
}

.profit-summary-item .value.positive {
    color: var(--buy-signal);
}

.profit-summary-item .value.negative {
    color: var(--sell-signal);
}

.profit-summary-item .value.neutral {
    color: #333;
}

/* 历史交易列表 */
.history-table-wrapper {
    overflow-x: auto;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.history-table th {
    padding: 10px 12px;
    text-align: left;
    background: #f8f9fa;
    color: #666;
    font-weight: 500;
    border-bottom: 1px solid #e0e0e0;
}

.history-table td {
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

.history-table tr:hover {
    background: #fafafa;
}

.history-table tr.clickable-row {
    cursor: pointer;
}

.history-table tr.clickable-row:hover {
    background: #f0f4ff;
}

.history-table .stock-cell {
    display: flex;
    flex-direction: column;
}

.history-table .stock-name {
    font-weight: 500;
    color: #333;
}

.history-table .stock-code {
    font-size: 0.75rem;
    color: #999;
}

.history-table .profit-cell {
    font-weight: 600;
}

.history-table .profit-cell.positive {
    color: var(--buy-signal);
}

.history-table .profit-cell.negative {
    color: var(--sell-signal);
}

.history-table .date-cell {
    color: #666;
    font-size: 0.8rem;
}

.history-table .days-cell {
    text-align: center;
    color: #666;
}

/* ===== 收藏表格增强 ===== */
.holdings-section {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.holdings-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.holdings-section .section-title {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.holdings-section .section-title i {
    color: var(--fav-primary);
}

.favorites-table-wrapper {
    overflow-x: auto;
}

.favorites-table {
    width: 100%;
    border-collapse: collapse;
}

.favorites-table th {
    padding: 14px 16px;
    text-align: left;
    background: #f8f9fa;
    color: #666;
    font-weight: 500;
    font-size: 0.85rem;
    border-bottom: 1px solid #e0e0e0;
    white-space: nowrap;
}

.favorites-table td {
    padding: 14px 16px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.9rem;
}

.favorites-table tr.clickable-row {
    cursor: pointer;
    transition: background 0.2s ease;
}

.favorites-table tr.clickable-row:hover {
    background: #f8f9ff;
}

.favorites-table tr.sold-row {
    opacity: 0.7;
    background: #fafafa;
}

/* 信标列 */
.favorites-table .signal-cell {
    width: 60px;
    text-align: center;
}

.signal-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 0.75rem;
}

/* 红色 - 卖出信号 */
.signal-badge.sell-signal {
    background: rgba(220, 53, 69, 0.15);
    color: var(--signal-red);
    animation: signal-flash 1.5s ease-in-out infinite;
}

/* 绿色 - 买入信号 */
.signal-badge.buy-signal {
    background: rgba(40, 167, 69, 0.15);
    color: var(--signal-green);
    animation: signal-flash 1.5s ease-in-out infinite;
}

/* 黄色 - 中立信号 */
.signal-badge.neutral-signal {
    background: rgba(255, 193, 7, 0.15);
    color: var(--signal-yellow);
}

.signal-badge.no-signal {
    background: #f0f0f0;
    color: #ccc;
}

@keyframes signal-flash {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.1); }
}

/* 股票信息单元格 */
.stock-info-cell {
    display: flex;
    flex-direction: column;
}

.stock-info-cell .stock-name {
    font-weight: 600;
    color: #333;
}

.stock-info-cell .stock-code {
    font-size: 0.75rem;
    color: #999;
}

/* 类型徽章 */
.type-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.type-badge.buy {
    background: rgba(220, 53, 69, 0.1);
    color: var(--buy-signal);
}

.type-badge.sell {
    background: rgba(40, 167, 69, 0.1);
    color: var(--sell-signal);
}

/* 状态标签 */
.status-tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-tag.holding {
    background: rgba(21, 101, 192, 0.1);
    color: var(--holding-color);
}

.status-tag.sold {
    background: rgba(108, 117, 125, 0.1);
    color: var(--sold-color);
}

/* 收益值 */
.profit-value {
    font-weight: 600;
}

.profit-value.positive {
    color: var(--buy-signal);
}

.profit-value.negative {
    color: var(--sell-signal);
}

/* ===== 响应式调整 ===== */
@media (max-width: 991px) {
    .profit-summary {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 767px) {
    .signal-indicators {
        flex-direction: column;
    }
    
    .signal-card {
        min-width: unset;
    }
    
    .profit-summary {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .profit-summary-item {
        padding: 12px;
    }
    
    .profit-summary-item .value {
        font-size: 1rem;
    }
    
    .favorites-table {
        font-size: 0.8rem;
    }
    
    .favorites-table th,
    .favorites-table td {
        padding: 10px 8px;
    }
}

/* ===== 个人统计面板 ===== */
.personal-stats-panel .stat-card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.personal-stats-panel .stat-card .card-header {
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
    padding: 12px 16px;
}

.personal-stats-panel .stat-card .card-header h6 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
}

.personal-stats-panel .stat-card .card-body {
    padding: 8px 16px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid #fafafa;
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-row .stat-label {
    font-size: 0.8rem;
    color: #666;
}

.stat-row .stat-value {
    font-size: 0.85rem;
    font-weight: 600;
}

.stat-row .stat-value.positive {
    color: #dc3545;
}

.stat-row .stat-value.negative {
    color: #198754;
}

/* ===== 信标详情展开 ===== */
.signal-card {
    position: relative;
}

.signal-toggle-btn {
    background: none;
    border: 1px solid #e0e0e0;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #666;
    transition: all 0.2s;
    flex-shrink: 0;
}

.signal-toggle-btn:hover {
    background: #f0f0f0;
    color: #333;
}

.signal-toggle-btn.expanded i {
    transform: rotate(180deg);
}

.signal-detail {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    padding: 12px 16px;
    margin-top: 8px;
    margin-bottom: 8px;
    max-height: 240px;
    overflow-y: auto;
}

.signal-detail-item {
    padding: 6px 0;
    border-bottom: 1px solid #f5f5f5;
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

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

.signal-detail-item .analyst-link {
    color: #667eea;
    font-weight: 500;
    text-decoration: none;
}

.signal-detail-item .analyst-link:hover {
    text-decoration: underline;
    color: #4a5ec9;
}

/* 提醒详情条中的股票链接（跳转股票详情页） */
.signal-detail-item .stock-link {
    color: #1565c0;
    font-weight: 500;
    text-decoration: none;
}

.signal-detail-item .stock-link:hover {
    text-decoration: underline;
    color: #0d47a1;
}

.signal-detail-item .badge {
    font-size: 0.7rem;
    margin-left: auto;
}

/* ===== 5级信号徽章 ===== */
.signal-level-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.signal-level-badge.strong-buy {
    background: #d4edda;
    color: #155724;
}

.signal-level-badge.buy {
    background: #e8f5e9;
    color: #2e7d32;
}

.signal-level-badge.hold {
    background: #fff3cd;
    color: #856404;
}

.signal-level-badge.sell {
    background: #ffebee;
    color: #c62828;
}

.signal-level-badge.strong-sell {
    background: #f8d7da;
    color: #721c24;
}

/* ===== 收益率走势图 ===== */
.portfolio-chart-container {
    height: 520px;
    position: relative;
}

/* 快捷时间筛选胶囊（与策略收益页/回测详情页同款） */
.chart-time-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 0;
}
.chart-time-tab {
    padding: 4px 14px;
    border-radius: 14px;
    border: 1px solid #dee2e6;
    background: #fff;
    color: #495057;
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.15s;
}
.chart-time-tab:hover, .chart-time-tab.active {
    background: #667eea;
    color: #fff;
    border-color: #667eea;
}

/* ===== 收益/时长堆叠显示 ===== */
.profit-days-cell {
    text-align: center;
    min-width: 90px;
}

.profit-days-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.profit-days-stack .profit-value {
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.2;
}

.profit-days-stack .profit-value.positive {
    color: #dc3545;
}

.profit-days-stack .profit-value.negative {
    color: #198754;
}

.profit-days-stack .days-value {
    font-size: 0.72rem;
    color: #999;
    line-height: 1.2;
}

.col-profit-days {
    min-width: 100px;
}

/* 持仓表格中的收益/时长列 */
.favorites-table .profit-days-cell {
    min-width: 100px;
}

/* 历史表格中的收益/时长列 */
.history-table .profit-days-cell {
    min-width: 100px;
}

/* ===== 空状态 ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 16px;
    color: #ddd;
}

.empty-state p {
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.empty-state small {
    display: block;
    margin-bottom: 16px;
}

/* ===== 股票名称/代码 hover 链接标识 ===== */
.stock-name-link,
.stock-code-link {
    cursor: pointer;
    transition: color 0.15s;
}

.stock-name-link:hover,
.stock-code-link:hover {
    color: var(--buy-signal, #28a745);
    text-decoration: underline;
}

.holding-table tbody tr:hover .stock-name-link,
.holding-table tbody tr:hover .stock-code-link {
    text-decoration: underline;
}

/* ===== 图表全屏 ===== */
.chart-fullscreen-btn {
    border-radius: 6px;
    padding: 4px 8px;
}

.chart-fullscreen-btn i {
    font-size: 0.85rem;
}

.portfolio-chart-container {
    position: relative;
    height: 520px;
    transition: all 0.3s ease;
}

.portfolio-chart-container.chart-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    background: #fff;
    padding: 60px 40px 40px;
    border-radius: 0;
    box-shadow: 0 0 40px rgba(0,0,0,0.15);
}

/* ECharts 容器全屏时撑满（内部 div 100% + echarts resize 自适应） */
.portfolio-chart-container.chart-fullscreen #portfolioChart {
    width: 100% !important;
    height: 100% !important;
}

.chart-fullscreen-overlay {
    display: none;
}

.chart-fullscreen-overlay.active {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9998;
    background: rgba(0, 0, 0, 0.3);
}

/* 全屏退出按钮 */
.chart-fullscreen-close {
    display: none;
    position: fixed;
    top: 20px;
    right: 30px;
    z-index: 10000;
    background: rgba(0,0,0,0.7);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

.chart-fullscreen-close.active {
    display: flex;
}

/* ===== 卖出弹窗按钮统一 ===== */
#sellModal .modal-footer .btn {
    min-width: 90px;
    font-size: 0.9rem;
    padding: 8px 16px;
}

/* ===== 列表排序链接 ===== */
.sort-link {
    color: #666;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.15s;
}

.sort-link:hover {
    color: #333;
}

.sort-link i {
    font-size: 0.7rem;
    margin-left: 3px;
    vertical-align: middle;
}
