/* FinGenius 台股分析平台樣式 */

/* 全域樣式 */
body {
    font-family: 'Microsoft JhengHei', 'PingFang TC', 'Helvetica Neue', STHeitiTC-light, sans-serif;
    background-color: #f8fafc;
    color: #333;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1;
}

.container {
    max-width: 1200px;
}

/* 頁面標題 */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%) !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

header.bg-gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%) !important;
}

header h1 {
    font-weight: 700;
    letter-spacing: -0.5px;
}

header .opacity-90 {
    color: rgba(255, 255, 255, 0.85);
}

/* 連接狀態徽章 */
#connectionStatus {
    background-color: rgba(255, 255, 255, 0.2);
    padding: 0.5rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

#connectionStatus:hover {
    background-color: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

/* 卡片樣式 */
.card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 25px rgba(0,0,0,0.12);
}

.card-header {
    border-radius: 10px 10px 0 0 !important;
    border: none;
    font-weight: 600;
}

/* 按鈕樣式 */
.btn {
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-outline-secondary {
    border-color: #e9ecef;
    color: #6c757d;
}

.btn-outline-secondary:hover {
    background-color: #e9ecef;
    border-color: #adb5bd;
}

/* 表單樣式 */
.form-control, .form-select {
    border-radius: 8px;
    border: 2px solid #e9ecef;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    font-size: 1rem;
}

.form-control:focus, .form-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
    background-color: #fff;
}

.form-label {
    font-weight: 500;
    color: #495057;
    margin-bottom: 0.75rem;
}

.form-range {
    height: 6px;
    border-radius: 3px;
}

.form-range .form-range-track {
    background-color: #e9ecef;
}

.form-range .form-range-thumb {
    width: 20px;
    height: 20px;
    background-color: #667eea;
    border: 3px solid white;
    box-shadow: 0 2px 5px rgba(102, 126, 234, 0.4);
    border-radius: 50%;
    transition: all 0.2s ease;
}

.form-range .form-range-thumb:active {
    background-color: #5a6fd8;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.6);
}

fieldset {
    border: none;
    padding: 0;
    margin: 0;
}

legend {
    padding: 0;
    margin-bottom: 0.5rem;
}

.input-group {
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    border-radius: 8px;
    overflow: hidden;
}

/* 進度條樣式 */
.progress {
    height: 8px;
    border-radius: 4px;
    background-color: #e9ecef;
}

.progress-bar {
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
}

/* Agent 進度卡片 */
.agent-card {
    background: white;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    border-left: 4px solid #e9ecef;
    transition: all 0.2s ease;
}

.agent-card.active {
    border-left-color: #667eea;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.1);
}

.agent-card.completed {
    border-left-color: #28a745;
    background-color: #f8fff9;
}

.agent-card.error {
    border-left-color: #dc3545;
    background-color: #fff5f5;
}

.agent-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    margin-right: 15px;
}

.agent-icon.sentiment { background-color: #e3f2fd; color: #1976d2; }
.agent-icon.risk { background-color: #fff3e0; color: #f57c00; }
.agent-icon.institutional { background-color: #f3e5f5; color: #7b1fa2; }
.agent-icon.technical { background-color: #e8f5e8; color: #388e3c; }
.agent-icon.chip { background-color: #fff8e1; color: #f9a825; }
.agent-icon.big_deal { background-color: #fce4ec; color: #c2185b; }

/* 圖表樣式 */
.chart-container {
    position: relative;
    height: 400px;
    width: 100%;
}

/* 分析結果樣式 */
.analysis-content {
    line-height: 1.6;
}

.analysis-content h6 {
    color: #495057;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 8px;
    margin-bottom: 15px;
}

.analysis-content .metric {
    display: inline-block;
    background-color: #f8f9fa;
    padding: 4px 8px;
    border-radius: 4px;
    margin: 2px;
    font-size: 0.9em;
    font-weight: 500;
}

.metric.positive { background-color: #d4edda; color: #155724; }
.metric.negative { background-color: #f8d7da; color: #721c24; }
.metric.neutral { background-color: #fff3cd; color: #856404; }

/* 標籤樣式 */
.nav-tabs {
    border-bottom: 2px solid #e9ecef;
    gap: 0.5rem;
}

.nav-tabs .nav-link {
    color: #6c757d;
    border: none;
    border-bottom: 3px solid transparent;
    font-weight: 500;
    padding: 0.75rem 1.25rem;
    transition: all 0.3s ease;
    position: relative;
}

.nav-tabs .nav-link:hover {
    color: #667eea;
    border-bottom-color: #667eea;
    background-color: rgba(102, 126, 234, 0.05);
}

.nav-tabs .nav-link.active {
    color: #667eea;
    border-bottom-color: #667eea;
    background-color: rgba(102, 126, 234, 0.08);
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.15);
}

/* 標籤內容 */
.tab-content {
    border-radius: 0 0 10px 10px;
}

.tab-pane {
    animation: fadeIn 0.3s ease-in;
}

/* 模態對話框樣式 */
.modal-content {
    border-radius: 12px;
    border: none;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 12px 12px 0 0;
    padding: 1.5rem;
}

.modal-header .modal-title {
    font-weight: 600;
    font-size: 1.25rem;
}

.modal-body {
    padding: 2rem;
}

.modal-footer {
    border-top: 1px solid #e9ecef;
    padding: 1.5rem;
    background-color: #f8f9fa;
}

.btn-group {
    gap: 0.5rem;
}

.btn-check:checked + .btn {
    background-color: #667eea;
    border-color: #667eea;
    color: white;
}

.config-section {
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 1rem;
}

/* 頁面底部 */
footer {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-top: 1px solid #e9ecef;
    margin-top: auto;
}

footer p {
    font-size: 0.95rem;
    letter-spacing: 0.5px;
}

footer .text-muted {
    opacity: 0.8;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }

    header h1 {
        font-size: 1.5rem;
    }

    header .d-flex {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .card-body {
        padding: 1rem;
    }

    .card-header {
        padding: 0.75rem 1rem;
    }

    .agent-card {
        padding: 10px;
    }

    .agent-icon {
        width: 35px;
        height: 35px;
        font-size: 14px;
        margin-right: 10px;
    }

    .nav-tabs .nav-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }

    .tab-pane {
        padding: 1rem 0;
    }

    .modal-body {
        padding: 1.5rem;
    }

    .btn-group {
        flex-wrap: wrap;
    }

    .btn-group .btn {
        flex: 1 0 48%;
    }

    main {
        margin-bottom: 2rem;
    }

    footer {
        margin-top: 3rem;
    }
}

/* 載入動畫 */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

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

/* 成功/錯誤狀態 */
.success-icon { color: #28a745; }
.error-icon { color: #dc3545; }
.warning-icon { color: #ffc107; }

/* 徽章樣式 */
.badge {
    padding: 0.5rem 0.75rem;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.badge.bg-secondary {
    background-color: #6c757d !important;
}

.badge.bg-success {
    background-color: #28a745 !important;
}

.badge.bg-danger {
    background-color: #dc3545 !important;
}

.badge.bg-warning {
    background-color: #ffc107 !important;
    color: #333 !important;
}

.badge.bg-info {
    background-color: #17a2b8 !important;
}

/* 警告/信息框樣式 */
.alert {
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    margin-bottom: 1rem;
}

.alert-info {
    background-color: #e7f3ff;
    color: #004085;
    border-left: 4px solid #0056b3;
}

.alert-warning {
    background-color: #fff3cd;
    color: #664d03;
    border-left: 4px solid #ff9800;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border-left: 4px solid #dc3545;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border-left: 4px solid #28a745;
}

/* 工具提示樣式 */
.tooltip-inner {
    background-color: #333;
    font-size: 0.875rem;
}

/* 滾動條樣式 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 動畫效果 */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.slide-up {
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}
/* Markdown 內容樣式 */
.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    font-weight: 600;
    line-height: 1.3;
}

.markdown-content h2 {
    font-size: 1.75rem;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 0.5rem;
    color: #2c3e50;
}

.markdown-content h3 {
    font-size: 1.4rem;
    color: #34495e;
}

.markdown-content p {
    margin-bottom: 1rem;
    line-height: 1.8;
}

.markdown-content ul,
.markdown-content ol {
    margin-bottom: 1rem;
    padding-left: 2rem;
}

.markdown-content li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.markdown-content strong {
    font-weight: 600;
    color: #2c3e50;
}

.markdown-content em {
    font-style: italic;
    color: #555;
}

.markdown-content code {
    background-color: #f5f5f5;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.markdown-content pre {
    background-color: #f5f5f5;
    padding: 1rem;
    border-radius: 5px;
    overflow-x: auto;
    margin-bottom: 1rem;
}

.markdown-content blockquote {
    border-left: 4px solid #667eea;
    padding-left: 1rem;
    margin-left: 0;
    margin-bottom: 1rem;
    color: #555;
    font-style: italic;
}

.markdown-content table {
    width: 100%;
    margin-bottom: 1rem;
    border-collapse: collapse;
}

.markdown-content table th,
.markdown-content table td {
    border: 1px solid #ddd;
    padding: 0.75rem;
    text-align: left;
}

.markdown-content table th {
    background-color: #f8f9fa;
    font-weight: 600;
}

.markdown-content table tr:hover {
    background-color: #f8f9fa;
}

/* 分析內容卡片樣式 */
.card.bg-light {
    background-color: #f8f9fa !important;
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
}

.card.bg-light:hover {
    background-color: #ffffff !important;
    border-color: #667eea;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.1);
}

.card-title {
    color: #2c3e50;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #e9ecef;
}

.card-title i {
    margin-right: 0.5rem;
}

/* 圖表容器樣式 */
.chart-container {
    position: relative;
    height: 400px;
    width: 100%;
    margin-bottom: 1rem;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

/* 分析內容樣式 */
.analysis-content {
    line-height: 1.7;
    color: #495057;
}

.analysis-content strong {
    color: #2c3e50;
    font-weight: 600;
}

.analysis-content em {
    color: #667eea;
    font-style: italic;
}

.analysis-content ul, .analysis-content ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.analysis-content li {
    margin-bottom: 0.5rem;
}

/* 空態樣式 */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: #6c757d;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state p {
    font-size: 1rem;
    margin-bottom: 0;
}
