/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4f46e5;
    --primary-dark: #4338ca;
    --secondary-color: #10b981;
    --light-color: #f8fafc;
    --dark-color: #1e293b;
    --gray-color: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --radius: 8px;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: #f1f5f9;
    color: var(--dark-color);
    line-height: 1.5;
}

/* 布局 */
.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 24px;
    min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    position: sticky;
    top: 24px;
    height: fit-content;
}

.sidebar-header {
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.sidebar-header h1 {
    font-size: 24px;
    color: var(--dark-color);
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.sidebar-header p {
    color: var(--gray-color);
    font-size: 14px;
}

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

.sidebar-section h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 目录列表 */
.directories-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.directory-item {
    padding: 12px 16px;
    border-radius: var(--radius);
    background: var(--light-color);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.directory-item:hover {
    border-color: var(--primary-color);
    background: #f8fafc;
    transform: translateX(4px);
}

.directory-item.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.directory-count {
    font-size: 12px;
    padding: 2px 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
}

/* 搜索框 */
.search-container {
    position: relative;
    margin-bottom: 16px;
}

.search-input {
    width: 100%;
    padding: 12px 16px 12px 44px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 14px;
    transition: all 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-color);
}

/* 统计信息 */
.stats-info {
    background: #f0f9ff;
    border-radius: var(--radius);
    padding: 16px;
    border: 1px solid #e0f2fe;
}

.stats-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 14px;
}

.stats-item:last-child {
    margin-bottom: 0;
}

.stats-label {
    color: var(--gray-color);
}

.stats-value {
    font-weight: 600;
    color: var(--dark-color);
}

/* 主内容区 */
.main-content {
    padding: 24px 0;
}

.content-header {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 24px;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left h2 {
    font-size: 20px;
    color: var(--dark-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.current-directory {
    color: var(--gray-color);
    font-size: 14px;
    margin-top: 4px;
}

/* 图片网格 */
.images-container {
    min-height: 400px;
}

.images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.image-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.image-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

.image-preview {
    height: 200px;
    overflow: hidden;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

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

.image-info {
    padding: 16px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.image-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.image-meta {
    font-size: 12px;
    color: var(--gray-color);
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
}

.image-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
}

.btn-preview, .btn-download {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: var(--radius);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-preview {
    background: #f1f5f9;
    color: var(--dark-color);
}

.btn-preview:hover {
    background: #e2e8f0;
}

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

.btn-download:hover {
    background: var(--primary-dark);
}

/* 加载状态和空状态 */
.loading-state, .empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--gray-color);
}

.loading-state i, .empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: var(--dark-color);
}

/* 分页 */
.pagination-container {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.pagination-info {
    font-size: 14px;
    color: var(--gray-color);
}

.pagination-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.page-btn {
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: white;
    color: var(--dark-color);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-btn:hover:not(:disabled) {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

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

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-jump {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 12px;
}

.page-jump input {
    width: 60px;
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 14px;
    text-align: center;
}

.page-jump input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn-jump {
    padding: 6px 12px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    cursor: pointer;
}

.btn-jump:hover {
    background: var(--primary-dark);
}

/* 搜索结果显示 */
.search-results-header {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.search-results-header h3 {
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-results-header .btn-clear {
    background: none;
    border: none;
    color: var(--gray-color);
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.search-results-header .btn-clear:hover {
    color: var(--dark-color);
}

/* 图片预览模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    max-width: 90%;
    max-height: 90vh;
    position: relative;
}

.modal-image {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    background: #1e293b;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-info .image-name {
    color: white;
    margin-bottom: 0;
}

.btn-modal-download {
    padding: 8px 16px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-modal-download:hover {
    background: var(--primary-dark);
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .container {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .sidebar {
        position: static;
        margin-bottom: 16px;
    }
    
    .images-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 16px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 12px;
    }
    
    .content-header {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }
    
    .images-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    
    .pagination-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .pagination-nav {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .sidebar {
        padding: 16px;
    }
    
    .images-grid {
        grid-template-columns: 1fr;
    }
    
    .image-actions {
        flex-direction: column;
    }
    
    .page-btn {
        min-width: 32px;
        height: 32px;
        font-size: 13px;
    }
}