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

/* 基础样式设置 */
:root {
    --bg-primary: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    --bg-secondary: rgba(30, 41, 59, 0.8);
    --bg-card: rgba(30, 41, 59, 0.6);
    --bg-card-hover: rgba(30, 41, 59, 0.8);
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --accent-blue: #3b82f6;
    --accent-blue-hover: #2563eb;
    --success-green: #ef4444; /* **修改：将绿色 #10b981 替换为红色 #ef4444** */
    --danger-red: #10b981;    /* **修改：将红色 #ef4444 替换为绿色 #10b981** */
    --neutral-gray: #64748b;
    --border-radius: 16px;
    --border-radius-sm: 12px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    --border-color: rgba(51, 65, 85, 0.3);
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --glow-effect: none;
}

/* --- 极简白主题 (White) --- */
[data-theme="light"] {
    --bg-primary: #f1f5f9;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f8fafc;
    --text-primary: #1e293b; /* 深色字 */
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --accent-blue: #2563eb; /* 更深的蓝 */
    --accent-blue-hover: #1d4ed8;
    --success-green: #dc2626; /* 鲜艳红 */
    --danger-red: #16a34a;    /* 鲜艳绿 */
    --neutral-gray: #64748b;
    --border-color: #e2e8f0;
    --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    --glow-effect: none;
}

/* --- 赛博朋克主题 (Cyberpunk) --- */
[data-theme="cyberpunk"] {
    --bg-primary: linear-gradient(135deg, #050505 0%, #1a0b2e 100%); /* 深黑紫背景 */
    --bg-secondary: rgba(0, 0, 0, 0.8);
    --bg-card: rgba(20, 20, 30, 0.6);
    --bg-card-hover: rgba(40, 40, 50, 0.8);
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent-blue: #00f3ff; /* 霓虹青 */
    --accent-blue-hover: #00c2cc;
    --success-green: #ff0055; /* 霓虹红/洋红 */
    --danger-red: #00ff9f;    /* 霓虹毒液绿 */
    --neutral-gray: #64748b;
    --border-color: rgba(0, 243, 255, 0.2); /* 青色边框 */
    --card-shadow: 0 0 10px rgba(0, 243, 255, 0.1);
    --glow-effect: 0 0 5px currentColor;
}

/* --- 针对赛博朋克的特殊样式修正 --- */
[data-theme="cyberpunk"] .stock-card {
    border: 1px solid var(--border-color);
    box-shadow: var(--card-shadow);
}
[data-theme="cyberpunk"] .stock-card:hover {
    box-shadow: 0 0 15px var(--accent-blue); /* 悬停发光 */
    border-color: var(--accent-blue);
}
/* 让赛博朋克模式下的涨跌幅自带发光 */
[data-theme="cyberpunk"] .price-change.positive {
    background: rgba(255, 0, 85, 0.1);
    border-color: var(--success-green);
    box-shadow: 0 0 5px var(--success-green);
    color: var(--success-green);
}
[data-theme="cyberpunk"] .price-change.negative {
    background: rgba(0, 255, 159, 0.1);
    border-color: var(--danger-red);
    box-shadow: 0 0 5px var(--danger-red);
    color: var(--danger-red);
}

/* --- 猛男粉 (Macho Pink) - 黑粉硬核风 --- */
[data-theme="pink"] {
    --bg-primary: linear-gradient(135deg, #180505 0%, #2b0816 100%);
    --bg-secondary: rgba(40, 10, 20, 0.8);
    --bg-card: rgba(40, 10, 20, 0.6);
    --bg-card-hover: rgba(60, 20, 40, 0.8);
    --text-primary: #ffe0e9;
    --text-secondary: #ffb3c6;
    --text-muted: #9d5b6b;
    --accent-blue: #ff007f; /* 核心：热粉色代替蓝色 */
    --accent-blue-hover: #e60073;
    --success-green: #ff3333;
    --danger-red: #00ffaa;
    --border-color: rgba(255, 0, 127, 0.3);
    --card-shadow: 0 4px 12px rgba(255, 0, 127, 0.15);
    --glow-effect: none;
}

/* --- 可爱风 (Cute) - 软萌圆润风 --- */
[data-theme="cute"] {
    --bg-primary: #fff0f5; /* 薰衣草腮红底色 */
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #fff9fb;
    --text-primary: #5d5d5d; /* 柔和深灰 */
    --text-secondary: #8b8b8b;
    --text-muted: #b4b4b4;
    --accent-blue: #ff9eb5; /* 嫩粉色 */
    --accent-blue-hover: #ff8fa8;
    --success-green: #ff6b6b; /* 马卡龙红 */
    --danger-red: #74c69d;    /* 马卡龙绿 */
    --border-color: #ffe4e1;
    --card-shadow: 0 4px 15px rgba(255, 182, 193, 0.2);
    --border-radius: 24px;    /* **超大圆角** */
    --border-radius-sm: 16px;
    --glow-effect: none;
}

/* --- 设置页面的主题选择器样式 --- */
.theme-grid {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}
.theme-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}
.theme-preview {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    box-shadow: var(--shadow-md);
    transition: transform 0.2s;
}
.theme-option:hover .theme-preview {
    transform: scale(1.1);
    border-color: var(--accent-blue);
}
.theme-default { background: linear-gradient(135deg, #0f172a, #1e293b); }
.theme-light { background: #f1f5f9; border: 1px solid #ccc; }
.theme-cyberpunk {
    background: linear-gradient(135deg, #000, #2a0a3d);
    border: 2px solid #00f3ff;
    box-shadow: 0 0 10px #00f3ff;
}
.theme-pink {
    background: linear-gradient(135deg, #180505, #ff007f);
    border: 2px solid #ff007f;
}
.theme-cute {
    background: #fff0f5;
    border: 4px solid #ff9eb5; /* 边框粗一点显得可爱 */
}

/* 全局样式 */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

/* 主容器 */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 100%;
    margin: 0 auto;
}

/* 头部样式 */
.header {
    padding: 1rem 1.5rem;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(51, 65, 85, 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
}

.header-left {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.date-info {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 400;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-title h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    margin: 0;
}

/* 顶部导航样式 */
.top-nav {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.top-nav .nav-item {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    padding: 0.5rem 0;
    position: relative;
}

.top-nav .nav-item:hover {
    color: var(--text-primary);
}

.top-nav .nav-item.active {
    color: var(--accent-blue);
}

.top-nav .nav-item.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent-blue);
    border-radius: 2px;
}

/* 主要内容区域 */
.main-content {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    /* 调整底部边距，以适应更高的底部行情栏 (80px + 20px 间距) */
    padding-bottom: 100px; /* **关键修改：将 90px 增加到 100px** */
}

/* 导航栏搜索按钮 - 优化版 */
.nav-icon-btn {
    background: rgba(255, 255, 255, 0.05); /* 微微的透明背景 */
    border: 1px solid rgba(255, 255, 255, 0.1); /* 极细的边框 */
    border-radius: 50%; /* 正圆形 */
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(4px);
    margin-left: 0.5rem;
}

/* 悬停效果 */
.nav-icon-btn:hover {
    background: var(--accent-blue); /* 悬停变蓝 */
    border-color: var(--accent-blue);
    color: #ffffff;
    transform: translateY(-1px); /* 微微上浮 */
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3); /* 蓝色光晕 */
}

/* 点击/激活效果 */
.nav-icon-btn:active {
    transform: translateY(0) scale(0.95); /* 按压微缩 */
}

/* 确保 SVG 图标颜色跟随文字颜色 */
.nav-icon-btn svg {
    stroke: currentColor;
    width: 18px;
    height: 18px;
}

/* 默认隐藏搜索区域 */
.add-stock-section {
    display: none;
    position: absolute; /* 悬浮在内容上方 */
    top: 60px; /* header 高度 */
    left: 0;
    right: 0;
    z-index: 999;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(51, 65, 85, 0.3);
    animation: slideDown 0.2s ease-out;
}

/* 激活时显示 */
.add-stock-section.active {
    display: block;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.add-stock-input-wrapper {
    display: flex;
    gap: 0.75rem;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(51, 65, 85, 0.3);
    border-radius: var(--border-radius);
    padding: 0.5rem;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
}

.add-stock-input-wrapper:focus-within {
    box-shadow: var(--shadow-lg), 0 0 0 3px rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.5);
}

.stock-input {
    flex: 1;
    padding: 0.875rem 1rem;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-fast);
}

.stock-input::placeholder {
    color: var(--text-muted);
}

.add-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.25rem;
    background: var(--accent-blue);
    color: white;
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-sm);
}

.add-btn:hover {
    background: var(--accent-blue-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.add-btn:active {
    transform: translateY(0);
}

.add-icon {
    font-size: 1.125rem;
    font-weight: 700;
}

/* 视图切换按钮组 */
.view-toggle {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    justify-content: flex-end;
}

.view-btn {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(51, 65, 85, 0.3);
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.view-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.view-btn.active {
    background: var(--accent-blue);
    color: white;
    border-color: var(--accent-blue);
}

.view-icon {
    font-size: 1rem;
}

.view-text {
    font-size: 0.75rem;
}

/* 股票列表容器 */
.stock-list-container {
    flex: 1;
}

.stock-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.75rem;
    padding: 0.5rem 0;
}

/* 列表模式样式 */
.stock-list.list-view {
    grid-template-columns: 1fr !important;
}

.stock-list.list-view .stock-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    margin-bottom: 0.25rem;
    height: auto;
    min-height: 60px;
}

.stock-list.list-view .stock-card-content {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 1rem;
}

.stock-list.list-view .stock-info {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
}

.stock-list.list-view .stock-name {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    text-align: left;
    flex: 1;
}

.stock-list.list-view .stock-price-section {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1rem;
}

.stock-list.list-view .current-price {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
    min-width: 80px;
    text-align: right;
}

.stock-list.list-view .price-change {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.125rem;
    padding: 0.5rem 0.75rem;
    min-width: 80px;
}

.stock-list.list-view .change-amount {
    font-size: 0.875rem;
}

.stock-list.list-view .change-percent {
    font-size: 0.75rem;
}

/* 股票卡片样式 */
.stock-card {
    background: var(--bg-card);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(51, 65, 85, 0.3);
    border-radius: var(--border-radius);
    padding: 0.75rem;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
    cursor: pointer;
    animation: fadeInUp 0.5s ease-out;
    position: relative;
    overflow: hidden;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.stock-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-blue), var(--success-green));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--transition-normal);
}

.stock-card:hover {
    background: var(--bg-card-hover);
    box-shadow: var(--shadow-xl);
    transform: translateY(-2px);
}

.stock-card:hover::before {
    transform: scaleX(1);
}

.stock-card-content {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    gap: 0.75rem;
}

.stock-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

/* 删除股票代码样式，只保留股票名称 */
.stock-name {
    font-size: 1rem; /* 加大字体 */
    font-weight: 600; /* 加粗 */
    color: var(--text-primary);
    line-height: 1.3;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stock-price-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.current-price {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.price-change {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.125rem;
    font-weight: 600;
    padding: 0.375rem 0.5rem;
    border-radius: 8px;
    transition: all var(--transition-fast);
    width: 100%;
    text-align: center;
}

.change-amount {
    font-size: 0.875rem;
    font-weight: 700;
}

.change-percent {
    font-size: 0.75rem;
    opacity: 0.9;
}

.price-change.positive {
    /* 涨红 */
    color: var(--success-green);
    background: rgba(239, 68, 68, 0.15); /* 对应红色透明背景 */
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.price-change.negative {
    /* 跌绿 */
    color: var(--danger-red);
    /* **关键修改：降低背景透明度，使其不那么显眼** */
    background: rgba(16, 185, 129, 0.05); /* 原来是 0.15，改为 0.05 */
    border: 1px solid rgba(16, 185, 129, 0.3); /* 边框不变，保持清晰度 */
}

.price-change.neutral {
    color: var(--neutral-gray);
    background: rgba(100, 116, 139, 0.15);
    border: 1px solid rgba(100, 116, 139, 0.3);
}

/* 骨架屏样式 */
.skeleton-card {
    background: var(--bg-card);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(51, 65, 85, 0.3);
    border-radius: var(--border-radius);
    padding: 0.75rem;
    box-shadow: var(--shadow-md);
    animation: pulse 1.5s infinite ease-in-out;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.skeleton-content {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    gap: 0.75rem;
}

.skeleton-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
}

/* 删除股票代码骨架，只保留名称 */
.skeleton-name {
    width: 80px;
    height: 16px; /* 加大高度匹配新字体大小 */
    background: rgba(100, 116, 139, 0.3);
    border-radius: 6px;
    animation: pulse 1.5s infinite ease-in-out;
}

.skeleton-price {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.skeleton-current-price {
    width: 60px;
    height: 16px;
    background: rgba(100, 116, 139, 0.3);
    border-radius: 6px;
    animation: pulse 1.5s infinite ease-in-out;
    animation-delay: 0.2s;
}

.skeleton-change {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    width: 100%;
}

.skeleton-change-amount {
    width: 50px;
    height: 14px;
    background: rgba(100, 116, 139, 0.2);
    border-radius: 5px;
    animation: pulse 1.5s infinite ease-in-out;
    animation-delay: 0.4s;
}

.skeleton-change-percent {
    width: 40px;
    height: 12px;
    background: rgba(100, 116, 139, 0.2);
    border-radius: 5px;
    animation: pulse 1.5s infinite ease-in-out;
    animation-delay: 0.6s;
}

/* --- 底部跑马灯样式 --- */
.market-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(15px);
    border-top: 1px solid rgba(51, 65, 85, 0.3);
    padding: 0; /* 移除内边距，由内部控制 */
    z-index: 100;
    height: 80px; /* **保持 80px 高度** */
    display: flex;
    align-items: center; /* 垂直居中 */
    overflow: hidden; /* 隐藏超出部分 */
}

/* 确保包裹层也拉伸到 100% 高度 */
.marquee-wrapper {
    width: 100%;
    overflow: hidden;
    position: relative;
    height: 100%; /* **关键修改：确保跑马灯包裹层拉伸高度** */
    display: flex; /* **新增：使用 flex 帮助内部轨道垂直居中** */
    align-items: center; /* **新增：让跑马灯轨道在 80px 高度中居中** */
    mask-image: linear-gradient(to right, transparent, black 5%, black 95%, transparent); /* 两侧渐隐效果 */
    -webkit-mask-image: linear-gradient(to right, transparent, black 5%, black 95%, transparent);
}

.marquee-track {
    display: flex;
    gap: 2rem; /* 指数之间的间距 */
    white-space: nowrap;
    width: max-content; /* 宽度由内容决定 */
    padding-left: 100%; /* 初始位置从右侧开始 */
    /* 移除这里的 animation 定义 */
}

/* **新增：仅对需要滚动的轨道应用动画** */
.marquee-track.active-marquee {
    animation: marquee-scroll 40s linear infinite;
}

/* 鼠标悬停时暂停动画 */
/* **关键修改：使用 !important 提高优先级，确保覆盖所有可能的冲突** */
.marquee-track.active-marquee:hover {
    animation-play-state: paused !important;
}

.market-card {
    /* 重写原有样式，适应跑马灯 */
    flex-shrink: 0; /* 防止被压缩 */
    display: flex;
    align-items: center; /* 横向排列 */
    gap: 0.75rem;
    padding: 0.5rem 0.5rem; /* 保持内边距 */
    border-right: none;
    border-left: 3px solid transparent;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    border: 1px solid rgba(51, 65, 85, 0.3);
    transition: all 0.2s ease;
    min-width: 180px;
    height: 60px; /* **新增：固定卡片高度，使其在 80px 中有更多垂直空间** */
}

.market-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--accent-blue);
    transform: translateY(-1px);
}

.market-info {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

/* 稍微调整文字布局适应横向 */
.market-card .market-data {
    /* 保持原来的 flex 属性 */
    display: flex;
    align-items: center; /* 确保数据行垂直居中 */
    gap: 0.5rem;
}

/* 调整指数名称的垂直对齐 */
.market-name {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    /* **新增：设置行高，确保名称占用足够空间** */
    line-height: 1.2;
}

.market-value {
    font-size: 0.875rem;
    color: var(--text-primary);
    font-weight: 600;
}

.market-change {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.125rem 0.375rem;
    border-radius: 6px;
    align-self: flex-start;
}

.market-change.positive {
    /* 涨红 */
    color: var(--success-green);
    background: rgba(239, 68, 68, 0.1);
}

.market-change.negative {
    /* 跌绿 */
    color: var(--danger-red);
    background: rgba(16, 185, 129, 0.1);
}

@keyframes marquee-scroll {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%); /* 移动一半（因为我们会复制一份数据做无缝循环） */
    }
}

.loading-indices {
    color: var(--text-muted);
    font-size: 0.8rem;
    padding: 0 1rem;
}

/* --- 设置界面样式 --- */
.settings-view {
    padding: 1rem;
    max-width: 800px;
    margin: 0 auto;
}

.settings-card {
    background: var(--bg-card);
    border: 1px solid rgba(51, 65, 85, 0.3);
    border-radius: var(--border-radius);
    padding: 1.5rem;
}

.settings-card h3 {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.settings-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.index-options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.index-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(51, 65, 85, 0.3);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.index-option:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--accent-blue);
}

/* 离线数据库卡片样式 */
.database-info {
    margin-bottom: 1.5rem;
}

.info-item {
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
}

.info-label {
    color: var(--text-muted);
    margin-right: 0.5rem;
    font-size: 0.9rem;
}

.info-value {
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.9rem;
    user-select: none;
    width: 100%;
}

.checkbox-label input[type="checkbox"] {
    accent-color: var(--accent-blue);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.settings-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(51, 65, 85, 0.3);
}

.save-btn {
    background: var(--accent-blue);
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.save-btn:hover {
    background: var(--accent-blue-hover);
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(51, 65, 85, 0.3);
    border-radius: var(--border-radius);
    padding: 0;
    width: 90%;
    max-width: 400px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.3s ease;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.modal-body {
    padding: 1.5rem;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(51, 65, 85, 0.3);
}

.modal-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.modal-title-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.close-modal {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    padding: 0.25rem;
    line-height: 1;
}

.close-modal:hover {
    color: var(--text-primary);
    transform: rotate(90deg);
}

.modal-body {
    padding: 1.5rem;
}

.modal-stock-info {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.modal-stock-code {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}

.modal-stock-price {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(51, 65, 85, 0.3);
}

.modal-current-price {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-price-change {
    font-size: 1rem;
    font-weight: 600;
    padding: 0.375rem 0.75rem;
    border-radius: 8px;
    align-self: flex-start;
}

.modal-stock-details {
    /* **关键修改：使用 Grid 实现两列布局** */
    display: grid;
    /* 每行两列，每列宽度相等 */
    grid-template-columns: 1fr 1fr;
    /* 行间距和列间距 */
    gap: 0.75rem;
    
    /* 移除之前 app.js 中添加的 display: flex; flex-direction: column; */
    /* 保持原来的 vertical-gap */
}

/* 关键修改：调整每个详情项的样式 */
.detail-item {
    display: flex;
    flex-direction: column; /* 标签和值垂直排列 */
    align-items: flex-start; /* 左对齐 */
    padding: 0.75rem 0.875rem; /* 调整内边距 */
    background: rgba(51, 65, 85, 0.2);
    border-radius: var(--border-radius-sm);
    gap: 0.25rem; /* 标签和值之间的间距 */
    /* **新增：确保高度一致，防止错位** */
    min-height: 55px;
}

.detail-label {
    font-size: 0.75rem; /* 减小标签字体 */
    color: var(--text-muted);
    font-weight: 500;
}

.detail-value {
    font-size: 0.9375rem; /* 稍微放大值字体 */
    color: var(--text-primary);
    font-weight: 600;
    /* 确保值文本不会被截断 */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.modal-footer {
    display: flex;
    padding: 1rem 1.5rem 1.5rem;
    justify-content: flex-end;
    gap: 0.75rem;
    border-top: 1px solid rgba(51, 65, 85, 0.3);
}

.delete-stock-btn {
    padding: 0.75rem 1.25rem;
    background: var(--danger-red);
    color: white;
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-sm);
}

.delete-stock-btn:hover {
    background: #dc2626;
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.delete-stock-btn:active {
    transform: translateY(0);
}

/* 空状态样式 */
.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 3rem 1rem;
    font-size: 1rem;
    font-weight: 500;
}

/* 状态指示器样式 */
.status-indicator {
    display: inline-block;
    font-size: 1.25rem;
    margin-left: 0.5rem;
    vertical-align: middle;
    animation: pulse 2s infinite;
    cursor: help;
}

/* 呼吸灯动画 */
@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.7;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* 无价格状态样式 */
.current-price.no-price {
    color: var(--text-muted);
    font-style: italic;
    font-size: 1rem;
}

/* 日期信息样式调整 */
.date-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* 动画定义 */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* 响应式设计：平板及以下 (宽度 ≤ 768px) */ 
@media (max-width: 768px) { 
    .header { 
        padding: 1rem; 
    } 
    
    .main-content { 
        padding: 1rem; 
    } 
    
    .header-title h1 { 
        font-size: 1.5rem; 
    } 
    
    /* 股票卡片：平板上可以保持卡片视图，但间距更小 */ 
    .stock-card { 
        padding: 0.75rem; 
    } 
    
    /* 股票列表：平板上调整卡片视图的列数，使其更紧凑 */ 
    .stock-list:not(.list-view) { 
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); /* 保证每行至少 4-5 个卡片 */ 
        gap: 0.75rem; 
    } 
    
    /* 模态框：平板上可更大 */ 
    .modal-content { 
        width: 85%; 
        max-width: 600px; 
        margin: 1rem; 
    } 
    
    /* 模态框详情：在平板上维持两列布局，但调整间距 */ 
    .modal-stock-details { 
        grid-template-columns: 1fr 1fr; 
        gap: 0.75rem; 
    } 

    /* 资讯卡片：调整内边距 */ 
    .news-card { 
        padding: 1rem; 
    } 

    /* 设置界面的 Grid 布局调整 */ 
    .index-options-grid { 
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); 
    } 
    
    /* 底部跑马灯：保持高度，但确保内容不溢出 */ 
    .market-footer { 
        height: 80px; /* 保持与桌面一致 */ 
    } 
    .main-content { 
        padding-bottom: 100px; 
    } 
}

/* 响应式设计：手机及以下 (宽度 ≤ 480px) */ 
@media (max-width: 480px) { 
    /* 头部优化：导航栏使用更小的图标按钮，标题可以靠左 */ 
    .header { 
        padding: 0.75rem 1rem; 
    } 
    
    .header-left { 
        gap: 0.125rem; 
    } 
    
    .header-title h1 { 
        font-size: 1.3rem; 
    } 
    
    /* 顶部导航：使用更小的图标/文字 */ 
    .top-nav { 
        gap: 0.75rem; 
    } 
    
    .top-nav .nav-item { 
        font-size: 0.875rem; 
        padding: 0.5rem 0; 
    } 
    
    /* 搜索/添加区域：改为垂直堆叠 */ 
    .add-stock-input-wrapper { 
        flex-direction: column; 
        padding: 0.75rem; 
        gap: 0.5rem; 
    } 
    
    .add-btn { 
        justify-content: center; 
        padding: 0.6rem 1rem; 
        font-size: 1rem; 
    } 
    
    /* 股票列表：卡片视图强制为两列 */ 
    .stock-list:not(.list-view) { 
        grid-template-columns: 1fr 1fr; /* 手机上固定为两列，确保卡片足够大 */ 
        gap: 0.5rem; 
    } 

    /* 列表视图：保持单列，但优化内边距 */ 
    .stock-list.list-view .stock-card { 
        padding: 0.5rem 0.75rem; 
    } 

    /* 1. 进一步缩小模态框，让它看起来不像全屏 */ 
    .modal-content { 
        width: 85% !important;  /* 改为 85% */ 
        max-width: 350px;       /* 限制最大宽度 */ 
        margin: 0 auto; 
    }

    /* 2. 确保数据是一行两个 */ 
    .modal-stock-details { 
        display: grid; 
        grid-template-columns: 1fr 1fr !important; /* 强制两列 */ 
        gap: 0.5rem; 
    } 

    /* 3. 优化内部小卡片的内边距，防止太挤 */ 
    .detail-item { 
        padding: 0.5rem; /* 桌面端是 0.75rem，手机端改小一点 */ 
        min-height: 50px; /* 高度也稍微改小 */ 
    }

    /* 优化 Tab 容器：减小间隙，允许填满 */ 
    .modal-tabs { 
        gap: 2px !important;            /* 间距改得很小 */ 
        justify-content: space-between; /* 两端对齐 */ 
        overflow-x: hidden;             /* 禁止左右滚动 */ 
    }

    /* 优化 Tab 按钮：变紧凑，字体变小，自动平分宽度 */ 
    .modal-tab-item { 
        padding: 6px 2px !important;   /* 左右内边距几乎去掉 */ 
        font-size: 12px !important;    /* 字体稍微改小，确保放得下 */ 
        flex: 1;                       /* 大家平分空间 */ 
        text-align: center;            /* 文字居中 */ 
        min-width: auto !important;    /* 取消最小宽度限制 */ 
    }

    /* 设置界面的 Grid 布局调整 */ 
            .index-options-grid {
                grid-template-columns: 1fr 1fr; /* 手机上改为两列 */
                gap: 0.5rem;
            } 
    
    /* 资讯视图：调整 Tab 大小 */ 
    .news-tab-item { 
        padding: 0.6rem 0.5rem; 
        font-size: 0.875rem; 
    }
    
    /* 优化主题选择：手机上一行显示5个 */ 
    .theme-grid { 
        flex-wrap: nowrap !important;   /* 强制一行 */ 
        gap: 4px !important;            /* 间距极小 */ 
        justify-content: space-between; /* 撑满一行 */
    }
    
    /* --- 底部跑马灯优化 (手机) --- */
    
    /* 1. 调整跑马灯轨道（marquee-track）和卡片（.market-card）应用更小的间距 */
    .marquee-track {
        gap: 1rem !important; /* 原来是 2rem，改为 1rem，减少卡片之间的间距 */
    }
    
    /* 2. 调整跑马灯卡片（market-card）的内边距和最小宽度，使其更紧凑 */
    .market-footer .market-card {
        min-width: 140px !important; /* 原来是 180px，减小最小宽度 */
        padding: 0.5rem !important; /* 减小内边距 */
        gap: 0.5rem !important;
    }
    
    /* 3. 调整指数名称和数据字体大小，以适应更小的卡片 */
    .market-footer .market-card .market-name {
        font-size: 0.7rem !important;
    }
    
    .market-footer .market-card .market-value {
        font-size: 0.8rem !important;
    }
    
    .market-footer .market-card .market-change {
        font-size: 0.65rem !important;
    }

    .theme-option { 
        flex: 1;        /* 平分宽度 */ 
        min-width: 0;   /* 允许被压缩 */ 
        padding: 0;     /* 去掉多余内边距 */ 
    }

    .theme-preview { 
        width: 40px !important;   /* 圆圈变小 (原60px) */ 
        height: 40px !important; 
        margin: 0 auto;           /* 居中 */ 
    }

    .theme-option span { 
        font-size: 10px !important; /* 文字变小 */ 
        transform: scale(0.9);      /* 再稍微缩一点以防换行 */ 
        white-space: nowrap;        /* 禁止换行 */ 
    }
    
    /* 底部跑马灯：为了简洁，可以考虑降低高度（可选） */ 
    .market-footer { 
        height: 70px; /* **修改：将 60px 增加到 70px** */ 
    } 
    .main-content { 
        padding-bottom: 90px; /* **修改：将 80px 增加到 90px** */ 
    } 
}

/* 资讯功能样式 */
.news-view {
    width: 100%;
    height: 100%;
}

/* 顶部 Tab 切换栏 */
.news-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    background: var(--bg-card);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(51, 65, 85, 0.3);
    border-radius: var(--border-radius-sm);
    padding: 0.5rem;
    box-shadow: var(--shadow-md);
}

/* Tab 切换按钮 */
.news-tab-item {
    flex: 1;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
}

.news-tab-item:hover {
    background: rgba(59, 130, 246, 0.1);
    color: var(--text-primary);
}

.news-tab-item.active {
    background: var(--accent-blue);
    color: white;
    box-shadow: var(--shadow-sm);
}

/* 新闻列表 */
.news-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow-y: auto;
    max-height: calc(100vh - 200px);
}

/* 新闻卡片 */
.news-card {
    background: var(--bg-card);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(51, 65, 85, 0.3);
    border-radius: var(--border-radius);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
    cursor: pointer;
    animation: fadeInUp 0.5s ease-out;
    position: relative;
    overflow: hidden;
}

.news-card:hover {
    background: var(--bg-card-hover);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

/* 新闻标题 */
.news-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
    margin-bottom: 0.5rem;
    transition: color var(--transition-fast);
}

.news-card:hover .news-title {
    color: var(--accent-blue);
}

/* 新闻摘要 */
.news-summary {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 新闻元信息 */
.news-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.news-source {
    font-weight: 500;
}

.news-time {
    font-style: italic;
}

/* 加载状态 */
.news-loading {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
    font-size: 0.875rem;
    font-style: italic;
}

/* 空状态 */
.news-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 3rem 1rem;
    font-size: 1rem;
    font-weight: 500;
}

/* 行情视图样式 */
.market-view {
    padding: 1rem;
}

.market-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    background: var(--bg-card);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(51, 65, 85, 0.3);
    border-radius: var(--border-radius-sm);
    padding: 0.5rem;
    box-shadow: var(--shadow-md);
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.market-tabs::-webkit-scrollbar {
    display: none;
}

.market-tab-item {
    min-width: 80px;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
    white-space: nowrap;
}

.market-tab-item:hover {
    background: rgba(59, 130, 246, 0.1);
    color: var(--text-primary);
}

.market-tab-item.active {
    background: var(--accent-blue);
    color: white;
    box-shadow: var(--shadow-sm);
}

.market-list-header {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: rgba(51, 65, 85, 0.2);
    border-radius: var(--border-radius-sm);
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
}

.market-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow-y: auto;
    max-height: calc(100vh - 300px);
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.market-list::-webkit-scrollbar {
    display: none;
}

.market-card {
    background: var(--bg-card);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(51, 65, 85, 0.3);
    border-radius: var(--border-radius);
    padding: 1rem;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
    cursor: pointer;
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 1rem;
    align-items: center;
}

.market-card:hover {
    background: var(--bg-card-hover);
    box-shadow: var(--shadow-xl);
    transform: translateY(-2px);
}

.market-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.market-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.market-symbol {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.market-price-section {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
}

.market-price {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.market-change {
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    white-space: nowrap;
}

.market-change.positive {
    color: var(--success-green);
    background: rgba(239, 68, 68, 0.15);
}

.market-change.negative {
    color: var(--danger-red);
    background: rgba(16, 185, 129, 0.15);
}

.market-details {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.market-loading {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
    font-size: 0.875rem;
    font-style: italic;
}

.market-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 3rem 1rem;
    font-size: 1rem;
    font-weight: 500;
}

/* 模态框 Tab 样式 */
.modal-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(51, 65, 85, 0.3);
    padding-bottom: 0.5rem;
}

.modal-tab-item {
    padding: 0.5rem 1rem;
    background: transparent;
    border: none;
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
    white-space: nowrap;
    position: relative;
}

.modal-tab-item:hover {
    background: rgba(59, 130, 246, 0.1);
    color: var(--text-primary);
}

.modal-tab-item.active {
    color: var(--accent-blue);
    font-weight: 600;
}

.modal-tab-item.active::after {
    content: '';
    position: absolute;
    bottom: -0.625rem;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent-blue);
    border-radius: 2px;
}

/* 模态框视图容器 */
.modal-view {
    display: none;
}

.modal-view.active {
    display: block;
}

/* 财务数据网格 */
.finance-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-top: 1rem;
}

.finance-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.75rem 0.875rem;
    background: rgba(51, 65, 85, 0.2);
    border-radius: var(--border-radius-sm);
    min-height: 55px;
}

.finance-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.finance-value {
    font-size: 0.9375rem;
    color: var(--text-primary);
    font-weight: 600;
}

/* 股东列表 */
.holders-count {
    padding: 0.75rem 0;
    font-size: 0.9375rem;
    color: var(--text-primary);
    font-weight: 600;
    border-bottom: 1px solid rgba(51, 65, 85, 0.3);
    margin-bottom: 1rem;
}

.holders-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
}

.holder-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0.875rem;
    background: rgba(51, 65, 85, 0.2);
    border-radius: var(--border-radius-sm);
}

.holder-name {
    font-size: 0.9375rem;
    color: var(--text-primary);
    font-weight: 500;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.holder-ratio {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    font-weight: 600;
    white-space: nowrap;
}

/* 模态框加载状态 */
.modal-loading {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
    font-size: 0.875rem;
    font-style: italic;
}

/* 空数据状态 */
.modal-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
    font-size: 0.875rem;
}

/* 适配财务和股东视图的模态框内容 */
#modal-view-finance, #modal-view-holders {
    padding: 0.5rem 0;
}

/* --- AI 聊天模态框样式 --- */
.ai-modal-content {
    height: 80vh; /* 更高一点，方便聊天 */
    display: flex;
    flex-direction: column;
}

.ai-chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: rgba(15, 23, 42, 0.5);
}

.ai-message {
    display: flex;
    margin-bottom: 0.5rem;
}

.ai-message.user {
    justify-content: flex-end;
}

.ai-message.ai, .ai-message.system {
    justify-content: flex-start;
}

.message-content {
    max-width: 80%;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.ai-message.user .message-content {
    background: var(--accent-blue);
    color: white;
    border-bottom-right-radius: 2px;
}

.ai-message.ai .message-content {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-bottom-left-radius: 2px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.ai-message.system .message-content {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    font-size: 0.85rem;
    text-align: center;
    width: 100%;
    max-width: 100%;
}

.ai-input-area {
    padding: 1rem;
    border-top: 1px solid rgba(51, 65, 85, 0.3);
    display: flex;
    gap: 0.75rem;
    background: var(--bg-card);
}

#ai-input {
    flex: 1;
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid rgba(51, 65, 85, 0.5);
    background: rgba(15, 23, 42, 0.5);
    color: white;
}

#ai-send-btn {
    padding: 0 1.5rem;
    background: var(--accent-blue);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}

/* --- 极客风连接测试终端样式 --- */
.terminal-log {
    margin-top: 1rem;
    background: #000;
    border: 1px solid #333;
    border-radius: 6px;
    font-family: 'Courier New', Courier, monospace;
    overflow: hidden;
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.1);
}

.terminal-header {
    background: #1a1a1a;
    color: #666;
    padding: 4px 10px;
    font-size: 0.75rem;
    border-bottom: 1px solid #333;
    letter-spacing: 1px;
}

.terminal-content {
    padding: 8px;
    color: #0f0; /* 黑客绿 */
    font-size: 0.85rem;
    line-height: 1.5;
    min-height: 0;        /* 覆盖原来的最小高度 */
    height: 70px;         /* 固定高度，大约 2-3 行 */
    overflow-y: auto;     /* 内容多了自动滚动 */
    /* 隐藏滚动条但保留滚动功能 */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

/* 隐藏 Chrome/Safari 的滚动条 */
.terminal-content::-webkit-scrollbar {
    display: none;
}

.log-line {
    margin-bottom: 4px;
    opacity: 0;
    animation: fadeInLog 0.1s forwards;
}

.log-line.error {
    color: #ef4444;
}

.log-line.success {
    color: #0f0;
    font-weight: bold;
    text-shadow: 0 0 5px rgba(0, 255, 0, 0.5);
}

@keyframes fadeInLog {
    to { opacity: 1; }
}

.typing-cursor::after {
    content: '▋';
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* 隐藏滚动条样式 */
.modal-content::-webkit-scrollbar,
.main-content::-webkit-scrollbar,
.news-list::-webkit-scrollbar {
    display: none;
}

/* 为其他需要滚动的元素添加隐藏滚动条样式 */
.main-content,
.news-list {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

/* 持股管理视图样式 */
.position-inputs {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group label {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
}

.input-group input {
    padding: 0.75rem;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(51, 65, 85, 0.5);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    transition: all var(--transition-fast);
}

.input-group input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.save-btn {
    background: var(--accent-blue);
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 1.5rem;
    width: 100%;
}

.save-btn:hover {
    background: var(--accent-blue-hover);
}

.position-summary {
    background: rgba(51, 65, 85, 0.2);
    border-radius: var(--border-radius-sm);
    padding: 1rem;
}

.position-summary h3 {
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-weight: 600;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(51, 65, 85, 0.3);
}

.summary-item:last-child {
    border-bottom: none;
}

.summary-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
}

.summary-value {
    font-size: 0.9375rem;
    color: var(--text-primary);
    font-weight: 600;
}

/* 盈亏颜色类 */
.profit {
    color: var(--success-green);
    background: rgba(239, 68, 68, 0.15);
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
}

.loss {
    color: var(--danger-red);
    background: rgba(16, 185, 129, 0.15);
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
}

/* AI分析视图样式 */
.ai-analysis-btn {
    background: var(--accent-blue);
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 1.5rem;
    width: 100%;
}

.ai-analysis-btn:hover {
    background: var(--accent-blue-hover);
}

.ai-analysis-result {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(51, 65, 85, 0.3);
    border-radius: var(--border-radius-sm);
    padding: 1rem;
    min-height: 200px;
    line-height: 1.6;
    color: var(--text-primary);
    font-size: 0.9375rem;
    /* 打字机效果 */
    overflow: hidden;
    position: relative;
}

/* 模拟Markdown样式 */
.ai-analysis-result h1,
.ai-analysis-result h2,
.ai-analysis-result h3 {
    color: var(--accent-blue);
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

.ai-analysis-result p {
    margin-bottom: 1rem;
}

.ai-analysis-result ul,
.ai-analysis-result ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.ai-analysis-result li {
    margin-bottom: 0.5rem;
}

.ai-analysis-result strong {
    font-weight: 700;
    color: var(--text-primary);
}

.ai-analysis-result em {
    font-style: italic;
    color: var(--text-secondary);
}

/* 打字机效果 */
.typewriter {
    overflow: hidden;
    border-right: 0.15em solid var(--accent-blue);
    white-space: nowrap;
    margin: 0 auto;
    animation: typing 3.5s steps(40, end), blink-caret 0.75s step-end infinite;
}

@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blink-caret {
    from, to { border-color: transparent; }
    50% { border-color: var(--accent-blue); }
}

/* --- 修复 AI 聊天窗口在浅色主题 (极简白/可爱风) 下的显示 --- */

/* 1. 聊天区域背景变白，文字变黑 */
[data-theme="light"] .ai-chat-body,
[data-theme="cute"] .ai-chat-body {
    background: rgba(255, 255, 255, 0.9); /* 白底 */
    border: 1px solid var(--border-color); /* 加个边框区分 */
    color: var(--text-primary);
}

/* 2. 输入框适配：浅灰底，深色字 */
[data-theme="light"] #ai-input,
[data-theme="cute"] #ai-input {
    background: #f1f5f9; /* 浅灰背景 */
    color: #334155;      /* 深灰色文字 */
    border: 1px solid #cbd5e1;
}
[data-theme="light"] #ai-input::placeholder,
[data-theme="cute"] #ai-input::placeholder {
    color: #94a3b8; /* 占位符颜色 */
}

/* 3. AI 回复气泡：浅灰底，深色字 */
[data-theme="light"] .ai-message.ai .message-content,
[data-theme="cute"] .ai-message.ai .message-content {
    background: #f8fafc; /* 气泡背景 */
    color: #334155;      /* 气泡文字 */
    border: 1px solid #e2e8f0;
}

/* 4. 系统提示消息：稍微深一点的绿色背景，方便阅读 */
[data-theme="light"] .ai-message.system .message-content,
[data-theme="cute"] .ai-message.system .message-content {
    background: rgba(16, 185, 129, 0.15);
    color: #059669;
    font-weight: 500;
}

/* 5. 确保标题区域背景跟随卡片颜色 */
[data-theme="light"] .ai-modal-content,
[data-theme="cute"] .ai-modal-content {
    background: var(--bg-card); /* 纯白 */
}

/* --- 登录模态框样式 --- */

.modal.show {
    /* 确保登录模态框默认显示 */
    display: flex;
}

.login-content {
    max-width: 350px !important;
}

/* 确保只对登录框的输入框应用白色背景 */
.login-content .input-group input {
    background: rgba(255, 255, 255, 0.05);
}

/* 浅色主题下的登录输入框 */
[data-theme="light"] .login-content .input-group input,
[data-theme="cute"] .login-content .input-group input {
    background: #f1f5f9;
}