/* ===== 世界书样式 ===== */

/* 世界书屏幕 */
#worldbook-screen {
    background: var(--bg-primary);
}

/* 头部 */
.wb-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.wb-back-btn,
.wb-add-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.2s;
}

.wb-back-btn:active,
.wb-add-btn:active {
    background: rgba(0, 0, 0, 0.05);
}

.wb-back-btn svg,
.wb-add-btn svg {
    width: 22px;
    height: 22px;
    stroke-width: 1.5;
}

.wb-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
}

/* 搜索栏 */
.wb-search-bar {
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.wb-search-input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-primary);
    border-radius: 10px;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
}

.wb-search-input-wrap svg {
    width: 18px;
    height: 18px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.wb-search-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 15px;
    color: var(--text-primary);
    outline: none;
}

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

.wb-search-clear {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--text-light);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    flex-shrink: 0;
}

.wb-search-clear svg {
    width: 12px;
    height: 12px;
}

/* 内容区域 */
.wb-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    padding-bottom: 100px;
}

/* 空状态 */
.wb-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.wb-empty-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.4;
}

.wb-empty-icon svg {
    width: 100%;
    height: 100%;
}

.wb-empty-text {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 8px;
}

.wb-empty-sub {
    font-size: 13px;
    opacity: 0.7;
}

/* 文件夹 */
.wb-folder {
    margin-bottom: 12px;
    background: var(--bg-secondary);
    border-radius: 12px;
    overflow: hidden;
}

.wb-folder-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    cursor: pointer;
    transition: background 0.2s;
}

.wb-folder-header:active {
    background: rgba(0, 0, 0, 0.03);
}

.wb-folder-icon {
    width: 20px;
    height: 20px;
    color: var(--primary-color);
    flex-shrink: 0;
}

.wb-folder-icon svg {
    width: 100%;
    height: 100%;
}

.wb-folder-name {
    flex: 1;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
}

.wb-folder-count {
    font-size: 13px;
    color: var(--text-secondary);
    background: var(--bg-primary);
    padding: 2px 8px;
    border-radius: 10px;
}

.wb-folder-arrow {
    width: 18px;
    height: 18px;
    color: var(--text-light);
    transition: transform 0.2s;
}

.wb-folder-arrow.expanded {
    transform: rotate(90deg);
}

.wb-folder-arrow svg {
    width: 100%;
    height: 100%;
}

.wb-folder-content {
    padding: 0 16px 16px;
}

.wb-folder-empty {
    padding: 20px;
    text-align: center;
    color: var(--text-light);
    font-size: 13px;
}

/* 分区标题 */
.wb-section-title {
    font-size: 13px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 4px;
    margin-top: 8px;
}

/* 世界书卡片 */
.wb-book-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.wb-book-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 14px 16px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.wb-book-card:active {
    transform: scale(0.98);
    background: var(--bg-primary);
}

.wb-book-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.wb-book-icon {
    width: 18px;
    height: 18px;
    color: var(--primary-color);
    flex-shrink: 0;
}

.wb-book-icon svg {
    width: 100%;
    height: 100%;
}

.wb-book-name {
    flex: 1;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wb-book-preview {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 8px;
}

.wb-book-meta {
    font-size: 11px;
    color: var(--text-light);
}

/* 浮动按钮 */
.wb-fab {
    position: fixed;
    bottom: calc(24px + var(--safe-bottom));
    right: 24px;
    width: 56px;
    height: 56px;
    background: var(--primary-color);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
    transition: all 0.2s;
    z-index: 10;
}

.wb-fab:active {
    transform: scale(0.92);
}

.wb-fab svg {
    width: 24px;
    height: 24px;
}

/* ===== 世界书详情全屏 ===== */
.wb-detail-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: flex;
    align-items: flex-end;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.wb-detail-overlay.active {
    opacity: 1;
    visibility: visible;
}

.wb-detail {
    width: 100%;
    height: 90%;
    background: var(--bg-primary);
    border-radius: 20px 20px 0 0;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.wb-detail-overlay.active .wb-detail {
    transform: translateY(0);
}

.wb-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.wb-detail-close,
.wb-detail-edit {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    border-radius: 50%;
}

.wb-detail-close svg,
.wb-detail-edit svg {
    width: 22px;
    height: 22px;
}

.wb-detail-title {
    flex: 1;
    text-align: center;
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    padding: 0 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wb-detail-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.wb-detail-content {
    font-size: 15px;
    line-height: 1.8;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-break: break-word;
}

.wb-detail-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    text-align: center;
    font-size: 12px;
    color: var(--text-light);
}

/* ===== 世界书选择器 ===== */
.wb-selector-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: flex;
    align-items: flex-end;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.wb-selector-overlay.active {
    opacity: 1;
    visibility: visible;
}

.wb-selector {
    width: 100%;
    height: 85%;
    background: var(--bg-primary);
    border-radius: 20px 20px 0 0;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.wb-selector-overlay.active .wb-selector {
    transform: translateY(0);
}

.wb-selector-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.wb-selector-close {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 50%;
    font-size: 15px;
}

.wb-selector-close svg {
    width: 22px;
    height: 22px;
}

.wb-selector-title {
    flex: 1;
    text-align: center;
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
}

.wb-selector-confirm {
    padding: 8px 16px;
    background: var(--primary-color);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

.wb-selector-confirm:active {
    opacity: 0.8;
}

.wb-selector-subheader {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: var(--bg-secondary);
}

.wb-selector-stats {
    font-size: 14px;
    color: var(--text-secondary);
}

.wb-selector-stats span {
    color: var(--primary-color);
    font-weight: 600;
}

.wb-selector-clear {
    padding: 6px 12px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
}

.wb-selector-clear:active {
    background: var(--bg-primary);
}

.wb-selector-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.wb-selector-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.wb-selector-empty-icon {
    width: 56px;
    height: 56px;
    margin-bottom: 16px;
    opacity: 0.4;
}

.wb-selector-empty-icon svg {
    width: 100%;
    height: 100%;
}

.wb-selector-empty-text {
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 6px;
}

.wb-selector-empty-sub {
    font-size: 12px;
    opacity: 0.7;
}

/* 选择器文件夹 */
.wb-selector-folder {
    margin-bottom: 12px;
    background: var(--bg-secondary);
    border-radius: 12px;
    overflow: hidden;
}

.wb-selector-folder-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
}

.wb-selector-folder-icon {
    width: 18px;
    height: 18px;
    color: var(--primary-color);
    flex-shrink: 0;
}

.wb-selector-folder-icon svg {
    width: 100%;
    height: 100%;
}

.wb-selector-folder-name {
    flex: 1;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
}

.wb-selector-folder-count {
    font-size: 12px;
    color: var(--text-secondary);
}

.wb-selector-folder-books {
    padding: 0 16px 12px;
}

/* 选择器世界书 */
.wb-selector-book {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.wb-selector-book:last-child {
    border-bottom: none;
}

.wb-selector-book-icon {
    width: 16px;
    height: 16px;
    color: var(--text-secondary);
    flex-shrink: 0;
    margin-top: 2px;
}

.wb-selector-book-icon svg {
    width: 100%;
    height: 100%;
}

.wb-selector-book-info {
    flex: 1;
    min-width: 0;
}

.wb-selector-book-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.wb-selector-book-preview {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 选择器分区 */
.wb-selector-section {
    margin-bottom: 16px;
}

.wb-selector-section-title {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 4px;
}

/* 复选框 */
.wb-selector-checkbox {
    width: 22px;
    height: 22px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    background: var(--bg-primary);
}

.wb-selector-checkbox.checked {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.wb-selector-checkbox.indeterminate {
    background: var(--primary-color);
    border-color: var(--primary-color);
    position: relative;
}

.wb-selector-checkbox.indeterminate::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 2px;
    background: white;
    border-radius: 1px;
}

.wb-selector-checkbox svg {
    width: 14px;
    height: 14px;
}

/* 已绑定的世界书标签 */
.wb-bound-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.wb-bound-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(102, 126, 234, 0.1);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 20px;
    font-size: 13px;
    color: var(--primary-color);
}

.wb-bound-tag svg {
    width: 14px;
    height: 14px;
}

/* TA的记忆页面世界书按钮 */
.mem-worldbook-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.2s;
}

.mem-worldbook-btn:active {
    background: rgba(0, 0, 0, 0.05);
}

.mem-worldbook-btn svg {
    width: 22px;
    height: 22px;
}

/* 设置页面世界书按钮 */
#bind-worldbook-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

#bind-worldbook-btn svg {
    width: 16px;
    height: 16px;
}
