/* ============================================
   新闻轮播模块 V2 CSS 样式 - 3行布局
   news-carousel-v2.css
   ============================================ */

/* 新闻轮播容器 - 使用card样式使其与文章区域一致 */
.news-carousel-wrapper {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    margin: 0 0 0px 0;  /* 改为与文章区域一致的margin */
}

/* 如果新闻区域需要card样式，可以使用以下样式 */
.content-width-left .news-carousel-wrapper {
    /* 确保与card样式一致 */
    border: 1px solid #e6ecff;
}

/* 新闻轮播内容区域 */
.news-carousel-content {
    padding: 12px 15px;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* 第1行：分类导航 */
.news-category-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding-bottom: 8px;
    border-bottom: 1px solid #f0f0f0;
}

.category-item {
    padding: 4px 12px;
    font-size: 13px;
    color: #666;
    background: #f5f7fa;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
    white-space: nowrap;
}

.category-item:hover {
    background: #e8f2ff;
    color: #2a8cff;
}

.category-item.active {
    background: #2a8cff;
    color: #fff;
    font-weight: 600;
}

/* 第2-3行：新闻列表 - PC端横向2行 */
.news-list-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);  /* 3列布局 - 可在此修改列数 */
    gap: 8px 12px;  /* 行间距8px，列间距12px */
    min-height: 48px;
}

.news-item {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 22px;
    overflow: hidden;
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    0% {
        opacity: 0;
        transform: translateX(10px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

.news-number {
    flex: 0 0 20px;
    height: 20px;
    width: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

/* 前3名使用特殊颜色 */
.news-item:nth-child(1) .news-number {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.news-item:nth-child(2) .news-number {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.news-item:nth-child(3) .news-number {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.news-link {
    flex: 1;
    font-size: 13px;
    color: #333;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    text-decoration: none;
    transition: all 0.3s ease;
    display: inline-block;
    line-height: 1.4;
}

.news-link:hover {
    color: #2a8cff;
    text-decoration: underline;
    margin-left: 4px;
}

.news-link:visited {
    color: #666;
}

.news-link:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(42, 140, 255, 0.2);
}

/* 空状态 */
.news-empty {
    text-align: center;
    padding: 15px;
    color: #999;
    font-size: 12px;
}

/* ============================================
   响应式设计
   ============================================ */

/* 平板和小屏幕 */
@media (max-width: 1024px) and (min-width: 768px) {
    .news-list-container {
        grid-template-columns: repeat(2, 1fr);  /* 平板2列 */
        gap: 6px 10px;
    }
}

/* 手机端：竖向显示，固定3行 */
@media (max-width: 767px) {
    .news-carousel-wrapper {
        margin: 5px;
        margin-bottom: 8px;
    }
    
    .news-carousel-content {
        padding: 10px 12px;
        min-height: 85px;  /* 增加高度以容纳3行 */
        gap: 8px;
    }
    
    .news-category-nav {
        gap: 6px;
        padding-bottom: 6px;
    }
    
    .category-item {
        padding: 3px 10px;
        font-size: 12px;
    }
    
    /* 手机端：单列布局，固定显示3行 */
    .news-list-container {
        grid-template-columns: 1fr;  /* 单列 */
        gap: 5px;
        min-height: 66px;  /* 3行高度：20px * 3 + 5px * 2 */
    }
    
    .news-item {
        height: 20px;
        gap: 6px;
    }
    
    .news-number {
        flex: 0 0 18px;
        width: 18px;
        height: 18px;
        font-size: 10px;
    }
    
    .news-link {
        font-size: 12px;
    }
}

/* 小手机屏幕 */
@media (max-width: 480px) {
    .news-carousel-content {
        padding: 8px 10px;
        min-height: 80px;  /* 3行高度 */
        gap: 6px;
    }
    
    .news-category-nav {
        gap: 5px;
    }
    
    .category-item {
        padding: 2px 8px;
        font-size: 11px;
    }
    
    /* 保持单列，固定3行 */
    .news-list-container {
        grid-template-columns: 1fr;  /* 单列 */
        gap: 4px;
        min-height: 62px;  /* 3行：18px * 3 + 4px * 2 */
    }
    
    .news-item {
        height: 18px;
        gap: 4px;
    }
    
    .news-number {
        flex: 0 0 16px;
        width: 16px;
        height: 16px;
        font-size: 9px;
    }
    
    .news-link {
        font-size: 11px;
    }
}

/* ============================================
   特殊效果
   ============================================ */

/* 悬停整个容器时暂停动画 */
.news-carousel-wrapper:hover .news-item {
    animation-play-state: paused;
}

/* 加载动画 */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.news-loading {
    animation: pulse 1.5s ease-in-out infinite;
}

/* ============================================
   股市占位容器
   ============================================ */
.stock-market-card {
    border: 1px solid #e6ecff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    background: #fff;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.stock-market-card .card-head {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    font-size: 12px;
    font-weight: 500;
    padding: 6px 12px;
    border-bottom: 1px solid #f0f3ff;
    color: #5b6189;
    min-height: 32px;
}

.stock-market-head {
    min-height: 0;
}

.stock-market-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #8a92b5;
}

.stock-market-updated {
    min-width: 100px;
    text-align: right;
}

.stock-market-refresh-btn {
    border: none;
    background: #f3f6ff;
    color: #4a63d8;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.2s ease;
}

.stock-market-refresh-btn:hover {
    background: #e1e8ff;
    transform: rotate(20deg);
}

.stock-market-refresh-btn.is-rotating i {
    animation: spin 0.8s linear infinite;
}

.stock-market-refresh-btn i {
    transition: transform 0.2s ease;
}

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

.stock-market-body {
    min-height: 260px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, rgba(58,118,255,0.05), rgba(58,118,255,0.02));
    text-align: center;
    flex-direction: column;
    gap: 12px;
    flex: 1;
}

.stock-market-body.has-data {
    align-items: stretch;
    justify-content: flex-start;
    text-align: left;
    gap: 0;
}

.stock-market-body.has-data > .stock-market-section {
    margin-top: 6px;
    padding-top: 0;
}

.stock-market-status {
    font-size: 13px;
    color: #98a1c0;
}

.stock-market-status.stock-market-error {
    color: #e05055;
}

.stock-market-grid {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 0;
    padding-bottom: 0;
}

.stock-market-grid > .stock-market-item:last-child {
    margin-bottom: 0;
}

.stock-market-item {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1fr;
    align-items: center;
    padding: 2px 6px;
    border-radius: 6px;
    background: rgba(247, 249, 255, 0.6);
    font-size: 13px;
}

.stock-market-title {
    font-size: 13px;
    font-weight: 600;
    color: #2c365e;
    white-space: nowrap;
}

.stock-market-price {
    font-size: 16px;
    font-weight: 700;
    text-align: right;
}

.stock-market-change {
    font-size: 13px;
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    align-items: center;
    color: inherit;
}

.stock-market-change span {
    min-width: 52px;
    text-align: right;
}

.stock-market-item.stock-up .stock-market-price,
.stock-market-item.stock-up .stock-market-change {
    color: #e34f4f;
}

.stock-market-item.stock-down .stock-market-price,
.stock-market-item.stock-down .stock-market-change {
    color: #1ba784;
}

.stock-market-item.stock-flat .stock-market-price,
.stock-market-item.stock-flat .stock-market-change {
    color: #7a86a4;
}

.stock-market-item.stock-flat .stock-market-change span:last-child {
    opacity: 0.8;
}

.stock-market-section {
    margin-top: 0;
    padding-top: 0;
    border-top: 1px solid rgba(230, 236, 255, 0.9);
}

.stock-market-section-head {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #5b6189;
    margin-bottom: 6px;
    margin-top: 8px;
}

.stock-market-section-head i {
    color: #4a63d8;
}

.stock-market-sector-grid {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stock-market-sector-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 8px;
    border-radius: 6px;
    background: rgba(244, 246, 255, 0.6);
    font-size: 12px;
}

.stock-market-sector-item .sector-info {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
}

.sector-name {
    font-weight: 600;
    color: #2c365e;
}

.sector-amount {
    color: #8a92b5;
    font-size: 11px;
    white-space: nowrap;
}

.sector-values {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    font-variant-numeric: tabular-nums;
}

.sector-percent {
    font-size: 13px;
    font-weight: 600;
}

.sector-change {
    font-size: 12px;
    opacity: 0.85;
}

.stock-market-sector-item.sector-up .sector-percent,
.stock-market-sector-item.sector-up .sector-change {
    color: #e34f4f;
}

.stock-market-sector-item.sector-down .sector-percent,
.stock-market-sector-item.sector-down .sector-change {
    color: #1ba784;
}

.stock-market-sector-item.sector-flat .sector-percent,
.stock-market-sector-item.sector-flat .sector-change {
    color: #7a86a4;
}

.mobile-stock-wrapper {
    display: none;
}

@media (max-width: 991px) {
    .desktop-stock-wrapper {
        display: none;
    }
    .mobile-stock-wrapper {
        display: block;
        margin-top: 12px;
    }
    .mobile-stock-wrapper .stock-market-section {
        display: none;
    }
    .mobile-stock-wrapper .stock-market-body {
        min-height: auto;
        padding: 12px;
        background: #fff;
    }
    .mobile-stock-wrapper .stock-market-grid {
        gap: 8px;
    }
}

/* ============================================
   股票查询区域样式
   ============================================ */
.stock-market-stock-section {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(230, 236, 255, 0.9);
}

.stock-market-stock-header {
    margin-bottom: 8px;
}

.stock-market-stock-search {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
}

.stock-search-input {
    flex: 1;
    padding: 6px 10px;
    padding-right: 64px; /* 为删除按钮和搜索按钮预留空间 */
    border: 1px solid #e6ecff;
    border-radius: 4px;
    font-size: 12px;
    color: #333;
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.stock-search-input:focus {
    outline: none;
    border-color: #2a8cff;
    box-shadow: 0 0 0 2px rgba(42, 140, 255, 0.1);
}

.stock-search-input::placeholder {
    color: #999;
}

/* 搜索结果：显示在输入框内部 */
.stock-search-result {
    position: absolute;
    left: 12px;
    right: 64px; /* 与 padding-right 对齐，避免被按钮遮挡 */
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    display: none;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

/* 有结果时显示结果，并隐藏输入文字 */
.stock-market-stock-search.has-result .stock-search-result {
    display: flex;
}

.stock-market-stock-search.has-result .stock-search-input {
    color: transparent;
}

/* 输入框获得焦点时，优先显示输入内容，隐藏结果，避免重叠 */
.stock-market-stock-search.has-result .stock-search-input:focus {
    color: #333;
}

.stock-market-stock-search.has-result .stock-search-input:focus ~ .stock-search-result {
    display: none;
}

.stock-search-btn,
.stock-delete-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 4px;
    background: #f3f6ff;
    color: #4a63d8;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.2s ease;
    font-size: 12px;
}

.stock-search-btn:hover {
    background: #e1e8ff;
    transform: scale(1.05);
}

.stock-delete-btn {
    position: absolute;
    right: 36px; /* 在搜索按钮左侧，位于输入框内部 */
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(227, 79, 79, 0.1);
    color: #e34f4f;
    display: none; /* 默认隐藏，有结果时显示 */
    font-size: 10px;
    z-index: 1;
}

.stock-market-stock-search.has-result .stock-delete-btn {
    display: inline-flex;
}

.stock-delete-btn:hover {
    background: rgba(227, 79, 79, 0.2);
    transform: translateY(-50%) scale(1.08);
}

/* 查询结果中的单行样式（嵌入输入框内） */
.stock-search-result .stock-item {
    padding: 0;
    background: transparent;
    border-radius: 0;
    gap: 8px;
    font-size: 12px;
}

.stock-search-result .stock-item-name {
    font-size: 12px;
    min-width: auto;
    flex: 0 0 auto;
}

.stock-search-result .stock-price-value {
    font-size: 13px;
    min-width: auto;
    flex: 0 0 auto;
}

.stock-search-result .stock-price-change {
    font-size: 11px;
    min-width: auto;
    flex: 0 0 auto;
    gap: 6px;
}

.stock-mover-section {
    margin-top: -2px; /* 控制与上方搜索框的垂直间距，数值越大间距越大 */
    /* 如需单独调整左右间距，可在这里设置 padding-left / padding-right，例如：
       padding-left: 8px;
       padding-right: 8px;
    */
}

.stock-mover-item {
    font-size: 13px;
    color: #2c365e;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 20px;
    white-space: nowrap;
}

.stock-mover-item .mover-code {
    font-weight: 600;
    color: #4a63d8;
    min-width: 60px;
}

.stock-mover-item .mover-name {
    flex: 1;
}

.stock-mover-item .mover-price {
    font-weight: 600;
}

.stock-mover-item .mover-change {
    display: flex;
    gap: 6px;
    min-width: 110px;
    justify-content: flex-end;
}

.stock-mover-item.mover-up .mover-price,
.stock-mover-item.mover-up .mover-change {
    color: #e34f4f;
}

.stock-mover-item.mover-down .mover-price,
.stock-mover-item.mover-down .mover-change {
    color: #1ba784;
}

.stock-mover-item.mover-flat .mover-price,
.stock-mover-item.mover-flat .mover-change {
    color: #7a86a4;
}

.stock-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: 6px;
    background: rgba(247, 249, 255, 0.6);
    font-size: 13px;
    gap: 12px;
}

.stock-item-name {
    font-size: 13px;
    font-weight: 600;
    color: #2c365e;
    flex: 0 0 auto;
    min-width: 80px;
}

.stock-price-value {
    font-size: 16px;
    font-weight: 700;
    flex: 0 0 auto;
    min-width: 70px;
    text-align: right;
}

.stock-price-change {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    flex: 0 0 auto;
    min-width: 100px;
    justify-content: flex-end;
}

.stock-price-change span {
    white-space: nowrap;
}

.stock-price-change span:first-child {
    font-weight: 600;
}

.stock-item.stock-up .stock-price-value,
.stock-item.stock-up .stock-price-change {
    color: #e34f4f;
}

.stock-item.stock-down .stock-price-value,
.stock-item.stock-down .stock-price-change {
    color: #1ba784;
}

.stock-item.stock-flat .stock-price-value,
.stock-item.stock-flat .stock-price-change {
    color: #7a86a4;
}

/* 移动端样式调整 */
@media (max-width: 991px) {
    .stock-item {
        padding: 10px 12px;
        font-size: 14px;
    }
    
    .stock-item-name {
        font-size: 14px;
        min-width: 90px;
    }
    
    .stock-price-value {
        font-size: 18px;
        min-width: 80px;
    }
    
    .stock-price-change {
        font-size: 13px;
        min-width: 110px;
    }
}

/* 移动端股票查询区域样式调整 */
@media (max-width: 991px) {
    .desktop-stock-wrapper .stock-market-stock-section {
        display: none !important;
    }
    
    .mobile-stock-wrapper .stock-market-stock-section {
        margin-top: 12px;
        padding-top: 12px;
        border-top: 1px solid rgba(230, 236, 255, 0.9);
    }
    
    .mobile-stock-wrapper .stock-market-stock-search {
        gap: 8px;
    }
    
    .mobile-stock-wrapper .stock-search-input {
        font-size: 14px;
        padding: 8px 12px;
    }
    
    .mobile-stock-wrapper .stock-search-btn,
    .mobile-stock-wrapper .stock-delete-btn {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
}

