* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft JhengHei', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0c1426 0%, #1a2332 50%, #0f1b2a 100%);
    color: #e2e8f0;
    min-height: 100vh;
}

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

/* 頂部導航 */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 16px 24px;
    margin-bottom: 24px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 2rem;
    animation: rotate 4s linear infinite;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: bold;
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.market-status {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
}

.status-dot {
    width: 12px;
    height: 12px;
    background: #10b981;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-text {
    font-weight: 600;
    color: #10b981;
}

.update-time {
    color: #64748b;
    font-family: monospace;
}

/* 大盤指數區 */
.market-overview {
    margin-bottom: 24px;
}

.index-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.index-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
}

.index-card:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

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

.index-name {
    font-weight: 600;
    color: #cbd5e1;
}

.index-code {
    font-size: 0.8rem;
    color: #64748b;
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 8px;
    border-radius: 4px;
    font-family: monospace;
}

.index-price {
    font-size: 1.8rem;
    font-weight: bold;
    margin-bottom: 8px;
}

.index-change {
    font-weight: 600;
    font-size: 1rem;
}

/* 主要內容區 */
.main-content {
    display: grid;
    grid-template-columns: 280px 1fr 320px;
    gap: 24px;
    align-items: start;
}

/* 側邊欄 */
.sidebar, .info-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* 面板通用樣式 */
.search-panel,
.institutional-panel,
.hot-stocks-panel,
.news-panel,
.trade-detail-panel,
.analysis-suggestion,
.stock-info-panel,
.chart-panel,
.indicators-panel {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
}

.search-panel h3,
.institutional-panel h3,
.hot-stocks-panel h3,
.news-panel h3,
.trade-detail-panel h3,
.analysis-suggestion h3,
.chart-panel h3,
.indicators-panel h3 {
    margin-bottom: 16px;
    color: #f1f5f9;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 搜尋面板 */
.search-box {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.search-box input {
    flex: 1;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: #e2e8f0;
    font-size: 0.9rem;
}

.search-box input::placeholder {
    color: #64748b;
}

.search-box button {
    padding: 10px 16px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.search-box button:hover {
    background: linear-gradient(135deg, #2563eb, #1e40af);
    transform: translateY(-1px);
}

.quick-stocks {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.quick-stock {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #60a5fa;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-stock:hover {
    background: rgba(59, 130, 246, 0.2);
    transform: scale(1.05);
}

/* 法人進出 */
.institutional-data {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.inst-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.inst-name {
    color: #cbd5e1;
    font-weight: 500;
}

.inst-value {
    font-weight: bold;
    font-family: monospace;
}

/* 熱門股 */
.hot-stocks-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hot-stock-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.hot-stock-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.hot-stock-info {
    display: flex;
    flex-direction: column;
}

.hot-stock-name {
    font-weight: 600;
    color: #f1f5f9;
}

.hot-stock-code {
    font-size: 0.8rem;
    color: #64748b;
}

.hot-stock-price {
    text-align: right;
}

.hot-stock-value {
    font-weight: bold;
}

.hot-stock-change {
    font-size: 0.8rem;
}

/* 個股資訊 */
.stock-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.stock-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.stock-name {
    font-size: 1.5rem;
    font-weight: bold;
    color: #f1f5f9;
}

.stock-code {
    background: rgba(59, 130, 246, 0.1);
    color: #60a5fa;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: monospace;
}

.stock-industry {
    color: #64748b;
    font-size: 0.9rem;
}

.stock-price-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
}

.current-price {
    font-size: 2.2rem;
    font-weight: bold;
    color: #f1f5f9;
}

.price-change {
    font-size: 1.2rem;
    font-weight: bold;
}

.price-details {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 8px;
    font-size: 0.9rem;
    color: #94a3b8;
}

.price-details span {
    white-space: nowrap;
}

/* 圖表面板 */
.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.chart-controls {
    display: flex;
    gap: 8px;
}

.chart-btn {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    color: #cbd5e1;
    cursor: pointer;
    transition: all 0.2s;
}

.chart-btn.active,
.chart-btn:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.4);
    color: #60a5fa;
}

.chart-container {
    width: 100%;
    height: 400px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

#stockChart {
    width: 100%;
    height: 100%;
}

/* 技術指標 */
.indicators-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.indicator-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 16px;
    text-align: center;
}

.indicator-name {
    color: #94a3b8;
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.indicator-value {
    font-size: 1.4rem;
    font-weight: bold;
    color: #f1f5f9;
    margin-bottom: 8px;
    font-family: monospace;
}

.indicator-status {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 12px;
}

.indicator-status.positive {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.indicator-status.negative {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.indicator-status.neutral {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

/* 新聞列表 */
.news-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 300px;
    overflow-y: auto;
}

.news-item {
    padding: 12px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    border-left: 3px solid #3b82f6;
}

.news-title {
    font-weight: 600;
    color: #f1f5f9;
    margin-bottom: 4px;
    font-size: 0.9rem;
    line-height: 1.4;
}

.news-time {
    color: #64748b;
    font-size: 0.8rem;
}

/* 成交明細 */
.trade-table {
    font-size: 0.9rem;
}

.trade-header {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-weight: 600;
    color: #cbd5e1;
}

.trade-body {
    max-height: 200px;
    overflow-y: auto;
}

.trade-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    color: #94a3b8;
    font-family: monospace;
}

/* 分析建議 */
.suggestion-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.suggestion-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.suggestion-type {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

.suggestion-text {
    color: #cbd5e1;
    font-size: 0.9rem;
    line-height: 1.4;
}

/* 底部統計 */
.footer-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 24px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
}

.stat-item {
    text-align: center;
    padding: 16px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
}

.stat-label {
    display: block;
    color: #94a3b8;
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    font-family: monospace;
}

/* 顏色系統 */
.positive {
    color: #10b981;
}

.negative {
    color: #ef4444;
}

.neutral {
    color: #f59e0b;
}

/* 動畫 */
@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

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

/* 響應式設計 */
@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .sidebar, .info-sidebar {
        order: 2;
    }
    
    .analysis-area {
        order: 1;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 12px;
    }
    
    .header {
        padding: 12px 16px;
        flex-direction: column;
        gap: 12px;
    }
    
    .index-cards {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
    
    .indicators-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
    
    .footer-stats {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
    
    .stock-price-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .price-details {
        flex-direction: column;
        gap: 8px;
    }
}

/* 卷軸樣式 */
.news-list::-webkit-scrollbar,
.trade-body::-webkit-scrollbar {
    width: 4px;
}

.news-list::-webkit-scrollbar-track,
.trade-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.news-list::-webkit-scrollbar-thumb,
.trade-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

.news-list::-webkit-scrollbar-thumb:hover,
.trade-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}