/* ==========================================
   观澜台 - 页面通用样式
   Version: 2.0
   ========================================== */

/* CSS变量继承 */
:root {
    /* 主色调 */
    --primary-50: #eff6ff;
    --primary-100: #dbeafe;
    --primary-200: #bfdbfe;
    --primary-300: #93c5fd;
    --primary-400: #60a5fa;
    --primary-500: #3b82f6;
    --primary-600: #2563eb;
    --primary-700: #1d4ed8;
    
    /* 中性色 */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    /* 功能色 */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    
    /* 股票涨跌色 */
    --stock-up: #ef4444;
    --stock-down: #22c55e;
    --stock-flat: #6b7280;
    
    /* 圆角 */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;
    
    /* 阴影 */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

/* 基础重置 */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 
                 'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--gray-800);
    background: #ffffff;
    -webkit-font-smoothing: antialiased;
}

/* ==========================================
   容器
   ========================================== */
.container {
    max-width: 100%;
    margin: 0;
    padding: 20px 24px;
    background: #ffffff;
}

/* ==========================================
   页面标题
   ========================================== */
.page-header {
    margin-bottom: 20px;
}

.page-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-900);
}

/* 页面标题行：左边标题，右边筛选 */
.page-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--gray-100);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-actions input[type="date"] {
    height: 32px;
    padding: 0 10px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 13px;
    color: var(--gray-700);
    background: white;
}

.header-actions input[type="date"]:focus {
    border-color: var(--primary-500);
    outline: none;
}

.header-actions .btn {
    height: 32px;
    padding: 0 12px;
    font-size: 12px;
}

/* ==========================================
   筛选区域
   ========================================== */
.filter-box {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--gray-50);
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
}

.filter-box label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--gray-600);
    font-weight: 500;
}

.filter-box label svg {
    color: var(--gray-400);
}

/* 输入框 */
.filter-box input[type="date"],
.filter-box input[type="text"],
.filter-box input[type="number"] {
    height: 36px;
    padding: 0 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    font-size: 14px;
    color: var(--gray-800);
    background: white;
    outline: none;
    transition: all 0.2s;
}

.filter-box input:focus {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* 下拉框 */
.filter-box select,
.view-mode-select {
    height: 36px;
    padding: 0 32px 0 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    font-size: 14px;
    color: var(--gray-800);
    background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M2.5 4.5L6 8l3.5-3.5'/%3E%3C/svg%3E") no-repeat right 10px center;
    appearance: none;
    cursor: pointer;
    outline: none;
    transition: all 0.2s;
}

.filter-box select:focus,
.view-mode-select:focus {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ==========================================
   按钮
   ========================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 36px;
    padding: 0 16px;
    font-size: 14px;
    font-weight: 500;
    color: white;
    background: var(--primary-500);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn:hover {
    background: var(--primary-600);
}

.btn:active {
    transform: scale(0.98);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-200);
}

.btn-outline {
    background: transparent;
    color: var(--primary-500);
    border: 1px solid var(--primary-500);
}

.btn-outline:hover {
    background: var(--primary-50);
}

.btn-sm {
    height: 28px;
    padding: 0 10px;
    font-size: 12px;
}

.btn-lg {
    height: 44px;
    padding: 0 24px;
    font-size: 16px;
}

/* 视图切换按钮 */
.view-mode-toggle {
    height: 36px;
    padding: 0 16px;
    background: var(--gray-100);
    color: var(--gray-700);
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.view-mode-toggle:hover {
    background: var(--gray-200);
}

.view-mode-toggle.active {
    background: var(--primary-500);
    color: white;
}

/* ==========================================
   标签页
   ========================================== */
.tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--gray-100);
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
}

.tab-item {
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-600);
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
}

.tab-item:hover {
    color: var(--gray-800);
}

.tab-item.active {
    background: white;
    color: var(--primary-600);
    box-shadow: var(--shadow-sm);
}

/* ==========================================
   卡片
   ========================================== */
.card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50);
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--gray-900);
}

.card-body {
    padding: 20px;
}

/* ==========================================
   表格
   ========================================== */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

table thead {
    background: var(--gray-50);
}

table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--gray-700);
    border-bottom: 1px solid var(--gray-200);
    white-space: nowrap;
}

table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-800);
}

table tbody tr:hover {
    background: var(--gray-50);
}

table tbody tr:last-child td {
    border-bottom: none;
}

/* ==========================================
   数据对齐 - 左对齐为默认
   ========================================== */
.text-left { text-align: left !important; }
.text-right { text-align: right; }
.text-center { text-align: center; }

/* 数字单元格 */
.num-cell {
    font-variant-numeric: tabular-nums;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 13px;
    color: #1f2937;
}

/* ==========================================
   连板数分组样式
   ========================================== */
.limit-group {
    margin-bottom: 24px;
}

.limit-group-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    color: white;
}

.limit-group-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
}

.limit-group-title {
    font-size: 15px;
    font-weight: 600;
}

.limit-group-count {
    margin-left: auto;
    font-size: 13px;
    opacity: 0.9;
}

.limit-group-table {
    border: 1px solid var(--gray-200);
    border-top: none;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    overflow: hidden;
}

/* ==========================================
   股票标签
   ========================================== */
.stock-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: var(--gray-100);
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--gray-700);
    white-space: nowrap;
}

.stock-tag.up {
    background: rgba(239, 68, 68, 0.1);
    color: var(--stock-up);
}

.stock-tag.down {
    background: rgba(34, 197, 94, 0.1);
    color: var(--stock-down);
}

/* 概念标签 */
.concept-tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    background: var(--primary-50);
    border: 1px solid var(--primary-200);
    border-radius: var(--radius-full);
    font-size: 12px;
    color: var(--primary-700);
    white-space: nowrap;
}

/* ==========================================
   统计信息
   ========================================== */
.stats {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--gray-300);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--gray-600);
}

.stat-value {
    font-weight: 600;
    color: var(--gray-800);
}

/* ==========================================
   涨跌幅颜色
   ========================================== */
.text-up, .price-up { color: var(--stock-up) !important; }
.text-down, .price-down { color: var(--stock-down) !important; }
.text-flat, .price-flat { color: var(--stock-flat) !important; }

/* ==========================================
   空状态
   ========================================== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--gray-500);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state-text {
    font-size: 14px;
}

/* ==========================================
   加载状态
   ========================================== */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--gray-500);
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--gray-200);
    border-top-color: var(--primary-500);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ==========================================
   模态框
   ========================================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow: auto;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
}

.modal-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-900);
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--gray-500);
    font-size: 20px;
    cursor: pointer;
}

.modal-close:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid var(--gray-200);
}

/* ==========================================
   响应式
   ========================================== */
@media (max-width: 768px) {
    .container {
        padding: 16px;
    }
    
    .page-title {
        font-size: 18px;
    }
    
    .filter-box {
        padding: 12px;
    }
    
    table th,
    table td {
        padding: 10px 12px;
    }
    
    .limit-group-header {
        padding: 10px 12px;
    }
}

@media (max-width: 480px) {
    .filter-box {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-box > * {
        width: 100%;
    }
    
    .btn {
        width: 100%;
    }
}

/* ==========================================
   DataTables 样式覆盖
   ========================================== */
.dataTables_wrapper {
    font-size: 13px;
}

.dataTables_filter input {
    height: 32px;
    padding: 0 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    outline: none;
    transition: all 0.2s;
}

.dataTables_filter input:focus {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.dataTables_length select {
    height: 32px;
    padding: 0 24px 0 8px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
}

.dataTables_info {
    font-size: 12px;
    color: var(--gray-500);
    padding: 12px 0;
}

.dataTables_paginate {
    padding: 12px 0;
}

.dataTables_paginate .paginate_button {
    padding: 6px 12px !important;
    margin: 0 2px !important;
    border: 1px solid var(--gray-300) !important;
    border-radius: var(--radius-md) !important;
    background: white !important;
    color: var(--gray-700) !important;
    font-size: 12px !important;
    transition: all 0.15s !important;
}

.dataTables_paginate .paginate_button:hover {
    background: var(--gray-100) !important;
    border-color: var(--gray-400) !important;
}

.dataTables_paginate .paginate_button.current {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%) !important;
    border-color: #4f46e5 !important;
    color: white !important;
    font-weight: 600 !important;
}

.dataTables_paginate .paginate_button.disabled {
    opacity: 0.4 !important;
    cursor: not-allowed !important;
}

/* 表格排序图标 */
table.dataTable thead .sorting:after,
table.dataTable thead .sorting_asc:after,
table.dataTable thead .sorting_desc:after {
    opacity: 0.5;
    font-size: 10px;
}

table.dataTable thead .sorting_asc:after,
table.dataTable thead .sorting_desc:after {
    opacity: 1;
    color: var(--primary-500);
}

/* limit-count-table 样式 */
.limit-count-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    overflow: hidden;
}

.limit-count-table thead th {
    padding: 10px 8px;
    font-size: 12px;
    font-weight: 500;
    color: var(--gray-500);
    background: #fafafa;
    border-bottom: 1px solid var(--gray-200);
    text-align: left;
    white-space: normal;
    word-wrap: break-word;
    vertical-align: middle;
    line-height: 1.4;
}

.limit-count-table tbody td {
    padding: 10px 8px;
    font-size: 13px;
    color: var(--gray-700);
    border-bottom: 1px solid var(--gray-100);
    text-align: left;
    vertical-align: middle;
    white-space: nowrap;
}

.limit-count-table tbody tr:hover {
    background: #f5f5f5;
}

.limit-count-table tbody tr:nth-child(even) {
    background: #fafafa;
}

.limit-count-table tbody tr:nth-child(even):hover {
    background: #f5f5f5;
}
