/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #ff9a56 0%, #ff6b35 50%, #f7931e 100%);
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 顶部导航 */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
}

.logo {
    font-size: 1.8rem;
    font-weight: 700;
    color: #ff6b35;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-info {
    display: flex;
    gap: 20px;
    font-size: 0.9rem;
    color: #666;
}

.total-count, .loaded-count {
    background: rgba(255, 154, 86, 0.15);
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid rgba(255, 107, 53, 0.3);
    color: #d63031;
    font-weight: 500;
}

/* 主要内容区域 */
.main {
    padding: 30px 0;
}

/* 控制区域 */
.controls {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.search-box {
    display: flex;
    gap: 10px;
    flex: 1;
    min-width: 300px;
}

#searchInput {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid rgba(255, 154, 86, 0.3);
    border-radius: 25px;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.9);
}

#searchInput:focus {
    border-color: #ff6b35;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.15);
}

.search-box button {
    padding: 12px 20px;
    border: none;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

#searchBtn {
    background: linear-gradient(45deg, #ff6b35, #f7931e);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.3);
}

#searchBtn:hover {
    background: linear-gradient(45deg, #e55a2b, #e8851a);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.4);
}

#clearBtn {
    background: #f8f9fa;
    color: #666;
    border: 2px solid #e9ecef;
}

#clearBtn:hover {
    background: #e9ecef;
}

.view-controls {
    display: flex;
    gap: 10px;
}

.view-btn {
    padding: 10px 16px;
    border: 2px solid rgba(255, 154, 86, 0.3);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.9);
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.view-btn.active,
.view-btn:hover {
    background: linear-gradient(45deg, #ff6b35, #f7931e);
    color: white;
    border-color: #ff6b35;
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.3);
}

/* 图片网格 */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.gallery.list-view {
    grid-template-columns: 1fr;
    gap: 12px;
}

.image-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    backdrop-filter: blur(10px);
}

.image-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

/* 列表视图特殊样式 */
.gallery.list-view .image-card {
    display: grid;
    grid-template-columns: 200px 1fr auto;
    gap: 20px;
    align-items: center;
    padding: 15px;
    border-radius: 12px;
    min-height: 120px;
}

.gallery.list-view .image-card:hover {
    transform: translateX(5px);
}

.image-container {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
}

.gallery.list-view .image-container {
    width: 200px;
    height: 90px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}

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

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

.image-info {
    padding: 15px;
}

.gallery.list-view .image-info {
    padding: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.image-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: #333;
    margin-bottom: 5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gallery.list-view .image-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: #ff6b35;
}

.image-path {
    font-size: 0.8rem;
    color: #666;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gallery.list-view .image-path {
    font-size: 0.85rem;
    color: #888;
    line-height: 1.4;
}

/* 列表视图操作区域 */
.list-actions {
    display: none;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
}

.gallery.list-view .list-actions {
    display: flex;
}

.list-action-btn {
    padding: 6px 12px;
    border: 1px solid #ff6b35;
    background: white;
    color: #ff6b35;
    border-radius: 15px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.list-action-btn:hover {
    background: #ff6b35;
    color: white;
    transform: scale(1.05);
}

/* 列表视图图片信息 */
.image-meta {
    display: none;
    font-size: 0.75rem;
    color: #999;
    margin-top: 5px;
}

.gallery.list-view .image-meta {
    display: block;
}

/* 加载状态 */
.loading {
    text-align: center;
    padding: 40px 20px;
    color: white;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.load-complete {
    text-align: center;
    padding: 40px 20px;
    color: white;
    font-size: 1.1rem;
    font-weight: 500;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .header-content {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-box {
        min-width: auto;
    }
    
    .gallery {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 15px;
    }

    .gallery.list-view .image-card {
        grid-template-columns: 150px 1fr;
        gap: 15px;
        padding: 12px;
    }

    .gallery.list-view .image-container {
        width: 150px;
        height: 80px;
    }

    .gallery.list-view .list-actions {
        display: none;
    }

    .view-controls {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .gallery {
        grid-template-columns: 1fr;
    }

    .gallery.list-view .image-card {
        grid-template-columns: 120px 1fr;
        gap: 12px;
        padding: 10px;
        min-height: 100px;
    }

    .gallery.list-view .image-container {
        width: 120px;
        height: 70px;
    }

    .gallery.list-view .image-title {
        font-size: 1rem;
    }

    .gallery.list-view .image-path {
        font-size: 0.8rem;
    }

    .search-box {
        flex-direction: column;
    }

    .search-box button {
        width: 100%;
    }
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.modal-content {
    position: relative;
    width: 95%;
    max-width: 1200px;
    height: 95%;
    margin: 2.5% auto;
    background: linear-gradient(145deg, #fff 0%, #fafafa 100%);
    border-radius: 25px;
    overflow: hidden;
    display: grid;
    grid-template-rows: 1fr auto;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 154, 86, 0.2);
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 45px;
    height: 45px;
    border: none;
    background: linear-gradient(45deg, #ff6b35, #f7931e);
    color: white;
    border-radius: 50%;
    font-size: 1.3rem;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: linear-gradient(45deg, #e55a2b, #e8851a);
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.4);
}

.modal-image-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #fafafa 0%, #f0f0f0 100%);
    overflow: hidden;
    padding: 20px;
    min-height: 0;
}

.modal-image-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.modal-image-container img:hover {
    transform: scale(1.02);
}

.modal-info {
    padding: 25px 30px;
    background: linear-gradient(145deg, #fff 0%, #fafafa 100%);
    border-top: 2px solid rgba(255, 154, 86, 0.2);
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 20px;
    align-items: start;
}

.modal-details {
    min-width: 0;
}

.modal-info h3 {
    font-size: 1.3rem;
    color: #333;
    margin-bottom: 8px;
    word-break: break-all;
    font-weight: 600;
    background: linear-gradient(45deg, #ff6b35, #f7931e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.modal-info p {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 15px;
    word-break: break-all;
    line-height: 1.5;
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 140px;
}

.modal-actions button {
    padding: 12px 20px;
    border: none;
    border-radius: 25px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

#downloadBtn {
    background: linear-gradient(45deg, #00b894, #00a085);
    color: white;
}

#downloadBtn:hover {
    background: linear-gradient(45deg, #00a085, #009077);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 184, 148, 0.3);
}

#copyLinkBtn {
    background: linear-gradient(45deg, #0984e3, #74b9ff);
    color: white;
}

#copyLinkBtn:hover {
    background: linear-gradient(45deg, #0770c4, #5fa8f5);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(9, 132, 227, 0.3);
}

.modal-navigation {
    display: flex;
    justify-content: center;
    gap: 15px;
    padding: 20px 30px;
    background: linear-gradient(145deg, #fafafa 0%, #f0f0f0 100%);
    border-top: 1px solid rgba(255, 154, 86, 0.1);
}

.modal-navigation button {
    padding: 12px 24px;
    border: 2px solid #ff6b35;
    background: white;
    color: #ff6b35;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: 500;
    min-width: 120px;
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.1);
}

.modal-navigation button:hover:not(:disabled) {
    background: linear-gradient(45deg, #ff6b35, #f7931e);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.3);
}

.modal-navigation button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 返回顶部按钮 */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    border: none;
    background: linear-gradient(45deg, #ff6b35, #f7931e);
    color: white;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(255, 107, 53, 0.3);
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
    z-index: 99;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: linear-gradient(45deg, #e55a2b, #e8851a);
    transform: translateY(-3px);
    box-shadow: 0 6px 25px rgba(255, 107, 53, 0.4);
}

/* 模态框响应式 */
@media (max-width: 768px) {
    .modal-content {
        width: 98%;
        height: 98%;
        margin: 1% auto;
        border-radius: 15px;
    }

    .modal-info {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 20px;
    }

    .modal-actions {
        flex-direction: row;
        justify-content: center;
    }

    .modal-navigation {
        flex-direction: column;
        gap: 12px;
        padding: 15px 20px;
    }

    .modal-navigation button {
        min-width: auto;
        width: 100%;
    }

    .modal-close {
        top: 15px;
        right: 15px;
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }

    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
    }
}

@media (max-width: 480px) {
    .modal-info h3 {
        font-size: 1.1rem;
    }

    .modal-actions {
        flex-direction: column;
        gap: 10px;
    }

    .modal-actions button {
        padding: 10px 16px;
        font-size: 0.85rem;
    }
}
