/* 页面管理 */
.pages-manager {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pages-list {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
    min-height: 0;
}

#pageThumbnails {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

#pageThumbnails::-webkit-scrollbar {
    width: 6px;
}

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

#pageThumbnails::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

#pageThumbnails:hover::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.4);
}

.page-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    gap: 0.75rem;
}

.page-item:hover {
    border-color: #d63384;
    background: #fff5f7;
}

.page-item.active {
    border-color: #d63384;
    background: #fff5f7;
}

.page-info {
    flex: 1;
}

.page-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: #495057;
}

.page-number {
    font-size: 0.75rem;
    color: #6c757d;
}

.btn-page-action {
    border: none;
    background: transparent;
    color: #6c757d;
    cursor: pointer;
    padding: 0.25rem;
}

.btn-page-action:hover {
    color: #d63384;
}

/* 列表视图操作按钮样式 */
.page-item.list-item .action-buttons {
    display: flex;
    align-items: center;
    gap: 4px;
}

.page-item.list-item .action-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: #f8f9fa;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    color: #6c757d;
    transition: all 0.2s ease;
    position: relative;
}

.page-item.list-item .action-btn:hover {
    background: #e9ecef;
    color: #333;
    transform: scale(1.05);
}

.page-item.list-item .action-btn::after {
    content: attr(title);
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-right: 8px;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    font-size: 12px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 100;
}

.page-item.list-item .action-btn:hover::after {
    opacity: 1;
    visibility: visible;
}

/* 图层管理 */
.layers-manager {
    height: 100%;
}

.layers-toolbar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.layers-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: calc(100vh - 240px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
    transition: scrollbar-color 0.3s ease;
}

/* 页面缩略图网格视图 */
#pageThumbnails.grid-view {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 0;
    max-height: calc(100vh - 240px);
    overflow-y: auto;
}

#pageThumbnails.list-view {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px;
    flex: 1;
    max-height: calc(100vh - 240px);
    min-height: 0;
    overflow-y: auto;
}

.page-item.grid-item {
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    padding: 28px 0;
    width: 100%;
}

.page-item.grid-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.page-item.grid-item.active {
    border-color: #dc3545;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.2);
}

.page-thumbnail {
    display: none;
}

.page-item.grid-item .page-number {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 40px;
}

.page-item.grid-item .page-badge {
    width: 24px;
    height: 24px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #dee2e6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    color: #333;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.page-item.grid-item .page-number-text {
    font-size: 12px;
    color: #6c757d;
    margin-top: 4px;
}

.page-item.grid-item .page-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.page-item.grid-item .page-content {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.page-item.grid-item .page-image {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.page-item.grid-item .page-image img {
    width: 90px;
    height: 175px;
    /* 320:628 = 90:175 */
    object-fit: contain;
}

.page-item.grid-item .add-page-btn {
    width: 32px;
    height: 32px;
    margin-bottom: -16px;
    border: 1px solid #dee2e6;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    color: #6c757d;
    transition: all 0.2s ease;
}

.page-item.grid-item .add-page-btn:hover {
    background: #f8f9fa;
    color: #333;
    border-color: #adb5bd;
    transform: scale(1.1);
}

.page-item.grid-item .action-buttons {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
    margin-right: 16px;
}

.page-item.grid-item .action-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: #f8f9fa;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    color: #6c757d;
    transition: all 0.2s ease;
    position: relative;
}

.page-item.grid-item .action-btn:hover {
    background: #e9ecef;
    color: #333;
    transform: scale(1.05);
}

.page-item.grid-item .action-btn::after {
    content: attr(title);
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-right: 8px;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    font-size: 12px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 100;
}

.page-item.grid-item .action-btn:hover::after {
    opacity: 1;
    visibility: visible;
}

.page-item.grid-item.active .page-badge {
    background: #dc3545;
    color: white;
    border-color: #dc3545;
}

.page-item.grid-item .preview-thumb {
    width: 100%;
    height: 100%;
    position: relative;
    border: 1px solid #dee2e6;
}

.page-item.grid-item .page-info {
    display: none;
}

.page-item.grid-item .page-title {
    display: none;
}

.page-item.grid-item .btn-page-action {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border: none;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0;
    z-index: 15;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.page-item.grid-item:hover .btn-page-action {
    opacity: 1;
}

.page-item.grid-item .btn-page-action:hover {
    background: #f8f9fa;
    transform: scale(1.1);
}

.page-item.grid-item .btn-page-action::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    right: 0;
    margin-bottom: 8px;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    font-size: 12px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 100;
}

.page-item.grid-item .btn-page-action:hover::after {
    opacity: 1;
    visibility: visible;
}

/* 页面网格视图 - 参考UI样式 */
.pages-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 600px;
    overflow-y: auto;
}

.page-item-grid {
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 4px;
    overflow: hidden;
}

.page-item-grid:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.page-item-grid.active {
    box-shadow: 0 0 0 2px #dc3545;
}

.page-preview-grid {
    width: 100px;
    height: 160px;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    background: #f8f9fa;
}

.preview-thumb-grid {
    width: 100%;
    height: 100%;
    position: relative;
}

/* 页码标记 */
.page-number-badge {
    position: absolute;
    top: 5px;
    left: 5px;
    width: 20px;
    height: 20px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #dee2e6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    color: #333;
    z-index: 10;
}

.page-item-grid.active .page-number-badge {
    background: #dc3545;
    color: white;
    border-color: #dc3545;
}

/* 页面标题 */
.page-title-grid {
    font-size: 11px;
    font-weight: 500;
    margin-top: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #333;
}

/* 添加页面按钮 */
.add-page-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100px;
    height: 160px;
    border: 2px dashed #dee2e6;
    border-radius: 4px;
    background: #f8f9fa;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 10px;
}

.add-page-btn:hover {
    border-color: #dc3545;
    background: #fff5f5;
}

.add-page-btn i {
    font-size: 24px;
    color: #dc3545;
}

/* 图层列表滚动条样式 */
.layers-list::-webkit-scrollbar {
    width: 6px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.layers-list::-webkit-scrollbar-track {
    background: transparent;
}

.layers-list::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.layers-list:hover::-webkit-scrollbar,
.layers-list:active::-webkit-scrollbar,
.layers-list:focus::-webkit-scrollbar {
    opacity: 1;
}

.layers-list:hover::-webkit-scrollbar-thumb,
.layers-list:active::-webkit-scrollbar-thumb,
.layers-list:focus::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.4);
}

.layers-list {
    scrollbar-gutter: stable;
}

.layer-item {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    gap: 0.75rem;
}

.layer-item:hover {
    border-color: #d63384;
    background: #f8f9fa;
}

.layer-item.active {
    border-color: #d63384;
    background: #fff5f7;
}

.layer-visibility {
    color: #20c997;
}

.layer-info {
    flex: 1;
}

.layer-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: #495057;
}

.layer-type {
    font-size: 0.75rem;
    color: #6c757d;
}

.layer-actions {
    color: #6c757d;
    cursor: pointer;
}

.layer-actions:hover {
    color: #d63384;
}