/* ============ 基础重置与变量 ============ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --primary: #C28548;
    --primary-dark: #9B6239;
    --primary-light: #EAD3B0;
    --bg: #FCF6E8;
    --bg-card: rgba(255, 248, 235, 0.9);
    --text: #3E2A1F;
    --text-secondary: #9A6A3E;
    --text-light: #B1885C;
    --border: rgba(210, 165, 105, 0.5);
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --radius: 16px;
    --tab-height: 56px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html, body {
    height: 100%;
    overflow: hidden;
    font-family: 'Noto Serif SC', 'PingFang SC', 'Microsoft YaHei', system-ui, serif;
    background-color: var(--bg);
    color: var(--text);
}

body::before {
    content: "";
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-image: radial-gradient(circle at 20% 35%, rgba(190,140,70,0.06) 2%, transparent 2.5%),
                      radial-gradient(circle at 80% 70%, rgba(150,95,45,0.05) 1.5%, transparent 2%);
    background-size: 45px 45px, 60px 60px;
    pointer-events: none;
    z-index: 0;
}

/* ============ 页面容器 ============ */
.page-container {
    max-width: 540px;
    margin: 0 auto;
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

.page-content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 16px;
}

.page-content::-webkit-scrollbar { display: none; }

/* ============ 顶部导航 ============ */
.top-header {
    padding: 12px 16px;
    background: linear-gradient(135deg, #EAD7BB, #F9EEDB);
    border-bottom: 1px solid rgba(180,120,60,0.2);
    text-align: center;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.top-header h1 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #6B3E1C;
    letter-spacing: 4px;
}

.top-header .subtitle {
    font-size: 0.7rem;
    color: #A9723C;
    letter-spacing: 2px;
}

/* ============ 底部TabBar ============ */
.bottom-tabbar {
    display: flex;
    justify-content: space-around;
    background: rgba(249, 240, 222, 0.96);
    backdrop-filter: blur(20px);
    border-top: 1px solid #E4CDA7;
    padding: 6px 16px calc(6px + var(--safe-bottom));
    flex-shrink: 0;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
}

.tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: 0.68rem;
    color: var(--text-light);
    cursor: pointer;
    flex: 1;
    text-align: center;
    padding: 4px 0;
    border-radius: 30px;
    transition: all 0.2s;
    text-decoration: none;
}

.tab-item .tab-icon {
    font-size: 1.35rem;
    line-height: 1;
}

.tab-item.active {
    color: var(--primary-dark);
    font-weight: 600;
    background: rgba(200, 140, 80, 0.1);
}

/* ============ 通用卡片 ============ */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    margin: 0 12px 12px;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 16px 12px 12px;
    font-weight: 600;
    color: #784F2C;
    border-left: 3px solid #DBA35C;
    padding-left: 10px;
    font-size: 1rem;
    letter-spacing: 1px;
}

.section-title .count {
    font-size: 0.7rem;
    color: var(--text-secondary);
    font-weight: 400;
    margin-left: auto;
}

/* ============ 搜索栏 ============ */
.search-bar {
    display: flex;
    align-items: center;
    background: white;
    border-radius: 24px;
    padding: 8px 14px;
    margin: 12px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.search-bar input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 0.88rem;
    font-family: inherit;
    background: transparent;
    color: var(--text);
}

.search-bar input::placeholder {
    color: var(--text-light);
}

.search-bar .search-icon {
    font-size: 1.1rem;
    margin-right: 8px;
    color: var(--text-light);
}

.search-bar .search-btn {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 0.78rem;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
}

.search-bar .search-btn:active {
    background: var(--primary-dark);
}

/* ============ 分类标签 ============ */
.category-tabs {
    display: flex;
    gap: 8px;
    padding: 0 12px 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
}

.category-tabs::-webkit-scrollbar { display: none; }

.category-tag {
    flex-shrink: 0;
    background: white;
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 0.78rem;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.category-tag.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ============ 藏品列表项 ============ */
.relic-list {
    padding: 0 12px;
}

.relic-item {
    display: flex;
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 12px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 0.15s;
}

.relic-item:active {
    transform: scale(0.98);
}

.relic-thumb {
    width: 110px;
    height: 110px;
    flex-shrink: 0;
    background: #EFE0CA center/cover no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: var(--primary-light);
}

.relic-info {
    flex: 1;
    padding: 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.relic-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: #5C3F1F;
    margin-bottom: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.relic-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.relic-meta .tag {
    background: var(--primary-light);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.65rem;
    color: #784F2C;
}

.relic-desc {
    font-size: 0.72rem;
    color: var(--text-light);
    margin-top: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* ============ 轮播图 ============ */
.carousel {
    position: relative;
    overflow: hidden;
    border-radius: 20px;
    margin: 0 12px 16px;
    box-shadow: 0 8px 24px -8px rgba(0,0,0,0.15);
}

.carousel-track {
    display: flex;
    transition: transform 0.4s ease;
}

.carousel-slide {
    flex: 0 0 100%;
    aspect-ratio: 16/9;
    background-size: cover;
    background-position: center;
    position: relative;
    display: flex;
    align-items: flex-end;
}

.carousel-slide .slide-text {
    width: 100%;
    background: linear-gradient(transparent, rgba(0,0,0,0.6));
    color: white;
    padding: 20px 16px 14px;
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 1px;
}

.carousel-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: -28px;
    position: relative;
    z-index: 2;
    padding-bottom: 12px;
}

.carousel-dot {
    width: 6px;
    height: 6px;
    border-radius: 6px;
    background: rgba(255,255,255,0.5);
    transition: all 0.3s;
    cursor: pointer;
}

.carousel-dot.active {
    width: 20px;
    background: white;
}

/* ============ 藏品网格(首页) ============ */
.relic-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 0 12px;
}

.relic-grid-item {
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: transform 0.15s;
}

.relic-grid-item:active {
    transform: scale(0.96);
}

.relic-grid-thumb {
    width: 100%;
    aspect-ratio: 1;
    background: #EFE0CA center/cover no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--primary-light);
}

.relic-grid-name {
    padding: 8px;
    font-size: 0.72rem;
    font-weight: 500;
    text-align: center;
    color: #5C3F1F;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ============ 快捷入口 ============ */
.quick-actions {
    display: flex;
    gap: 12px;
    padding: 0 12px 16px;
}

.quick-action {
    flex: 1;
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px 8px;
    text-align: center;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: transform 0.15s;
    text-decoration: none;
    color: inherit;
}

.quick-action:active {
    transform: scale(0.97);
}

.quick-action .action-icon {
    font-size: 1.8rem;
    margin-bottom: 6px;
}

.quick-action .action-text {
    font-size: 0.75rem;
    font-weight: 500;
    color: #6B3F1C;
}

.quick-action .action-sub {
    font-size: 0.65rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ============ 我的页面 ============ */
.profile-header {
    background: linear-gradient(135deg, #B26B36, #7E4622);
    padding: 28px 20px;
    color: white;
    text-align: center;
    border-radius: 0 0 32px 32px;
    position: relative;
    overflow: hidden;
}

.profile-header::after {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(circle at 30% 40%, rgba(255,215,150,0.15) 2%, transparent 2.5%);
    background-size: 30px 30px;
    pointer-events: none;
}

.profile-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    margin: 0 auto 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    border: 2px solid rgba(255,255,255,0.4);
}

.profile-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.profile-desc {
    font-size: 0.72rem;
    opacity: 0.8;
}

.profile-menu {
    padding: 12px;
}

.menu-group {
    margin-bottom: 12px;
}

.menu-group-title {
    font-size: 0.72rem;
    color: var(--text-light);
    padding: 8px 12px 4px;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 12px;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: 8px;
    cursor: pointer;
    transition: transform 0.15s;
    text-decoration: none;
    color: inherit;
}

.menu-item:active {
    transform: scale(0.98);
}

.menu-item .menu-icon {
    font-size: 1.3rem;
    width: 24px;
    text-align: center;
}

.menu-item .menu-text {
    flex: 1;
    font-size: 0.88rem;
}

.menu-item .menu-arrow {
    font-size: 0.8rem;
    color: var(--text-light);
}

.menu-item .menu-badge {
    background: #E45B3C;
    color: white;
    font-size: 0.6rem;
    padding: 2px 8px;
    border-radius: 10px;
    margin-right: 4px;
}

/* ============ 统计卡片 ============ */
.stats-row {
    display: flex;
    gap: 10px;
    padding: 0 12px 16px;
}

.stat-card {
    flex: 1;
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 14px 8px;
    text-align: center;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.stat-card .stat-num {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 4px;
}

.stat-card .stat-label {
    font-size: 0.68rem;
    color: var(--text-secondary);
}

/* ============ 空状态 ============ */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-light);
}

.empty-state .empty-icon {
    font-size: 3.5rem;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-state .empty-text {
    font-size: 0.88rem;
}

/* ============ 加载中 ============ */
.loading-more {
    text-align: center;
    padding: 16px;
    color: var(--text-light);
    font-size: 0.78rem;
}

.no-more {
    text-align: center;
    padding: 16px;
    color: var(--text-light);
    font-size: 0.7rem;
}

/* ============ Toast ============ */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.75);
    color: white;
    padding: 10px 24px;
    border-radius: 24px;
    font-size: 0.85rem;
    z-index: 9999;
    pointer-events: none;
    animation: toastIn 0.3s ease;
}

@keyframes toastIn {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* ============ 详情弹窗 ============ */
.detail-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    display: flex;
    align-items: flex-end;
    animation: fadeIn 0.2s;
}

.detail-panel {
    background: var(--bg);
    border-radius: 24px 24px 0 0;
    width: 100%;
    max-width: 540px;
    max-height: 80vh;
    overflow-y: auto;
    margin: 0 auto;
    animation: slideUp 0.3s ease;
}

.detail-panel::-webkit-scrollbar { display: none; }

.detail-handle {
    width: 36px;
    height: 4px;
    background: #D4B082;
    border-radius: 2px;
    margin: 10px auto;
}

.detail-images {
    position: relative;
    overflow: hidden;
}

.detail-image {
    width: 100%;
    aspect-ratio: 4/3;
    background: #EFE0CA center/cover no-repeat;
}

.detail-body {
    padding: 16px 20px 24px;
}

.detail-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: #5C3F1F;
    margin-bottom: 12px;
}

.detail-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 0.82rem;
}

.detail-label {
    color: var(--text-light);
    flex-shrink: 0;
    min-width: 56px;
}

.detail-value {
    color: var(--text);
}

.detail-section {
    margin-top: 16px;
}

.detail-section h3 {
    font-size: 0.9rem;
    color: #784F2C;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

.detail-section p {
    font-size: 0.82rem;
    color: var(--text);
    line-height: 1.7;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* ============ 添加按钮(FAB) ============ */
.fab-btn {
    position: fixed;
    bottom: calc(var(--tab-height) + var(--safe-bottom) + 20px);
    right: 20px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, #C28548, #9B6239);
    color: white;
    border: none;
    font-size: 1.6rem;
    box-shadow: 0 4px 16px rgba(155, 98, 57, 0.4);
    cursor: pointer;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
}
.fab-btn:active {
    transform: scale(0.92);
    box-shadow: 0 2px 8px rgba(155, 98, 57, 0.3);
}

/* ============ 表单弹窗 ============ */
.form-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    display: flex;
    align-items: flex-end;
    animation: fadeIn 0.2s;
}
.form-panel {
    background: var(--bg);
    border-radius: 24px 24px 0 0;
    width: 100%;
    max-width: 540px;
    max-height: 85vh;
    overflow-y: auto;
    margin: 0 auto;
    animation: slideUp 0.3s ease;
}
.form-panel::-webkit-scrollbar { display: none; }
.form-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--bg);
    z-index: 1;
    border-radius: 24px 24px 0 0;
}
.form-header h3 {
    font-size: 1rem;
    color: #5C3F1F;
    letter-spacing: 2px;
}
.form-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: white;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
}
.form-body {
    padding: 16px 20px 24px;
}
.form-group {
    margin-bottom: 14px;
}
.form-group label {
    display: block;
    font-size: 0.78rem;
    color: #784F2C;
    margin-bottom: 6px;
    font-weight: 500;
}
.form-group label .required {
    color: #E45B3C;
    margin-left: 2px;
}
.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 0.85rem;
    font-family: inherit;
    color: var(--text);
    background: white;
    outline: none;
    transition: border-color 0.2s;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(194, 133, 72, 0.15);
}
.form-group textarea {
    min-height: 80px;
    resize: vertical;
}
.form-group .form-hint {
    font-size: 0.65rem;
    color: var(--text-light);
    margin-top: 4px;
}
.form-submit {
    width: 100%;
    background: linear-gradient(135deg, #C28548, #9B6239);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 12px;
    font-size: 0.95rem;
    font-family: inherit;
    font-weight: 500;
    letter-spacing: 2px;
    cursor: pointer;
    margin-top: 8px;
    transition: opacity 0.2s;
}
.form-submit:active {
    opacity: 0.85;
}
.form-submit:disabled {
    opacity: 0.6;
    pointer-events: none;
}
