/* 全域樣式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 訊號標籤 Overlay 樣式 - 進階版 (已移除，改回內建 Markers) */

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "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;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

/* 頭部樣式 */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    font-size: 28px;
    font-weight: 600;
}

.header-info {
    display: flex;
    gap: 15px;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.btn-back {
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    transition: background 0.3s;
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.3);
}

.project-info {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.info-item {
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
}

/* 搜尋列 */
.search-bar {
    padding: 20px 40px;
    border-bottom: 1px solid transparent;
}

.search-bar input {
    width: 100%;
    padding: 12px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.search-bar input:focus {
    outline: none;
    border-color: #667eea;
}

/* 按鈕 */
.btn-refresh {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.btn-refresh:hover {
    background: rgba(255, 255, 255, 0.3);
}

.btn-share {
    background: #667eea;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
    margin-left: 10px;
    text-decoration: none;
}

.btn-share:hover {
    background: #5a6fd6;
}

/* 專案列表 */
.project-list {
    padding: 40px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.project-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 24px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.project-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
    transform: translateY(-2px);
}

.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.project-title {
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

.project-status {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.status-active {
    background: #d4edda;
    color: #155724;
}

.status-inactive {
    background: #f8d7da;
    color: #721c24;
}

.project-meta {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    font-size: 14px;
    color: #666;
}

.project-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 12px;
    color: #999;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 18px;
    font-weight: 600;
}

.stat-positive {
    color: #28a745;
}

.stat-negative {
    color: #dc3545;
}

.stat-neutral {
    color: #333;
}

/* 總體資金損益頁面 */
.performance-controls {
    justify-content: space-between;
    flex-wrap: wrap;
}

.control-title {
    font-weight: 700;
    font-size: 18px;
    color: #333;
}

.summary-grid {
    padding: 24px 40px 10px 40px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.summary-card {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}

.summary-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.summary-value {
    font-size: 22px;
    font-weight: 700;
}

.charts-grid {
    padding: 10px 40px 30px 40px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
}

.detail-section {
    padding: 0 40px 40px 40px;
}

.detail-list {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.detail-row {
    display: grid;
    grid-template-columns: 180px 200px 1fr;
    gap: 16px;
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--surface);
}

.detail-metric {
    font-weight: 700;
    color: var(--text-primary);
}

.detail-value {
    font-weight: 600;
}

.detail-note {
    color: var(--text-secondary);
}

/* 控制面板 */
.controls {
    padding: 20px 40px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    gap: 20px;
    align-items: center;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.control-group label {
    font-weight: 600;
    color: #666;
}

.control-group select {
    padding: 8px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: border-color 0.3s;
}

.control-group select:focus {
    outline: none;
    border-color: #667eea;
}

/* 長按鈕 / CTA */
.cta-bar {
    padding: 0 40px 24px 40px;
}

.btn-cta {
    width: 100%;
    padding: 14px 20px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.3s;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}

.btn-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 34px rgba(102, 126, 234, 0.4);
}

/* 圖表容器 */
.charts-container {
    padding: 40px;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.chart-section {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
}

.chart-section h2 {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin-bottom: 16px;
}

.chart {
    position: relative;  /* 讓標籤可以絕對定位 */
    width: 100%;
    height: 500px;
    background: white;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
}

/* 載入動畫 */
.loading {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 18px;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-left: 10px;
    border: 3px solid #667eea;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 錯誤訊息 */
.error {
    text-align: center;
    padding: 60px 20px;
    color: #dc3545;
    font-size: 18px;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .project-list {
        grid-template-columns: 1fr;
        padding: 20px;
    }

    .controls {
        flex-direction: column;
        align-items: stretch;
    }

    .charts-container {
        padding: 20px;
    }

    .chart {
        height: 400px;
    }
}
