/* static/css/style.css */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
    font-size: 28px;
}

.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px;
    border-radius: 15px;
    text-align: center;
    transition: transform 0.3s;
}

.card:hover {
    transform: translateY(-5px);
}

.card h3 {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 10px;
}

.card .amount {
    font-size: 32px;
    font-weight: bold;
}

.card .change {
    font-size: 18px;
    margin-top: 5px;
}

.up { color: #ff4d4f; }
.down { color: #52c41a; }

.controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
    align-items: center;
}

input, select, button {
    padding: 12px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 14px;
    transition: all 0.3s;
    font-family: inherit;
}

input:focus, select:focus {
    outline: none;
    border-color: #667eea;
}

button {
    background: #667eea;
    color: white;
    border: none;
    cursor: pointer;
    font-weight: 600;
    white-space: nowrap;
}

button:hover {
    background: #764ba2;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-refresh {
    background: #52c41a;
}

.btn-refresh:hover {
    background: #73d13d;
}

.btn-export {
    background: #faad14;
}

.btn-export:hover {
    background: #ffc53d;
}

.btn-import {
    background: #722ed1;
}

.btn-import:hover {
    background: #9254de;
}

.btn-danger {
    background: #ff4d4f;
}

.btn-danger:hover {
    background: #ff7875;
}

.btn-small {
    padding: 8px 15px;
    font-size: 12px;
}

.btn-cancel {
    background: #999;
}

.search-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 25px;
}

.search-section h3 {
    margin-bottom: 15px;
    color: #333;
}

#searchInput {
    flex: 1;
    min-width: 200px;
}

.search-results {
    margin-top: 15px;
    max-height: 400px;
    overflow-y: auto;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.search-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.3s;
}

.search-item:hover {
    background: #f5f5f5;
}

.search-item:last-child {
    border-bottom: none;
}

.search-item-info {
    flex: 1;
}

.search-item-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.search-item-code {
    font-size: 12px;
    color: #999;
}

.search-item-nav {
    text-align: right;
    margin-right: 15px;
}

.search-item-change {
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.search-item-change.up {
    background: #fff1f0;
    color: #ff4d4f;
}

.search-item-change.down {
    background: #f6ffed;
    color: #52c41a;
}

.fund-list {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 15px;
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.list-header h3 {
    color: #333;
}

.fund-item {
    background: white;
    padding: 20px;
    margin-bottom: 15px;
    border-radius: 12px;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr 1fr 1fr auto;
    align-items: center;
    gap: 15px;
    transition: all 0.3s;
    border-left: 4px solid transparent;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.fund-item:hover {
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    transform: translateX(5px);
}

.fund-item.profit { border-left-color: #ff4d4f; }
.fund-item.loss { border-left-color: #52c41a; }

.fund-name {
    font-weight: 600;
    color: #333;
    font-size: 15px;
}

.fund-code {
    font-size: 12px;
    color: #999;
    margin-top: 4px;
}

.price {
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

.change-pct {
    font-size: 16px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 6px;
    display: inline-block;
}

.change-pct.up {
    background: #fff1f0;
    color: #ff4d4f;
}

.change-pct.down {
    background: #f6ffed;
    color: #52c41a;
}

.label {
    font-size: 11px;
    color: #999;
    margin-bottom: 4px;
    text-transform: uppercase;
}

.value {
    font-size: 14px;
    color: #333;
    font-weight: 500;
}

.profit-value {
    font-weight: 600;
    font-size: 15px;
}

.profit-value.up {
    color: #ff4d4f;
}

.profit-value.down {
    color: #52c41a;
}

.actions {
    display: flex;
    gap: 8px;
}

.empty-state {
    text-align: center;
    padding: 60px;
    color: #999;
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal h3 {
    margin-bottom: 20px;
    color: #333;
    font-size: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #666;
    font-size: 14px;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    font-size: 16px;
}

.form-group input[readonly] {
    background: #f5f5f5;
    cursor: not-allowed;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 25px;
}

.last-update {
    text-align: center;
    color: #999;
    font-size: 12px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e8e8e8;
}

.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 10px;
    color: white;
    font-weight: 500;
    z-index: 2000;
    animation: slideIn 0.3s ease;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
}

.toast.success {
    background: #52c41a;
}

.toast.error {
    background: #ff4d4f;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@media (max-width: 1200px) {
    .fund-item {
        grid-template-columns: 1fr 1fr;
        gap: 15px;
    }

    .fund-item > div {
        padding: 10px;
        background: #f8f9fa;
        border-radius: 8px;
    }

    .actions {
        grid-column: span 2;
        justify-content: flex-end;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container {
        padding: 20px;
    }

    .controls {
        flex-direction: column;
    }

    input, button {
        width: 100%;
    }

    .fund-item {
        grid-template-columns: 1fr;
    }

    .actions {
        grid-column: span 1;
    }
}

/* static/css/style.css（添加一些新样式） */
/* ... 保持之前的CSS，添加以下 ... */

.btn-secondary {
    background: #722ed1;
}

.btn-secondary:hover {
    background: #9254de;
}

.search-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.3s;
}

.search-item:hover {
    background: #f5f5f5;
}

.search-item:last-child {
    border-bottom: none;
}

.search-item-info {
    flex: 1;
}

.search-item-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.search-item-code {
    font-size: 12px;
    color: #999;
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.list-header h3 {
    color: #333;
}

/* static/css/style.css - 添加总资产卡片样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
    font-size: 28px;
}

.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    transition: transform 0.3s;
}

.card:hover {
    transform: translateY(-5px);
}

.card h3 {
    font-size: 13px;
    opacity: 0.9;
    margin-bottom: 10px;
}

.card .amount {
    font-size: 24px;
    font-weight: bold;
}

.card .change {
    font-size: 14px;
    margin-top: 5px;
    opacity: 0.9;
}

.up { color: #ff4d4f; }
.down { color: #52c41a; }

.controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
    align-items: center;
}

input, select, button {
    padding: 12px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 14px;
    transition: all 0.3s;
    font-family: inherit;
}

input:focus, select:focus {
    outline: none;
    border-color: #667eea;
}

button {
    background: #667eea;
    color: white;
    border: none;
    cursor: pointer;
    font-weight: 600;
    white-space: nowrap;
}

button:hover {
    background: #764ba2;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-refresh { background: #52c41a; }
.btn-refresh:hover { background: #73d13d; }

.btn-export { background: #faad14; }
.btn-export:hover { background: #ffc53d; }

.btn-import { background: #722ed1; }
.btn-import:hover { background: #9254de; }

.btn-secondary { background: #13c2c2; }
.btn-secondary:hover { background: #36cfc9; }

.btn-danger { background: #ff4d4f; }
.btn-danger:hover { background: #ff7875; }

.btn-small { padding: 8px 15px; font-size: 12px; }

.btn-cancel { background: #999; }

.search-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 25px;
}

.search-section h3 {
    margin-bottom: 15px;
    color: #333;
}

#searchInput {
    flex: 1;
    min-width: 200px;
}

.search-results {
    margin-top: 15px;
    max-height: 400px;
    overflow-y: auto;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.search-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.3s;
}

.search-item:hover { background: #f5f5f5; }
.search-item:last-child { border-bottom: none; }

.search-item-info { flex: 1; }
.search-item-name { font-weight: 600; color: #333; margin-bottom: 4px; }
.search-item-code { font-size: 12px; color: #999; }

.fund-list {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 15px;
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.list-header h3 { color: #333; }

.fund-item {
    background: white;
    padding: 20px;
    margin-bottom: 15px;
    border-radius: 12px;
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr auto;
    align-items: center;
    gap: 12px;
    transition: all 0.3s;
    border-left: 4px solid transparent;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.fund-item:hover {
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    transform: translateX(5px);
}

.fund-item.profit { border-left-color: #ff4d4f; }
.fund-item.loss { border-left-color: #52c41a; }

.fund-name { font-weight: 600; color: #333; font-size: 14px; }
.fund-code { font-size: 12px; color: #999; margin-top: 4px; }

.price { font-size: 16px; font-weight: bold; color: #333; }

.change-pct {
    font-size: 14px;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 6px;
    display: inline-block;
}

.change-pct.up { background: #fff1f0; color: #ff4d4f; }
.change-pct.down { background: #f6ffed; color: #52c41a; }

.label { font-size: 10px; color: #999; margin-bottom: 4px; text-transform: uppercase; }
.value { font-size: 13px; color: #333; font-weight: 500; }

.profit-value { font-weight: 600; font-size: 14px; }
.profit-value.up { color: #ff4d4f; }
.profit-value.down { color: #52c41a; }

.actions { display: flex; gap: 8px; }

.empty-state { text-align: center; padding: 60px; color: #999; }
.empty-state-icon { font-size: 48px; margin-bottom: 15px; }

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.modal {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(50px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal h3 { margin-bottom: 20px; color: #333; font-size: 20px; }

.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; color: #666; font-size: 14px; font-weight: 500; }
.form-group input { width: 100%; font-size: 16px; }
.form-group input[readonly] { background: #f5f5f5; cursor: not-allowed; }

.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 25px; }

.last-update { text-align: center; color: #999; font-size: 12px; margin-top: 20px; padding-top: 20px; border-top: 1px solid #e8e8e8; }

.toast {
    position: fixed;
    top: 20px; right: 20px;
    padding: 15px 25px;
    border-radius: 10px;
    color: white;
    font-weight: 500;
    z-index: 2000;
    animation: slideIn 0.3s ease;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
}

.toast.success { background: #52c41a; }
.toast.error { background: #ff4d4f; }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@media (max-width: 1200px) {
    .fund-item { grid-template-columns: 1fr 1fr; gap: 15px; }
    .fund-item > div { padding: 10px; background: #f8f9fa; border-radius: 8px; }
    .actions { grid-column: span 2; justify-content: flex-end; }
}

@media (max-width: 768px) {
    body { padding: 10px; }
    .container { padding: 20px; }
    .controls { flex-direction: column; }
    input, button { width: 100%; }
    .fund-item { grid-template-columns: 1fr; }
    .actions { grid-column: span 1; }
}

/* static/css/style.css - 添加图表样式 */
/* ... 之前的CSS ... */

/* 图表区域 */
.chart-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 25px;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.chart-header h3 {
    color: #333;
    margin: 0;
}

.chart-controls {
    display: flex;
    gap: 8px;
}

.chart-container {
    position: relative;
    height: 300px;
    background: white;
    border-radius: 10px;
    padding: 15px;
}

/* 图表模态框 */
.chart-modal-content {
    width: 90%;
    max-width: 900px;
    max-height: 80vh;
    overflow-y: auto;
}

.chart-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.chart-modal-header h3 {
    margin: 0;
    color: #333;
}

.btn-close {
    background: none;
    border: none;
    font-size: 20px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s;
}

.btn-close:hover {
    background: #f0f0f0;
    color: #333;
    transform: none;
    box-shadow: none;
}

.chart-modal-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
}

.chart-canvas-container {
    position: relative;
    height: 400px;
}

/* 基金列表添加图表按钮 */
.btn-chart {
    background: #1890ff;
    margin-left: 5px;
}

.btn-chart:hover {
    background: #40a9ff;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .chart-container {
        height: 250px;
        padding: 10px;
    }

    .chart-canvas-container {
        height: 300px;
    }

    .chart-modal-content {
        width: 95%;
        padding: 20px;
    }
}

/* static/css/style.css - 添加自动记录样式 */
/* ... 之前的CSS ... */

/* 自动记录信息 */
.auto-record-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    padding: 10px 15px;
    background: #f6ffed;
    border: 1px solid #b7eb8f;
    border-radius: 8px;
    font-size: 13px;
}

.record-status {
    color: #52c41a;
    font-weight: 500;
}

.last-record {
    color: #999;
}

.auto-tag {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

/* 列表头部样式调整 */
.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.list-header h3 {
    color: #333;
    margin: 0;
}
