/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    overflow-x: hidden; /* 防止水平滚动 */
    padding-top: 70px; /* 为固定的header留出空间 */
}

/* 导航栏样式 */
.main-nav {
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    height: 70px; /* 固定header高度 */
}

/* 管理员标识样式 */
.admin-badge {
    background-color: #ff4444;
    color: white;
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 5px;
    font-weight: 500;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 0.7rem;
}
.logo-img {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
    background: #eee;
}
.main-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: #222;
    margin-left: 0.5rem;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 2.5rem;
    font-size: 1.1rem;
}

.nav-links li {
    position: relative;
}

.nav-links a {
    text-decoration: none;
    color: #333;
    font-weight: 500;
    padding: 0.5rem 1.2rem;
    border-radius: 4px;
    transition: background-color 0.3s, color 0.3s;
}

.nav-links .active a,
.nav-links a:active,
.nav-links a:focus {
    color: #d32f2f;
    background-color: #fff3e0;
    font-weight: bold;

/* 相似度题材对样式 */
.similarity-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    margin-bottom: 1rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.similarity-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

.similarity-score {
    background: rgba(255,255,255,0.2);
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: bold;
}

.loading, .error, .no-data {
    text-align: center;
    padding: 2rem;
    color: #666;
    font-size: 1rem;
}

.error {
    color: #d32f2f;
}

.no-data {
    color: #999;
}
}

.nav-links a:hover {
    background-color: #f0f0f0;
    color: #d32f2f;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info {
    position: relative;
    display: flex;
    align-items: center;
    cursor: pointer;
}

.user-name {
    margin-right: 10px;
    color: #333;
    font-weight: 500;
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background-color: #fff;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    border-radius: 4px;
    min-width: 120px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 1001;
}

.user-info:hover .user-dropdown {
    opacity: 1;
    visibility: visible;
}

.user-dropdown a {
    display: block;
    padding: 10px 20px;
    color: #333;
    text-decoration: none;
    transition: background-color 0.3s;
}

.user-dropdown a:hover {
    background-color: #f5f5f5;
}

.auth-links {
    display: flex;
    gap: 20px;
}

.login-link, .register-link {
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.3s;
}

.login-link {
    color: #0066cc;
    border: 1px solid #0066cc;
}

.login-link:hover {
    background-color: #0066cc;
    color: #fff;
}

.register-link {
    background-color: #0066cc;
    color: #fff;
    border: 1px solid #0066cc;
}

.register-link:hover {
    background-color: #0052a3;
}

.user-phone {
    font-size: 1rem;
    color: #333;
    margin-right: 15px;
}
.avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #eee;
    cursor: pointer;
}

/* 主要内容区域 */
main {
    max-width: 1700px;
    margin: 0 auto 2rem auto; /* 修改顶部外边距 */
    padding: 0 2rem;
}

/* 风口题材部分 */
.hot-topics {
    position: relative;
    background: transparent;
    box-shadow: none;
    padding-top: 2.5rem;
    padding-bottom: 2rem;
    width: 100%;
    overflow: visible;
}
.hot-bg {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100vw;
    height: 100%;
    background: url('/stock/static/bg.jpg') center/cover no-repeat;
    opacity: 0.7;
    z-index: -2;
    margin-left: 0vw;
    margin-right: 0vw;
}
.hot-topics-content {
    position: relative;
    z-index: 1;
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
}
.hot-topics h2 {
    position: relative;
    z-index: 1;
    margin-bottom: 1.5rem;
    color: #fff;
    font-size: 1.3rem;
    font-weight: bold;
    letter-spacing: 2px;
    padding: 0 0;
}
.topics-container {
    position: relative;
    z-index: 1;
    display: flex;
    gap: 1.2rem;
    align-items: flex-start;  /* 从顶部对齐 */
    padding: 0;
    min-height: 335px;  /* 同步调整最小高度 */
}
.topic-area {
    flex: 1.2;
    display: flex;
    flex-direction: column;
    gap: 0.72rem;  /* 微调间隙使总高度精确匹配 */
    height: auto;
}
.topic-card {
    width: 100%;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.10);
    padding: 1.1rem 1rem 0.8rem 1rem;  /* 减少底部内边距 */
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    color: #fff;
    background: #FF6666;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;  /* 恢复动画效果 */
}
.topic-card.positive {
    background: #FF6666;
}
.topic-card.negative {
    background: #43a047;
}
.topic-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 0.4rem;  /* 减少底部边距 */
}
.topic-title {
    font-size: 1.1rem;
    font-weight: bold;
    color: #ffffff;
    text-decoration: none;
    transition: color 0.3s ease;
    cursor: pointer;
}
.topic-title:hover {
    color: #ffeb3b;
    text-decoration: underline;
}
.topic-change {
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    transition: background-color 0.3s ease;
    color: #ffffff;
}
.topic-card.positive .topic-change {
    background-color: rgba(255, 255, 255, 0.15);
}
.topic-card.negative .topic-change {
    background-color: rgba(255, 255, 255, 0.15);
}
.topic-desc {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.5;  /* 减小行高 */
    margin: 8px 0;  /* 减小上下边距 */
    height: 7.5rem;  /* 减小描述区域高度 */
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 5;  /* 限制最多显示5行 */
    -webkit-box-orient: vertical;
}
.topic-stocks {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;  /* 减小间距 */
    flex: 1;
    overflow-y: auto;
    margin-top: 0.3rem;  /* 减少上边距 */
}
.stock-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.98rem;
    padding: 6px 0;  /* 减少内边距 */
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.stock-row:last-child {
    border-bottom: none;
}
.stock-name {
    font-weight: 500;
    color: #ffffff;
    text-decoration: none;
    transition: color 0.3s ease;
}
/* .stock-name:hover {
    color: #ffeb3b;
} */
.stock-pct {
    font-weight: 600;
    color: #ffffff;
}

/* 四个并排部分 */
.four-columns {
    display: flex;
    gap: 1.2rem;
    margin-top: 2rem;
    justify-content: space-between;
}

.four-columns .column {
    flex: 0 0 24%; /* 四列布局默认24%宽度 */
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 1.2rem;
    /* height: fit-content; */
    display: flex;
    flex-direction: column;
}

.four-columns .narrow-column1 {
    flex: 0 0 24%; /* 新闻解码列稍宽，32% */
}

.four-columns .narrow-column2 {
    flex: 0 0 24%; /* 其他三列稍窄，22% */
}
.four-columns .narrow-column3 {
    flex: 0 0 24; /* 其他三列稍窄，22% */
}
.four-columns .narrow-column4 {
    flex: 0 0 24%; /* 其他三列稍窄，22% */
}

.column {
    flex: 0 0 32%; /* 三列布局通用宽度设置 */
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 1.2rem;
    /* height: fit-content; */
    display: flex;
    flex-direction: column;
}

.column h2 {
    font-size: 1.2rem;
    color: #333;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #f0f0f0;
}

.content-container {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    padding-bottom: 1rem; /* 增加底部内边距以统一高度 */
    flex-grow: 1; /* 使内容容器占据可用空间 */
}

.card {
    background: #fff;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
}

.card-title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.card-title {
    font-weight: 600;
    color: #333;
    font-size: 1rem;
    flex: 1;
    word-wrap: break-word; /* 允许长单词换行 */
    overflow-wrap: break-word; /* 确保长单词也能换行 */
    margin-right: 0.5rem;
}

.card-time {
    font-size: 0.85rem;
    color: #666;
    white-space: nowrap; /* 时间不换行 */
}

.card-desc {
    font-size: 0.95rem;
    color: #666;
    line-height: 1.5;
    word-wrap: break-word; /* 允许长单词换行 */
    overflow-wrap: break-word; /* 确保长单词也能换行 */
}

.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.tag {
    font-size: 0.8rem;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    background: #ffe0b2;
    color: #d84315;
    white-space: nowrap;
    font-weight: 500;
}

.tag:nth-child(2n) {
    background: #e3f2fd;
    color: #1976d2;
}

.tag:nth-child(3n) {
    background: #e8f5e9;
    color: #388e3c;
}

/* Reset main container styles when it's specifically for the opportunity layout */
main:has(> .opportunity-main) {
    margin: 0;
    padding: 0;
    max-width: none;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .four-columns {
        flex-wrap: wrap; /* 允许换行 */
        gap: 1rem; /* 减小间距 */
    }
    
    .four-columns .column,
    .four-columns .news-decoding-column,
    .four-columns .narrow-column {
        flex: 0 0 48%; /* 两列布局，每列48% */
    }
}

@media (max-width: 768px) {
    .four-columns {
        flex-direction: column; /* 垂直排列 */
        gap: 1rem;
    }
    
    .four-columns .column,
    .four-columns .news-decoding-column,
    .four-columns .narrow-column {
        flex: 0 0 100%; /* 单列布局，每列100% */
    }
    
    .nav-container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav-links {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }
}

.opportunity-main {
    display: flex;
    gap: 0;
    margin: 0;
    max-width: 100%;
    min-height: calc(100vh - 70px);
    background: #f7f7f7;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
}
.opportunity-list-panel {
    width: 25%;
    background: #f5f7fa;
    border-radius: 0;
    padding: 1.2rem 1rem 1rem 1rem;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    height: calc(100vh - 70px - 1.2rem - 1rem); /* 减去padding */
    overflow-y: auto;
}
.opportunity-search {
    width: 100%;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    font-size: 1rem;
    margin-bottom: 1rem;
    outline: none;
    transition: border 0.2s;
}
.opportunity-search:focus {
    border: 1.5px solid #d32f2f;
}
.opportunity-list {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}
.opportunity-item {
    background: #fff;
    border-radius: 10px;
    padding: 0.8rem 1rem 0.7rem 1rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.03);
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
    border: 2px solid transparent;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}
.opportunity-item.active, .opportunity-item:hover {
    background: #fff3e0;
    border: 2px solid #ff9800;
    box-shadow: 0 2px 8px rgba(255,152,0,0.08);
}
.opportunity-item-title {
    font-size: 1rem;
    font-weight: 600;
    color: #222;
    margin-bottom: 0.1rem;
}
.opportunity-item-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.opportunity-item-tag {
    font-size: 0.8rem;
    padding: 0.1rem 0.7rem;
    border-radius: 10px;
    font-weight: 500;
    display: inline-block;
    margin-right: 6px;
    margin-bottom: 4px;
}
.concept-tag {
    font-size: 0.8rem;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    white-space: nowrap;
    font-weight: 500;
    background: #e3f2fd;  /* 浅蓝背景 */
    color: #1976d2;       /* 蓝色文字 */
}
.stock-tag {
    font-size: 0.8rem;
    padding: 0.2rem 0.6rem;
    border-ratio: 4px;
    white-space: nowrap;
    font-weight: 500;
    background: #ffe0b2;  /* 淡黄背景 */
    color: #d84315;       /* 红色文字 */
}
.opportunity-item-time {
    font-size: 0.82rem;
    color: #bdbdbd;
    margin-top: 0.1rem;
}
.opportunity-content-panel {
    flex: 1;
    width: 75%;
    background: #fff;
    border-radius: 0;
    box-shadow: none;
    padding: 1rem 0;
    min-height: calc(100vh - 70px);
    overflow-x: auto;
}
.opportunity-content {
    width: 100%;
    min-height: calc(100vh - 70px - 2rem); /* 减去父元素的padding */
    font-size: 1rem;
    color: #222;
}

.small-card {
    min-height: unset;
    padding: 0.8rem 1rem;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    aspect-ratio: auto;  /* 移除比例限制 */
}

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

.small-card .topic-header {
    margin-bottom: 0;
    flex-direction: column;
    align-items: center;
}

.small-card .topic-title,
.small-card .topic-change {
    font-size: 1.1rem;
    text-align: center;
}

.small-card .topic-desc,
.small-card .topic-stocks {
    display: none;
}

.grid-area {
    flex: 1.8;
    display: flex;
    flex-direction: column;
    height: auto;
    box-sizing: border-box;
    padding: 0;  /* 移除内边距 */
    margin: 0;   /* 移除外边距 */
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 2px;  /* 减小间隙以增大每个格子的高度 */
    padding: 0px;  /* 减小内边距以增大每个格子的高度 */
    height: 335px;  /* 保持与左侧三大块一致的高度 */
}

/* 响应式优化 */
@media screen and (max-width: 768px) {
    .grid-container {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .topic-title {
        font-size: 0.9em;
    }
    
    .stock-name {
        font-size: 0.85em;
    }
}

@media screen and (max-width: 480px) {
    .grid-container {
        grid-template-columns: 1fr;
    }
}

/* 调整三个卡片的高度 */
.topic-area:not(.grid-area) .topic-card {
    height: 335px;  /* 进一步减小高度以减少空白 */
    overflow: hidden;
}

/* 删除之前为对齐添加的额外边距规则 */
/* .topic-area:not(.grid-area) {
    margin-top: 1px;  微调顶部对齐 
} */
