/**
 * 相册管理增强样式
 * 包含树形结构、智能相册、封面选择等功能
 */

/* ===== 布局切换 ===== */
.view-toggle {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: flex-end;
}

.view-toggle button {
    padding: 8px 16px;
    border: 1px solid #e0e0e0;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
}

.view-toggle button.active {
    background: #1890ff;
    color: #fff;
    border-color: #1890ff;
}

.view-toggle button:hover:not(.active) {
    background: #f5f5f5;
}

/* ===== 相册树形视图 ===== */
.albums-tree {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.tree-node {
    margin-bottom: 10px;
}

.tree-node-content {
    display: flex;
    align-items: center;
    padding: 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    position: relative;
}

.tree-node-content:hover {
    background: #f5f7fa;
}

.tree-node-content.selected {
    background: #e6f7ff;
    border-left: 3px solid #1890ff;
}

.tree-toggle {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
    cursor: pointer;
    border: none;
    background: transparent;
    color: #666;
    font-size: 14px;
    transition: transform 0.2s;
}

.tree-toggle.expanded {
    transform: rotate(90deg);
}

.tree-toggle:hover {
    color: #1890ff;
}

.tree-icon {
    margin-right: 8px;
    font-size: 18px;
}

.tree-label {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tree-name {
    font-size: 14px;
    color: #333;
}

.tree-count {
    font-size: 12px;
    color: #999;
}

.tree-badge {
    padding: 2px 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
}

.tree-actions {
    display: flex;
    gap: 5px;
    opacity: 0;
    transition: opacity 0.2s;
}

.tree-node-content:hover .tree-actions {
    opacity: 1;
}

.tree-action-btn {
    padding: 4px 8px;
    border: none;
    background: transparent;
    color: #666;
    cursor: pointer;
    border-radius: 4px;
    font-size: 12px;
    transition: all 0.2s;
}

.tree-action-btn:hover {
    background: rgba(24, 144, 255, 0.1);
    color: #1890ff;
}

.tree-children {
    margin-left: 28px;
    border-left: 1px dashed #e0e0e0;
    padding-left: 10px;
}

.tree-children.collapsed {
    display: none;
}

/* ===== 智能相册向导 ===== */
.smart-album-wizard {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.smart-album-wizard.active {
    opacity: 1;
    pointer-events: all;
}

.wizard-container {
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 700px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    transform: scale(0.9);
    transition: transform 0.3s;
}

.smart-album-wizard.active .wizard-container {
    transform: scale(1);
}

.wizard-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wizard-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.wizard-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: #999;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s;
    font-size: 20px;
}

.wizard-close:hover {
    background: #f5f5f5;
    color: #333;
}

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

.wizard-section {
    margin-bottom: 24px;
}

.wizard-section-title {
    font-size: 15px;
    font-weight: 500;
    color: #333;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.wizard-section-icon {
    font-size: 18px;
}

.rule-group {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
}

.rule-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.rule-row:last-child {
    margin-bottom: 0;
}

.form-group {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    font-size: 13px;
    color: #666;
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: #1890ff;
    box-shadow: 0 0 0 3px rgba(24, 144, 255, 0.1);
}

.tag-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-option {
    padding: 6px 12px;
    border: 1px solid #e0e0e0;
    background: #fff;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
}

.tag-option:hover {
    border-color: #1890ff;
    background: #f0f7ff;
}

.tag-option.selected {
    background: #1890ff;
    color: #fff;
    border-color: #1890ff;
}

.preview-section {
    background: #f0f7ff;
    border: 1px dashed #1890ff;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
}

.preview-btn {
    padding: 8px 24px;
    border: none;
    background: #1890ff;
    color: #fff;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.preview-btn:hover {
    background: #40a9ff;
}

.preview-result {
    margin-top: 12px;
    font-size: 13px;
    color: #666;
}

.preview-photos {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
    margin-top: 12px;
}

.preview-photo {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 4px;
}

.wizard-footer {
    padding: 16px 24px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.wizard-footer button {
    padding: 10px 24px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-cancel {
    background: #f5f5f5;
    color: #666;
}

.btn-cancel:hover {
    background: #e0e0e0;
}

.btn-primary {
    background: #1890ff;
    color: #fff;
}

.btn-primary:hover {
    background: #40a9ff;
}

/* ===== 封面选择器 ===== */
.cover-selector {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.cover-selector.active {
    opacity: 1;
    pointer-events: all;
}

.cover-selector-content {
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 900px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.cover-type-tabs {
    display: flex;
    border-bottom: 1px solid #e0e0e0;
    padding: 0 24px;
}

.cover-type-tab {
    padding: 16px 24px;
    border: none;
    background: transparent;
    color: #666;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    font-size: 14px;
}

.cover-type-tab:hover {
    color: #1890ff;
}

.cover-type-tab.active {
    color: #1890ff;
    border-bottom-color: #1890ff;
}

.cover-photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    padding: 24px;
    max-height: 400px;
    overflow-y: auto;
}

.cover-photo-item {
    position: relative;
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.2s;
}

.cover-photo-item:hover {
    transform: scale(1.05);
}

.cover-photo-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
}

.cover-photo-item.selected {
    box-shadow: 0 0 0 3px #1890ff;
}

.cover-photo-item .select-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    background: #1890ff;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.2s;
}

.cover-photo-item.selected .select-badge {
    opacity: 1;
}

.mosaic-preview {
    padding: 24px;
    text-align: center;
}

.mosaic-grid {
    display: grid;
    gap: 4px;
    max-width: 400px;
    margin: 0 auto;
    border-radius: 8px;
    overflow: hidden;
}

.mosaic-grid.count-2 {
    grid-template-columns: 1fr 1fr;
}

.mosaic-grid.count-3 {
    grid-template-columns: 2fr 1fr;
    grid-template-rows: 1fr 1fr;
}

.mosaic-grid.count-3 .mosaic-item:first-child {
    grid-row: span 2;
}

.mosaic-grid.count-4 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}

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

/* ===== 拖拽排序 ===== */
.sortable-ghost {
    opacity: 0.4;
    background: #e6f7ff;
}

.sortable-drag {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    transform: rotate(2deg);
}

.drag-handle {
    cursor: move;
    color: #999;
    margin-right: 8px;
}

.drag-handle:hover {
    color: #1890ff;
}

/* ===== 响应式设计 ===== */
@media (max-width: 768px) {
    .wizard-container {
        width: 95%;
        max-height: 90vh;
    }

    .rule-row {
        grid-template-columns: 1fr;
    }

    .cover-photos-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }

    .tree-children {
        margin-left: 16px;
        padding-left: 8px;
    }
}

/* ===== 加载动画 ===== */
@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.skeleton {
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
}

/* ===== 空状态 ===== */
.empty-tree {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-tree-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.empty-tree-text {
    font-size: 14px;
    margin-bottom: 20px;
}
