/* 
 * 资产配置页面样式文件
 * 提取自 index.html 的内联样式
 */

/* CSS 变量定义 */
:root {
    --color-bg-primary: #0f172a;
    --color-bg-secondary: #1e293b;
    --color-accent-gold: #fbbf24;
    --color-accent-gold-dark: #f59e0b;
    --color-positive: #10b981;
    --color-negative: #ef4444;
    --color-slate-400: rgb(148, 163, 184);
    --color-slate-500: rgb(100, 116, 139);
    --color-slate-700: rgb(51, 65, 85);
    --color-slate-800: rgb(30, 41, 59);
    --color-slate-900: rgb(15, 23, 42);
}

/* 全局字体设置 */
* {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* 渐变背景 */
.gradient-bg {
    background: linear-gradient(135deg, var(--color-bg-primary) 0%, var(--color-bg-secondary) 100%);
}

/* 毛玻璃卡片效果 */
.card-glass {
    background: rgba(30, 41, 59, 0.8);
    backdrop-filter: blur(10px);
}

/* 金色强调色 */
.gold-accent {
    color: var(--color-accent-gold);
}

/* 金色渐变背景 */
.gold-bg {
    background: linear-gradient(135deg, var(--color-accent-gold) 0%, var(--color-accent-gold-dark) 100%);
}

/* 正向数值（涨） */
.positive {
    color: var(--color-positive);
}

/* 负向数值（跌） */
.negative {
    color: var(--color-negative);
}

/* 展开图标动画 */
.expand-icon {
    transition: transform 0.3s ease;
}

.expanded .expand-icon {
    transform: rotate(180deg);
}

/* 资产卡片 */
.asset-card {
    transition: all 0.3s ease;
}

/* 点击反馈（移动端优化） */
.asset-card:active {
    transform: scale(0.98);
    opacity: 0.9;
}

/* 进度条动画 */
.progress-bar {
    transition: width 0.5s ease;
}

/* 激活的标签页 */
.tab-active {
    border-bottom: 2px solid var(--color-accent-gold);
    color: var(--color-accent-gold);
}

/* 淡入动画 */
.animate-fade-in {
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 响应式优化 */
@media (max-width: 640px) {
    .asset-card {
        padding: 0.75rem;
    }
}

/* ========== 新增样式 - 借鉴 WealthPilot2 ========== */

/* 进度条容器（带目标标记） */
.progress-with-target {
    position: relative;
    height: 0.625rem;
    background: var(--color-slate-700);
    border-radius: 9999px;
    overflow: visible;
}

/* 目标位置标记线 */
.progress-target-marker {
    position: absolute;
    top: -2px;
    bottom: -2px;
    width: 2px;
    background: rgba(255, 255, 255, 0.6);
    z-index: 10;
    border-radius: 1px;
}

/* 实际进度填充 */
.progress-fill {
    height: 100%;
    border-radius: 9999px;
    transition: width 0.7s ease-out;
}

/* 可展开卡片 */
.expandable-card {
    overflow: hidden;
    transition: all 0.3s ease;
}

.expandable-card.expanded {
    border-color: var(--color-accent-gold);
}

/* 展开内容区域 */
.card-expand-content {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
}

.expandable-card.expanded .card-expand-content {
    max-height: 500px;
    opacity: 1;
}

/* 状态徽章 - 超配 */
.badge-overweight {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.125rem 0.5rem;
    border-radius: 0.5rem;
    font-size: 0.625rem;
    font-weight: 700;
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* 状态徽章 - 低配 */
.badge-underweight {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.125rem 0.5rem;
    border-radius: 0.5rem;
    font-size: 0.625rem;
    font-weight: 700;
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

/* 策略建议提示 */
.strategy-tip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 0.75rem;
    margin-top: 0.75rem;
    border-radius: 0.75rem;
    font-size: 0.6875rem;
    font-weight: 600;
}

.strategy-tip.tip-buy {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    color: #93c5fd;
}

.strategy-tip.tip-sell {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

/* 加粗数字显示 */
.font-black {
    font-weight: 900;
}

/* 子资产明细区域 */
.sub-assets-detail {
    background: rgba(15, 23, 42, 0.5);
    border-top: 1px solid var(--color-slate-700);
    padding: 0.75rem;
}

/* 子资产行 */
.sub-asset-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background: rgba(30, 41, 59, 0.5);
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
}

.sub-asset-row:last-child {
    margin-bottom: 0;
}

/* ========== 资产编辑功能样式 ========== */

/* 可编辑子资产行 */
.sub-asset-row.editable {
    flex-wrap: wrap;
    gap: 0.5rem;
}

.sub-asset-row .fund-info {
    flex: 1;
    min-width: 0;
}

.sub-asset-row .fund-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* 份额输入框 */
.shares-input {
    width: 100px;
    padding: 0.375rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--color-slate-700);
    border-radius: 0.5rem;
    text-align: right;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.shares-input:focus {
    outline: none;
    border-color: var(--color-accent-gold);
    box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.2);
}

.shares-input::placeholder {
    color: var(--color-slate-500);
}

/* 编辑操作按钮 */
.edit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.edit-btn.save {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.edit-btn.save:active {
    background: rgba(16, 185, 129, 0.4);
    transform: scale(0.95);
}

.edit-btn.cancel {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.edit-btn.cancel:active {
    background: rgba(239, 68, 68, 0.4);
    transform: scale(0.95);
}

.edit-btn.delete {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

.edit-btn.delete:active {
    background: rgba(239, 68, 68, 0.3);
    transform: scale(0.95);
}

/* 添加基金按钮 */
.add-fund-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.625rem;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-accent-gold);
    background: rgba(251, 191, 36, 0.1);
    border: 1px dashed rgba(251, 191, 36, 0.3);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.add-fund-btn:active {
    background: rgba(251, 191, 36, 0.2);
    transform: scale(0.98);
}

/* 添加基金弹窗 */
.add-fund-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: flex-end;
    justify-content: center;
    z-index: 60;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.add-fund-modal.active {
    display: flex;
}

.add-fund-modal-content {
    width: 100%;
    max-width: 28rem;
    background: var(--color-slate-800);
    border-radius: 1.5rem 1.5rem 0 0;
    padding: 1.5rem;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.add-fund-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.add-fund-modal-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.add-fund-modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-slate-700);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
}

.add-fund-form-group {
    margin-bottom: 1rem;
}

.add-fund-form-group label {
    display: block;
    font-size: 0.875rem;
    color: var(--color-slate-400);
    margin-bottom: 0.5rem;
}

.add-fund-input {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    color: white;
    background: var(--color-slate-900);
    border: 1px solid var(--color-slate-700);
    border-radius: 0.75rem;
    transition: border-color 0.2s;
}

.add-fund-input:focus {
    outline: none;
    border-color: var(--color-accent-gold);
}

.add-fund-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

.add-fund-actions button {
    flex: 1;
    padding: 0.875rem;
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.add-fund-actions .btn-cancel {
    background: var(--color-slate-700);
    color: white;
}

.add-fund-actions .btn-confirm {
    background: linear-gradient(135deg, var(--color-accent-gold) 0%, var(--color-accent-gold-dark) 100%);
    color: var(--color-slate-900);
}

.add-fund-actions button:active {
    transform: scale(0.98);
}

/* ========== 投前规划计算组件样式 ========== */

/* 主容器 */
.investment-planner {
    transition: all 0.3s ease;
}

.investment-planner.expanded {
    border-color: var(--color-accent-gold);
}

/* 图标样式变化 */
.investment-planner.expanded .planner-icon {
    background: var(--color-accent-gold);
    color: var(--color-slate-900);
}

/* 展开内容区域 */
.planner-expand-content {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
}

.investment-planner.expanded .planner-expand-content {
    max-height: 1200px;
    opacity: 1;
}

/* 箭头旋转 */
.investment-planner.expanded #planner-chevron {
    transform: rotate(180deg);
}

/* 快捷金额按钮 */
.quick-amount-btn {
    flex-shrink: 0;
    padding: 0.5rem 1rem;
    border-radius: 0.75rem;
    font-size: 0.6875rem;
    font-weight: 700;
    background: var(--color-slate-800);
    border: 1px solid var(--color-slate-700);
    color: var(--color-slate-400);
    cursor: pointer;
    transition: all 0.2s;
}

.quick-amount-btn.active {
    background: var(--color-accent-gold);
    border-color: var(--color-accent-gold);
    color: var(--color-slate-900);
}

.quick-amount-btn.reset {
    background: rgba(100, 116, 139, 0.2);
    border-color: transparent;
}

.quick-amount-btn:active {
    transform: scale(0.95);
}

/* 分配结果项 */
.allocation-result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid var(--color-slate-700);
    border-radius: 0.75rem;
    transition: all 0.2s;
}

.allocation-result-item:active {
    background: rgba(30, 41, 59, 0.8);
}

.allocation-result-item .color-bar {
    width: 4px;
    height: 2.5rem;
    border-radius: 9999px;
    flex-shrink: 0;
}

.allocation-result-item .asset-info {
    flex: 1;
    margin-left: 0.75rem;
}

.allocation-result-item .asset-name {
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
}

.allocation-result-item .asset-ratio {
    font-size: 0.5625rem;
    font-weight: 700;
    color: var(--color-slate-400);
    text-transform: uppercase;
    letter-spacing: -0.025em;
}

.allocation-result-item .allocation-amount {
    text-align: right;
}

.allocation-result-item .amount-value {
    font-size: 0.875rem;
    font-weight: 900;
    color: var(--color-accent-gold);
    letter-spacing: -0.025em;
}

.allocation-result-item .amount-label {
    font-size: 0.5625rem;
    font-weight: 700;
    color: var(--color-slate-400);
}

/* 隐藏滚动条 */
.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.no-scrollbar::-webkit-scrollbar {
    display: none;
}

/* ========== 堆叠条形图样式 ========== */

/* 堆叠条形图容器 */
.stacked-bar-container {
    background: var(--color-slate-700);
}

/* 堆叠条形图每个分段 */
.stacked-bar-segment {
    height: 100%;
    min-width: 2px;
}

/* 第一个分段圆角 */
.stacked-bar-segment:first-child {
    border-radius: 9999px 0 0 9999px;
}

/* 最后一个分段圆角 */
.stacked-bar-segment:last-child {
    border-radius: 0 9999px 9999px 0;
}

/* 只有一个分段时两端都圆角 */
.stacked-bar-segment:only-child {
    border-radius: 9999px;
}

/* 资产图例列表项 */
.asset-legend-list>div {
    padding: 0.25rem 0;
}