/* --- 世界书 (World Book) 样式 --- */

#world-book-screen, 
#edit-world-book-screen {
    background-color: #fff;
}

#world-book-screen .content {
    padding: 16px;
    height: calc(100% - 44px - var(--safe-top));
    overflow-y: auto;
}

/* 新建菜单样式 */
.world-book-new-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    width: 140px;
    z-index: 100;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    border: 1px solid #eee;
}

.world-book-new-menu .menu-item {
    padding: 12px 16px;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    border-bottom: 1px solid #f5f5f5;
}

.world-book-new-menu .menu-item:last-child {
    border-bottom: none;
}

.world-book-new-menu .menu-item:active {
    background-color: #f0f0f0;
}

/* 网格视图 */
.grid-view {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px 16px;
}

.grid-view .wb-item-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.grid-view .wb-item-card:active {
    opacity: 0.7;
}

.grid-view .wb-icon-wrapper {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border-radius: 16px;
    transition: background 0.2s;
}

.grid-view .wb-item-card:active .wb-icon-wrapper {
    background: #e9ecef;
}

.grid-view .wb-folder-icon {
    color: #ffca28;
    fill: #ffca28;
}

.grid-view .wb-entry-icon {
    color: #42a5f5;
    fill: #42a5f5;
}

.grid-view .wb-item-name {
    font-size: 13px;
    color: #333;
    text-align: center;
    word-break: break-all;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    width: 100%;
}

/* 列表视图 */
.list-view {
    display: flex;
    flex-direction: column;
    background-color: #fff;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #eee;
}

.list-view .wb-item-card {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    gap: 16px;
    cursor: pointer;
    border-bottom: 1px solid #f5f5f5;
}

.list-view .wb-item-card:last-child {
    border-bottom: none;
}

.list-view .wb-item-card:active {
    background-color: #f0f0f0;
}

.list-view .wb-icon-wrapper {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.list-view .wb-folder-icon {
    color: #ffca28;
    fill: #ffca28;
}

.list-view .wb-entry-icon {
    color: #42a5f5;
    fill: #42a5f5;
}

.list-view .wb-item-name {
    font-size: 15px;
    color: #333;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 多选模式适配 */
.wb-item-card.is-selecting {
    position: relative;
}

.wb-item-card.selected .wb-icon-wrapper {
    background: var(--primary-color) !important;
}

.wb-item-card.selected .wb-icon-wrapper svg {
    color: white !important;
    fill: white !important;
}

/* 世界书多选工具栏 */
#world-book-multi-select-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    padding-bottom: 10px;
    border-top: 1px solid #eee;
    z-index: 20;
    animation: slideUp 0.3s ease-out;
}

/* 世界书选择模态框 (全屏) */
#world-book-selection-modal {
    z-index: 300;
}

#journal-worldbook-selection-modal {
    z-index: 201;
}

#journal-worldbook-selection-modal .modal-window {
    width: 90%;
    max-width: 380px;
}

#journal-worldbook-selection-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 40vh;
    overflow-y: auto;
}

/* 全屏选择器列表项 */
.wb-selector-row {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    background: #fff;
    cursor: pointer;
}

.wb-selector-row:last-child {
    border-bottom: none;
}

.wb-selector-row:active {
    background-color: #f5f5f5;
}

.wb-selector-icon {
    margin-right: 12px;
    display: flex;
    align-items: center;
    color: #5a6b7c;
}

.wb-selector-name {
    flex: 1;
    font-size: 15px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wb-selector-arrow {
    width: 8px;
    height: 14px;
    position: relative;
}

.wb-selector-arrow::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 8px;
    height: 8px;
    border-top: 2px solid #ccc;
    border-right: 2px solid #ccc;
    transform: translateY(-50%) rotate(45deg);
}

.wb-selector-checkbox {
    appearance: none;
    width: 22px;
    height: 22px;
    border: 1px solid #ccc;
    border-radius: 50%;
    outline: none;
    cursor: pointer;
    position: relative;
    background: #fff;
}

.wb-selector-checkbox:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.wb-selector-checkbox:checked::after {
    content: '';
    position: absolute;
    top: 4px;
    left: 7px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* 已绑定世界书卡片 (旧样式已弃用，新样式在 js/settings.js 中内联定义) */
.bound-wb-card {
    display: none;
}

.world-book-select-item {
    display: flex;
    align-items: center;
    padding: 12px 5px;
    border-bottom: 1px solid #f0f0f0;
}

.world-book-select-item:last-child {
    border-bottom: none;
}

.world-book-select-item input[type="checkbox"] {
    margin-right: 15px;
    width: 20px;
    height: 20px;
}

.world-book-select-item label {
    font-weight: 500;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}
