/* --------------------------------------------------
 * 核心设计系统与全局变量
 * -------------------------------------------------- */
:root {
    --bg-main: #060814;
    --bg-card: rgba(18, 22, 43, 0.65);
    --bg-drawer: #0c0f24;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-color-glow: rgba(0, 240, 255, 0.2);
    
    /* 渐变与主题色 */
    --accent-glow: linear-gradient(135deg, #00f0ff 0%, #8a2be2 100%);
    --color-primary: #00f0ff;
    --color-secondary: #a355ff;
    --color-text-main: #f0f3fa;
    --color-text-sub: #8fa0c4;
    
    /* 情绪色板 */
    --color-bullish: #00ff87;
    --color-bearish: #ff2d55;
    --color-neutral: #8fa0c4;
    --color-mixed: #ffb700;

    /* 字体族 */
    --font-english: 'Outfit', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-chinese: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;

    /* 全面屏安全区域支持 */
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* --------------------------------------------------
 * 基础样式重置
 * -------------------------------------------------- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent; /* 移除移动端点击高亮框 */
}

body {
    background-color: var(--bg-main);
    color: var(--color-text-main);
    font-family: var(--font-chinese);
    font-size: 15px;
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

/* 隐藏滚动条但保留滚动功能 */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

/* --------------------------------------------------
 * 背景流光装饰 (Premium Glow Effect)
 * -------------------------------------------------- */
.glow-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.glow-circle {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.15;
    mix-blend-mode: screen;
}

.glow-1 {
    width: 300px;
    height: 300px;
    background: #00f0ff;
    top: -50px;
    right: -50px;
    animation: floatGlow 12s ease-in-out infinite alternate;
}

.glow-2 {
    width: 350px;
    height: 350px;
    background: #8a2be2;
    bottom: 10%;
    left: -100px;
    animation: floatGlow 16s ease-in-out infinite alternate-reverse;
}

@keyframes floatGlow {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(40px, 30px) scale(1.15); }
}

/* --------------------------------------------------
 * 头部设计
 * -------------------------------------------------- */
.app-header {
    padding: calc(16px + var(--safe-top)) 20px 16px 20px;
    background: rgba(6, 8, 20, 0.85);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 10;
}

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

.logo-icon {
    font-size: 20px;
}

.brand h1 {
    font-family: var(--font-english);
    font-size: 20px;
    font-weight: 700;
    background: var(--accent-glow);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    font-size: 11px;
    color: var(--color-text-sub);
    margin-top: 2px;
    letter-spacing: 0.5px;
}

/* --------------------------------------------------
 * 搜索和过滤控制台
 * -------------------------------------------------- */
.app-container {
    padding: 16px 16px calc(24px + var(--safe-bottom)) 16px;
}

.search-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.search-bar-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 14px;
    font-size: 16px;
    opacity: 0.6;
}

#search-input {
    width: 100%;
    padding: 12px 40px 12px 40px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.04);
    color: var(--color-text-main);
    font-size: 14px;
    font-family: var(--font-chinese);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    outline: none;
}

#search-input:focus {
    border-color: var(--color-primary);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.15);
}

.clear-btn {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: var(--color-text-sub);
    font-size: 14px;
    cursor: pointer;
    padding: 4px;
}

/* 热门股票标签样式 */
.trending-tags-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
}

.trending-tags-wrapper::-webkit-scrollbar {
    display: none; /* 隐藏过滤区的滚动条 */
}

.tag-title {
    font-size: 12px;
    color: var(--color-text-sub);
    white-space: nowrap;
}

.hot-stocks-tags {
    display: flex;
    gap: 6px;
}

.stock-tag {
    font-family: var(--font-english);
    font-size: 12px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--color-text-sub);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.stock-tag:active, .stock-tag.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #000;
    font-weight: 600;
    box-shadow: 0 0 8px rgba(0, 240, 255, 0.4);
}

/* --------------------------------------------------
 * 加载器动画
 * -------------------------------------------------- */
.loader-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 0;
    gap: 16px;
    color: var(--color-text-sub);
    font-size: 13px;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255, 255, 255, 0.05);
    border-top: 3px solid var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* --------------------------------------------------
 * 博主卡片网格
 * -------------------------------------------------- */
.bloggers-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.blogger-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

/* 针对手机端长按或点击有微弱压下反馈 */
.blogger-card:active {
    transform: scale(0.98);
    border-color: var(--border-color-glow);
    box-shadow: 0 4px 15px rgba(0, 240, 255, 0.05);
}

.blogger-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar-wrapper {
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.1) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.avatar-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
    font-family: var(--font-english);
    font-size: 16px;
    background: var(--accent-glow);
}

.blogger-info-box {
    flex: 1;
    min-width: 0;
}

.blogger-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.blogger-display-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tweets-count-badge {
    font-family: var(--font-english);
    font-size: 11px;
    font-weight: 500;
    color: var(--color-text-sub);
    background: rgba(255, 255, 255, 0.06);
    padding: 2px 6px;
    border-radius: 6px;
    white-space: nowrap;
}

.blogger-handle-name {
    font-family: var(--font-english);
    font-size: 13px;
    color: var(--color-text-sub);
    margin-top: 1px;
}

/* 卡片中主要提及股票模块 */
.card-mentions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.mention-label {
    font-size: 11px;
    color: var(--color-text-sub);
    margin-right: 2px;
}

.stock-badge-mini {
    font-family: var(--font-english);
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: var(--color-text-main);
}

/* 卡片中的摘要段落预览 */
.summary-preview {
    font-size: 13px;
    color: var(--color-text-sub);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    border-left: 2px solid var(--color-secondary);
    padding-left: 10px;
    margin-top: 2px;
}

/* --------------------------------------------------
 * 移动端抽屉组件 (Detail Drawer)
 * -------------------------------------------------- */
.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(3, 4, 10, 0.6);
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    transition: opacity 0.38s cubic-bezier(0.32, 0.94, 0.6, 1),
                backdrop-filter 0.38s cubic-bezier(0.32, 0.94, 0.6, 1);
}

.drawer-overlay.active {
    opacity: 1;
    pointer-events: auto;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.drawer-content {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 88vh; /* 手机端拉起，占大部分高度 */
    background-color: var(--bg-drawer);
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px 24px 0 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(100%);
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
    transition: transform 0.38s cubic-bezier(0.32, 0.94, 0.6, 1);
}

.drawer-overlay.active .drawer-content {
    transform: translateY(0);
}

/* 顶部拖动条设计 */
.drawer-handle-bar {
    width: 100%;
    height: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding-top: 6px;
    cursor: grab;
}

.handle-indicator {
    width: 40px;
    height: 4px;
    background-color: rgba(255, 255, 255, 0.18);
    border-radius: 2px;
}

/* 抽屉头部 */
.drawer-header {
    padding: 4px 18px 16px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.back-btn {
    align-self: flex-start;
    background: none;
    border: none;
    color: var(--color-primary);
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    padding: 4px 0;
}

.arrow-icon {
    font-size: 14px;
}

.drawer-header .blogger-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.drawer-header .avatar-wrapper {
    width: 44px;
    height: 44px;
}

.drawer-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-text-main);
}

.twitter-handle {
    font-family: var(--font-english);
    font-size: 12px;
    color: var(--color-text-sub);
}

/* 抽屉内容滚动区域 */
.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    -webkit-overflow-scrolling: touch; /* 顺滑的iOS回弹效果 */
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-main);
    margin-bottom: 10px;
    letter-spacing: 0.5px;
}

/* --------------------------------------------------
 * 画像总结卡片与 Markdown 样式
 * -------------------------------------------------- */
.summary-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 16px 20px;
    font-size: 14.5px;
    color: var(--color-text-sub);
    box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.01);
}

/* 解析总结渲染的 Markdown 美化 */
.markdown-body h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-primary);
    margin-top: 20px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.markdown-body h3::before {
    content: "";
    display: inline-block;
    width: 3px;
    height: 12px;
    background-color: var(--color-primary);
    border-radius: 2px;
}

.markdown-body h3:first-of-type {
    margin-top: 0;
}

.markdown-body p {
    margin-bottom: 14px;
    line-height: 1.7;
    font-size: 14.5px;
    color: #e2e8f0;
}

.markdown-body ul {
    list-style: none;
    margin-bottom: 14px;
}

.markdown-body li {
    position: relative;
    padding-left: 20px;
    margin-bottom: 10px;
    line-height: 1.65;
    font-size: 14px;
    color: #f1f5f9;
}

.markdown-body li::before {
    content: "•";
    position: absolute;
    left: 4px;
    color: var(--color-secondary);
    font-weight: bold;
}

.markdown-body strong {
    color: #fff;
    font-weight: 600;
}

/* --------------------------------------------------
 * 推文列表区
 * -------------------------------------------------- */
.tweets-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 8px;
}

.tweets-header .section-title {
    margin-bottom: 0;
}

/* 对照切换开关 */
.toggle-lang-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
}

.toggle-label {
    font-size: 11px;
    color: var(--color-text-sub);
}

.switch {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 18px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .3s;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.slider:before {
    position: absolute;
    content: "";
    height: 12px;
    width: 12px;
    left: 2px;
    bottom: 2px;
    background-color: var(--color-text-sub);
    transition: .3s;
}

input:checked + .slider {
    background-color: rgba(0, 240, 255, 0.15);
    border-color: var(--color-primary);
}

input:checked + .slider:before {
    transform: translateX(16px);
    background-color: var(--color-primary);
}

.slider.round {
    border-radius: 18px;
}

.slider.round:before {
    border-radius: 50%;
}

.tweet-bubble {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    transition: background-color 0.2s ease;
}

/* 标注转推样式 */
.tweet-retweet-banner {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: var(--color-text-sub);
    opacity: 0.7;
}

.retweet-icon {
    font-size: 11px;
}

.tweet-content-zh {
    font-size: 15.5px;
    line-height: 1.6;
    color: #ffffff;
    font-weight: 500;
}

.tweet-content-en {
    font-family: var(--font-english);
    font-size: 13px;
    line-height: 1.55;
    color: var(--color-text-sub);
    padding-top: 8px;
    margin-top: 8px;
    border-top: 1px dashed rgba(255, 255, 255, 0.08);
}

/* 提及个股高亮标识 */
.tweet-cashtags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.cashtag-link {
    font-family: var(--font-english);
    font-size: 11px;
    font-weight: 600;
    color: var(--color-primary);
    background: rgba(0, 240, 255, 0.06);
    padding: 1px 6px;
    border-radius: 4px;
    border: 1px solid rgba(0, 240, 255, 0.08);
}

/* 底部元数据栏 */
.tweet-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 10.5px;
    color: var(--color-text-sub);
    margin-top: 2px;
}

.tweet-date {
    font-family: var(--font-english);
}

.tweet-stats {
    display: flex;
    gap: 10px;
    font-family: var(--font-english);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 3px;
}

/* --------------------------------------------------
 * 提示通知组件 (Toast)
 * -------------------------------------------------- */
.toast-notify {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translate(-50%, 30px);
    background: rgba(12, 15, 36, 0.9);
    border: 1px solid var(--color-primary);
    box-shadow: 0 4px 20px rgba(0, 240, 255, 0.2);
    color: var(--color-text-main);
    padding: 10px 18px;
    border-radius: 20px;
    font-size: 12px;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast-notify.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* --------------------------------------------------
 * 选项卡 Tabs 样式
 * -------------------------------------------------- */
.drawer-tabs {
    display: flex;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 3px;
    margin-top: 4px;
}

.drawer-tab {
    flex: 1;
    background: none;
    border: none;
    color: var(--color-text-sub);
    padding: 8px 12px;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
}

.drawer-tab.active {
    background: rgba(0, 240, 255, 0.1);
    color: var(--color-primary);
    box-shadow: 0 2px 10px rgba(0, 240, 255, 0.1);
}

.tab-content {
    display: none;
    flex-direction: column;
    gap: 16px;
}

.tab-content.active {
    display: flex;
}
