/* ══════════════════════════════════════════════════
   梦幻西游收益助手 —— 玻璃拟态暗色科技风
   ══════════════════════════════════════════════════ */

:root {
    --bg:          #0a0e17;
    --bg-card:     rgba(19, 25, 38, 0.72);
    --bg-input:    rgba(14, 18, 28, 0.85);
    --border:      rgba(0, 212, 255, 0.12);
    --border-glow: rgba(0, 212, 255, 0.25);

    --primary:     #00d4ff;
    --primary-dim: rgba(0, 212, 255, 0.15);
    --accent:      #a78bfa;
    --accent-dim:  rgba(167, 139, 250, 0.12);

    --text:        #e2e8f0;
    --text-light:  #7b8ba0;
    --text-dim:    #3d4a5f;

    --success:     #00e676;
    --danger:      #ff3d71;
    --warning:     #ffb300;

    --radius:      12px;
    --radius-sm:   8px;
}

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

body {
    font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ── 背景装饰 ── */
.bg-grid {
    position: fixed; inset: 0; z-index: 0; pointer-events: none;
    background-image:
        linear-gradient(rgba(0,212,255,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,212,255,0.03) 1px, transparent 1px);
    background-size: 60px 60px;
}
.bg-glow {
    position: fixed; inset: 0; z-index: 0; pointer-events: none;
    background:
        radial-gradient(ellipse 60% 50% at 20% 20%, rgba(0,212,255,0.06), transparent),
        radial-gradient(ellipse 50% 40% at 80% 70%, rgba(167,139,250,0.05), transparent);
}

/* ── 导航 ── */
.navbar {
    position: relative; z-index: 10;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px; height: 56px;
    background: rgba(10, 14, 23, 0.9);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(20px);
}
.nav-left { display: flex; align-items: center; gap: 12px; }
.nav-logo { width: 32px; height: 32px; border-radius: 6px; }
.nav-title {
    font-size: 17px; font-weight: 700; letter-spacing: 1px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.nav-user {
    font-size: 13px; color: var(--accent); font-weight: 600;
}
.nav-right { display: flex; align-items: center; gap: 16px; }
.nav-date { font-size: 13px; color: var(--text-light); font-variant-numeric: tabular-nums; }

/* ── 标签页 ── */
.tabs {
    position: relative; z-index: 10;
    display: flex; gap: 4px; padding: 12px 24px 0;
}
.tab-btn {
    padding: 10px 24px; border: none; border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    background: transparent; color: var(--text-light);
    font-size: 14px; font-weight: 600; cursor: pointer;
    transition: all 0.25s ease;
    border-bottom: 2px solid transparent;
}
.tab-btn:hover { color: var(--text); background: var(--primary-dim); }
.tab-btn.active {
    color: var(--primary);
    background: var(--bg-card);
    border-bottom-color: var(--primary);
    backdrop-filter: blur(20px);
}

/* ── 内容区 ── */
.tab-content {
    position: relative; z-index: 5;
    display: none; padding: 16px 24px 24px;
    animation: fadeIn 0.3s ease;
}
.tab-content.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ── 卡片 ── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
    margin-bottom: 16px;
    backdrop-filter: blur(20px);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255,255,255,0.04);
    transition: border-color 0.3s ease;
}
.card:hover { border-color: var(--border-glow); }
.card-title {
    font-size: 15px; font-weight: 700; color: var(--primary);
    margin-bottom: 14px; letter-spacing: 0.5px;
}
.card-desc { font-size: 13px; color: var(--text-light); margin-bottom: 16px; line-height: 1.6; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-header .card-title { margin-bottom: 0; }

/* ── 表单 ── */
.form-row {
    display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end;
}
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label {
    font-size: 12px; color: var(--text-light); font-weight: 500; letter-spacing: 0.3px;
}
.form-actions { display: flex; align-items: flex-end; gap: 12px; }
.form-actions .btn { border: 1px solid transparent; padding: 10px 20px; }

.input {
    padding: 9px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14px;
    font-family: "Consolas", "Microsoft YaHei", monospace;
    outline: none;
    transition: all 0.25s ease;
    min-width: 120px;
}
.input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 12px rgba(0, 212, 255, 0.15);
}
.input::placeholder { color: var(--text-dim); }

select.input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%237b8ba0' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
    cursor: pointer;
}

/* ── 按钮 ── */
.btn {
    padding: 9px 20px; border: none; border-radius: var(--radius-sm);
    font-size: 14px; font-weight: 600; cursor: pointer;
    transition: all 0.25s ease; letter-spacing: 0.5px;
}
.btn-primary {
    background: linear-gradient(135deg, var(--primary), #0090c8);
    color: #000; box-shadow: 0 2px 12px rgba(0, 212, 255, 0.25);
}
.btn-primary:hover { box-shadow: 0 4px 20px rgba(0, 212, 255, 0.4); transform: translateY(-1px); }
.btn-sm {
    padding: 6px 14px; font-size: 12px;
    background: var(--bg-input); color: var(--text-light);
    border: 1px solid var(--border);
}
.btn-sm:hover { color: var(--primary); border-color: var(--primary); }
.btn-sm.active { color: var(--primary); border-color: var(--primary); background: var(--primary-dim); }

/* ── 快捷按钮 ── */
.today-tag {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 6px;
    background: var(--primary-dim);
    color: var(--primary);
    font-size: 10px;
    border-radius: 4px;
    border: 1px solid var(--border);
    vertical-align: middle;
}
.quick-label { font-size: 12px; color: var(--text-dim); }

/* ── 表格 ── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table thead th {
    padding: 10px 14px; text-align: left; font-weight: 600;
    color: var(--text-light); font-size: 12px; letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    background: #0a0e17;     /* 完全不透明，防止滚动时下方行透出 */
    position: sticky; top: 0; z-index: 5;
    white-space: nowrap;
    box-shadow: 0 1px 0 var(--border);   /* 底部加一道线，滚动时更清晰 */
}
.table tbody td {
    padding: 10px 14px; border-bottom: 1px solid rgba(255,255,255,0.03);
    color: var(--text);
}
.table tbody tr:hover { background: var(--primary-dim); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; font-family: "Consolas", monospace; white-space: nowrap; }
.table .gain { color: var(--success); }
.table .loss { color: var(--danger); }
.table .total-row td { font-weight: 700; background: var(--primary-dim); color: var(--primary); }

/* 物价表格列宽固定，防止错位 */
#marketTableBody td, #marketSearchBody td { white-space: nowrap; }
#marketTableBody td:first-child, #marketSearchBody td:first-child { max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
#marketTableBody td:last-child, #marketSearchBody td:last-child { font-size: 11px; color: var(--text-light); white-space: nowrap; }

.daily-total { font-size: 16px; font-weight: 700; color: var(--success); font-variant-numeric: tabular-nums; }

/* ── 图表 ── */
.chart-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.chart-card { min-height: 300px; }
.chart-container { width: 100%; height: 260px; }

.mode-btns { display: flex; gap: 4px; }

/* ── 统计卡片 ── */
.stat-cards {
    display: grid; grid-template-columns: 1fr 1fr 1fr 2fr; gap: 12px; margin-bottom: 16px;
}
.stat-card { text-align: left; margin-bottom: 0; }
.stat-card-wide { grid-column: span 1; }
.stat-label { font-size: 12px; color: var(--text-light); margin-bottom: 6px; letter-spacing: 0.5px; }
.stat-value {
    font-size: 32px; font-weight: 700; font-variant-numeric: tabular-nums;
    font-family: "Consolas", "Microsoft YaHei", monospace;
}
.stat-value.primary { color: var(--primary); }
.stat-value.danger { color: var(--danger); }
.stat-value.success { color: var(--success); }
.stat-status { font-size: 12px; color: var(--text-light); margin-top: 8px; }

.progress-bar {
    width: 100%; height: 8px; background: var(--bg-input);
    border-radius: 4px; margin-top: 12px; overflow: hidden;
}
.progress-fill {
    height: 100%; border-radius: 4px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    transition: width 0.6s ease;
    box-shadow: 0 0 8px rgba(0, 212, 255, 0.3);
}

/* ── 底部 ── */
.footer {
    position: relative; z-index: 5;
    display: flex; justify-content: space-between;
    padding: 12px 24px; font-size: 11px; color: var(--text-dim);
    border-top: 1px solid var(--border);
    margin-top: auto;
}

/* ── 状态消息 ── */
.status-msg { font-size: 13px; color: var(--success); margin-left: 12px; }
.status-msg.error { color: var(--danger); }

/* ── 单选按钮 ── */
.radio-group { display: flex; gap: 16px; }
.radio {
    display: flex; align-items: center; gap: 6px;
    font-size: 14px; color: var(--text); cursor: pointer;
}
.radio input[type="radio"] {
    accent-color: var(--primary); width: 16px; height: 16px;
}

/* ── 响应式 ── */
@media (max-width: 960px) {
    .chart-row { grid-template-columns: 1fr; }
    .stat-cards { grid-template-columns: 1fr 1fr; }
    .form-row { flex-direction: column; }
    .form-group { width: 100%; }
    .input { width: 100%; }
}

/* ── 滚动条 ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-glow); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ══════ Toast 提示 ══════ */
.toast-container {
    position: fixed; top: 70px; right: 24px; z-index: 9999;
    display: flex; flex-direction: column; gap: 8px;
}
.toast {
    padding: 12px 20px; border-radius: var(--radius-sm);
    font-size: 14px; font-weight: 500; color: #fff;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    opacity: 0; transform: translateX(100px);
    transition: all 0.3s ease;
    min-width: 180px; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(0); }
.toast.success { background: linear-gradient(135deg, var(--success), #00c853); }
.toast.error { background: linear-gradient(135deg, var(--danger), #c51162); }
.toast.info { background: linear-gradient(135deg, var(--primary), #0090c8); color: #000; }

/* ══════ 模态框 ══════ */
.modal-overlay {
    position: fixed; inset: 0; z-index: 1000;
    background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(4px);
    display: none; align-items: center; justify-content: center;
}
.modal-overlay.show { display: flex; animation: fadeIn 0.2s ease; }
.modal {
    width: 380px; padding: 28px 32px;
    background: var(--bg-card); border: 1px solid var(--border-glow);
    border-radius: var(--radius); backdrop-filter: blur(20px);
    box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}
.modal-title {
    font-size: 17px; font-weight: 700; color: var(--primary);
    margin-bottom: 20px; letter-spacing: 0.5px;
}
.modal .form-group label { font-size: 12px; color: var(--text-light); margin-bottom: 4px; display: block; }

/* ══════ 空状态 ══════ */
.empty-state {
    text-align: center; padding: 32px 16px;
    color: var(--text-dim); font-size: 14px;
}

/* ══════ 图表空状态 ══════ */
.chart-empty {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-dim); font-size: 14px;
    pointer-events: none;
}
.chart-card { position: relative; }

/* ══════ 目标达成记录 ══════ */
.achievement-list { display: flex; flex-direction: column; gap: 10px; }
.achievement-empty {
    text-align: center; padding: 20px; color: var(--text-dim); font-size: 14px;
}
.achievement-item {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 18px; border-radius: var(--radius-sm);
    background: rgba(0, 230, 118, 0.06);
    border: 1px solid rgba(0, 230, 118, 0.15);
    transition: border-color 0.3s ease;
}
.achievement-item:hover { border-color: rgba(0, 230, 118, 0.3); }
.achievement-icon {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--success); color: #000;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; font-weight: 700; flex-shrink: 0;
}
.achievement-info { flex: 1; }
.achievement-title {
    font-size: 14px; font-weight: 600; color: var(--success);
    margin-bottom: 4px;
}
.achievement-detail {
    font-size: 12px; color: var(--text-light);
    font-variant-numeric: tabular-nums;
}

/* ══════ 编辑输入框 ══════ */
.edit-input {
    padding: 5px 8px !important; font-size: 12px !important; min-width: 0 !important;
}

/* ══════ 物价趋势 ══════ */
.market-cats { display: flex; flex-wrap: wrap; gap: 8px; }
.market-cat-btn { margin-bottom: 4px; }
.market-cat-btn.active {
    color: var(--primary); border-color: var(--primary);
    background: var(--primary-dim);
}
.market-update { font-size: 12px; color: var(--text-light); font-variant-numeric: tabular-nums; }
.market-hint { font-size: 12px; color: var(--text-dim); }

/* ══════ 移动端优化 ══════ */
@media (max-width: 768px) {
    .navbar { padding: 0 12px; height: 48px; }
    .nav-title { font-size: 14px; }
    .nav-right { gap: 8px; }
    .nav-date { display: none; }
    .tabs { padding: 8px 12px 0; }
    .tab-btn { padding: 8px 14px; font-size: 13px; }
    .tab-content { padding: 12px; }
    .card { padding: 14px 16px; }
    .form-row { gap: 8px; }
    .form-group { min-width: 0; }
    .input { min-width: 0; width: 100%; }
    .stat-cards { grid-template-columns: 1fr 1fr; }
    .stat-value { font-size: 24px; }
    .table { font-size: 12px; }
    .table thead th, .table tbody td { padding: 8px 10px; }
    .modal { width: 92%; padding: 20px 24px; }
    .toast-container { top: 56px; right: 12px; left: 12px; }
    .toast { min-width: 0; }
}
