/* 全域樣式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang TC', 'Microsoft JhengHei', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* 頁首 */
header {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 搜尋區 */
.search-box {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

#searchInput {
    flex: 1;
    padding: 15px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s;
}

#searchInput:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#industryFilter {
    padding: 15px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
    background: white;
    cursor: pointer;
    min-width: 200px;
}

/* 統計卡片 */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.stat-label {
    color: #666;
    font-size: 14px;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 32px;
    font-weight: bold;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 股票網格 */
.stock-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.stock-card {
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s;
    border-left: 4px solid #667eea;
}

.stock-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.stock-card .symbol {
    font-size: 20px;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 5px;
}

.stock-card .name {
    font-size: 18px;
    color: #333;
    margin-bottom: 10px;
}

.stock-card .industry {
    font-size: 13px;
    color: #999;
    background: #f5f5f5;
    padding: 5px 10px;
    border-radius: 5px;
    display: inline-block;
}

/* 載入和錯誤訊息 */
.loading, .error {
    background: white;
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    font-size: 18px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.error {
    color: #e74c3c;
    background: #fee;
}

/* 返回按鈕 */
.back-btn {
    display: inline-block;
    padding: 10px 20px;
    background: #667eea;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 20px;
    transition: all 0.3s;
}

.back-btn:hover {
    background: #5568d3;
    transform: translateX(-3px);
}

/* 報價卡片 */
.quote-card {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.quote-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.stock-code {
    font-size: 24px;
    font-weight: bold;
    color: #667eea;
}

.stock-name {
    font-size: 20px;
    color: #666;
    margin-top: 5px;
}

.quote-time {
    font-size: 14px;
    color: #999;
}

.quote-price {
    margin: 30px 0;
}

.price {
    font-size: 48px;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
}

.change {
    font-size: 24px;
    font-weight: 600;
}

.change.positive {
    color: #e74c3c;
}

.change.negative {
    color: #27ae60;
}

.change.neutral {
    color: #999;
}

.quote-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    padding-top: 20px;
    border-top: 2px solid #f0f0f0;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.detail-item .label {
    font-size: 14px;
    color: #999;
}

.detail-item .value {
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

/* 圖表容器 */
.chart-container {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.chart-header h2 {
    font-size: 24px;
    color: #333;
}

.period-selector {
    display: flex;
    gap: 10px;
}

.period-btn {
    padding: 8px 16px;
    border: 2px solid #e0e0e0;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.period-btn:hover {
    border-color: #667eea;
    color: #667eea;
}

.period-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

#priceChart {
    max-height: 400px;
}

/* 技術分析區塊 */
.tech-analysis-section {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.tech-analysis-section h2 {
    font-size: 24px;
    color: #333;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.tech-analysis-section h3 {
    font-size: 18px;
    color: #666;
    margin-bottom: 15px;
}

/* 趨勢判斷區塊 */
.trend-box {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.trend-signal {
    padding: 15px 20px;
    border-radius: 8px;
    font-size: 18px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 15px;
}

.trend-signal.bullish {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
    color: white;
}

.trend-signal.bearish {
    background: linear-gradient(135deg, #51cf66 0%, #40c057 100%);
    color: white;
}

.trend-signal.neutral {
    background: linear-gradient(135deg, #adb5bd 0%, #868e96 100%);
    color: white;
}

.ma-values {
    display: flex;
    justify-content: space-around;
    gap: 15px;
    flex-wrap: wrap;
}

.ma-item {
    flex: 1;
    min-width: 100px;
    text-align: center;
    padding: 10px;
    background: white;
    border-radius: 8px;
}

.ma-label {
    display: block;
    font-size: 14px;
    color: #999;
    margin-bottom: 5px;
}

.ma-value {
    display: block;
    font-size: 20px;
    font-weight: bold;
    color: #333;
}

/* 交叉信號 */
.cross-signal {
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    border-left: 4px solid;
}

.cross-signal.golden_cross {
    background: #fff5f5;
    border-left-color: #e74c3c;
}

.cross-signal.death_cross {
    background: #f0fdf4;
    border-left-color: #27ae60;
}

.cross-signal h3 {
    margin-bottom: 10px;
    color: #333;
}

.cross-signal p {
    color: #666;
    line-height: 1.6;
}

.cross-date {
    font-size: 14px;
    color: #999;
    margin-top: 10px;
}

/* 支撐與壓力 */
.sr-box {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.sr-levels {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.level {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-radius: 8px;
    background: white;
}

.level.resistance {
    border-left: 4px solid #e74c3c;
}

.level.current {
    border-left: 4px solid #667eea;
    font-weight: bold;
}

.level.support {
    border-left: 4px solid #27ae60;
}

.level-label {
    font-size: 14px;
    color: #999;
}

.level-value {
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

.distance {
    font-size: 14px;
    color: #999;
    margin-left: 10px;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    background: #667eea;
    color: white;
    border-radius: 12px;
    font-size: 12px;
    margin-left: 10px;
}

/* 成交量分析 */
.volume-box {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.volume-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.volume-item {
    background: white;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
}

.volume-label {
    display: block;
    font-size: 14px;
    color: #999;
    margin-bottom: 8px;
}

.volume-value {
    display: block;
    font-size: 20px;
    font-weight: bold;
    color: #333;
}

.volume-value.high-volume {
    color: #e74c3c;
}

.volume-alert {
    padding: 12px 20px;
    background: #fff5f5;
    border-left: 4px solid #e74c3c;
    border-radius: 8px;
    color: #c0392b;
    font-weight: 600;
}

.volume-normal {
    padding: 12px 20px;
    background: #f0fdf4;
    border-left: 4px solid #27ae60;
    border-radius: 8px;
    color: #27ae60;
    font-weight: 600;
}

/* 突破警報 */
.breakout-alert {
    padding: 20px;
    border-radius: 10px;
    border-left: 4px solid;
    font-size: 16px;
    margin-bottom: 20px;
}

.breakout-alert.with-volume {
    background: #fff5f5;
    border-left-color: #e74c3c;
    color: #c0392b;
}

.breakout-alert.without-volume {
    background: #fffbf0;
    border-left-color: #f39c12;
    color: #d68910;
}

/* 成交量圖表區塊 */
.volume-chart-section {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    margin-top: 30px;
}

.volume-chart-section .chart-header {
    margin-bottom: 20px;
}

.volume-chart-section h2 {
    font-size: 24px;
    color: #333;
}

#volumeChart {
    max-height: 300px;
}

/* 財報健康度區塊 */
.financial-section {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    margin-top: 30px;
}

.financial-section h2 {
    font-size: 24px;
    color: #333;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.financial-section h3 {
    font-size: 18px;
    color: #666;
    margin-bottom: 15px;
}

/* 健康度評分區塊 */
.health-score-box {
    text-align: center;
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 25px;
}

.health-score-box.excellent {
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
    color: white;
}

.health-score-box.healthy {
    background: linear-gradient(135deg, #3498db 0%, #5dade2 100%);
    color: white;
}

.health-score-box.fair {
    background: linear-gradient(135deg, #f39c12 0%, #f1c40f 100%);
    color: white;
}

.health-score-box.warning {
    background: linear-gradient(135deg, #e67e22 0%, #f39c12 100%);
    color: white;
}

.health-score-box.critical {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
}

.health-stars {
    font-size: 36px;
    letter-spacing: 5px;
    margin-bottom: 10px;
}

.health-score {
    font-size: 28px;
    font-weight: bold;
    margin-bottom: 5px;
}

.health-status {
    font-size: 18px;
    opacity: 0.9;
}

/* 財報指標網格 */
.indicators-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.indicator-item {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    border-left: 4px solid #ddd;
    transition: all 0.3s;
}

.indicator-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.indicator-item.status-excellent {
    border-left-color: #27ae60;
    background: linear-gradient(135deg, #f0fff4 0%, #f8f9fa 100%);
}

.indicator-item.status-healthy {
    border-left-color: #3498db;
    background: linear-gradient(135deg, #f0f9ff 0%, #f8f9fa 100%);
}

.indicator-item.status-warning {
    border-left-color: #f39c12;
    background: linear-gradient(135deg, #fffbf0 0%, #f8f9fa 100%);
}

.indicator-item.status-critical {
    border-left-color: #e74c3c;
    background: linear-gradient(135deg, #fff5f5 0%, #f8f9fa 100%);
}

.indicator-item.status-neutral {
    border-left-color: #95a5a6;
}

.indicator-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.indicator-name {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.indicator-status {
    font-size: 18px;
}

.indicator-value {
    font-size: 24px;
    font-weight: bold;
    color: #333;
    margin-bottom: 8px;
}

.indicator-change {
    font-size: 14px;
    margin-left: 8px;
}

.indicator-change.positive {
    color: #e74c3c;
}

.indicator-change.negative {
    color: #27ae60;
}

.indicator-yoy {
    font-size: 13px;
    color: #666;
    margin-left: 8px;
}

.indicator-message {
    font-size: 14px;
    color: #666;
    line-height: 1.5;
}

/* EPS、營收和現金流圖表容器 */
.eps-chart-container,
.revenue-chart-container,
.cash-flow-chart-container {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.eps-chart-container h3,
.revenue-chart-container h3,
.cash-flow-chart-container h3 {
    font-size: 18px;
    color: #333;
    margin-bottom: 15px;
}

#epsChart,
#revenueChart,
#cashFlowChart {
    max-height: 300px;
}

/* 產業分析區塊 */
.industry-section {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    margin-top: 30px;
}

.industry-section h2 {
    font-size: 24px;
    color: #333;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.industry-section h3 {
    font-size: 18px;
    color: #666;
    margin-bottom: 15px;
}

.industry-not-found {
    text-align: center;
    padding: 30px;
    color: #666;
}

/* 產業資訊卡片 */
.industry-info-box {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 25px;
    border-radius: 12px;
    color: white;
    margin-bottom: 25px;
}

.industry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.industry-name {
    font-size: 28px;
    font-weight: bold;
}

.industry-trend {
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
}

.industry-trend.trend-growth {
    background: rgba(231, 76, 60, 0.9);
}

.industry-trend.trend-stable {
    background: rgba(52, 152, 219, 0.9);
}

.industry-trend.trend-cyclical {
    background: rgba(241, 196, 15, 0.9);
    color: #333;
}

.industry-trend.trend-defensive {
    background: rgba(39, 174, 96, 0.9);
}

.industry-trend.trend-recovery {
    background: rgba(155, 89, 182, 0.9);
}

.industry-factors h4 {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 12px;
}

.factors-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.factor-tag {
    background: rgba(255, 255, 255, 0.2);
    padding: 6px 14px;
    border-radius: 15px;
    font-size: 13px;
}

/* 產業詳細資訊 */
.industry-details-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin: 20px 0;
}

.detail-card {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px 20px;
    border-radius: 10px;
}

.detail-card h4 {
    font-size: 13px;
    opacity: 0.8;
    margin-bottom: 10px;
}

.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.revenue-tag {
    background: rgba(52, 152, 219, 0.3);
    color: #fff;
    padding: 5px 12px;
    border-radius: 12px;
    font-size: 12px;
}

.competitor-tag,
.competitor-link {
    background: rgba(231, 76, 60, 0.3);
    color: #fff;
    padding: 5px 12px;
    border-radius: 12px;
    font-size: 12px;
    text-decoration: none;
}

.competitor-link:hover {
    background: rgba(231, 76, 60, 0.5);
}

.hot-topic-tag {
    background: linear-gradient(135deg, #f39c12, #e74c3c);
    color: #fff;
    padding: 5px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.no-data {
    color: rgba(255, 255, 255, 0.5);
    font-size: 13px;
}

.supply-chain-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.supply-chain-badge {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    width: fit-content;
}

.supply-chain-badge.supply-upstream {
    background: linear-gradient(135deg, #3498db, #2980b9);
}

.supply-chain-badge.supply-midstream {
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
}

.supply-chain-badge.supply-downstream {
    background: linear-gradient(135deg, #27ae60, #229954);
}

.supply-chain-badge.supply-endservice {
    background: linear-gradient(135deg, #e67e22, #d35400);
}

.supply-chain-desc {
    font-size: 12px;
    opacity: 0.8;
    line-height: 1.5;
}

@media (max-width: 768px) {
    .industry-details-grid {
        grid-template-columns: 1fr;
    }
}

/* 同業比較 */
.peer-comparison-container {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 12px;
}

.loading-placeholder {
    text-align: center;
    padding: 20px;
    color: #666;
}

.error-message {
    text-align: center;
    color: #e74c3c;
    padding: 20px;
}

.peer-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.peer-table th,
.peer-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.peer-table th {
    background: #667eea;
    color: white;
    font-weight: 600;
}

.peer-table th:first-child {
    border-radius: 8px 0 0 0;
}

.peer-table th:last-child {
    border-radius: 0 8px 0 0;
}

.peer-table tbody tr:hover {
    background: #f0f0f0;
}

.peer-table .target-row {
    background: rgba(102, 126, 234, 0.1);
}

.peer-table .target-row:hover {
    background: rgba(102, 126, 234, 0.15);
}

.stock-symbol {
    font-weight: 600;
    color: #333;
}

.target-badge {
    display: inline-block;
    background: #667eea;
    color: white;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 8px;
}

.health-stars {
    font-size: 14px;
    margin-right: 8px;
}

.health-stars.health-excellent {
    color: #27ae60;
}

.health-stars.health-good {
    color: #3498db;
}

.health-stars.health-warning {
    color: #f39c12;
}

.health-stars.health-critical {
    color: #e74c3c;
}

.health-label {
    font-size: 12px;
    color: #666;
}

.error-cell {
    color: #999;
    font-style: italic;
}

.industry-average {
    display: flex;
    justify-content: space-around;
    padding: 15px;
    background: white;
    border-radius: 8px;
    margin-top: 15px;
}

.industry-average span {
    color: #666;
    font-size: 14px;
}

.industry-average strong {
    color: #667eea;
    margin-left: 5px;
}

/* 響應式設計 */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.8em;
    }

    .search-box {
        flex-direction: column;
    }

    #industryFilter {
        min-width: 100%;
    }

    .stock-grid {
        grid-template-columns: 1fr;
    }

    .quote-price .price {
        font-size: 36px;
    }

    .chart-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .period-selector {
        flex-wrap: wrap;
        width: 100%;
    }

    .period-btn {
        flex: 1;
        min-width: calc(33.333% - 7px);
    }
}

/* ==================== 警示樣式 ==================== */

.alerts-section {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.alerts-section h2 {
    margin: 0 0 15px 0;
    font-size: 18px;
    color: #333;
}

.alert-summary {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    margin-bottom: 15px;
}

.alert-summary.no-alerts {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #d4edda;
    color: #155724;
}

.alert-summary .alert-icon {
    font-size: 24px;
    color: #28a745;
}

.alert-counts {
    display: flex;
    gap: 15px;
}

.alert-counts .count {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.alert-counts .count.critical {
    background: #f8d7da;
    color: #721c24;
}

.alert-counts .count.warning {
    background: #fff3cd;
    color: #856404;
}

.alert-counts .count.info {
    background: #d1ecf1;
    color: #0c5460;
}

.alert-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.alert-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    border-radius: 10px;
    background: #f8f9fa;
}

.alert-item.critical {
    background: #fff5f5;
    border-left: 4px solid #dc3545;
}

.alert-item.warning {
    background: #fffbeb;
    border-left: 4px solid #ffc107;
}

.alert-item.info {
    background: #f0f9ff;
    border-left: 4px solid #17a2b8;
}

.alert-badge {
    padding: 4px 10px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.alert-badge.critical {
    background: #dc3545;
    color: white;
}

.alert-badge.warning {
    background: #ffc107;
    color: #333;
}

.alert-badge.info {
    background: #17a2b8;
    color: white;
}

.alert-content {
    flex: 1;
}

.alert-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 3px;
}

.alert-description {
    font-size: 13px;
    color: #666;
}

.alert-category {
    font-size: 12px;
    color: #999;
    padding: 3px 8px;
    background: #eee;
    border-radius: 5px;
}

/* ==================== 自選股按鈕 ==================== */

.quote-header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.watchlist-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 16px;
    border: 2px solid #667eea;
    border-radius: 25px;
    background: white;
    color: #667eea;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.watchlist-btn:hover {
    background: #f0f4ff;
}

.watchlist-btn.active {
    background: #667eea;
    color: white;
}

.watchlist-btn.active:hover {
    background: #5567d5;
}

/* ==================== 自選股清單 ==================== */

.watchlist-empty {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.watchlist-empty .hint {
    font-size: 13px;
    margin-top: 10px;
}

.watchlist-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.watchlist-header h3 {
    margin: 0;
    font-size: 16px;
    color: #333;
}

.watchlist-header .count {
    font-size: 14px;
    color: #666;
}

.watchlist-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.watchlist-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: #f8f9fa;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.watchlist-item:hover {
    background: #e9ecef;
}

.watchlist-item .symbol {
    font-weight: 600;
    color: #333;
}

.watchlist-item .remove-btn {
    background: none;
    border: none;
    color: #999;
    font-size: 16px;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.watchlist-item .remove-btn:hover {
    background: #dc3545;
    color: white;
}

/* ==================== 自選股警示儀表板 ==================== */

.watchlist-alerts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.watchlist-alerts-header h3 {
    margin: 0;
    font-size: 18px;
    color: #333;
}

.watchlist-alerts-header .summary {
    display: flex;
    gap: 15px;
    font-size: 14px;
}

.watchlist-alerts-header .summary .critical {
    color: #dc3545;
    font-weight: 600;
}

.watchlist-alerts-header .summary .warning {
    color: #ffc107;
    font-weight: 600;
}

.watchlist-alerts-empty,
.no-alerts {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.no-alerts .icon {
    font-size: 48px;
    color: #28a745;
    margin-bottom: 10px;
}

.alerts-by-stock {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
}

.stock-alerts-card {
    background: white;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: all 0.2s ease;
}

.stock-alerts-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.12);
}

.stock-alerts-card .stock-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.stock-alerts-card .symbol {
    font-size: 18px;
    font-weight: 700;
    color: #333;
}

.stock-alerts-card .alert-badges {
    display: flex;
    gap: 5px;
}

.stock-alerts-card .badge {
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
}

.stock-alerts-card .badge.critical {
    background: #dc3545;
    color: white;
}

.stock-alerts-card .badge.warning {
    background: #ffc107;
    color: #333;
}

.stock-alerts-card .badge.info {
    background: #17a2b8;
    color: white;
}

.stock-alerts {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.alert-mini {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    padding: 6px 10px;
    background: #f8f9fa;
    border-radius: 6px;
}

.alert-mini.critical {
    background: #fff5f5;
}

.alert-mini.warning {
    background: #fffbeb;
}

.alert-mini.info {
    background: #f0f9ff;
}

.alert-mini .level {
    font-weight: 600;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
}

.alert-mini.critical .level {
    background: #dc3545;
    color: white;
}

.alert-mini.warning .level {
    background: #ffc107;
    color: #333;
}

.alert-mini.info .level {
    background: #17a2b8;
    color: white;
}

.alert-mini .name {
    color: #333;
}

.stock-alerts .more {
    font-size: 12px;
    color: #999;
    text-align: center;
    padding-top: 5px;
}

/* ==================== 提醒設定樣式 ==================== */

.notification-section {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.notification-section h2 {
    margin: 0 0 20px 0;
    font-size: 18px;
    color: #333;
}

/* 規則表單 */
.rule-form {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.rule-form h3 {
    margin: 0 0 15px 0;
    font-size: 16px;
    color: #333;
}

.form-section {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e9ecef;
}

.form-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.form-section label {
    display: block;
    font-weight: 600;
    color: #555;
    margin-bottom: 10px;
    font-size: 14px;
}

.form-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.form-row input[type="number"] {
    width: 120px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
}

.form-row select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    background: white;
}

.form-row button {
    padding: 8px 16px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.form-row button:hover {
    background: #5567d5;
}

.form-row span {
    color: #666;
    font-size: 14px;
}

/* 規則列表 */
.rules-empty {
    text-align: center;
    padding: 30px;
    color: #999;
}

.rules-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    color: #666;
    font-size: 14px;
}

.rules-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.rule-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.rule-item.triggered {
    border-left-color: #28a745;
    background: #f0fdf4;
}

.rule-item.inactive {
    border-left-color: #999;
    opacity: 0.7;
}

.rule-info {
    flex: 1;
}

.rule-symbol {
    font-weight: 700;
    font-size: 16px;
    color: #333;
    margin-bottom: 5px;
}

.rule-message {
    font-size: 14px;
    color: #555;
    margin-bottom: 8px;
}

.rule-meta {
    display: flex;
    gap: 10px;
}

.rule-type {
    font-size: 12px;
    padding: 2px 8px;
    background: #e9ecef;
    border-radius: 4px;
    color: #666;
}

.rule-status {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 4px;
}

.rule-status.active {
    background: #d4edda;
    color: #155724;
}

.rule-status.triggered {
    background: #cce5ff;
    color: #004085;
}

.rule-status.inactive {
    background: #e9ecef;
    color: #666;
}

.rule-actions {
    display: flex;
    gap: 8px;
}

.rule-actions button {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-toggle {
    background: #e9ecef;
    color: #333;
}

.btn-toggle:hover {
    background: #dee2e6;
}

.btn-reset {
    background: #28a745;
    color: white;
}

.btn-reset:hover {
    background: #218838;
}

.btn-delete {
    background: #dc3545;
    color: white;
}

.btn-delete:hover {
    background: #c82333;
}

/* 通知列表 */
.notifications-empty {
    text-align: center;
    padding: 30px;
    color: #999;
}

.notifications-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.btn-mark-all {
    padding: 6px 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
}

.notifications-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.notification-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 15px;
    background: #f8f9fa;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.notification-item:hover {
    background: #e9ecef;
}

.notification-item.unread {
    background: #fff;
    border: 1px solid #667eea;
}

.notification-icon {
    font-size: 24px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f4ff;
    border-radius: 10px;
}

.notification-content {
    flex: 1;
}

.notification-title {
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.notification-message {
    font-size: 13px;
    color: #666;
    margin-bottom: 4px;
}

.notification-time {
    font-size: 12px;
    color: #999;
}

.unread-dot {
    width: 8px;
    height: 8px;
    background: #667eea;
    border-radius: 50%;
    position: absolute;
    top: 15px;
    right: 15px;
}

/* 通知鈴鐺 */
.notification-bell {
    position: relative;
    cursor: pointer;
    padding: 8px;
}

.bell-icon {
    font-size: 24px;
}

.unread-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: #dc3545;
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
}

/* 推送設定 */
.push-settings {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.push-settings h4 {
    margin-bottom: 15px;
    color: #333;
    font-size: 16px;
}

.push-channel {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

.push-channel:last-child {
    margin-bottom: 0;
}

.channel-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

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

.channel-name {
    font-weight: 600;
    flex: 1;
}

.channel-status {
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
}

.channel-status.configured {
    background: #d4edda;
    color: #155724;
}

.channel-status.not-configured {
    background: #fff3cd;
    color: #856404;
}

.channel-form {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.channel-form input[type="email"] {
    flex: 1;
    min-width: 200px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.channel-form button {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    background: #667eea;
    color: white;
    transition: background 0.2s;
}

.channel-form button:hover {
    background: #5a6fd6;
}

.channel-form button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.channel-form .btn-test {
    background: #6c757d;
}

.channel-form .btn-test:hover {
    background: #5a6268;
}

.channel-hint {
    font-size: 12px;
    color: #856404;
    margin-top: 10px;
    padding: 8px;
    background: #fff3cd;
    border-radius: 4px;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

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

.toggle-switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 26px;
}

.toggle-switch .slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .slider {
    background-color: #667eea;
}

.toggle-switch input:checked + .slider:before {
    transform: translateX(24px);
}

.toggle-switch input:disabled + .slider {
    background-color: #e0e0e0;
    cursor: not-allowed;
}

/* 響應式 */
@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .form-row input[type="number"],
    .form-row select {
        width: 100%;
    }

    .form-row button {
        width: 100%;
        margin-top: 5px;
    }

    .rule-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .rule-actions {
        width: 100%;
    }

    .rule-actions button {
        flex: 1;
    }

    .channel-form {
        flex-direction: column;
        align-items: stretch;
    }

    .channel-form input[type="email"] {
        width: 100%;
    }

    .channel-form button {
        width: 100%;
    }
}

/* ===== K 線圖區塊樣式 ===== */

/* K 線圖容器 */
.candlestick-section {
    background: #131722;
    border-radius: 15px;
    overflow: hidden;
}

.candlestick-section .chart-header {
    background: #131722;
    padding: 20px 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.candlestick-section .chart-header h2 {
    color: #fff;
    margin-bottom: 15px;
}

/* 圖表類型選擇器 */
.chart-type-selector {
    display: inline-flex;
    gap: 5px;
    margin-right: 20px;
    background: rgba(255, 255, 255, 0.1);
    padding: 4px;
    border-radius: 8px;
}

.chart-type-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.chart-type-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.chart-type-btn.active {
    background: #667eea;
    color: #fff;
}

/* K 線圖期間選擇器（深色主題） */
.candlestick-section .period-selector {
    display: inline-flex;
    gap: 5px;
}

.candlestick-section .period-btn {
    padding: 8px 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.candlestick-section .period-btn:hover {
    border-color: #667eea;
    color: #fff;
}

.candlestick-section .period-btn.active {
    background: #667eea;
    border-color: #667eea;
    color: #fff;
}

/* K 線圖主容器 */
.candlestick-chart {
    width: 100%;
    min-height: 500px;
}

/* 均線資訊欄 */
.ma-info-bar,
.vol-ma-info-bar {
    background: rgba(0, 0, 0, 0.3);
    padding: 10px 20px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
    font-size: 13px;
    font-family: 'Consolas', 'Monaco', monospace;
}

.ma-info,
.vol-ma-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
}

.ma-label {
    color: #888;
    font-weight: bold;
    padding: 3px 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    margin-right: 5px;
}

.ma-value {
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* 均線顏色 */
.ma-value.ma-10 { color: #FFFF00; }
.ma-value.ma-20 { color: #FF00FF; }
.ma-value.ma-60 { color: #00FFFF; }
.ma-value.ma-100 { color: #FFFFFF; }
.ma-value.ma-200 { color: #FF69B4; }
.ma-value.ma-240 { color: #FFA500; }

/* OHLC 資訊欄（開高低收 + 成交量） */
.ohlc-info-bar {
    background: linear-gradient(180deg, rgba(19, 23, 34, 0.95) 0%, rgba(19, 23, 34, 0.85) 100%);
    padding: 12px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    min-height: 44px;
}

.ohlc-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 20px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 14px;
}

.ohlc-info.latest {
    opacity: 0.9;
}

.ohlc-date {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ohlc-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.ohlc-item.volume {
    margin-left: 10px;
    padding-left: 15px;
    border-left: 1px solid rgba(255, 255, 255, 0.2);
}

.ohlc-label {
    color: #888;
    font-size: 12px;
    font-weight: 500;
}

.ohlc-value {
    color: #fff;
    font-weight: 600;
    font-size: 14px;
}

.ohlc-value.up {
    color: #ef5350;
}

.ohlc-value.down {
    color: #26a69a;
}

.ohlc-change {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: 600;
}

.ohlc-change.up {
    background: rgba(239, 83, 80, 0.15);
    color: #ef5350;
}

.ohlc-change.down {
    background: rgba(38, 166, 154, 0.15);
    color: #26a69a;
}

.change-arrow {
    font-size: 10px;
}

.change-value {
    font-size: 14px;
}

.change-percent {
    font-size: 12px;
    opacity: 0.9;
}

/* 響應式調整 */
@media (max-width: 768px) {
    .candlestick-section .chart-header {
        padding: 15px;
    }

    .chart-type-selector,
    .candlestick-section .period-selector {
        flex-wrap: wrap;
        width: 100%;
        margin-bottom: 10px;
    }

    .chart-type-btn,
    .candlestick-section .period-btn {
        padding: 6px 12px;
        font-size: 12px;
    }

    .candlestick-chart {
        min-height: 400px;
    }

    .ma-info-bar,
    .vol-ma-info-bar {
        padding: 8px 15px;
        font-size: 11px;
        gap: 10px;
    }

    .ma-info,
    .vol-ma-info {
        gap: 8px;
    }

    .ohlc-info-bar {
        padding: 8px 15px;
    }

    .ohlc-info {
        gap: 12px;
        font-size: 12px;
    }

    .ohlc-item.volume {
        margin-left: 5px;
        padding-left: 10px;
    }

    .ohlc-label {
        font-size: 10px;
    }

    .ohlc-value {
        font-size: 12px;
    }

    .ohlc-change {
        padding: 3px 8px;
    }

    .change-value {
        font-size: 12px;
    }

    .change-percent {
        font-size: 10px;
    }
}

@media (max-width: 480px) {
    .candlestick-chart {
        min-height: 350px;
    }

    .ma-value {
        font-size: 10px;
    }

    .ohlc-info-bar {
        padding: 6px 10px;
    }

    .ohlc-info {
        gap: 8px;
        font-size: 11px;
    }

    .ohlc-item.volume {
        width: 100%;
        margin-left: 0;
        padding-left: 0;
        margin-top: 5px;
        border-left: none;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        padding-top: 5px;
    }

    .ohlc-change {
        padding: 2px 6px;
        font-size: 10px;
    }
}

/* ============ K線圖畫線工具 ============ */

.chart-toolbar {
    background: #1e222d;
    padding: 12px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-radius: 10px 10px 0 0;
    margin-bottom: -10px;
}

.drawing-tools {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.toolbar-label {
    color: #888;
    font-size: 13px;
    margin-right: 5px;
}

.tool-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #2a2e39;
    border: 1px solid #363a45;
    border-radius: 6px;
    color: #d1d4dc;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.tool-btn:hover {
    background: #363a45;
    border-color: #4a4e59;
}

.tool-btn.active {
    background: #667eea;
    border-color: #667eea;
    color: white;
}

.tool-btn-secondary {
    background: transparent;
    border-color: #ef535050;
    color: #ef5350;
}

.tool-btn-secondary:hover {
    background: #ef535020;
    border-color: #ef5350;
}

.line-icon {
    display: inline-block;
    width: 16px;
    height: 3px;
    border-radius: 2px;
}

.line-icon.resistance {
    background: #ef5350;
}

.line-icon.support {
    background: #26a69a;
}

.drawing-hint {
    font-size: 12px;
    color: #888;
    margin-left: 10px;
    padding: 4px 10px;
    border-radius: 4px;
    animation: pulse 1.5s infinite;
}

.drawing-hint.resistance {
    color: #ef5350;
    background: #ef535020;
}

.drawing-hint.support {
    color: #26a69a;
    background: #26a69a20;
}

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

.drawn-lines-list {
    margin-top: 5px;
}

.lines-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.line-group {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.group-label {
    font-size: 12px;
    color: #888;
}

.line-group.resistance .group-label {
    color: #ef5350;
}

.line-group.support .group-label {
    color: #26a69a;
}

.line-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 13px;
    font-family: 'Consolas', 'Monaco', monospace;
}

.line-tag.resistance {
    background: #ef535020;
    color: #ef5350;
    border: 1px solid #ef535040;
}

.line-tag.support {
    background: #26a69a20;
    color: #26a69a;
    border: 1px solid #26a69a40;
}

.remove-line {
    background: none;
    border: none;
    color: inherit;
    font-size: 16px;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.remove-line:hover {
    opacity: 1;
}

/* 響應式調整 */
@media (max-width: 768px) {
    .chart-toolbar {
        padding: 10px 15px;
    }

    .drawing-tools {
        gap: 8px;
    }

    .tool-btn {
        padding: 6px 12px;
        font-size: 12px;
    }

    .drawing-hint {
        width: 100%;
        margin-left: 0;
        margin-top: 8px;
        text-align: center;
    }
}

/* ============ 新聞區塊樣式 ============ */

.news-section {
    background: white;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.news-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.news-header h2 {
    font-size: 1.5em;
    color: #333;
    margin: 0;
}

.news-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.news-tab {
    padding: 8px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    background: white;
    color: #666;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.news-tab:hover {
    border-color: #667eea;
    color: #667eea;
}

.news-tab.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
}

.news-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.news-loading,
.news-error,
.news-empty {
    text-align: center;
    padding: 40px;
    color: #999;
}

.news-item {
    padding: 20px;
    border: 1px solid #f0f0f0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    background: #fafafa;
}

.news-item:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
}

.news-item.important {
    border-left: 4px solid #ff6b6b;
    background: linear-gradient(90deg, rgba(255, 107, 107, 0.05) 0%, transparent 100%);
}

.news-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.news-category {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.news-category.market {
    background: #e3f2fd;
    color: #1976d2;
}

.news-category.tech {
    background: #e8f5e9;
    color: #388e3c;
}

.news-category.finance {
    background: #fff3e0;
    color: #f57c00;
}

.news-category.industry {
    background: #f3e5f5;
    color: #7b1fa2;
}

.news-source {
    font-size: 12px;
    color: #888;
}

.news-time {
    font-size: 12px;
    color: #aaa;
}

.news-badge.important {
    background: #ff6b6b;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

.news-title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 8px;
}

.news-title {
    font-size: 1.1em;
    font-weight: 600;
    color: #333;
    margin: 0;
    line-height: 1.4;
    flex: 1;
}

.news-industries {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    flex-shrink: 0;
}

.industry-tag {
    display: inline-block;
    padding: 4px 10px;
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    color: white;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.industry-tag:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(243, 156, 18, 0.4);
}

.industry-filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border: 1px solid #ffcc80;
    border-radius: 8px;
    margin-bottom: 15px;
}

.industry-filter-bar span {
    color: #e65100;
    font-size: 14px;
}

.industry-filter-bar strong {
    color: #bf360c;
}

.industry-filter-bar button {
    padding: 6px 14px;
    background: #e65100;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}

.industry-filter-bar button:hover {
    background: #bf360c;
}

.news-impact-reason {
    margin-top: 10px;
    padding: 10px 14px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-left: 3px solid #0ea5e9;
    border-radius: 0 8px 8px 0;
    font-size: 13px;
    color: #0369a1;
    line-height: 1.6;
}

.news-summary {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
    margin: 0;
}

.news-stocks {
    margin-top: 12px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.news-stocks .stock-tag {
    display: inline-block;
    padding: 4px 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    transition: transform 0.2s;
}

.news-stocks .stock-tag:hover {
    transform: scale(1.05);
}

/* 響應式調整 */
@media (max-width: 768px) {
    .news-section {
        padding: 15px;
    }

    .news-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .news-tabs {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 5px;
    }

    .news-item {
        padding: 15px;
    }

    .news-title {
        font-size: 1em;
    }

    .news-summary {
        font-size: 13px;
    }

    .news-title-row {
        flex-direction: column;
        gap: 8px;
    }

    .news-industries {
        order: -1;
    }

    .industry-tag {
        font-size: 10px;
        padding: 3px 8px;
    }

    .industry-filter-bar {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
}

/* 股票頁面新聞區塊 */
#newsSection {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-top: 20px;
}

#newsSection h2 {
    margin: 0 0 15px 0;
    font-size: 18px;
    color: #333;
}

.news-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.news-item a {
    text-decoration: none;
    color: inherit;
    display: block;
}

.news-item .news-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.news-badge {
    background: #ff6b6b;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

.news-notice {
    background: #fff3cd;
    color: #856404;
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 13px;
}

.news-loading {
    text-align: center;
    padding: 30px;
    color: #888;
}

/* Main Navigation */
.main-nav {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.nav-link {
    text-decoration: none;
    color: #555;
    font-weight: 500;
    margin-right: 20px;
    padding: 10px 15px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.nav-link:hover {
    background-color: #f0f0f0;
    color: #333;
}

.nav-link.active {
    background-color: #667eea;
    color: white;
}
