/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    background-color: #f8f9fa;
}

/* 搜索框容器 - 固定顶部 */
.search-container {
    display: flex;
    padding: 10px;
    background-color: #f5f5f5;
    border-bottom: 1px solid #eee;
    position: fixed;
    margin-bottom: 40px;
    top: 0;
    left: 0;
    right: 0;
    z-index: 999;
    height: 60px; /* 明确搜索框高度，方便计算间距 */
}

/* 搜索输入框 */
.search-input {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px 0 0 4px;
    border-right: none;
    font-size: 14px;
    outline: none;
}

/* 搜索按钮 */
.search-btn {
    padding: 5px 15px;
    background-color: #7b8cff;
    border: 1px solid #7b8cff;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    font-size: 13px;
    border-left: none;
    color: #ffffff;
}

/* 用户持有基金区域 - 完整样式 */
.user-fund-section {
    padding: 10px 10px;
    margin-top: 60px; /* 搜索框高度(56px) + 10px间距，避免重叠 */
    margin-bottom: 5px;
}

.section-header {
    margin-bottom: 12px;
    display: flex;
    align-items: center;
}

.section-header h3 {
    font-size: 16px;
    color: #333;
    font-weight: 600;
    margin: 0;
}

/* 基金卡片容器 - 垂直一行一个 */
.user-fund-cards {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* 单个基金卡片 - 多字段布局优化 */
.fund-card {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    padding: 15px 15px 0 15px;
    display: flex;
    flex-direction: column;
    border: 1px solid #f0f0f0;
}

/* 卡片顶部：名称+代码 */
.fund-card__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.fund-card__name {
    font-size: 16px;
    color: #333;
    font-weight: 600;
    line-height: 1.4;
    max-width: 70%;
}

.fund-card__code {
    font-size: 12px;
    color: #ffffff;
    background-color: #ffca7b;
    padding: 2px 8px;
    border-radius: 4px;
}

/* 卡片中部：核心数据（双列布局） */
.fund-card__body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

/* 数据项样式 */
.fund-data-item {
    display: flex;
    flex-direction: column;
}

.fund-data-item__label {
    font-size: 11px;
    color: #999;
    margin-bottom: 4px;
}

.fund-data-item__value {
    font-size: 14px;
    color: #333;
    font-weight: 500;
}

/* 收益率特殊样式 */
.fund-data-item__value.profit-positive {
    color: #ff4d4f; /* 蚂蚁红-正收益 */
    font-size: 15px;
    font-weight: 600;
}

.fund-data-item__value.profit-negative {
    color: #00b42a; /* 蚂蚁绿-负收益 */
    font-size: 15px;
    font-weight: 600;
}

/* 卡片底部：更新时间信息 */
.fund-card__footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid #f5f5f5;
}

.fund-card__update-time {
    font-size: 11px;
    color: #999;
}

/* 无持有基金提示 */
.no-user-fund {
    padding: 30px 20px;
    text-align: center;
    color: #999;
    font-size: 14px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    margin-bottom: 10px;
}

/* 数值格式化优化 */
.fund-data-item__value.num-format {
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}

/* 搜索结果列表 - 修复重叠，明确顶部间距 */
.result-list {
    padding: 10px 10px;
    margin-top: 60px; /* 搜索框高度(56px) + 20px间距，彻底避免重叠 */
}

/* 搜索结果项 */
.fund-item {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    background-color: #fff;
    border-radius: 8px;
    margin-bottom: 8px;
}

/* 搜索结果项 - 基金代码 */
.fund-code {
    color: #666;
    font-size: 13px;
}

/* 搜索结果项 - 基金名称 */
.fund-name {
    font-weight: bold;
    margin: 5px 0;
    font-size: 15px;
}

/* 搜索结果项 - 基金分类 */
.fund-category {
    color: #888;
    font-size: 12px;
}

/* 加载提示 */
.loading {
    padding: 15px;
    text-align: center;
    color: #666;
    font-size: 14px;
}

/* 无更多数据提示 */
.no-more {
    padding: 15px;
    text-align: center;
    color: #999;
    font-size: 14px;
}

/* 无结果提示 */
.no-result {
    padding: 15px;
    text-align: center;
    color: #999;
    font-size: 14px;
    background-color: #fff;
    border-radius: 8px;
    margin-bottom: 8px;
}

/* 正收益/负收益颜色（全局复用） */
.text-green {
    color: #28a745;
}

.text-red {
    color: #dc3545;
}


/* 原有样式保持不变，新增以下内容 */

/* 添加基金弹窗遮罩 */
.add-fund-modal-mask {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.add-fund-modal-mask.active {
    opacity: 1;
    visibility: visible;
}

/* 添加基金弹窗容器 */
.add-fund-modal {
    background-color: #fff;
    border-radius: 8px;
    width: 90%;
    max-width: 350px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    overflow: hidden;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.add-fund-modal-mask.active .add-fund-modal {
    transform: translateY(0);
}

/* 弹窗标题栏 */
.modal-header {
    padding: 16px;
    border-bottom: 1px solid #f5f5f5;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h4 {
    font-size: 16px;
    color: #333;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    font-size: 20px;
    color: #999;
    cursor: pointer;
    transition: color 0.2s ease;
}

.modal-close:hover {
    color: #333;
}

/* 弹窗表单区域 */
.modal-body {
    padding: 16px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 14px;
    color: #333;
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
}

.form-control:focus {
    border-color: #7b8cff;
}

.form-control:disabled {
    background-color: #f5f5f5;
    color: #666;
    cursor: not-allowed;
}

/* 错误提示 */
.form-error {
    color: #ff4d4f;
    font-size: 12px;
    margin-top: 4px;
    display: none;
}

.form-error.show {
    display: block;
}

/* 弹窗底部按钮区域 */
.modal-footer {
    padding: 12px 16px;
    border-top: 1px solid #f5f5f5;
    display: flex;
    gap: 10px;
}

.modal-btn {
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border: none;
}

.btn-cancel {
    background-color: #c6c6c6;
    color: #ffffff;
}

.btn-cancel:hover {
    background-color: #c6c6c6;
}

.btn-confirm {
    background-color: #7b8cff;
    color: #ffffff;
}

.btn-confirm:hover {
    background-color: #7b8cff;
}

/* 加载中按钮样式 */
.btn-confirm.loading {
    background-color: #7b8cff;
    cursor: not-allowed;
}

/* 操作结果提示 */
.result-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0,0,0,0.7);
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.result-toast.active {
    opacity: 1;
    visibility: visible;
}


/* 原有样式保持不变，新增操作选择弹窗样式 */

/* 操作选择弹窗遮罩 */
.operate-select-modal-mask {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.operate-select-modal-mask.active {
    opacity: 1;
    visibility: visible;
}

/* 操作选择弹窗容器 */
.operate-select-modal {
    background-color: #fff;
    border-radius: 8px;
    width: 80%;
    max-width: 300px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    overflow: hidden;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.operate-select-modal-mask.active .operate-select-modal {
    transform: translateY(0);
}

/* 操作选择弹窗标题 */
.operate-select-modal__title {
    padding: 16px;
    border-bottom: 1px solid #f5f5f5;
    font-size: 16px;
    color: #333;
    font-weight: 600;
    text-align: center;
}

/* 操作选择按钮列表 */
.operate-select-modal__list {
    padding: 8px 0;
}

.operate-select-modal__item {
    padding: 14px 16px;
    text-align: center;
    font-size: 15px;
    color: #333;
    border-bottom: 1px solid #f5f5f5;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.operate-select-modal__item:last-child {
    border-bottom: none;
}

.operate-select-modal__item:hover {
    background-color: #f9f9f9;
}

/* 删除按钮特殊样式 */
.operate-select-modal__item.delete {
    color: #ff4d4f;
}

/* 取消按钮 */
.operate-select-modal__cancel {
    padding: 14px 16px;
    text-align: center;
    font-size: 15px;
    color: #333;
    cursor: pointer;
    background-color: #f5f5f5;
    transition: background-color 0.2s ease;
}

.operate-select-modal__cancel:hover {
    background-color: #eee;
}

/* 表单弹窗标题区分（添加/修改） */
.modal-header h4.update-title {
    color: #333;
}


/* 固定统计卡片样式 */
.stats-card {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    padding: 10px;
    margin: 10px 10px; /* 左右+底部各10px间距，与基金卡片对齐 */
    border: 1px solid #f0f0f0;
    position: sticky; /* 固定不滚动核心属性 */
    top: 70px; /* 与搜索框底部对齐 */
    z-index: 990; /* 低于搜索框，高于基金卡片 */
}



/* 统计卡片标题 */
.stats-card__header {
    margin-bottom: 12px;
}

/* 统计数据布局（四列均分） */
.stats-card__body {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

/* 统计数据项样式 */
.stats-data-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.stats-data-item__label {
    font-size: 13px;
    color: #999;
    margin-bottom: 4px;
}

.stats-data-item__value {
    font-size: 14px;
    color: #333;
    font-weight: 500;
    line-height: 1.3;
}

/* 适配小屏幕（四列转两列） */
@media (max-width: 375px) {
    .stats-card__body {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}
