/* ==================== 全局变量与重置 ==================== */
:root {
    --primary-color: #4a6fa5;
    --primary-color-rgb: 74, 111, 165;
    --secondary-color: #6b8cbc;
    --bg-color: #f8f9fa;
    --text-color: #333333;
    --sidebar-bg: #ffffff;
    --sidebar-border: #e0e0e0;
    --reader-bg: #ffffff;
    --hover-color: #3a5a8c;
    --card-shadow: 0 2px 12px rgba(0,0,0,0.04);
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;
    --transition: all 0.2s ease;
}

[data-theme="dark"] {
    --primary-color: #6b8cbc;
    --primary-color-rgb: 107, 140, 188;
    --secondary-color: #8ba6d4;
    --bg-color: #1a1a2e;
    --text-color: #e0e0e0;
    --sidebar-bg: #16213e;
    --sidebar-border: #2d3748;
    --reader-bg: #16213e;
    --hover-color: #8ba6d4;
}

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

body {
    font-family: 'Microsoft YaHei', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    height: 100vh;
    overflow: hidden;
}

.global-bg-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    pointer-events: none;
}

/* ==================== 应用容器 ==================== */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* ==================== 顶部导航栏 ==================== */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    height: 64px;
    background: var(--sidebar-bg);
    border-bottom: 1px solid var(--sidebar-border);
    flex-shrink: 0;
}

.header-left {
    flex: 1;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* 通知区域 */
.notification-wrapper {
    position: relative;
}

.notification-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-color);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.notification-btn:hover {
    background: rgba(var(--primary-color-rgb), 0.1);
    color: var(--primary-color);
}

.notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 18px;
    height: 18px;
    background: #ff6b6b;
    color: white;
    font-size: 0.7rem;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.notification-dropdown {
    position: fixed !important;
    width: 320px;
    max-height: 400px;
    background: var(--sidebar-bg);
    border: 1px solid var(--sidebar-border);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    z-index: 9999999 !important;
    display: none;
    overflow: hidden;
}


.notification-dropdown.show {
    display: block;
}

.notification-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--sidebar-border);
}

.notification-header h4 {
    font-size: 0.95rem;
    color: var(--primary-color);
    margin: 0;
}
.notification-list {
    max-height: 300px;
    overflow-y: auto;
}

.notification-empty {
    padding: 24px;
    text-align: center;
    color: var(--secondary-color);
    font-size: 0.85rem;
}
/* 通知项样式 */
.notification-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--sidebar-border);
    cursor: pointer;
    transition: var(--transition);
}

.notification-item:hover {
    background: rgba(var(--primary-color-rgb), 0.05);
}

.notification-item.unread {
    background: rgba(var(--primary-color-rgb), 0.08);
}

.notification-item.unread::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    background: var(--primary-color);
    border-radius: 50%;
}

.notification-item-title {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-color);
    margin-bottom: 4px;
}

.notification-item-time {
    font-size: 0.7rem;
    color: var(--secondary-color);
}
/* 认证按钮 */
.auth-buttons {
    display: flex;
    gap: 8px;
}

/* 用户资料 */
.user-profile {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px 4px 4px;
    border-radius: 40px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.user-profile:hover {
    background: rgba(var(--primary-color-rgb), 0.08);
}

.user-avatar-wrapper {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

.user-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-upload-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    opacity: 0;
    transition: var(--transition);
    cursor: pointer;
}

.user-avatar-wrapper:hover .avatar-upload-overlay {
    opacity: 1;
}

.user-nickname {
    font-weight: 500;
    font-size: 0.9rem;
}

/* 用户下拉菜单 */
.user-dropdown {
    position: fixed !important;  /* 改为 fixed */
    top: 60px !important;
    right: 20px !important;
    width: 240px;
    background: var(--sidebar-bg);
    border: 1px solid var(--sidebar-border);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    z-index: 9999999 !important;
    display: none;
}

.user-dropdown.show {
    display: block;
}

.user-dropdown-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
}

.dropdown-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

.dropdown-nickname {
    font-weight: 600;
    font-size: 1rem;
}

.dropdown-username {
    font-size: 0.8rem;
    color: var(--secondary-color);
}

.dropdown-divider {
    height: 1px;
    background: var(--sidebar-border);
    margin: 4px 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-color);
}

.dropdown-item:hover {
    background: rgba(var(--primary-color-rgb), 0.08);
}

.dropdown-item.danger {
    color: #ff6b6b;
}

.dropdown-item.danger:hover {
    background: rgba(255,107,107,0.1);
}

.dropdown-item i {
    width: 20px;
    color: var(--primary-color);
}

.dropdown-item.danger i {
    color: #ff6b6b;
}

/* ==================== 主布局 ==================== */
.main-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

/* ==================== 侧边栏导航 ==================== */
.sidebar-nav {
    width: 260px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    padding: 16px 8px;
    overflow-y: auto;
    flex-shrink: 0;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-color);
    font-size: 0.95rem;
    position: relative;
}

.nav-item i {
    width: 22px;
    font-size: 1.1rem;
    color: var(--secondary-color);
}

.nav-item:hover {
    background: rgba(var(--primary-color-rgb), 0.08);
}

.nav-item.active {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.nav-item.active i {
    color: white;
}

.nav-item .external-icon {
    margin-left: auto;
    font-size: 0.75rem;
    opacity: 0.7;
}

/* ==================== 内容区域 ==================== */
.content-area {
    flex: 1;
    overflow: hidden;  
    overflow-x: hidden;
    background: var(--bg-color);
    position: relative;
}

.view-panel {
    display: none;
    height: auto;           /* 改为 auto，因为绝对定位后 height 100% 会有问题 */
    overflow-y: auto;
    padding: 24px;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;              /* 添加 bottom: 0 */
    width: auto;
}

.view-panel.active {
    display: block;
}

.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.view-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.view-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* ==================== 按钮样式 ==================== */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 30px;
    background: var(--primary-color);
    color: white;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    white-space: nowrap;
}

.btn:hover {
    background: var(--hover-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(var(--primary-color-rgb), 0.2);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover {
    background: var(--primary-color);
    color: white;
}

.btn-small {
    padding: 4px 10px;
    font-size: 0.75rem;
    height: 28px;
}

.btn-large {
    padding: 12px 24px;
    font-size: 1rem;
    height: 48px;
}

/* ==================== 搜索框 ==================== */
.search-wrapper {
    display: flex;
    align-items: center;
    background: var(--reader-bg);
    border: 1px solid var(--sidebar-border);
    border-radius: 30px;
    padding: 0 12px;
    height: 36px;
    min-width: 200px;
}

.search-wrapper i {
    color: var(--secondary-color);
    margin-right: 8px;
}

.search-wrapper input {
    border: none;
    background: transparent;
    outline: none;
    color: var(--text-color);
    font-size: 0.85rem;
    width: 100%;
}

.search-wrapper input::placeholder {
    color: var(--secondary-color);
    opacity: 0.6;
}

/* ==================== Dashboard ==================== */
.dashboard-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.welcome-card {
    background: linear-gradient(135deg, #f0f4f8, #e8ecf1);
    border-radius: var(--border-radius-lg);
    padding: 28px;
    color: #333333;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--sidebar-border);
}

.welcome-text h3 {
    font-size: 1.5rem;
    margin-bottom: 8px;
    color: #333333;
}

.welcome-text p {
    color: #666666;
    opacity: 0.9;
}

.welcome-stats {
    display: flex;
    gap: 32px;
}

.welcome-stats .stat-item {
    text-align: center;
}

.welcome-stats .stat-value {
    font-size: 2rem;
    font-weight: 800;
    display: block;
    /* 强制使用深色/黑色，确保清晰可见 */
    color: #1a1a2e !important;
}

/* 暗色模式下也保持深色（或者用亮色，看您需求）*/
[data-theme="dark"] .welcome-stats .stat-value {
    color: #ffffff !important;
}

.welcome-stats .stat-label {
    font-size: 0.85rem;
    color: #666666;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.stat-card {
    background: var(--sidebar-bg);
    border: 1px solid var(--sidebar-border);
    border-radius: var(--border-radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-card i {
    font-size: 2rem;
    color: var(--primary-color);
    opacity: 0.7;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-number {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-name {
    font-size: 0.85rem;
    color: var(--secondary-color);
}

/* ==================== 码字日历（紧凑版）==================== */
.heatmap-section {
    background: var(--sidebar-bg);
    border: 1px solid var(--sidebar-border);
    border-radius: 12px;
    padding: 16px;
}

.heatmap-section h4 {
    margin-bottom: 12px;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
}

/* 日历容器 */
.calendar-container {
    background: var(--reader-bg);
    border-radius: 10px;
    padding: 12px;
}

/* 月份标题 */
.calendar-month {
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 12px;
    color: var(--text-color);
}

/* 统计信息 */
.calendar-stats {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--sidebar-border);
    font-size: 0.7rem;
    color: var(--secondary-color);
}

/* 星期行 */
.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    margin-bottom: 6px;
}

.calendar-weekday {
    font-size: 0.65rem;
    color: var(--secondary-color);
    padding: 4px 0;
}

/* 日期网格 */
.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

/* 日期格子 */
.calendar-day {
    aspect-ratio: 1 / 0.9;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.2s;
    background: rgba(var(--primary-color-rgb), 0.05);
    color: var(--text-color);
    padding: 4px 0;
}

.calendar-day:hover {
    transform: scale(1.05);
    background: rgba(var(--primary-color-rgb), 0.15);
}

/* 今日标记 */
.calendar-day.today {
    border: 1.5px solid var(--primary-color);
    font-weight: bold;
}

/* 非当前月日期 */
.calendar-day.other-month {
    opacity: 0.3;
}

/* 有写作记录的格子 - 颜色深浅表示字数 */
.calendar-day.has-record {
    background: var(--primary-color);
    color: white;
}

.calendar-day.has-record.low {
    background: rgba(var(--primary-color-rgb), 0.3);
    color: var(--text-color);
}

.calendar-day.has-record.medium {
    background: rgba(var(--primary-color-rgb), 0.6);
    color: white;
}

.calendar-day.has-record.high {
    background: var(--primary-color);
    color: white;
}

/* 字数显示 */
.calendar-day .day-number {
    font-weight: 500;
    font-size: 0.7rem;
}

.calendar-day .day-words {
    font-size: 0.55rem;
    opacity: 0.8;
    margin-top: 2px;
}

/* 空状态 */
.calendar-empty {
    text-align: center;
    padding: 30px;
    color: var(--secondary-color);
    font-size: 0.8rem;
}

/* ==================== 书籍库 ==================== */
.bookshelf-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.view-toggle {
    display: flex;
    gap: 4px;
    background: var(--reader-bg);
    border: 1px solid var(--sidebar-border);
    border-radius: 30px;
    padding: 2px;
}

.toggle-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    color: var(--secondary-color);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-btn:hover {
    background: rgba(var(--primary-color-rgb), 0.1);
    color: var(--primary-color);
}

.toggle-btn.active {
    background: var(--primary-color);
    color: white;
}

.sort-options {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sort-btn {
    padding: 6px 14px;
    border: 1px solid var(--sidebar-border);
    border-radius: 30px;
    background: transparent;
    color: var(--text-color);
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition);
}

.sort-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.sort-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.filter-options select {
    padding: 6px 14px;
    border: 1px solid var(--sidebar-border);
    border-radius: 30px;
    background: var(--reader-bg);
    color: var(--text-color);
    font-size: 0.8rem;
    cursor: pointer;
    outline: none;
}

/* 列表视图 */
.bookshelf-list-view {
    background: var(--sidebar-bg);
    border: 1px solid var(--sidebar-border);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.books-table {
    width: 100%;
    border-collapse: collapse;
}

.books-table th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 500;
    color: var(--secondary-color);
    font-size: 0.8rem;
    border-bottom: 1px solid var(--sidebar-border);
    background: rgba(var(--primary-color-rgb), 0.03);
}

.books-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--sidebar-border);
    color: var(--text-color);
    font-size: 0.9rem;
}

.books-table tbody tr {
    cursor: pointer;
    transition: var(--transition);
}

.books-table tbody tr:hover {
    background: rgba(var(--primary-color-rgb), 0.05);
}

.book-cover-cell {
    width: 48px;
}

.book-cover-thumb {
    width: 40px;
    height: 56px;
    border-radius: 6px;
    object-fit: cover;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

.book-title-cell {
    font-weight: 500;
}

.book-actions {
    display: flex;
    gap: 8px;
}

.book-actions button {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    color: var(--secondary-color);
    transition: var(--transition);
}

.book-actions button:hover {
    background: rgba(var(--primary-color-rgb), 0.1);
    color: var(--primary-color);
}

/* 图墙视图 */
.bookshelf-grid-view {
    padding: 20px 0 !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
}
.books-grid {
    display: flex !important;
    flex-direction: row !important;
    gap: 16px !important;  /* 改小间距，原来是 24px */
    padding: 8px 4px 20px 4px !important;
    grid-template-columns: none !important;
}
.book-card {
    flex-shrink: 0 !important;
    width: 150px !important;  /* 稍微调小一点，让更多卡片可见 */
    background: transparent !important;
    border: none !important;
    border-radius: 12px !important;
    overflow: visible !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
}
.book-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
    border-color: var(--primary-color);
}

.book-card-cover {
    width: 150px !important;
    height: 200px !important;
    aspect-ratio: 3 / 4 !important;
    border-radius: 12px !important;
    overflow: hidden !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15) !important;
    transition: box-shadow 0.3s ease !important;
    background: linear-gradient(135deg, #f5f5f5, #e8e8e8) !important;
}
.book-card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.book-card-info {
    padding: 10px 2px 0 2px !important;
    background: transparent !important;
    text-align: left !important;
}
.book-card-title {
    font-weight: 600;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.book-card-author {
    font-size: 0.8rem;
    color: var(--secondary-color);
    margin-bottom: 8px;
}

.book-card-stats {
    font-size: 0.75rem;
    color: var(--secondary-color);
    display: flex;
    justify-content: space-between;
}

.bookshelf-empty {
    text-align: center;
    padding: 60px;
    color: var(--secondary-color);
}

.bookshelf-empty i {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* ==================== 拼字房 ==================== */
.online-users-section {
    background: var(--sidebar-bg);
    border: 1px solid var(--sidebar-border);
    border-radius: var(--border-radius);
    padding: 16px;
    margin-bottom: 20px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.section-header h4 {
    font-size: 0.9rem;
    color: var(--primary-color);
}

.online-count {
    font-size: 0.8rem;
    color: var(--secondary-color);
}

.online-users-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
}

.online-user-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-color);
}

.online-user-item .online-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4CAF50;
}

.quick-join-section {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.quick-join-section input {
    flex: 1;
    max-width: 200px;
    padding: 0 16px;
    height: 44px;
    border: 1px solid var(--sidebar-border);
    border-radius: 30px;
    background: var(--reader-bg);
    color: var(--text-color);
    font-size: 0.9rem;
    outline: none;
}

.quick-join-section input:focus {
    border-color: var(--primary-color);
}

.rooms-section h4 {
    margin-bottom: 16px;
    color: var(--primary-color);
}

.rooms-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.room-card {
    background: var(--sidebar-bg);
    border: 1px solid var(--sidebar-border);
    border-radius: var(--border-radius);
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.room-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.room-info {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.room-name {
    font-weight: 600;
    font-size: 1rem;
}

.room-meta {
    display: flex;
    gap: 16px;
    color: var(--secondary-color);
    font-size: 0.8rem;
}

.room-actions {
    display: flex;
    gap: 8px;
}

/* ==================== 面板容器（设定库/背景库/设置） ==================== */
.material-panel-container,
.background-panel-container,
.settings-panel-container {
    background: var(--sidebar-bg);
    border: 1px solid var(--sidebar-border);
    border-radius: var(--border-radius);
    min-height: 400px;
}

.loading-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
    color: var(--secondary-color);
    gap: 8px;
}

/* ==================== 快捷键配置 ==================== */
.shortcuts-container {
    background: var(--sidebar-bg);
    border: 1px solid var(--sidebar-border);
    border-radius: var(--border-radius);
    padding: 20px;
}

.shortcuts-search {
    display: flex;
    align-items: center;
    background: var(--reader-bg);
    border: 1px solid var(--sidebar-border);
    border-radius: 30px;
    padding: 0 16px;
    height: 40px;
    margin-bottom: 20px;
}

.shortcuts-search i {
    color: var(--secondary-color);
    margin-right: 10px;
}

.shortcuts-search input {
    border: none;
    background: transparent;
    outline: none;
    color: var(--text-color);
    width: 100%;
}

.shortcuts-groups {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.shortcut-group h5 {
    font-size: 0.9rem;
    color: var(--primary-color);
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--sidebar-border);
}

.shortcut-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px dashed var(--sidebar-border);
}

.shortcut-name {
    font-size: 0.9rem;
    color: var(--text-color);
}

.shortcut-key-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.shortcut-key {
    background: rgba(var(--primary-color-rgb), 0.1);
    border: 1px solid var(--sidebar-border);
    border-radius: 6px;
    padding: 6px 14px;
    font-family: monospace;
    font-size: 0.85rem;
    color: var(--primary-color);
    cursor: pointer;
    transition: var(--transition);
}

.shortcut-key:hover {
    background: var(--primary-color);
    color: white;
}

.shortcut-key.recording {
    background: #ff9800;
    color: white;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.shortcut-reset-btn {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    color: var(--secondary-color);
    font-size: 0.7rem;
}

.shortcut-reset-btn:hover {
    background: rgba(var(--primary-color-rgb), 0.1);
    color: var(--primary-color);
}

.shortcut-conflict-hint {
    margin-top: 16px;
    padding: 12px 16px;
    background: rgba(255,152,0,0.1);
    border: 1px solid #ff9800;
    border-radius: 8px;
    color: #ff9800;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
}

/* ==================== 备份与恢复 ==================== */
.backup-container {
    background: var(--sidebar-bg);
    border: 1px solid var(--sidebar-border);
    border-radius: var(--border-radius);
    padding: 24px;
}

.backup-stats {
    margin-bottom: 32px;
}

.backup-stats h4 {
    margin-bottom: 16px;
    color: var(--primary-color);
}

.backup-stats .stats-grid {
    grid-template-columns: repeat(6, 1fr);
}

.backup-actions {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 32px;
}

.backup-history h4 {
    margin-bottom: 16px;
    color: var(--primary-color);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: var(--reader-bg);
    border: 1px solid var(--sidebar-border);
    border-radius: 8px;
}

.history-time {
    font-weight: 500;
}

.history-stats {
    color: var(--secondary-color);
    font-size: 0.85rem;
}

.history-actions {
    display: flex;
    gap: 8px;
}

/* ==================== 模态框 ==================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.modal-container {
    background: var(--sidebar-bg);
    border-radius: var(--border-radius-lg);
    width: 90%;
    max-width: 500px;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    border-bottom: 1px solid var(--sidebar-border);
}

.modal-header h3 {
    font-size: 1.2rem;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.close-modal-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    color: var(--secondary-color);
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.close-modal-btn:hover {
    background: rgba(0,0,0,0.1);
    color: var(--text-color);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(85vh - 140px);
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--sidebar-border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* 表单样式 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-color);
}

.form-group .required {
    color: #ff6b6b;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--sidebar-border);
    border-radius: 8px;
    background: var(--reader-bg);
    color: var(--text-color);
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition);
}

.form-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(var(--primary-color-rgb), 0.1);
}

.char-count {
    text-align: right;
    font-size: 0.75rem;
    color: var(--secondary-color);
    margin-top: 4px;
}

/* 封面上传 */
.cover-upload-area {
    cursor: pointer;
}

.cover-preview {
    width: 120px;
    height: 160px;
    border: 2px dashed var(--sidebar-border);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--secondary-color);
    transition: var(--transition);
    overflow: hidden;
}

.cover-preview:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.cover-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cover-preview i {
    font-size: 2rem;
}

/* 回收站 */
.trash-info {
    padding: 12px 16px;
    background: rgba(255,152,0,0.1);
    border-radius: 8px;
    margin-bottom: 16px;
    color: #ff9800;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.trash-list {
    max-height: 300px;
    overflow-y: auto;
}

.trash-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid var(--sidebar-border);
}

.trash-item:last-child {
    border-bottom: none;
}

.trash-book-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.trash-book-cover {
    width: 36px;
    height: 48px;
    border-radius: 4px;
    object-fit: cover;
}

.trash-book-title {
    font-weight: 500;
}

.trash-book-meta {
    font-size: 0.75rem;
    color: var(--secondary-color);
}

.trash-actions {
    display: flex;
    gap: 4px;
}

/* ==================== 右键菜单 ==================== */
.context-menu {
    position: fixed;
    background: var(--sidebar-bg);
    border: 1px solid var(--sidebar-border);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    padding: 4px 0;
    min-width: 180px;
    z-index: 100000;
    display: none;
}

.context-menu-item {
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-color);
    transition: var(--transition);
}

.context-menu-item:hover {
    background: rgba(var(--primary-color-rgb), 0.08);
}

.context-menu-item i {
    width: 18px;
    color: var(--primary-color);
}

.context-menu-item.danger {
    color: #ff6b6b;
}

.context-menu-item.danger i {
    color: #ff6b6b;
}

.context-menu-divider {
    height: 1px;
    background: var(--sidebar-border);
    margin: 4px 0;
}

/* ==================== Toast ==================== */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--primary-color);
    color: white;
    padding: 12px 24px;
    border-radius: 40px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    z-index: 1000000;
    opacity: 0;
    transition: all 0.3s;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.success {
    background: #4CAF50;
}

.toast.error {
    background: #f44336;
}

.toast.warning {
    background: #ff9800;
}

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

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

::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* ==================== 响应式 ==================== */
@media (max-width: 900px) {
    .sidebar-nav {
        width: 80px;
    }
    
    .nav-item span {
        display: none;
    }
    
    .nav-item .external-icon {
        display: none;
    }
    
    .nav-item {
        justify-content: center;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .backup-stats .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 600px) {
    .view-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .welcome-card {
        flex-direction: column;
        text-align: center;
        gap: 20px;
    }
    
    .room-card {
        flex-direction: column;
        gap: 16px;
    }
}
/* ==================== 书籍封面统一尺寸 ==================== */

/* 固定封面尺寸变量 */
:root {
    --book-cover-width: 120px;
    --book-cover-height: 160px;
    --book-cover-ratio: 3 / 4;
}

/* 列表视图封面 */
.book-cover-cell {
    width: 60px !important;
    padding: 8px !important;
}

.book-cover-thumb {
    width: 44px !important;
    height: 58px !important;
    object-fit: cover !important;
    border-radius: 4px !important;
    display: block !important;
    background: linear-gradient(135deg, #f0f0f0, #e0e0e0) !important;
}

/* 图墙视图封面 */
.book-card-cover {
    width: 100% !important;
    aspect-ratio: 3 / 4 !important;
    overflow: hidden !important;
    background: linear-gradient(135deg, #f5f5f5, #e8e8e8) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.book-card-cover img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
}

/* 书籍卡片整体 */
.book-card {
    width: 100% !important;
    max-width: 180px !important;
    margin: 0 auto !important;
}

/* 最近编辑封面 */
.recent-cover {
    width: 48px !important;
    height: 64px !important;
    object-fit: cover !important;
    border-radius: 4px !important;
    background: linear-gradient(135deg, #f0f0f0, #e0e0e0) !important;
    flex-shrink: 0 !important;
}

/* 回收站封面 */
.trash-book-cover {
    width: 36px !important;
    height: 48px !important;
    object-fit: cover !important;
    border-radius: 4px !important;
    background: linear-gradient(135deg, #f0f0f0, #e0e0e0) !important;
}

/* 上传封面预览 */
.cover-preview {
    width: 120px !important;
    height: 160px !important;
    border: 2px dashed var(--sidebar-border) !important;
    border-radius: 8px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    color: var(--secondary-color) !important;
    transition: var(--transition) !important;
    overflow: hidden !important;
    background: var(--reader-bg) !important;
}

.cover-preview img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
}

.cover-preview i {
    font-size: 2rem !important;
}

.cover-preview span {
    font-size: 0.8rem !important;
}

/* 图墙视图网格调整 */
.books-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)) !important;
    gap: 20px !important;
    justify-items: center !important;
}

/* 默认封面占位符样式 */
.book-cover-thumb[src=""],
.book-card-cover img[src=""],
.recent-cover[src=""] {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color)) !important;
    color: white !important;
    font-size: 0.7rem !important;
    text-align: center !important;
}

/* 图片加载失败时的样式 */
.book-cover-thumb:not([src]), 
.book-cover-thumb[src=""] {
    position: relative !important;
}

.book-cover-thumb:not([src])::after,
.book-cover-thumb[src=""]::after {
    content: "📖" !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    font-size: 1.2rem !important;
    color: white !important;
}

.book-card-cover img:not([src])::before,
.book-card-cover img[src=""]::before {
    content: "📚" !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    font-size: 2rem !important;
    color: white !important;
}
/* ==================== 现代化导航样式 ==================== */

/* 侧边栏玻璃毛效果 */
.sidebar-nav {
    background: var(--glass-bg) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border-right: 1px solid rgba(var(--primary-color-rgb), 0.15) !important;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.05) !important;
}

/* 导航项渐变悬停效果 */
.nav-item {
    position: relative;
    overflow: hidden;
    border-radius: 12px !important;
    margin: 4px 8px !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.nav-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, 
        rgba(var(--primary-color-rgb), 0.15) 0%, 
        rgba(var(--primary-color-rgb), 0.05) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.nav-item:hover::before {
    opacity: 1;
}

.nav-item:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(var(--primary-color-rgb), 0.15);
}

/* 导航项激活状态 - 渐变背景 */
.nav-item.active {
    background: linear-gradient(135deg, 
        var(--primary-color) 0%, 
        var(--secondary-color) 100%) !important;
    color: white !important;
    box-shadow: 0 6px 16px rgba(var(--primary-color-rgb), 0.3) !important;
    position: relative;
}

.nav-item.active::after {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 60%;
    background: white;
    border-radius: 0 4px 4px 0;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.nav-item.active i {
    color: white !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 导航图标动画 */
.nav-item i {
    transition: all 0.3s ease;
    font-size: 1.2rem !important;
}

.nav-item:hover i {
    transform: scale(1.1);
    color: var(--primary-color);
}

.nav-item.active:hover i {
    color: white !important;
}

/* 导航项之间的分割线（可选） */
.nav-menu {
    gap: 2px !important;
}

/* 顶部导航栏玻璃毛效果 */
.top-header {
    background: var(--glass-bg) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border-bottom: 1px solid rgba(var(--primary-color-rgb), 0.15) !important;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.05) !important;
}

/* 内容区域背景微渐变 */
.content-area {
    background: linear-gradient(135deg, 
        rgba(var(--primary-color-rgb), 0.02) 0%, 
        rgba(var(--primary-color-rgb), 0) 100%) !important;
}

/* 卡片玻璃毛效果 */
.stat-card, .welcome-card, .room-card, .backup-stats, .shortcuts-container,
.material-panel, .background-panel, .settings-panel-content {
    background: var(--glass-bg) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    border: 1px solid rgba(var(--primary-color-rgb), 0.12) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.05) !important;
    transition: all 0.3s ease !important;
}

.stat-card:hover, .room-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(var(--primary-color-rgb), 0.12) !important;
    border-color: rgba(var(--primary-color-rgb), 0.25) !important;
}

/* 欢迎卡片特殊渐变 */
.welcome-card {
    background: linear-gradient(135deg, 
        var(--primary-color) 0%, 
        var(--secondary-color) 100%) !important;
    box-shadow: 0 10px 30px rgba(var(--primary-color-rgb), 0.3) !important;
}

/* 欢迎卡片内的统计数字 - 强制深色保证绝对清晰 */
.welcome-card .stat-value {
    color: #111111 !important;
    font-weight: 900 !important;
    font-size: 2rem !important;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.5) !important;
    background: none !important;
    -webkit-background-clip: unset !important;
    background-clip: unset !important;
}

.welcome-card .stat-label {
    color: #222222 !important;
    font-weight: 600 !important;
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.4) !important;
}

/* 暗色模式下使用亮色 */
[data-theme="dark"] .welcome-card .stat-value {
    color: #ffffff !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5) !important;
}

[data-theme="dark"] .welcome-card .stat-label {
    color: #dddddd !important;
}
/* 暗色模式下的适配 */
[data-theme="dark"] .welcome-card .stat-value {
    color: #ffffff !important;
}

[data-theme="dark"] .welcome-card .stat-label {
    color: rgba(255, 255, 255, 0.8) !important;
}

/* 按钮渐变效果 */
.btn {
    background: linear-gradient(135deg, 
        var(--primary-color) 0%, 
        var(--secondary-color) 100%) !important;
    border: none !important;
    box-shadow: 0 4px 12px rgba(var(--primary-color-rgb), 0.2) !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.btn:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 20px rgba(var(--primary-color-rgb), 0.35) !important;
    filter: brightness(1.05);
}

.btn-outline {
    background: transparent !important;
    border: 1.5px solid var(--primary-color) !important;
    color: var(--primary-color) !important;
    box-shadow: none !important;
}

.btn-outline:hover {
    background: linear-gradient(135deg, 
        var(--primary-color) 0%, 
        var(--secondary-color) 100%) !important;
    color: white !important;
    box-shadow: 0 6px 16px rgba(var(--primary-color-rgb), 0.25) !important;
}

/* 书籍卡片悬停效果 */
.book-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    border-radius: 16px !important;
    overflow: hidden;
}

.book-card:hover {
    transform: translateY(-8px) scale(1.02) !important;
    box-shadow: 0 20px 40px rgba(var(--primary-color-rgb), 0.15) !important;
}

.book-card-cover {
    position: relative;
    overflow: hidden;
}

.book-card-cover::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, 
        transparent 0%, 
        rgba(0, 0, 0, 0.3) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.book-card:hover .book-card-cover::after {
    opacity: 1;
}

.book-card-cover img {
    transition: transform 0.5s ease;
}

.book-card:hover .book-card-cover img {
    transform: scale(1.1);
}

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

::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, 
        var(--primary-color) 0%, 
        var(--secondary-color) 100%);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* 加载动画 */
.loading-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
    gap: 12px;
}

.loading-placeholder i {
    animation: pulse-glow 1.5s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% {
        opacity: 0.6;
        transform: scale(1);
        text-shadow: 0 0 10px rgba(var(--primary-color-rgb), 0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.1);
        text-shadow: 0 0 20px rgba(var(--primary-color-rgb), 0.6);
    }
}

/* 空状态图标动画 */
.empty-hint i {
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}
/* ==================== 一级页面强制不显示背景 ==================== */

/* 一级页面永远不显示背景遮罩 */
body.home-page .global-bg-overlay {
    display: none !important;
    background-image: none !important;
}

/* 一级页面背景色使用主题色 */
body.home-page {
    background: var(--bg-color) !important;
}

/* 移除一级页面的背景图标记 */
body.home-page.has-bg-image {
    background: var(--bg-color) !important;
}

/* 一级页面所有玻璃效果容器不受背景影响 */
body.home-page .sidebar-nav,
body.home-page .top-header,
body.home-page .stat-card,
body.home-page .welcome-card,
body.home-page .room-card {
    background: var(--glass-bg) !important;
}
/* ==================== 图墙模式 - 保持原位置，只改封面样式 ==================== */

/* 保持原有网格布局，不改变间距 */
.books-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)) !important;
    gap: 20px !important;
    padding: 8px 4px 20px 4px !important;
}

/* 书籍卡片 */
.book-card {
    width: 100% !important;
    max-width: 180px !important;
    margin: 0 auto !important;
    background: transparent !important;
    border: none !important;
    border-radius: 12px !important;
    overflow: visible !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
}

.book-card:hover {
    transform: translateY(-8px) !important;
    box-shadow: none !important;
}

/* 封面容器 */
.book-card-cover {
    width: 100% !important;
    aspect-ratio: 3 / 4 !important;
    border-radius: 12px !important;
    overflow: hidden !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15) !important;
    transition: box-shadow 0.3s ease !important;
    background: linear-gradient(135deg, #f5f5f5, #e8e8e8) !important;
}

.book-card:hover .book-card-cover {
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.2) !important;
}

.book-card-cover img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
}

.book-card-cover .cover-placeholder {
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color)) !important;
    color: white !important;
    font-size: 3rem !important;
    font-weight: bold !important;
}

/* 书籍信息 */
.book-card-info {
    padding: 10px 4px 0 4px !important;
    background: transparent !important;
    text-align: left !important;
}

.book-card-title {
    font-size: 0.95rem !important;
    font-weight: 600 !important;
    color: var(--text-color) !important;
    margin-bottom: 4px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

.book-card-author {
    font-size: 0.75rem !important;
    color: var(--secondary-color) !important;
    margin-bottom: 4px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

.book-card-stats {
    font-size: 0.7rem !important;
    color: var(--secondary-color) !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
}

.book-card-stats span:first-child::after {
    content: '·' !important;
    margin-left: 8px !important;
    color: var(--secondary-color) !important;
    opacity: 0.5 !important;
}
/* ==================== 背景库横向滚动布局（无空白，完全贴合图片） ==================== */
.background-panel-container {
    overflow: hidden !important;
    padding: 0 !important;
}

.background-panel {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* 横向滚动网格容器 */
.background-grid {
    display: flex !important;
    flex-direction: row !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    gap: 16px !important;
    padding: 16px 20px !important;
    scroll-behavior: smooth !important;
    flex: 1;
    align-items: flex-start !important;  /* 顶部对齐 */
}

/* 滚动条样式 */
.background-grid::-webkit-scrollbar {
    height: 6px;
}
.background-grid::-webkit-scrollbar-track {
    background: rgba(var(--primary-color-rgb), 0.08);
    border-radius: 10px;
}
.background-grid::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}

/* 背景卡片 - 高度完全由图片内容撑开，无多余空白 */
.bg-card {
    flex: 0 0 auto !important;
    width: 160px !important;
    /* 移除任何高度声明，让高度自动适应图片 */
    background: var(--reader-bg);
    border: 1px solid var(--sidebar-border);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
    /* 关键：去除任何内边距 */
    padding: 0 !important;
    margin: 0 !important;
    line-height: 0 !important;  /* 消除文字幽灵空白 */
}

.bg-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary-color);
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

.bg-card.active {
    border: 2px solid var(--primary-color);
}

/* 图片预览区域 - 正方形，占满整个卡片 */
.bg-preview {
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: var(--bg-color);
    /* 关键：去除任何内边距和外边距 */
    padding: 0 !important;
    margin: 0 !important;
    display: block !important;
}

.bg-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block !important;  /* 去除图片下方的幽灵空白 */
    transition: transform 0.2s;
}

.bg-card:hover .bg-preview img {
    transform: scale(1.05);
}

/* ===== 完全隐藏文字区域，不占空间 ===== */
.bg-info {
    display: none !important;
}

/* 空状态 */
.background-grid .empty-hint {
    flex: 1;
    text-align: center;
    padding: 40px;
    color: var(--secondary-color);
    min-width: 300px;
}
/* 欢迎卡片和统计卡片 - 降低层级 */
.welcome-card,
.stat-card,
.recent-section,
.dashboard-content > div {
    position: relative;
    z-index: 0 !important;
}

/* 确保 body 没有创建新的层叠上下文 */
body {
    isolation: auto;
}
.online-users-section {
    margin-bottom: 20px;
    padding: 12px;
    background: rgba(var(--primary-color-rgb), 0.03);
    border-radius: 12px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.section-header h4 {
    margin: 0;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.online-count {
    font-size: 0.75rem;
    color: var(--secondary-color);
}

.online-users-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.online-user-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--reader-bg);
    border-radius: 20px;
    font-size: 0.75rem;
    border: 1px solid var(--sidebar-border);
}

.online-user-item i {
    color: #4CAF50;
    font-size: 0.7rem;
}
/* 通知项 */
.notification-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--sidebar-border);
    cursor: pointer;
    transition: var(--transition);
}

.notification-item:hover {
    background: rgba(var(--primary-color-rgb), 0.05);
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-item.unread {
    background: rgba(var(--primary-color-rgb), 0.08);
    position: relative;
}

.notification-item.unread::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 5px;
    height: 5px;
    background: var(--primary-color);
    border-radius: 50%;
}

.notification-item-title {
    font-size: 0.85rem;
    color: var(--text-color);
    margin-bottom: 4px;
}

.notification-item-content {
    font-size: 0.8rem;
    color: var(--secondary-color);
}

.notification-item-time {
    font-size: 0.7rem;
    color: var(--secondary-color);
    margin-top: 6px;
}

.notification-empty {
    padding: 32px;
    text-align: center;
    color: var(--secondary-color);
    font-size: 0.85rem;
}
/* ==================== 备份与恢复页面样式 ==================== */

.backup-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* 数据统计区域 */
.backup-stats-section h3 {
    font-size: 1rem;
    color: var(--primary-color);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.backup-stats-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 16px;
}

.backup-stat-card {
    background: var(--sidebar-bg);
    border: 1px solid var(--sidebar-border);
    border-radius: 16px;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: var(--transition);
}

.backup-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
    border-color: var(--primary-color);
}

.backup-stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    color: white;
    font-size: 1.3rem;
}

.backup-stat-card .stat-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.backup-stat-card .stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1.2;
}

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

/* 操作按钮区域 */
.backup-actions-section {
    background: var(--sidebar-bg);
    border: 1px solid var(--sidebar-border);
    border-radius: 16px;
    padding: 24px;
}

.action-buttons-group {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.action-buttons-group .btn-large {
    min-width: 160px;
    padding: 14px 28px;
    font-size: 1rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(var(--primary-color-rgb), 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(var(--primary-color-rgb), 0.4);
}

.backup-tips {
    margin-top: 16px;
    text-align: center;
    color: var(--secondary-color);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* 历史记录区域 */
.backup-history-section {
    background: var(--sidebar-bg);
    border: 1px solid var(--sidebar-border);
    border-radius: 16px;
    padding: 20px;
}

.history-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.history-header h3 {
    font-size: 1rem;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.history-count-badge {
    background: rgba(var(--primary-color-rgb), 0.1);
    color: var(--primary-color);
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.history-table-wrapper {
    overflow-x: auto;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
}

.history-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 500;
    color: var(--secondary-color);
    font-size: 0.8rem;
    border-bottom: 1px solid var(--sidebar-border);
    white-space: nowrap;
}

.history-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--sidebar-border);
    color: var(--text-color);
    font-size: 0.9rem;
}

.history-table tbody tr {
    cursor: pointer;
    transition: var(--transition);
}

.history-table tbody tr:hover {
    background: rgba(var(--primary-color-rgb), 0.04);
}

.history-type-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 500;
}

.history-type-badge.full {
    background: rgba(76, 175, 80, 0.15);
    color: #4CAF50;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.history-type-badge.partial {
    background: rgba(255, 152, 0, 0.15);
    color: #ff9800;
    border: 1px solid rgba(255, 152, 0, 0.3);
}

.history-content-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.content-tag {
    padding: 2px 8px;
    background: rgba(var(--primary-color-rgb), 0.08);
    border-radius: 12px;
    font-size: 0.7rem;
    color: var(--secondary-color);
}

.history-actions {
    display: flex;
    gap: 8px;
}

.history-action-btn {
    width: 30px;
    height: 30px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    color: var(--secondary-color);
    font-size: 0.9rem;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.history-action-btn:hover {
    background: rgba(var(--primary-color-rgb), 0.1);
    color: var(--primary-color);
}

.history-action-btn.danger:hover {
    background: rgba(255, 107, 107, 0.1);
    color: #ff6b6b;
}

.empty-history-hint {
    text-align: center !important;
    padding: 48px !important;
    color: var(--secondary-color);
}

.empty-history-hint i {
    font-size: 2.5rem;
    margin-bottom: 12px;
    opacity: 0.5;
    display: block;
}

/* 选择性备份/恢复列表 */
.backup-select-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.backup-select-item {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    background: var(--reader-bg);
    border: 1px solid var(--sidebar-border);
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
}

.backup-select-item:hover {
    border-color: var(--primary-color);
    background: rgba(var(--primary-color-rgb), 0.02);
}

.backup-select-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 14px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.select-item-content {
    display: flex;
    align-items: center;
    flex: 1;
    gap: 12px;
}

.select-item-content i {
    width: 24px;
    color: var(--primary-color);
    font-size: 1.1rem;
}

.select-item-title {
    font-weight: 500;
    min-width: 100px;
}

.select-item-count {
    margin-left: auto;
    color: var(--secondary-color);
    font-size: 0.8rem;
}

/* 恢复文件信息 */
.backup-file-info {
    background: rgba(var(--primary-color-rgb), 0.05);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 8px;
}

.file-info-row {
    display: flex;
    margin-bottom: 8px;
}

.file-info-label {
    width: 80px;
    color: var(--secondary-color);
    font-size: 0.85rem;
}

.file-info-value {
    color: var(--text-color);
    font-size: 0.9rem;
}

.backup-content-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--sidebar-border);
}

.preview-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--reader-bg);
    border-radius: 20px;
    font-size: 0.75rem;
    color: var(--secondary-color);
}

.preview-item i {
    color: var(--primary-color);
}

.preview-item.disabled {
    opacity: 0.5;
}

/* 响应式 */
@media (max-width: 1100px) {
    .backup-stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 700px) {
    .backup-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .action-buttons-group .btn-large {
        min-width: 140px;
    }
}
/* ==================== 最近编辑表格样式 ==================== */

.recent-section {
    background: var(--sidebar-bg);
    border: 1px solid var(--sidebar-border);
    border-radius: var(--border-radius-lg);
    padding: 20px;
}

.recent-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.recent-section .section-header h4 {
    margin: 0;
    font-size: 1rem;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-more {
    transition: var(--transition);
}

.section-more:hover {
    opacity: 0.8;
    transform: translateX(2px);
}

.recent-table-wrapper {
    overflow-x: auto;
    border-radius: var(--border-radius-sm);
}

.recent-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.recent-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 500;
    color: var(--secondary-color);
    font-size: 0.8rem;
    border-bottom: 1px solid var(--sidebar-border);
    white-space: nowrap;
    background: rgba(var(--primary-color-rgb), 0.02);
}

.recent-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--sidebar-border);
    color: var(--text-color);
    white-space: nowrap;
}

.recent-table tbody tr {
    cursor: pointer;
    transition: var(--transition);
}

.recent-table tbody tr:hover {
    background: rgba(var(--primary-color-rgb), 0.04);
}

.recent-table .book-title-cell {
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}

.recent-table .book-cover-mini {
    width: 28px;
    height: 36px;
    border-radius: 4px;
    object-fit: cover;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

.recent-table .book-cover-placeholder {
    width: 28px;
    height: 36px;
    border-radius: 4px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.8rem;
}

.recent-table .word-count-cell {
    font-family: 'Monaco', 'Menlo', monospace;
}

.recent-table .time-cell {
    color: var(--secondary-color);
    font-size: 0.85rem;
}

.recent-table .empty-hint {
    text-align: center !important;
    padding: 40px !important;
    color: var(--secondary-color);
}

.recent-table .empty-hint i {
    font-size: 2rem;
    margin-bottom: 8px;
    opacity: 0.5;
    display: block;
}

.recent-table .empty-hint p {
    margin: 0;
    font-size: 0.9rem;
}

/* 响应式 */
@media (max-width: 768px) {
    .recent-table th:nth-child(2),
    .recent-table td:nth-child(2) {
        display: none;
    }
}
/* 主布局 - 确保正确的高度限制 */
.main-layout {
    position: relative;
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* 侧边栏保持可见 */
.sidebar-nav {
    position: relative;
    z-index: 10;
    flex-shrink: 0;
}

/* 内容区域作为定位容器 */
.content-area {
    position: relative;
    flex: 1;
    overflow: hidden;
    background: var(--bg-color);
    z-index: 1;
}

/* 视图面板在内容区域内绝对定位，实现重叠切换 */
.view-panel {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    height: auto;
    overflow-y: auto;
    padding: 24px;
    display: none;
    z-index: 1;
}

.view-panel.active {
    display: block;
}

/* 顶部导航栏保持在最上层 */
.top-header {
    position: relative;
    z-index: 20;
}
.view-panel {
    display: none;
}
.view-panel.active {
    display: block;
}
#settingsView .view-header {
    display: none;
}
#settingsView.active .view-header {
    display: block;
}
/* ==================== 顶部导航栏 - 玻璃质感 ==================== */
.top-header {
    background: linear-gradient(135deg, 
        rgba(255,255,255,0.95) 0%, 
        rgba(248,249,250,0.9) 50%,
        rgba(240,242,245,0.95) 100%
    ) !important;
    backdrop-filter: blur(20px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
    border-bottom: 1px solid rgba(0,0,0,0.06) !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.04), 0 1px 3px rgba(0,0,0,0.03) !important;
}

/* 深色主题 */
[data-theme="dark"] .top-header {
    background: linear-gradient(135deg, 
        rgba(22,33,62,0.95) 0%, 
        rgba(26,26,46,0.9) 50%,
        rgba(22,33,62,0.95) 100%
    ) !important;
    border-bottom: 1px solid rgba(255,255,255,0.06) !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2), 0 1px 3px rgba(0,0,0,0.1) !important;
}

/* 导航按钮悬停效果 */
.top-header .btn,
.top-header .btn-outline {
    transition: all 0.3s ease !important;
}
.top-header .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(var(--primary-color-rgb), 0.3);
}
.top-header .btn-outline:hover {
    background: rgba(var(--primary-color-rgb), 0.08) !important;
    transform: translateY(-1px);
}
/* ==================== 侧边导航栏 - 玻璃质感 ==================== */
.sidebar-nav {
    background: linear-gradient(180deg, 
        rgba(255,255,255,0.95) 0%, 
        rgba(248,249,250,0.9) 100%
    ) !important;
    backdrop-filter: blur(20px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
    border-right: 1px solid rgba(0,0,0,0.06) !important;
    padding: 12px 8px !important;
}

/* 导航项 */
.nav-item {
    margin-bottom: 4px !important;
    border-radius: 10px !important;
    padding: 10px 14px !important;
    transition: all 0.25s ease !important;
    border: 1px solid transparent !important;
}

.nav-item:hover {
    background: rgba(var(--primary-color-rgb), 0.06) !important;
    border-color: rgba(var(--primary-color-rgb), 0.1) !important;
    transform: translateX(3px);
}

.nav-item.active {
    background: linear-gradient(135deg, 
        rgba(var(--primary-color-rgb), 0.12), 
        rgba(var(--primary-color-rgb), 0.06)
    ) !important;
    border-color: rgba(var(--primary-color-rgb), 0.2) !important;
    box-shadow: 0 2px 8px rgba(var(--primary-color-rgb), 0.1) !important;
    font-weight: 600 !important;
}

/* 深色主题 */
[data-theme="dark"] .sidebar-nav {
    background: linear-gradient(180deg, 
        rgba(22,33,62,0.95) 0%, 
        rgba(26,26,46,0.9) 100%
    ) !important;
    border-right: 1px solid rgba(255,255,255,0.06) !important;
}
/* ==================== 侧边导航栏 - 圆角边框风格 ==================== */
.sidebar-nav {
    background: var(--sidebar-bg) !important;
    padding: 12px 10px !important;
}

/* 每个导航项 */
.nav-item {
    margin-bottom: 6px !important;
    border-radius: 10px !important;
    padding: 10px 14px !important;
    transition: all 0.2s ease !important;
    border: 1.5px solid var(--sidebar-border) !important;
    background: transparent !important;
}

.nav-item:hover {
    border-color: var(--primary-color) !important;
    background: rgba(var(--primary-color-rgb), 0.05) !important;
    transform: translateX(2px);
}

.nav-item.active {
    background: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: #fff !important;
    font-weight: 600 !important;
    box-shadow: 0 3px 12px rgba(var(--primary-color-rgb), 0.25) !important;
}

.nav-item.active i,
.nav-item.active span {
    color: #fff !important;
}