/* 股票分析结果样式 - v2.0模块化版本 */

/* 分析结果容器 */
.analysis-result {
    background: #ffffff;
    border-radius: 16px;
    padding: 0;
    margin: 20px 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.05);
    overflow: hidden;
    transition: all 0.3s ease;
    max-width: 100%;
    box-sizing: border-box;
}

.analysis-result:hover {
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.12);
}

/* 动画效果 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.analysis-result.animate-in {
    animation: fadeInUp 0.6s ease-out forwards;
}

/* 结果头部 */
.result-header {
    background: linear-gradient(135deg, #f6f9fc 0%, #ffffff 100%);
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.stock-info {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.stock-symbol {
    margin: 0;
    font-size: 2em;
    font-weight: 700;
    color: #1a1a1a;
    letter-spacing: -0.5px;
}

.analysis-date {
    font-size: 0.875em;
    color: #64748b;
    font-weight: 500;
}

.result-actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    background: #383333;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-btn:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.action-btn i {
    font-size: 0.875em;
    color: #ffffff;
}

/* 决策卡片 */
.decision-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 24px;
    color: white;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.decision-visual {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.decision-badge {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.15);
    padding: 16px 24px;
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

.decision-badge.buy {
    background: rgba(16, 185, 129, 0.15);
}

.decision-badge.sell {
    background: rgba(239, 68, 68, 0.15);
}

.decision-badge.hold {
    background: rgba(245, 158, 11, 0.15);
}

.decision-badge i {
    font-size: 1.5em;
}

.decision-badge span {
    font-size: 1.25em;
    font-weight: 600;
}

.confidence-meter {
    text-align: right;
}

.confidence-label {
    font-size: 0.875em;
    opacity: 0.9;
    margin-bottom: 8px;
}

.confidence-bar {
    width: 120px;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 4px;
}

.confidence-fill {
    height: 100%;
    background: linear-gradient(90deg, #10b981, #34d399);
    border-radius: 4px;
    transition: width 0.8s ease-out;
}

.confidence-value {
    font-size: 0.875em;
    font-weight: 600;
}

.decision-explanation {
    font-size: 0.95em;
    opacity: 0.95;
    line-height: 1.6;
}

/* 决策摘要部分 */
.decision-summary-section {
    border-bottom: 1px solid #f1f5f9;
}

.decision-summary-content {
    padding: 24px;
}

.decision-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
    padding: 20px;
    background: #f8fafc;
    border-radius: 12px;
}

.decision-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.decision-item .label {
    font-size: 0.875em;
    color: #64748b;
    font-weight: 500;
}

.decision-item .value {
    font-size: 1.1em;
    font-weight: 600;
    color: #1e293b;
}

.decision-item .value.decision-buy {
    color: #16a34a;
}

.decision-item .value.decision-sell {
    color: #dc2626;
}

.decision-item .value.decision-hold {
    color: #ca8a04;
}

.decision-reasons {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
}

.decision-reasons h5 {
    margin: 0 0 16px 0;
    color: #1e293b;
    font-size: 1em;
    font-weight: 600;
}

.decision-reasons ul {
    margin: 0;
    padding-left: 20px;
}

.decision-reasons li {
    margin-bottom: 8px;
    line-height: 1.6;
    color: #334155;
}

.no-reasons {
    color: #94a3b8;
    font-style: italic;
    text-align: center;
    padding: 20px 0;
}

/* 风险与机会部分 */
.risk-opportunity-section {
    border-bottom: 1px solid #f1f5f9;
}

.risk-opportunity-content {
    padding: 24px;
}

.risk-factors {
    margin-bottom: 24px;
}

.risk-factors h5 {
    margin: 0 0 16px 0;
    color: #dc2626;
    font-size: 1em;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.risk-list {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 12px;
    padding: 20px;
    margin: 0;
    padding-left: 40px;
}

.risk-item {
    margin-bottom: 8px;
    line-height: 1.6;
    color: #7f1d1d;
}

.risk-mitigation {
    margin-bottom: 24px;
}

.risk-mitigation h5 {
    margin: 0 0 16px 0;
    color: #059669;
    font-size: 1em;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mitigation-list {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 12px;
    padding: 20px;
    margin: 0;
    padding-left: 40px;
}

.mitigation-item {
    margin-bottom: 8px;
    line-height: 1.6;
    color: #064e3b;
}

.no-risk-data {
    color: #94a3b8;
    font-style: italic;
    text-align: center;
    padding: 20px 0;
}

/* 执行策略部分 */
.execution-section {
    border-bottom: 1px solid #f1f5f9;
}

.execution-content {
    padding: 24px;
}

.strategy-content {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    line-height: 1.6;
}

.no-strategy {
    color: #94a3b8;
    font-style: italic;
    text-align: center;
    padding: 20px 0;
}

/* 分析部分 */
.analysis-section {
    border-bottom: 1px solid #f1f5f9;
}

.analysis-section:last-child {
    border-bottom: none;
}

.section-header {
    padding: 20px 24px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s ease;
    border-bottom: 1px solid transparent;
}

.section-header:hover {
    background: #f8fafc;
}

.section-header.special {
    background: linear-gradient(135deg, #f1f5f9 0%, #f8fafc 100%);
}

.section-header.special:hover {
    background: linear-gradient(135deg, #e2e8f0 0%, #f1f5f9 100%);
}

.section-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-title h4 {
    margin: 0;
    font-size: 1.1em;
    font-weight: 600;
    color: #1e293b;
}

.section-title i {
    font-size: 1.1em;
}

.section-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.content-length {
    font-size: 0.75em;
    padding: 4px 12px;
    background: #e0e7ff;
    color: #4338ca;
    border-radius: 100px;
    font-weight: 500;
}

.toggle-icon {
    font-size: 0.875em;
    color: #64748b;
    transition: transform 0.3s ease;
}

.section-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    padding: 0 20px;
}

.section-content.expanded {
    max-height: none;
}

.content-wrapper {
    padding: 24px;
}

.content-text {
    font-size: 0.95em;
    line-height: 1.7;
    color: #334155;
    padding: 20px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    max-width: 100%;
    overflow-x: auto;
}

.content-text.markdown h3 {
    font-size: 1.2em;
    font-weight: 600;
    color: #1e293b;
    margin: 20px 0 12px;
}

.content-text.markdown h4 {
    font-size: 1.1em;
    font-weight: 600;
    color: #334155;
    margin: 16px 0 8px;
}

.content-text.markdown p {
    margin-bottom: 16px;
}

.content-text.markdown strong {
    color: #1e293b;
    font-weight: 600;
}

.no-data {
    color: #94a3b8;
    font-style: italic;
    text-align: center;
    padding: 40px 0;
}

.content-actions {
    padding: 0 24px 20px;
    display: flex;
    justify-content: flex-end;
}

.expand-btn {
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 0.875em;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.expand-btn:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* 投资内容样式（向后兼容） */
.investment-content {
    padding: 24px;
}

.investment-details {
    background: #fffbeb;
    border: 1px solid #fef3c7;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.detail-row:last-child {
    margin-bottom: 0;
}

.detail-label {
    font-weight: 600;
    color: #92400e;
}

.detail-value {
    color: #78350f;
    font-weight: 500;
}

/* 结果底部 */
.result-footer {
    padding: 20px 24px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
}

.report-iframe-container {
    background: #fff;
    position: relative;
}

.report-iframe {
    background: #fff;
}

/* 移动端全屏查看按钮 */
.mobile-fullscreen-btn {
    display: none;
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(102, 126, 234, 0.9);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 12px;
    cursor: pointer;
    z-index: 10;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.mobile-fullscreen-btn:hover {
    background: rgba(102, 126, 234, 1);
    transform: scale(1.05);
}

.mobile-fullscreen-btn i {
    margin-right: 4px;
}

/* 移动端显示全屏按钮 */
@media (max-width: 768px) {
    .mobile-fullscreen-btn {
        display: flex;
        align-items: center;
    }
    
    .report-iframe-container {
        position: relative;
    }
    
    /* 聊天消息在移动端的iframe优化 */
    .message-content .report-iframe {
        height: 400px !important;  /* 移动端降低高度 */
        border-radius: 6px;
    }
    
    /* 减少聊天消息在移动端的边距 */
    .message.bot-message {
        margin: 15px 0;
    }
    
    .message.bot-message .message-content {
        padding: 15px;
        margin-left: 10px;
    }
    
    .analysis-result {
        margin: 10px 0;
        border-radius: 12px;
    }
    
    .result-footer {
        padding: 15px;
    }
    
    /* 移动端免责声明优化 */
    .disclaimer {
        font-size: 11px;
        padding: 8px 0;
    }
    
    .disclaimer i {
        font-size: 10px;
    }
}

/* 超小屏幕进一步优化 */
@media (max-width: 480px) {
    .mobile-fullscreen-btn {
        padding: 4px 8px;
        font-size: 10px;
        top: 4px;
        right: 4px;
    }
    
    .mobile-fullscreen-btn span {
        display: none;  /* 超小屏幕只显示图标 */
    }
    
    /* 免责声明极简化 */
    .disclaimer {
        font-size: 10px;
        padding: 6px 0;
    }
    
    .disclaimer span {
        display: none;  /* 超小屏幕隐藏免责声明文字 */
    }
    
    .disclaimer i {
        font-size: 12px;
        color: #999;
    }
}

/* 全屏模态框样式 */
.report-fullscreen-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    display: flex;
    flex-direction: column;
}

.fullscreen-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.fullscreen-header h3 {
    margin: 0;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.close-fullscreen {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 10px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
}

.close-fullscreen:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.fullscreen-content {
    flex: 1;
    padding: 0;
    overflow: hidden;
}

.fullscreen-iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
}

.disclaimer {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875em;
    color: #64748b;
}

.disclaimer i {
    color: #f59e0b;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .analysis-result {
        margin: 10px 0;
        border-radius: 12px;
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .result-header {
        padding: 16px 12px;
        flex-wrap: wrap;
        overflow-x: hidden;
    }
    
    .stock-symbol {
        font-size: 1.5em;
        word-break: break-word;
    }
    
    .decision-visual {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }
    
    .confidence-meter {
        text-align: left;
    }
    
    .decision-details {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .section-header {
        padding: 16px 12px;
        overflow-x: hidden;
    }
    
    .section-title h4 {
        font-size: 1em;
        word-break: break-word;
    }
    
    .content-wrapper {
        padding: 16px 12px;
        overflow-x: auto;
    }
    
    .content-text {
        padding: 12px;
        font-size: 0.9em;
    }
    
    /* 表格在移动端横向滚动 */
    .content-text table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }
}