/* ============================================================
 * CW 公共样式 - common.css
 * 所有页面共享的基础样式：重置、导航栏、底部Tab栏、空状态等
 * ============================================================ */

/* ===== iOS 锁定 & 全局重置 ===== */
html, body {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden !important;
    touch-action: manipulation !important;
    -webkit-text-size-adjust: 100% !important;
    text-size-adjust: 100% !important;
}

input, textarea, select {
    font-size: 16px !important;
}

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

/* ===== 响应式字体变量 ===== */
:root {
    --font-xs: clamp(11px, 2.8vw, 12px);
    --font-sm: clamp(12px, 3vw, 13px);
    --font-base: clamp(14px, 3.5vw, 16px);
    --font-md: clamp(16px, 4vw, 18px);
    --font-lg: clamp(18px, 4.5vw, 20px);
    --font-xl: clamp(20px, 5vw, 24px);
    --font-2xl: clamp(24px, 6vw, 28px);
    --font-3xl: clamp(28px, 7vw, 32px);
    --font-4xl: clamp(32px, 8vw, 36px);
    --font-5xl: clamp(36px, 9vw, 40px);
}

/* ===== 手机安全状态栏 ===== */
.status-bar {
    height: env(safe-area-inset-top);
    background: var(--main, #B8860B);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 999;
}

/* ===== 顶部标准导航栏（index/statistics/settings 用 top-nav） ===== */
.top-nav {
    width: 100%;
    height: 55px;
    background: rgba(237, 237, 237, 0.85);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 clamp(12px, 3vw, 16px);
    color: #ab6a05;
    position: fixed;
    top: env(safe-area-inset-top);
    left: 0;
    z-index: 1000;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.brand-container {
    display: flex;
    align-items: center;
    gap: clamp(8px, 2vw, 12px);
}

.brand-logo {
    font-size: var(--font-5xl);
    color: var(--gold, #CFAF60);
}

.brand-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.brand-name {
    font-size: var(--font-base);
    font-weight: 600;
    line-height: 1.2;
}

.brand-slogan {
    font-size: 8px;
    color: var(--text-sub, #718096);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-top: 2px;
}

.book-icon-link {
    color: #27ae60;
    text-decoration: none;
    font-size: var(--font-3xl);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.book-icon-link:hover {
    transform: scale(1.1);
    color: var(--gold, #CFAF60);
}

/* ===== 子页面顶部导航栏（book/asset/category 用 nav-bar） ===== */
.nav-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    padding: 0 clamp(12px, 3vw, 16px);
    border-bottom: 1px solid var(--border, #E2E8F0);
    z-index: 1000;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.back-btn {
    font-size: 22px;
    color: var(--primary, var(--main, #B8860B));
    text-decoration: none;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    transition: all 0.2s ease;
}

.back-btn:hover {
    background: rgba(184, 134, 11, 0.08);
    transform: scale(1.05);
}

.page-title {
    flex: 1;
    text-align: center;
    font-size: clamp(16px, 4vw, 18px);
    font-weight: 600;
    color: var(--primary, var(--main, #B8860B));
}

.add-header-btn {
    font-size: clamp(22px, 5.5vw, 26px);
    color: var(--primary, var(--main, #B8860B));
    cursor: pointer;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    transition: all 0.2s ease;
}

.add-header-btn:hover {
    background: rgba(184, 134, 11, 0.08);
    transform: scale(1.05);
}

/* ===== 主内容区域（子页面通用） ===== */
.main {
    margin-top: 70px;
    padding: 0 clamp(12px, 3vw, 16px);
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

/* ===== 空状态 ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-sub, #718096);
}

.empty-state-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state-text {
    font-size: 15px;
    margin-bottom: 8px;
    font-weight: 600;
}

.empty-state-hint {
    font-size: 13px;
    color: var(--text-light, #A0AEC0);
}

/* ===== 底部 Tab 导航栏（index/statistics/settings） ===== */
.tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: clamp(60px, 8vw, 80px);
    background: #ffffff;
    display: flex;
    border-top: 1px solid #eee;
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 999;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #999;
    transition: all 0.2s ease;
    min-height: clamp(50px, 7vw, 70px);
}

.tab-item i {
    font-size: clamp(20px, 5vw, 24px);
    margin-bottom: 0px;
}

.tab-item span {
    font-size: clamp(11px, 3vw, 13px);
    font-weight: 500;
}

.tab-item:hover,
.tab-active {
    color: var(--main, #B8860B);
    transform: scale(1.05);
}

/* ===== 退出按钮（settings 用） ===== */
.logout-btn {
    background: linear-gradient(135deg, var(--main, #B8860B), var(--main-deep, #8B6914));
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 6px 12px;
    font-size: var(--font-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.logout-btn:hover {
    opacity: 0.9;
    transform: scale(1.05);
}

/* ===== 顶部筛选按钮（statistics 用） ===== */
.top-filter-btn {
    background: linear-gradient(135deg, var(--main, #B8860B), var(--main-deep, #8B6914));
    color: #fff;
    border: none;
    border-radius: 100px;
    width: 32px;
    height: 32px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 18px;
}

.top-filter-btn:hover {
    transform: translateY(-2px);
}

/* ===== 操作按钮（book/asset/category 共用） ===== */
.action-btn-icon {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.3s ease;
    background: transparent;
    flex-shrink: 0;
}

.action-btn-edit {
    background: linear-gradient(135deg, #EBF8FF 0%, #BEE3F8 100%);
    color: #3182CE;
}

.action-btn-edit:hover {
    background: linear-gradient(135deg, #4299E1 0%, #3182CE 100%);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(66, 153, 225, 0.3);
}

.action-btn-member {
    background: linear-gradient(135deg, #FAF5FF 0%, #E9D8FD 100%);
    color: #805AD5;
}

.action-btn-member:hover {
    background: linear-gradient(135deg, #9F7AEA 0%, #805AD5 100%);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(159, 122, 234, 0.3);
}

.action-btn-delete {
    background: linear-gradient(135deg, #FFF5F5 0%, #FED7D7 100%);
    color: #E53E3E;
}

.action-btn-delete:hover {
    background: linear-gradient(135deg, #FC8181 0%, #E53E3E 100%);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(229, 62, 62, 0.3);
}

/* ===== 成员卡片（book/asset 共用） ===== */
.member-section { margin-bottom: 24px; }
.member-section:last-child { margin-bottom: 0; }
.member-section-title {
    font-size: 15px; font-weight: 700; color: var(--primary); margin-bottom: 16px;
    display: flex; align-items: center; gap: 8px; padding-bottom: 8px;
    border-bottom: 2px solid rgba(184, 134, 11, 0.1);
}
.member-list-container { max-height: none; overflow-y: visible; overflow-x: hidden; padding-right: 0; }
.member-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 0; }
.member-card-header .member-remove-btn {
    width: 32px; height: 32px; padding: 0;
    display: flex; align-items: center; justify-content: center;
    border-radius: 8px; flex-shrink: 0; margin-left: 8px;
}
.member-info { flex: 1; display: flex; flex-direction: column; gap: 6px; margin-left: 12px; }
.member-name-row { display: flex; align-items: center; gap: 8px; }
.member-owner-badge {
    font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 6px;
    background: linear-gradient(135deg, #CFAF60 0%, #D4B872 100%); color: #fff;
}
.member-card {
    background: #fff;
    border: 1px solid var(--border, #E2E8F0);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.member-card:hover {
    box-shadow: 0 4px 12px rgba(184, 134, 11, 0.1);
    transform: translateY(-2px);
}

.member-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #B8860B 0%, #D4AF37 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 20px;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(45, 122, 111, 0.2);
}

.member-name {
    font-size: 16px;
    font-weight: 700;
    color: #333;
}

.member-email {
    font-size: 13px;
    color: #888;
}

.member-permission {
    font-size: 12px;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.perm-view {
    background: linear-gradient(135deg, #E3F2FD 0%, #BBDEFB 100%);
    color: #1976D2;
}

.perm-edit {
    background: linear-gradient(135deg, #FFF8E1 0%, #FFECB3 100%);
    color: #F57C00;
}

.perm-admin {
    background: linear-gradient(135deg, #FCE4EC 0%, #F8BBD0 100%);
    color: #C2185B;
}

.member-select {
    flex: 1;
    min-width: 0;
    padding: 10px 14px;
    border: 1px solid rgba(184, 134, 11, 0.2);
    border-radius: 12px;
    font-size: 14px;
    background: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.member-select:hover {
    border-color: var(--primary, var(--main, #B8860B));
    box-shadow: 0 2px 8px rgba(184, 134, 11, 0.1);
}

.member-select:focus {
    outline: none;
    border-color: var(--primary, var(--main, #B8860B));
    box-shadow: 0 0 0 3px rgba(184, 134, 11, 0.15);
}

.member-remove-btn {
    padding: 10px 16px;
    background: linear-gradient(135deg, #FFEBEE 0%, #FFCDD2 100%);
    color: #D32F2F;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    flex-shrink: 0;
}

.member-remove-btn:hover {
    background: linear-gradient(135deg, #EF5350 0%, #E53935 100%);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(211, 47, 47, 0.3);
}

/* ===== 滚动条美化 ===== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #d0d0d0;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #b0b0b0;
}
