/* 智慧選股系統 - 樣式表 */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg: #0f172a;
    --bg-card: #1e293b;
    --bg-hover: #334155;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* 導航欄 */
.navbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
}

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

/* 摘要卡片 */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.card {
    background: var(--bg-card);
    border-radius: 1rem;
    padding: 1.5rem;
    border: 1px solid var(--border);
}

.summary-card {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.card-icon {
    font-size: 2.5rem;
}

.card-content h3 {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.big-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

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

/* 選股區塊 */
.stock-section {
    margin: 2rem 0;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.section-header h2 {
    font-size: 1.5rem;
}

.filter-tabs {
    display: flex;
    gap: 0.5rem;
}

.tab {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.tab:hover {
    background: var(--bg-hover);
}

.tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

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

.stock-card {
    background: var(--bg-card);
    border-radius: 1rem;
    padding: 1.25rem;
    border: 1px solid var(--border);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stock-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.stock-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.stock-info h3 {
    font-size: 1.125rem;
    margin-bottom: 0.25rem;
}

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

.stock-industry {
    display: inline-block;
    font-size: 0.75rem;
    padding: 0.125rem 0.5rem;
    background: var(--bg);
    border-radius: 0.25rem;
    color: var(--text-muted);
    margin-left: 0.5rem;
}

.stock-desc {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    padding: 0.5rem;
    background: var(--bg);
    border-radius: 0.5rem;
    border-left: 3px solid var(--primary);
}

.stock-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    background: var(--primary);
    color: white;
}

.stock-badge.momentum { background: var(--danger); }
.stock-badge.value { background: var(--success); }
.stock-badge.breakout { background: var(--warning); }

.stock-price {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.current-price {
    font-size: 1.5rem;
    font-weight: 700;
}

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

.price-change.up { color: var(--danger); }
.price-change.down { color: var(--success); }

.stock-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.metric {
    text-align: center;
    padding: 0.5rem;
    background: var(--bg);
    border-radius: 0.5rem;
}

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

.metric-value {
    font-size: 0.875rem;
    font-weight: 600;
}

/* 圖表區塊 */
.market-section {
    margin: 2rem 0;
}

.market-section h2 {
    margin-bottom: 1rem;
}

.chart-container {
    background: var(--bg-card);
    border-radius: 1rem;
    padding: 1.5rem;
    border: 1px solid var(--border);
}

/* 策略說明 */
.strategy-section {
    margin: 2rem 0;
}

.strategy-section h2 {
    margin-bottom: 1rem;
}

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

.strategy-card {
    background: var(--bg-card);
    border-radius: 1rem;
    padding: 1.5rem;
    border: 1px solid var(--border);
}

.strategy-card h3 {
    margin-bottom: 0.75rem;
}

.strategy-card p {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.strategy-card ul {
    list-style: none;
}

.strategy-card li {
    font-size: 0.875rem;
    padding: 0.25rem 0;
    color: var(--text-muted);
}

.strategy-card li::before {
    content: '✓ ';
    color: var(--success);
}

/* 頁尾 */
.footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 1.5rem 0;
    margin-top: 3rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* 載入動畫 */
.loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

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

    .filter-tabs {
        width: 100%;
        overflow-x: auto;
    }

    .summary-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .summary-cards {
        grid-template-columns: 1fr;
    }

    .stock-metrics {
        grid-template-columns: repeat(2, 1fr);
    }
}
