/**
 * StockPicker - 现代化样式表
 * 基于 Bootstrap 5.3 的自定义样式
 */

/* ============================================
   CSS 变量定义
   ============================================ */
:root {
    --primary-color: #1e3a8a;
    --primary-light: #3b82f6;
    --primary-dark: #1e40af;
    --success-color: #22c55e;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #06b6d4;
    
    --bg-body: #f1f5f9;
    --bg-card: #ffffff;
    --bg-dark: #0f172a;
    
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    
    --border-color: #e2e8f0;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);
    
    --transition-fast: 0.15s ease;
    --transition: 0.2s ease;
}

/* 深色模式 */
[data-bs-theme="dark"] {
    --bg-body: #0f172a;
    --bg-card: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: #334155;
}

/* ============================================
   基础样式
   ============================================ */
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* ============================================
   卡片组件
   ============================================ */
.card {
    background: var(--bg-card);
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    transition: transform var(--transition), box-shadow var(--transition);
    overflow: hidden;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
    font-weight: 600;
}

.card-body {
    padding: 1.25rem;
}

.card-title {
    font-weight: 600;
    color: var(--text-primary);
}

/* ============================================
   表格样式
   ============================================ */
.table {
    margin-bottom: 0;
    color: var(--text-primary);
}

.table thead th {
    background-color: var(--bg-body);
    border-bottom: 2px solid var(--border-color);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.875rem 1rem;
}

.table tbody td {
    padding: 0.875rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
}

.table tbody tr:hover {
    background-color: rgba(59, 130, 246, 0.05);
}

.table-responsive {
    border-radius: var(--border-radius-sm);
}

/* ============================================
   价格颜色（中国股市惯例）
   ============================================ */
.text-up,
.text-profit,
.text-rise {
    color: var(--danger-color) !important;
}

.text-down,
.text-loss,
.text-fall {
    color: var(--success-color) !important;
}

/* 涨跌背景色 */
.bg-up {
    background-color: rgba(239, 68, 68, 0.1) !important;
}

.bg-down {
    background-color: rgba(34, 197, 94, 0.1) !important;
}

/* ============================================
   徽章样式
   ============================================ */
.badge {
    font-weight: 500;
    padding: 0.4em 0.8em;
    border-radius: 6px;
    font-size: 0.75rem;
}

.badge.bg-success {
    background-color: var(--success-color) !important;
}

.badge.bg-danger {
    background-color: var(--danger-color) !important;
}

.badge.bg-warning {
    background-color: var(--warning-color) !important;
    color: #000;
}

.badge.bg-info {
    background-color: var(--info-color) !important;
}

/* ============================================
   按钮样式
   ============================================ */
.btn {
    font-weight: 500;
    border-radius: var(--border-radius-sm);
    padding: 0.5rem 1rem;
    transition: all var(--transition-fast);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    border: none;
    color: #fff;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary-color) 100%);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-outline-primary {
    border-color: var(--primary-light);
    color: var(--primary-light);
}

.btn-outline-primary:hover {
    background-color: var(--primary-light);
    border-color: var(--primary-light);
}

.btn-group-sm > .btn,
.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

/* ============================================
   分页样式
   ============================================ */
.pagination {
    margin-bottom: 0;
}

.page-link {
    color: var(--primary-light);
    border: 1px solid var(--border-color);
    padding: 0.5rem 0.875rem;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.page-link:hover {
    background-color: var(--primary-light);
    border-color: var(--primary-light);
    color: #fff;
}

.page-item.active .page-link {
    background-color: var(--primary-light);
    border-color: var(--primary-light);
}

.page-item.disabled .page-link {
    color: var(--text-muted);
}

/* ============================================
   进度条
   ============================================ */
.progress {
    background-color: var(--border-color);
    border-radius: 100px;
    overflow: hidden;
}

.progress-bar {
    transition: width 0.6s ease;
}

/* ============================================
   警告/提示框
   ============================================ */
.alert {
    border: none;
    border-radius: var(--border-radius-sm);
    padding: 1rem 1.25rem;
}

.alert-info {
    background-color: rgba(6, 182, 212, 0.1);
    color: #0891b2;
}

.alert-success {
    background-color: rgba(34, 197, 94, 0.1);
    color: #16a34a;
}

.alert-warning {
    background-color: rgba(245, 158, 11, 0.1);
    color: #d97706;
}

.alert-danger {
    background-color: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

/* ============================================
   统计卡片
   ============================================ */
.stat-card {
    text-align: center;
    padding: 1.5rem;
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 1.5rem;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-card .stat-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* ============================================
   表单样式
   ============================================ */
.form-control,
.form-select {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 0.5rem 0.875rem;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* ============================================
   加载动画
   ============================================ */
.loading {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-light);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

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

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

.slide-in {
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ============================================
   响应式设计
   ============================================ */
@media (max-width: 991.98px) {
    .card {
        margin-bottom: 1rem;
    }
    
    .table-responsive {
        font-size: 0.875rem;
    }
    
    .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
}

@media (max-width: 767.98px) {
    h1 {
        font-size: 1.5rem;
    }
    
    h2 {
        font-size: 1.25rem;
    }
    
    .table thead th {
        font-size: 0.65rem;
        padding: 0.5rem 0.5rem;
    }
    
    .table tbody td {
        padding: 0.5rem 0.5rem;
        font-size: 0.8rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .stat-card .stat-value {
        font-size: 1.5rem;
    }

    /* 移动端：隐藏次要列（成交额、换手率、BOLL位置等） */
    .table .col-hide-sm {
        display: none;
    }

    /* 热门股票表格：隐藏成交额列 */
    #hotStocksTable th:nth-child(6),
    #hotStocksTable td:nth-child(6) {
        display: none;
    }

    /* 导航栏品牌文字简化 */
    .navbar-brand span.brand-full {
        display: none;
    }
    .navbar-brand span.brand-short {
        display: inline;
    }
}

@media (min-width: 768px) {
    .navbar-brand span.brand-short {
        display: none;
    }
    .navbar-brand span.brand-full {
        display: inline;
    }
}

@media (max-width: 575.98px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .page-link {
        padding: 0.375rem 0.625rem;
        font-size: 0.8125rem;
    }

    /* 超小屏：预测/选股表格隐藏历史命中、成交额排名列 */
    .table .col-hide-xs {
        display: none;
    }

    /* 统计卡片数字字体缩小 */
    .h3.fw-bold {
        font-size: 1.3rem;
    }
}

/* ============================================
   深色模式特定样式
   ============================================ */
[data-bs-theme="dark"] .card {
    background: var(--bg-card);
}

[data-bs-theme="dark"] .table thead th {
    background-color: var(--bg-dark);
}

[data-bs-theme="dark"] .table tbody tr:hover {
    background-color: rgba(59, 130, 246, 0.1);
}

[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
    background-color: var(--bg-dark);
    border-color: var(--border-color);
    color: var(--text-primary);
}

/* ============================================
   打印样式
   ============================================ */
@media print {
    body {
        background: #fff !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
    
    .navbar,
    footer,
    .btn,
    .pagination {
        display: none !important;
    }
    
    a[href]:after {
        content: none !important;
    }
}

/* ============================================
   工具类
   ============================================ */
.cursor-pointer {
    cursor: pointer;
}

.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hover-lift {
    transition: transform var(--transition);
}

.hover-lift:hover {
    transform: translateY(-4px);
}

/* 空状态 */
.empty-state {
    padding: 3rem 1rem;
    text-align: center;
}

.empty-state i {
    font-size: 3rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.empty-state h5 {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: 0;
}
