/* 財富儀表板樣式 - 簡約黑白高級感 */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    background: #fafafa;
    min-height: 100vh;
    color: #1a1a1a;
    padding: 20px 15px;
    padding-bottom: 60px;
    line-height: 1.5;
}

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

/* 標題樣式 */
header {
    color: #1a1a1a;
    margin-bottom: 24px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.header-title {
    flex: 1;
    text-align: center;
}

header h1 {
    font-size: 2rem;
    font-weight: 300;
    margin-bottom: 6px;
    letter-spacing: -1px;
    color: #000;
}

header p {
    font-size: 0.9rem;
    color: #666;
    font-weight: 300;
    letter-spacing: 0.5px;
}

.btn-risk-prediction {
    background: #000;
    border: 1px solid #000;
    border-radius: 0;
    padding: 10px 20px;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 400;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-risk-prediction:hover {
    background: #fff;
    color: #000;
    transform: translateY(-1px);
}

.btn-risk-prediction i {
    font-size: 0.9rem;
}

/* 總資產概覽 */
.overview-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.overview-card {
    background: #ffffff;
    border-radius: 0;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    border: 1px solid #e5e5e5;
    position: relative;
}

.overview-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    border-color: #000;
}

.overview-card.total-assets::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: #000;
}

.overview-card.net-worth::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: #333;
}

.overview-card.monthly-income::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: #666;
}

.overview-card.monthly-expense::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: #999;
}

.card-header h3 {
    font-size: 0.75rem;
    color: #666;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.card-content {
    text-align: left;
}

.main-value {
    font-size: 1.5rem;
    font-weight: 300;
    color: #000;
    margin-bottom: 4px;
    letter-spacing: -0.5px;
}

.sub-value {
    font-size: 0.75rem;
    color: #999;
    margin-bottom: 10px;
    font-weight: 300;
}

.change-indicator {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 10px;
    border-top: 1px solid #e5e5e5;
}

.change-label {
    font-size: 0.75rem;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 400;
}

.change-value {
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.change-value.positive {
    color: #000;
}

.change-value.negative {
    color: #666;
}

/* 區塊標題 */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    color: #1a1a1a;
}

.section-header h2 {
    font-size: 1.2rem;
    font-weight: 300;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #000;
    letter-spacing: -0.5px;
}

.rate-update-time {
    font-size: 0.75rem;
    color: #999;
    font-weight: 300;
}

/* 匯率資訊區塊 */
.exchange-rates-section {
    margin-bottom: 24px;
}

.rates-card-container {
    width: 100%;
}

.rates-card {
    background: #ffffff;
    border-radius: 0;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border: 1px solid #e5e5e5;
    border-left: 3px solid #000;
}

.rates-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.rate-item {
    display: flex;
    flex-direction: column;
    padding: 8px;
}

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

.rate-item-header i {
    font-size: 0.9rem;
    color: #666;
}

.rate-item-name {
    font-size: 0.75rem;
    color: #666;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.rate-item-value {
    font-size: 1.2rem;
    font-weight: 300;
    color: #000;
    margin-bottom: 4px;
    letter-spacing: -0.5px;
}

.rate-item-label {
    font-size: 0.7rem;
    color: #999;
    font-weight: 300;
}

@media (max-width: 768px) {
    .rates-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .rate-item-value {
        font-size: 1rem;
    }
}

.btn-icon {
    background: #000;
    border: 1px solid #000;
    border-radius: 0;
    width: 44px;
    height: 44px;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.btn-icon:hover {
    background: #fff;
    color: #000;
    transform: scale(1.05);
}

/* 資產分配 */
.asset-allocation-section {
    background: #ffffff;
    border-radius: 0;
    padding: 16px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border: 1px solid #e5e5e5;
}

.allocation-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.chart-container {
    position: relative;
    height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.chart-container canvas {
    width: 100% !important;
    height: 100% !important;
    max-width: 450px;
    max-height: 450px;
    margin: auto;
}

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

.allocation-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    transition: all 0.2s ease;
}

.allocation-item:hover {
    opacity: 0.7;
}

.allocation-item-info {
    flex: 1;
}

.allocation-item-name {
    font-weight: 500;
    color: #000;
    margin-bottom: 4px;
    font-size: 0.85rem;
    letter-spacing: 0.3px;
}

.allocation-item-category {
    font-size: 0.75rem;
    color: #999;
    font-weight: 300;
}

.allocation-item-value {
    font-size: 0.95rem;
    font-weight: 400;
    color: #000;
    letter-spacing: 0.5px;
}

.allocation-item-percent {
    font-size: 0.75rem;
    color: #666;
    margin-left: 8px;
    font-weight: 300;
}

/* 收入支出追蹤 */
.income-expense-section {
    background: #ffffff;
    border-radius: 0;
    padding: 16px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border: 1px solid #e5e5e5;
}

.tab-navigation {
    display: flex;
    gap: 0;
    border-bottom: 1px solid #e5e5e5;
}

.tab-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 0;
    background: transparent;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.8rem;
    font-weight: 400;
    border-bottom: 2px solid transparent;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tab-btn:hover {
    color: #000;
    background: #fafafa;
}

.tab-btn.active {
    background: transparent;
    color: #000;
    border-bottom-color: #000;
    font-weight: 500;
}

.ie-chart-container {
    margin: 16px 0;
    height: 200px;
    position: relative;
}

.ie-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e5e5e5;
}

.ie-summary-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.ie-label {
    font-size: 0.75rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 400;
}

.ie-value {
    font-size: 0.95rem;
    font-weight: 400;
    color: #000;
    letter-spacing: 0.3px;
}

.ie-value.positive {
    color: #000;
}

.ie-value.negative {
    color: #666;
}

/* 資產明細 */
.asset-details-section {
    margin-bottom: 24px;
}

.asset-categories {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.category-card {
    width: 100%;
}

.category-card {
    background: #ffffff;
    border-radius: 0;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border: 1px solid #e5e5e5;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.category-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    border-color: #000;
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e5e5e5;
}

.category-title {
    font-size: 0.95rem;
    font-weight: 400;
    color: #000;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.3px;
}

.category-total {
    font-size: 1.1rem;
    font-weight: 300;
    color: #000;
    letter-spacing: -0.5px;
}

.category-items {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.region-subtitle {
    grid-column: 1 / -1;
    font-size: 0.75rem;
    font-weight: 500;
    color: #666;
    padding: 6px 0;
    margin-top: 6px;
    border-top: 1px solid #e5e5e5;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.region-subtitle:first-child {
    margin-top: 0;
    border-top: none;
}

.region-total {
    font-weight: 600;
    color: #000;
    text-transform: none;
    letter-spacing: 0;
}

@media (max-width: 1200px) {
    .category-items {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .category-items {
        grid-template-columns: 1fr;
    }
    
    body {
        padding: 15px 10px;
        padding-bottom: 50px;
    }
    
    header h1 {
        font-size: 1.6rem;
    }
    
    .header-content {
        flex-direction: column;
        gap: 12px;
    }
    
    .btn-risk-prediction {
        width: 100%;
        justify-content: center;
    }
    
    .overview-section {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .overview-card {
        padding: 12px;
    }
    
    .main-value {
        font-size: 1.2rem;
    }
    
    .category-card {
        padding: 12px;
    }
    
    .rates-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }
    
    .rate-card {
        padding: 10px;
    }
}

.category-item {
    transition: background-color 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 8px;
    background: #fafafa;
    border-radius: 0;
    border: 1px solid #e5e5e5;
}

.item-name {
    font-weight: 400;
    color: #333;
    font-size: 0.85rem;
}

.item-value {
    font-weight: 400;
    color: #000;
    font-size: 0.85rem;
    letter-spacing: 0.3px;
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

/* 負債追蹤 */
.liability-section {
    background: #ffffff;
    border-radius: 0;
    padding: 16px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border: 1px solid #e5e5e5;
}

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

.liability-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: #fafafa;
    border-radius: 0;
    border-left: 3px solid #000;
    border: 1px solid #e5e5e5;
    border-left: 3px solid #000;
}

.liability-info {
    flex: 1;
}

.liability-name {
    font-weight: 500;
    color: #000;
    margin-bottom: 4px;
    font-size: 0.85rem;
}

.liability-type {
    font-size: 0.75rem;
    color: #999;
    font-weight: 300;
}

.liability-amount {
    font-size: 0.85rem;
    font-weight: 400;
    color: #000;
    letter-spacing: 0.3px;
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

/* 風險預測 */
.risk-prediction-content {
    padding: 0;
}

.net-worth-display {
    font-size: 1.5rem;
    font-weight: 300;
    color: #000;
    padding: 16px;
    background: #fafafa;
    border: 1px solid #e5e5e5;
    text-align: center;
    letter-spacing: -0.5px;
    margin-bottom: 20px;
}

.risk-prediction-result {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #e5e5e5;
}

.result-header {
    margin-bottom: 16px;
}

.result-header h4 {
    font-size: 1rem;
    font-weight: 500;
    color: #000;
    margin: 0;
}

.result-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #fafafa;
    border: 1px solid #e5e5e5;
}

.result-label {
    font-size: 0.85rem;
    color: #666;
    font-weight: 400;
}

.result-value {
    font-size: 1rem;
    color: #000;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.risk-chart-container {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #e5e5e5;
    height: 400px;
    position: relative;
}

/* 模態框 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    backdrop-filter: blur(2px);
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: #ffffff;
    border-radius: 0;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    border: 1px solid #e5e5e5;
    animation: slideDown 0.3s ease;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e5e5e5;
}

.modal-header h3 {
    font-size: 1.5rem;
    color: #000;
    font-weight: 300;
    letter-spacing: -0.5px;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #999;
    cursor: pointer;
    transition: color 0.3s ease;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-modal:hover {
    color: #000;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 400;
    color: #333;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 14px;
    border: 1px solid #e5e5e5;
    border-radius: 0;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    background: #fafafa;
    color: #000;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #000;
    background: #fff;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 30px;
    padding-top: 24px;
    border-top: 1px solid #e5e5e5;
}

.btn-primary,
.btn-secondary {
    padding: 12px 32px;
    border: 1px solid #000;
    border-radius: 0;
    font-size: 0.9rem;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-primary {
    background: #000;
    color: #fff;
}

.btn-primary:hover {
    background: #fff;
    color: #000;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #fff;
    color: #000;
    border-color: #666;
}

.btn-secondary:hover {
    background: #fafafa;
    border-color: #000;
}

/* 載入動畫 */
.spinner {
    border: 2px solid #e5e5e5;
    border-top: 2px solid #000;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 響應式設計 */
@media (max-width: 768px) {
    body {
        padding: 20px 15px;
    }

    .allocation-container {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .ie-summary {
        grid-template-columns: 1fr;
    }

    header h1 {
        font-size: 2rem;
    }

    .overview-card,
    .asset-allocation-section,
    .income-expense-section,
    .liability-section {
        padding: 24px;
    }
}
