/* 量化交易系统自定义样式 */

/* 全局样式 */
body {
    background-color: #f8f9fa;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 导航栏样式 */
.navbar-brand {
    font-weight: bold;
    font-size: 1.5rem;
    color: #1a252f !important; /* 深色文字，确保对比度 */
    text-shadow: 0 1px 2px rgba(0,0,0,0.1); /* 添加文字阴影 */
}

.navbar-nav .nav-link {
    font-weight: 600; /* 加粗字体 */
    transition: color 0.3s ease;
    color: #1a252f !important; /* 深色文字，提高对比度 */
    text-shadow: 0 1px 1px rgba(0,0,0,0.1); /* 添加文字阴影 */
}

.navbar-nav .nav-link:hover {
    color: #0056b3 !important; /* 悬停时使用深蓝色 */
    transform: translateY(-1px);
    text-shadow: 0 1px 2px rgba(0,0,0,0.2); /* 悬停时增强阴影 */
}

.navbar-nav .nav-link.active {
    color: #0056b3 !important; /* 激活状态使用深蓝色 */
    font-weight: 700; /* 激活状态加粗 */
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* 导航栏背景增强 */
.navbar {
    background: rgba(255, 255, 255, 0.98) !important; /* 提高背景不透明度 */
    box-shadow: 0 2px 20px rgba(0,0,0,0.15) !important; /* 增强阴影 */
    border-bottom: 2px solid rgba(0,0,0,0.1) !important; /* 增强边框 */
}

/* 卡片样式 */
.card {
    border-radius: 10px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1) !important;
}

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

/* 按钮样式 */
.btn {
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.btn-primary {
    background: linear-gradient(45deg, #007bff, #0056b3);
    border: none;
}

.btn-success {
    background: linear-gradient(45deg, #28a745, #1e7e34);
    border: none;
}

.btn-warning {
    background: linear-gradient(45deg, #ffc107, #e0a800);
    border: none;
    color: #212529;
}

.btn-info {
    background: linear-gradient(45deg, #17a2b8, #138496);
    border: none;
}

/* 表单样式 */
.form-control, .form-select {
    border-radius: 8px;
    border: 2px solid #e9ecef;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-control:focus, .form-select:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,0.25);
}

/* 进度条样式 */
.progress {
    border-radius: 10px;
    height: 20px;
}

.progress-bar {
    border-radius: 10px;
    background: linear-gradient(45deg, #007bff, #0056b3);
}

/* 表格样式 */
.table {
    border-radius: 8px;
    overflow: hidden;
}

/* 页脚样式 */
footer {
    margin-top: auto;
    border-top: 1px solid #dee2e6;
}

footer.bg-light {
    background-color: #f8f9fa !important;
}

footer .container {
    padding: 15px 0;
}

footer small {
    color: #6c757d;
    font-size: 0.875rem;
}

.table thead th {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(0,0,0,.02);
}

/* 警告框样式 */
.alert {
    border-radius: 8px;
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* 图标样式 */
.fa-3x {
    transition: transform 0.3s ease;
}

.card:hover .fa-3x {
    transform: scale(1.1);
}

/* 统计卡片样式 */
.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
}

.stat-card h2 {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 0;
}

.stat-card p {
    margin-bottom: 0;
    opacity: 0.9;
}

/* 图表容器样式 */
.chart-container {
    position: relative;
    height: 400px;
    margin: 20px 0;
}

/* 加载动画 */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .card-body {
        padding: 1rem;
    }
    
    .btn {
        font-size: 0.9rem;
    }
    
    .stat-card h2 {
        font-size: 2rem;
    }
}

/* 自定义滚动条 */
::-webkit-scrollbar {
    width: 8px;
}

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

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

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

/* 工具提示样式 */
.tooltip {
    font-size: 0.875rem;
}

/* 模态框样式 */
.modal-content {
    border-radius: 15px;
    border: none;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.modal-header {
    border-radius: 15px 15px 0 0;
    background: linear-gradient(45deg, #007bff, #0056b3);
    color: white;
}

/* 标签页样式 */
.nav-tabs .nav-link {
    border-radius: 8px 8px 0 0;
    border: none;
    color: #6c757d;
    font-weight: 500;
}

.nav-tabs .nav-link.active {
    background: linear-gradient(45deg, #007bff, #0056b3);
    color: white;
    border: none;
}

/* 徽章样式 */
.badge {
    border-radius: 6px;
    font-weight: 500;
}

/* 下拉菜单样式 */
.dropdown-menu {
    border-radius: 8px;
    border: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.dropdown-item {
    border-radius: 4px;
    margin: 2px 8px;
    transition: background-color 0.3s ease;
}

.dropdown-item:hover {
    background-color: #f8f9fa;
}

/* 分页样式 */
.pagination .page-link {
    border-radius: 6px;
    margin: 0 2px;
    border: none;
    color: #007bff;
}

.pagination .page-item.active .page-link {
    background: linear-gradient(45deg, #007bff, #0056b3);
    border: none;
}

/* 面包屑导航样式 */
.breadcrumb {
    background-color: transparent;
    padding: 0;
    margin-bottom: 20px;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: ">";
    color: #6c757d;
}

/* 代码块样式 */
pre {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    border: 1px solid #e9ecef;
}

code {
    background-color: #f8f9fa;
    padding: 2px 6px;
    border-radius: 4px;
    color: #e83e8c;
}

/* 打印样式 */
@media print {
    .navbar, .btn, .card-header {
        display: none !important;
    }
    
    .card {
        border: 1px solid #000 !important;
        box-shadow: none !important;
    }
} 

/* AI解释样式 */
.ai-explanation {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #333;
}

.ai-explanation br {
    margin-bottom: 0.5rem;
}

/* 股票搜索样式 */
#stockSearchResults {
    position: absolute;
    z-index: 1000;
    width: 100%;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-top: none;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.stock-item:hover {
    background-color: #f8f9fa;
}

/* 回测结果样式 */
.result-card {
    transition: all 0.3s ease;
}

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

/* 进度条样式 */
.progress {
    height: 25px;
    border-radius: 15px;
}

.progress-bar {
    border-radius: 15px;
    font-size: 12px;
    line-height: 25px;
}

/* 表格样式优化 */
.table-sm td, .table-sm th {
    padding: 0.5rem;
    font-size: 0.9rem;
}

/* 图表容器样式 */
.chart-container {
    position: relative;
    height: 400px;
    margin: 20px 0;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .ai-explanation {
        font-size: 0.9rem;
    }
    
    .chart-container {
        height: 300px;
    }
} 

/* ====== 新增样式 ====== */

/* 加载状态指示器 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.loading-overlay.show {
    opacity: 1;
    visibility: visible;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-content {
    text-align: center;
}

.loading-text {
    margin-top: 15px;
    font-size: 16px;
    color: #666;
    font-weight: 500;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 加载按钮状态 */
.btn-loading {
    position: relative;
    pointer-events: none;
}

.btn-loading .btn-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.btn-loading .btn-text {
    opacity: 0;
}

/* 主题切换样式 */
.theme-switcher {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.theme-switcher input {
    opacity: 0;
    width: 0;
    height: 0;
}

.theme-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.4s;
    border-radius: 34px;
}

.theme-slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

input:checked + .theme-slider {
    background-color: #2196F3;
}

input:checked + .theme-slider:before {
    transform: translateX(26px);
}

/* 深色主题 */
.dark-theme {
    background-color: #1a1a1a !important;
    color: #ffffff !important;
}

.dark-theme .card {
    background-color: #2d3748 !important;
    border-color: #4a5568 !important;
    color: #ffffff !important;
}

.dark-theme .navbar {
    background-color: #2d3748 !important;
}

.dark-theme .btn-outline-primary {
    color: #63b3ed !important;
    border-color: #63b3ed !important;
}

.dark-theme .btn-outline-primary:hover {
    background-color: #63b3ed !important;
    color: #1a1a1a !important;
}

/* 通知系统 */
.notification-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 1050;
    max-width: 350px;
}

.notification {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    margin-bottom: 10px;
    overflow: hidden;
    transform: translateX(400px);
    transition: all 0.4s ease;
    border-left: 4px solid #007bff;
}

.notification.show {
    transform: translateX(0);
}

.notification.success {
    border-left-color: #28a745;
}

.notification.error {
    border-left-color: #dc3545;
}

.notification.warning {
    border-left-color: #ffc107;
}

.notification-header {
    padding: 12px 16px 8px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.notification-title {
    font-weight: 600;
    font-size: 14px;
    margin: 0;
}

.notification-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
}

.notification-body {
    padding: 0 16px 12px;
    font-size: 13px;
    color: #6c757d;
}

.notification-progress {
    height: 2px;
    background: rgba(0,123,255,0.2);
    overflow: hidden;
}

.notification-progress-bar {
    height: 100%;
    background: #007bff;
    width: 100%;
    animation: progress 3s linear;
}

@keyframes progress {
    from { width: 100%; }
    to { width: 0%; }
}

/* 搜索组件 */
.global-search {
    position: relative;
    max-width: 400px;
}

.search-input {
    width: 100%;
    padding: 8px 40px 8px 16px;
    border: 1px solid #dee2e6;
    border-radius: 25px;
    background: rgba(255,255,255,0.9);
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
    background: white;
}

.search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #dee2e6;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 1000;
    display: none;
}

.search-results.show {
    display: block;
}

.search-result-item {
    padding: 12px 16px;
    border-bottom: 1px solid #f8f9fa;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.search-result-item:hover {
    background-color: #f8f9fa;
}

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

.search-result-title {
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 4px;
}

.search-result-description {
    font-size: 12px;
    color: #6c757d;
}

/* 收藏夹功能 */
.favorites-widget {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 16px;
}

.favorite-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f8f9fa;
}

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

.favorite-link {
    color: #007bff;
    text-decoration: none;
    font-size: 14px;
}

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

.favorite-remove {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    font-size: 12px;
    padding: 4px;
}

/* 错误页面样式 */
.error-container {
    text-align: center;
    padding: 80px 20px;
}

.error-code {
    font-size: 120px;
    font-weight: bold;
    color: #007bff;
    opacity: 0.8;
    margin-bottom: 20px;
}

.error-message {
    font-size: 24px;
    color: #333;
    margin-bottom: 16px;
}

.error-description {
    font-size: 16px;
    color: #6c757d;
    margin-bottom: 30px;
}

/* 响应式设计改进 */
@media (max-width: 768px) {
    .navbar-nav {
        background: rgba(0,123,255,0.95);
        border-radius: 8px;
        margin-top: 10px;
        padding: 8px;
    }
    
    .notification-container {
        left: 10px;
        right: 10px;
        max-width: none;
    }
    
    .global-search {
        width: 100%;
        margin: 10px 0;
    }
    
    .card {
        margin-bottom: 20px;
    }
    
    .error-code {
        font-size: 80px;
    }
    
    .error-message {
        font-size: 20px;
    }
}

/* 表格响应式 */
.table-responsive-stack {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
    .table-responsive-stack table,
    .table-responsive-stack thead,
    .table-responsive-stack tbody,
    .table-responsive-stack th,
    .table-responsive-stack td,
    .table-responsive-stack tr {
        display: block;
    }
    
    .table-responsive-stack thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    
    .table-responsive-stack tr {
        border: 1px solid #ccc;
        margin-bottom: 10px;
        padding: 10px;
        border-radius: 8px;
        background: white;
    }
    
    .table-responsive-stack td {
        border: none;
        position: relative;
        padding-left: 50%;
        padding-bottom: 10px;
    }
    
    .table-responsive-stack td:before {
        content: attr(data-label);
        position: absolute;
        left: 6px;
        width: 45%;
        text-align: left;
        font-weight: bold;
        color: #007bff;
    }
}

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

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

.slide-in-right {
    animation: slideInRight 0.4s ease-out;
}

@keyframes slideInRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

/* 工具提示样式 */
.custom-tooltip {
    position: relative;
    cursor: help;
}

.custom-tooltip:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 8px;
}

.custom-tooltip:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #333;
    margin-bottom: 2px;
} 