/* 全局样式 */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f8f9fa;
    color: #333;
}

/* 头部样式 */
header {
    transition: all 0.3s ease;
    padding: 0.2rem 0;
}

/* 头部标题样式 */
h1.h3 {
    font-size: 1.25rem;
    margin: 0;
}

/* 分类标题样式 */
h3.h5 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

/* 分类卡片样式 */
.category-card {
    transition: all 0.3s ease;
    border: none;
    border-radius: 0;
    overflow: hidden;
    cursor: pointer;
    height: 100%;
    background-color: transparent;
    box-shadow: none;
}

.category-card:hover {
    transform: none;
    box-shadow: none;
    border-color: transparent;
}

.category-card.active {
    border-color: transparent;
    box-shadow: none;
}

.category-card .card-body {
    padding: 0.2rem 0.6rem;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 0;
    min-height: auto;
    height: auto;
}

.category-card .card-title {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.05rem;
    height: auto;
    overflow: visible;
    display: block;
    -webkit-line-clamp: unset;
    -webkit-box-orient: unset;
}

/* 调整卡片内部元素间距 */
.category-card .d-flex.justify-content-between.align-items-center.mb-2 {
    margin-bottom: 0 !important;
    flex-direction: column;
    align-items: flex-start;
    flex-wrap: nowrap;
    gap: 0.05rem;
    padding-bottom: 0;
}

/* 调整统计信息间距 */
.category-stats-horizontal {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: flex-start;
    margin-top: -0.25rem;
    margin-bottom: 0;
    padding-bottom: 0;
    width: 100%;
}

.stat-item-horizontal {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    margin-top: 0;
    margin-bottom: 0;
}

/* 确保卡片内部没有多余的空白 */
.category-card .card-body > div {
    margin-bottom: 0;
    padding-bottom: 0;
}

/* 涨跌幅样式 */
.change-positive {
    color: #dc3545 !important;
    font-weight: 600;
}

.change-negative {
    color: #198754 !important;
    font-weight: 600;
}

.change-neutral {
    color: #6c757d !important;
}

/* 基础统计值样式 */
.stat-value {
    font-weight: 600;
}

.stat-label {
    color: #6c757d;
}

/* 进度条样式 */
.progress-bar-container {
    height: 6px;
    background-color: #e9ecef;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 0.25rem;
}

.progress-bar {
    height: 100%;
    transition: width 0.3s ease;
}

.progress-positive {
    background-color: #dc3545;
}

.progress-negative {
    background-color: #198754;
}

/* 股票列表样式 */
.stock-table-container {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

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

.table th {
    font-weight: 600;
    color: #495057;
    border-bottom: 2px solid #e9ecef;
}

.table td {
    vertical-align: middle;
    border-bottom: 1px solid #f0f0f0;
}

/* 加载状态 */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .category-card {
        margin-bottom: 1rem;
    }
    
    .category-stats {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .stat-item {
        text-align: left;
    }
    
    .header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}

/* 分类容器 */
.category-container {
    margin-bottom: 0.25rem;
    display: flex;
    align-items: flex-start;
    gap: 0;
    position: relative;
    padding-left: 3.5rem;
    margin-top: 0rem;
}

/* 竖排标题样式 */
.vertical-title {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 1rem;
    height: auto;
    margin-bottom: 0;
    padding: 0.5rem 0.25rem;
    position: absolute;
    left: 0;
    top: 0;
    min-height: auto;
    flex-shrink: 0;
    width: auto;
    align-self: flex-start;
    background-color: transparent;
    border-radius: 4px;
    box-shadow: none;
    z-index: 1;
    transform-origin: left top;
    line-height: 1.2;
}

/* 调整分类卡片容器位置 */
.category-container .category-cards-container {
    margin-left: 0;
    padding-left: 0;
    flex-grow: 1;
    width: 100%;
    margin-top: 0;
    margin-bottom: 0;
}

.vertical-title i {
    font-size: 1.2rem;
    transform: rotate(180deg);
}

.vertical-title span {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    white-space: nowrap;
    line-height: 1.5;
}

/* 调整分类卡片包装器 */
.category-card-wrapper {
    margin-bottom: 0.3rem;
    width: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
    background-color: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    min-height: auto;
    height: auto;
}

/* 确保卡片内部没有多余的空白 */
.category-card {
    height: auto;
    min-height: auto;
}

/* 调整分类标题间距 */
.category-container .vertical-title + .category-cards-container {
    margin-top: 0;
}

/* 统计信息横排样式 */
.category-stats-horizontal {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: nowrap;
    justify-content: flex-start;
    margin: 0;
    padding: 0;
    height: auto;
    overflow: hidden;
}

.stat-item-horizontal {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    font-size: 0.65rem;
    margin: 0;
    padding: 0;
    white-space: nowrap;
}

.stat-item-horizontal .stat-label {
    font-size: 0.6rem;
    color: #6c757d;
    font-weight: 400;
    white-space: nowrap;
}

.stat-item-horizontal .stat-value {
    font-size: 0.65rem;
    font-weight: 600;
    white-space: nowrap;
}

/* 分类卡片容器 - 宽屏紧凑布局 */
.category-cards-container {
    display: grid;
    grid-template-columns: repeat(7, minmax(120px, 1fr));
    gap: 0.5rem;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    flex-grow: 1;
    align-self: stretch;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
}

/* 分类卡片 */
.category-card-wrapper {
    margin-bottom: 0.3rem;
    width: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
    background-color: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* 主容器样式 */
.container {
    max-width: 100%;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

main.container {
    padding-top: 0rem;
    padding-bottom: 0rem;
}

/* 卡片内部样式优化 */
.category-card .card-body {
    padding: 0.2rem 0.6rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-title {
    font-size: 0.85rem;
    margin-bottom: 0.05rem;
    line-height: 1.1;
    height: auto;
    display: block;
    -webkit-line-clamp: unset;
    overflow: visible;
    white-space: nowrap;
}

.category-stats {
    margin-bottom: 0.1rem;
}

/* 刷新按钮样式 */
#refresh-btn {
    transition: all 0.2s ease;
    border: none !important;
}

#refresh-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
    transform: rotate(15deg);
    border: none !important;
}

/* 自动刷新开关样式优化 - 提高在蓝色背景下的可见性 */
.form-check-input:checked {
    background-color: #ffffff !important;
    border-color: #ffffff !important;
    box-shadow: 0 0 0 0.25rem rgba(255, 255, 255, 0.25) !important;
}

.form-check-input:not(:checked) {
    background-color: rgba(255, 255, 255, 0.3) !important;
    border-color: rgba(255, 255, 255, 0.5) !important;
}

.form-check-label {
    color: #ffffff !important;
    font-weight: 500 !important;
}

#refresh-btn.loading {
    animation: spin 1s linear infinite;
    border: none !important;
}

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

/* 无数据状态 */
.no-data {
    transition: all 0.3s ease;
    text-align: center;
    padding: 2rem;
    color: #6c757d;
}

/* 头部时间显示 */
#update-time {
    font-size: 0.875rem;
    font-weight: 500;
}

/* 分类下的股票列表 */
.category-stocks {
    margin-top: 0;
    overflow: hidden;
    transition: all 0.3s ease;
    background-color: #fff;
    border-radius: 0;
    border: none;
    width: 100%;
    box-sizing: border-box;
    align-self: flex-start;
    padding: 0;
    margin: 0;
    max-height: 180px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* 股票列表表格 */
.category-stocks-table {
    margin-bottom: 0;
    font-size: 0.875rem;
}

/* 紧凑表格样式 */
.category-stocks-table th,
.category-stocks-table td {
    padding: 0.2rem 0.3rem;
    white-space: nowrap;
    font-size: 0.75rem;
    line-height: 1;
}

.category-stocks-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.category-stocks-table tbody tr:hover {
    background-color: #f8f9fa;
}

/* 表格容器 - 支持横向滚动 */
.stocks-table-container {
    overflow-x: auto;
}

/* 复制全部按钮容器 */
.copy-all-container {
    display: inline-block !important;
    margin-left: 0.3rem !important;
    vertical-align: middle !important;
}

/* 复制全部按钮样式 */
.copy-all-btn {
    padding: 0.0625rem 0.25rem !important;
    font-size: 0.55rem !important;
    height: auto !important;
    line-height: 1 !important;
    border-radius: 3px !important;
    transition: all 0.2s ease !important;
    opacity: 0.7;
    border: 1px solid #ced4da !important;
    background-color: #ffffff !important;
    color: #495057 !important;
    margin: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: auto !important;
}

.copy-all-btn:hover {
    opacity: 1 !important;
    background-color: #e9ecef !important;
    border-color: #adb5bd !important;
    transform: none !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
    color: #212529 !important;
}

.copy-all-btn:active {
    transform: none !important;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1) !important;
}

/* 恢复表格头部默认样式 */
.category-stocks-table th:nth-child(2) {
    display: table-cell !important;
    align-items: normal !important;
    justify-content: normal !important;
}





/* 滚动条样式 */
::-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;
}

/* 复制提示动画 */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

/* 复制提示样式 */
.copy-toast {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.copy-toast i {
    font-size: 1rem;
}

/* 确保提示显示在最上层 */
.copy-toast {
    z-index: 9999 !important;
}

/* 自动刷新倒计时样式 */
#auto-refresh-countdown {
    font-size: 0.75rem !important;
}

/* 页脚样式 */
footer {
    padding: 0.75rem 0 !important;
    margin-top: 0.75rem !important;
    font-size: 0.85rem;
}

/* 响应式调整 - 宽屏优化 */
@media (min-width: 768px) {
    .category-cards-container {
        grid-template-columns: repeat(7, 1fr);
    }
}

@media (min-width: 992px) {
    .category-cards-container {
        grid-template-columns: repeat(7, 1fr);
    }
}

@media (min-width: 1200px) {
    .category-cards-container {
        grid-template-columns: repeat(7, 1fr);
    }
}

@media (min-width: 1400px) {
    .category-cards-container {
        grid-template-columns: repeat(7, 1fr);
    }
}

@media (min-width: 1600px) {
    .category-cards-container {
        grid-template-columns: repeat(7, 1fr);
    }
}

@media (min-width: 1800px) {
    .category-cards-container {
        grid-template-columns: repeat(7, 1fr);
    }
}

@media (min-width: 2000px) {
    .category-cards-container {
        grid-template-columns: repeat(7, 1fr);
    }
}

@media (max-width: 767px) {
    .category-cards-container {
        grid-template-columns: 1fr;
    }
    
    .category-stocks-table {
        font-size: 0.75rem;
    }
    
    .category-stocks-table th,
    .category-stocks-table td {
        padding: 0.375rem 0.25rem;
    }
}

/* 卡片分类样式 */
/* 上涨排名卡片 - 前3个 */
.rank-type-rising {
    background-color: #fef2f2;
}

.rank-type-rising .card-title {
    color: #991b1b;
    font-weight: 600;
}

/* 上涨速度排名卡片 - 第4-5个 */
.rank-type-speed {
    background-color: #fee2e2;
}

.rank-type-speed .card-title {
    color: #7f1d1d;
    font-weight: 600;
}

/* 下跌倒序排名卡片 - 最后2个 */
.rank-type-falling {
    background-color: #f0fff4;
}

.rank-type-falling .card-title {
    color: #166534;
    font-weight: 600;
}

/* 地域卡片样式（仅上涨前三） */
#region-cards .category-card-wrapper {
    background-color: #fef2f2;
}

#region-cards .card-title {
    color: #991b1b;
    font-weight: 600;
}

/* 确保所有卡片都没有左边线条 */
.category-card-wrapper {
    border-left: none;
}

/* 分类说明样式 */
.category-explanation {
    margin-top: 1rem;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background-color: #f8f9fa;
    border-radius: 4px;
    font-size: 0.875rem;
    color: #495057;
    border-left: 3px solid #6c757d;
}