/* 全局重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    font-family: 'Segoe UI', Roboto, system-ui, sans-serif;
    background: #f4f2ed;
    color: #1e1e2a;
    padding: 2rem 1.5rem;
}
.container {
    max-width: 1300px;
    margin: 0 auto;
}

/* 头部 */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e0d6c8;
}
.logo h1 {
    font-size: 2.2rem;
    font-weight: 700;
    color: #2b1e14;
}
.logo h1 i {
    color: #e63e6b;
    margin-right: 8px;
}
.logo span {
    font-size: 0.95rem;
    color: #6b5a4a;
    margin-left: 12px;
}
.user-area {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    background: #fffcf7;
    padding: 0.4rem 1.2rem 0.4rem 1.8rem;
    border-radius: 40px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}
.user-area i {
    font-size: 1.1rem;
    color: #4a3f35;
    cursor: pointer;
}
.user-area i:hover { color: #e63e6b; }
.avatar {
    width: 38px;
    height: 38px;
    background: #d9cdbf;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

/* 导航 */
nav {
    background: #ffffffd9;
    backdrop-filter: blur(4px);
    border-radius: 60px;
    padding: 0.5rem 1.8rem;
    margin-bottom: 2.5rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    border: 1px solid #ede6dc;
}
.nav-links {
    display: flex;
    gap: 1.8rem;
    flex-wrap: wrap;
}
.nav-links a {
    text-decoration: none;
    color: #3d3328;
    font-weight: 500;
    padding: 0.4rem 0.2rem;
    border-bottom: 2px solid transparent;
    display: flex;
    align-items: center;
    gap: 6px;
}
.nav-links a i { color: #8a7a68; }
.nav-links a:hover, .nav-links a.active {
    border-bottom-color: #e63e6b;
    color: #1e1e2a;
}
.search-box {
    display: flex;
    align-items: center;
    background: #f3efe9;
    border-radius: 40px;
    padding: 0.2rem 0.2rem 0.2rem 1.2rem;
}
.search-box input {
    border: none;
    background: transparent;
    padding: 0.4rem 0;
    outline: none;
    width: 140px;
    font-size: 0.9rem;
}
.search-box button {
    background: #e63e6b;
    border: none;
    color: #fff;
    padding: 0.4rem 1.2rem;
    border-radius: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
}
.search-box button:hover { background: #c92f58; }

/* 主布局 */
.main-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 2rem;
    margin-top: 0.5rem;
}

/* 左栏 */
.left-col { display: flex; flex-direction: column; gap: 2rem; }

/* 欢迎横幅 */
.welcome-banner {
    background: linear-gradient(145deg, #fff8f0, #f5ede4);
    padding: 1.8rem 2.2rem;
    border-radius: 28px;
    border: 1px solid #eae0d5;
}
.welcome-banner h2 {
    font-size: 1.6rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}
.welcome-banner h2 i { color: #e63e6b; }
.stats-mini {
    display: flex;
    gap: 2rem;
    margin-top: 0.8rem;
    flex-wrap: wrap;
}
.stats-mini .stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fffcf7;
    padding: 0.3rem 1.4rem 0.3rem 1rem;
    border-radius: 40px;
    border: 1px solid #e5dcd0;
    font-size: 0.9rem;
}
.stat-item i { color: #e63e6b; }
.stat-item strong { font-size: 1.2rem; margin-right: 2px; }

/* 快速添加 */
.quick-add {
    background: #fffcf7;
    border-radius: 28px;
    padding: 1.5rem 2rem;
    border: 1px solid #eae0d5;
}
.quick-add h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}
.quick-add .form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    align-items: center;
}
.quick-add input, .quick-add select {
    padding: 0.6rem 1rem;
    border: 1px solid #ddd2c4;
    border-radius: 40px;
    background: #fff;
    font-size: 0.9rem;
    flex: 1 1 130px;
    outline: none;
}
.quick-add select {
    padding-right: 2.2rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b5a4a' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}
.quick-add #itemName {
    flex: 2 1 220px;
}
.quick-add #itemPrice {
    flex: 1 1 100px;
}
.quick-add #itemDate {
    flex: 1 1 150px;
}
.quick-add input:focus, .quick-add select:focus {
    border-color: #e63e6b;
}
.quick-add button {
    background: #2b1e14;
    color: #fff;
    border: none;
    padding: 0.6rem 1.6rem;
    border-radius: 40px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}
.quick-add button:hover { background: #1f150e; }
.quick-add button.cancel-btn {
    background: #ede6dc;
    color: #3d3328;
}
.quick-add button.cancel-btn:hover { background: #d9cdbf; }

/* 备注输入框 */
.remark-input {
    width: 100%;
    margin-top: 0.6rem;
    padding: 0.5rem 0.9rem;
    border: 1px solid #e3d9cc;
    border-radius: 10px;
    background: #fff;
    font-size: 0.82rem;
    color: #3a2d20;
    resize: vertical;
    font-family: inherit;
    line-height: 1.5;
}
.remark-input:focus { outline: none; border-color: #e63e6b; }

/* 收藏列表 */
.collection-section {
    background: #fffcf7;
    border-radius: 28px;
    padding: 1.5rem 2rem 2rem;
    border: 1px solid #eae0d5;
}
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2rem;
}
.section-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}
#sortBtn {
    color: #8a7a68;
    cursor: pointer;
    font-size: 1rem;
    transition: color 0.2s;
}
#sortBtn:hover, #sortBtn.sort-active { color: #e63e6b; }
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.2rem;
}
.collect-card {
    background: #ffffff;
    border-radius: 20px;
    padding: 1rem 1rem 1.2rem;
    border: 1px solid #ede6dc;
    transition: 0.2s;
    position: relative;
}
.collect-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.04);
}
.card-img-placeholder {
    width: 100%;
    height: 120px;
    background: linear-gradient(145deg, #f0e8de, #e6dbcf);
    border-radius: 14px;
    margin-bottom: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #8a7a68;
    font-size: 2.2rem;
}
.collect-card h4 { font-size: 1rem; font-weight: 600; }
.collect-card .sub { font-size: 0.8rem; color: #6b5a4a; margin-top: 2px; }
.collect-card .price {
    font-size: 0.9rem;
    font-weight: 600;
    color: #2b1e14;
    margin-top: 6px;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
}
.collect-card .price .buy-date {
    font-size: 0.72rem;
    font-weight: 400;
    color: #b0a294;
    white-space: nowrap;
}
.collect-card .price .price-empty {
    font-size: 0.75rem;
    font-weight: 400;
    color: #b0a294;
}
.collect-card .card-remark {
    font-size: 0.75rem;
    color: #8a7a68;
    background: #faf3ec;
    border-radius: 6px;
    padding: 0.3rem 0.5rem;
    margin-top: 6px;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-all;
}
.collect-card .tags {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}
.collect-card .tags span {
    background: #f3ede6;
    padding: 0.1rem 0.8rem;
    border-radius: 30px;
    font-size: 0.7rem;
    font-weight: 500;
}
.grid-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2rem;
    color: #8a7a68;
}
.card-actions {
    margin-top: 12px;
    display: flex;
    gap: 10px;
    border-top: 1px solid #f0e8de;
    padding-top: 10px;
}
.card-actions i {
    color: #8a7a68;
    cursor: pointer;
    font-size: 0.9rem;
}
.card-actions i:hover { color: #e63e6b; }
.card-actions .fav { color: #e63e6b; }
.card-actions .delete:hover { color: #b33b4a; }

/* 右栏 */
.right-col {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}
.stats-card {
    background: #fffcf7;
    border-radius: 28px;
    padding: 1.5rem 1.8rem;
    border: 1px solid #eae0d5;
}
.stats-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}
.stat-line {
    display: flex;
    justify-content: space-between;
    padding: 0.4rem 0;
    border-bottom: 1px dashed #ede6dc;
    font-size: 0.9rem;
}
.stat-line:last-of-type { border-bottom: none; }
.stat-line .label { color: #5a4c3e; }
.stat-line .value { font-weight: 600; }

/* 进度条 */
.category-bar {
    margin-top: 0.8rem;
}
.bar-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    margin-bottom: 6px;
}
.bar-item .bar-track {
    flex: 1;
    height: 8px;
    background: #ede6dc;
    border-radius: 20px;
    overflow: hidden;
}
.bar-item .bar-fill {
    height: 100%;
    background: #e63e6b;
    border-radius: 20px;
}
.bar-item .bar-label {
    min-width: 56px;
    color: #4a3f35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.bar-item .bar-count {
    flex-shrink: 0;
    min-width: 56px;
    text-align: right;
    font-weight: 500;
    white-space: nowrap;
}

/* 标签云 */
.tag-cloud {
    background: #fffcf7;
    border-radius: 28px;
    padding: 1.5rem 1.8rem;
    border: 1px solid #eae0d5;
}
.tag-cloud h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}
.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.tag-list span {
    background: #f3ede6;
    padding: 0.2rem 1rem;
    border-radius: 30px;
    font-size: 0.8rem;
    cursor: default;
}

/* 备份 */
.backup-card {
    background: #fcfaf7;
    border-radius: 28px;
    padding: 1.5rem 1.8rem;
    border: 1px dashed #d9cdbf;
}
.backup-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.8rem;
    display: flex;
    align-items: center;
    gap: 8px;
}
.backup-card .btn-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.backup-card button {
    background: #ede6dc;
    border: none;
    padding: 0.5rem 1.2rem;
    border-radius: 40px;
    font-weight: 500;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
}
.backup-card button:hover { background: #d9cdbf; }

/* 页脚 */
footer {
    margin-top: 4rem;
    padding-top: 1.8rem;
    border-top: 1px solid #e5dcd0;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    color: #6b5a4a;
    font-size: 0.9rem;
}
footer .social i {
    font-size: 1.2rem;
    margin-left: 16px;
    color: #6b5a4a;
    cursor: pointer;
}
footer .social i:hover { color: #e63e6b; }

.badge-outline {
    display: inline-block;
    background: #f3ede6;
    font-size: 0.6rem;
    padding: 0.1rem 0.6rem;
    border-radius: 30px;
    color: #6b5a4a;
    margin-left: 6px;
}

/* ===== 铃铛提醒 ===== */
.bell-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    padding: 0 4px;
    background: #e63e6b;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 10px;
    text-align: center;
}
.user-area { position: relative; }
.user-area i.fa-bell { cursor: pointer; }

.bell-dropdown {
    position: fixed;
    top: 64px;
    right: 24px;
    width: 320px;
    max-height: 440px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.12);
    z-index: 999;
    overflow: hidden;
    animation: bellFade 0.15s ease;
}
@keyframes bellFade {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.bell-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.9rem 1.1rem;
    border-bottom: 1px solid #f3ede6;
    font-size: 0.92rem;
    color: #2b1e14;
}
.bell-close { cursor: pointer; color: #a0917f; font-size: 1.2rem; line-height: 1; }
.bell-close:hover { color: #2b1e14; }
.bell-body { max-height: 380px; overflow-y: auto; }
.bell-section { padding: 0.6rem 0; border-bottom: 1px solid #f7f1e9; }
.bell-section:last-child { border-bottom: none; }
.bell-section-title {
    font-size: 0.78rem;
    font-weight: 600;
    color: #8a7a68;
    padding: 0.3rem 1.1rem;
}
.bell-section-title i { margin-right: 6px; color: #e63e6b; }
.bell-list { padding: 0 0.4rem; }
.bell-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.45rem 0.7rem;
    border-radius: 8px;
    font-size: 0.85rem;
    color: #3a2d20;
    cursor: pointer;
}
.bell-item:hover { background: #faf3ec; }
.bell-item small { color: #a0917f; font-size: 0.72rem; margin-left: auto; }
.bell-more {
    padding: 0.4rem 1.1rem;
    font-size: 0.72rem;
    color: #b0a294;
}
.bell-empty {
    padding: 2rem 1rem;
    text-align: center;
    color: #8a7a68;
    font-size: 0.9rem;
}
.bell-empty i { color: #4ecb71; font-size: 1.4rem; margin-bottom: 0.5rem; display: block; }

/* ===== 视图切换（概览 / 全部藏品 / 统计 / 分类） ===== */
.view-page { animation: viewFadeIn 0.25s ease; }
@keyframes viewFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* 统计视图：顶部大数字卡 */
.stats-hero {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.2rem;
}
.stat-card-big {
    background: #fff;
    border-radius: 16px;
    padding: 1.4rem 1rem;
    text-align: center;
    box-shadow: 0 8px 24px rgba(0,0,0,0.04);
}
.stat-card-big i { font-size: 1.4rem; color: #e63e6b; }
.stat-card-big .num { font-size: 1.6rem; font-weight: 700; color: #2b1e14; margin-top: 0.4rem; }
.stat-card-big .cap { font-size: 0.78rem; color: #8a7a68; margin-top: 2px; }

/* 统计视图：瀑布流面板（列主导从上到下再开新列，消除行间空隙） */
.stats-grid {
    column-count: 2;
    column-gap: 1.2rem;
}
@media (max-width: 780px) {
    .stats-grid { column-count: 1; }
}
.panel-card {
    background: #fff;
    border-radius: 16px;
    padding: 1.2rem 1.4rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.04);
    break-inside: avoid;
    margin-bottom: 1.2rem;
    page-break-inside: avoid;
}
.panel-card h3 { font-size: 1rem; margin-bottom: 1rem; }

/* 最贵 Top5 行 */
.rank-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.8rem;
    padding: 0.5rem 0;
    border-bottom: 1px dashed #f0e8dd;
    font-size: 0.88rem;
}
.rank-row:last-child { border-bottom: none; }
.rank-name { color: #3a2d20; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-name small { display: block; font-size: 0.72rem; color: #a0917f; font-weight: 400; }
.rank-num {
    display: inline-block;
    width: 1.3rem;
    color: #e63e6b;
    font-weight: 700;
}
.rank-price { font-weight: 600; color: #2b1e14; white-space: nowrap; }

/* 分类视图：类别块 */
.cat-block {
    background: #fff;
    border-radius: 16px;
    padding: 1.2rem 1.4rem;
    margin-bottom: 1.2rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.04);
}
.cat-head {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding-bottom: 0.6rem;
    margin-bottom: 0.3rem;
    border-bottom: 2px solid #f7f1e9;
}
.cat-head i { color: #e63e6b; font-size: 1.1rem; }
.cat-head strong { font-size: 1rem; color: #2b1e14; }
.cat-meta { margin-left: auto; font-size: 0.78rem; color: #8a7a68; }
.cat-row {
    display: flex;
    align-items: baseline;
    gap: 0.8rem;
    padding: 0.45rem 0;
    border-bottom: 1px dashed #f5efe6;
    font-size: 0.88rem;
}
.cat-row:last-child { border-bottom: none; }
.cat-row .cat-name { font-weight: 500; color: #3a2d20; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-row .cat-group { color: #a0917f; font-size: 0.78rem; white-space: nowrap; }
.cat-row .cat-date { margin-left: auto; color: #b0a294; font-size: 0.75rem; white-space: nowrap; }
.cat-row .cat-price { font-weight: 600; color: #2b1e14; min-width: 72px; text-align: right; white-space: nowrap; }

/* 响应式 */
@media (max-width: 900px) {
    .main-grid { grid-template-columns: 1fr; }
    .right-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
}
@media (max-width: 600px) {
    .cat-row { flex-wrap: wrap; gap: 0.2rem 0.6rem; }
    .cat-row .cat-date { margin-left: 0; }
    .cat-row .cat-price { margin-left: auto; }
}
@media (max-width: 600px) {
    header { flex-direction: column; align-items: flex-start; gap: 0.8rem; }
    nav { flex-direction: column; align-items: stretch; gap: 0.8rem; border-radius: 28px; padding: 1rem; }
    .nav-links { justify-content: center; gap: 1rem; }
    .search-box input { width: 100px; }
    .right-col { grid-template-columns: 1fr; }
    .card-grid { grid-template-columns: 1fr 1fr; }
    .quick-add .form-row { flex-direction: column; }
    .quick-add .form-row input,
    .quick-add .form-row select { width: 100%; flex: unset; }
}
@media (max-width: 420px) {
    .card-grid { grid-template-columns: 1fr; }
}