﻿/* 设计库页面专用样式 - 现代化设计 */

/* ====== CSS变量系统 ====== */
:root {
    /* 主色调 */
    --primary-color: #667eea;
    --primary-light: #8b9aed;
    --primary-dark: #4a5cbd;
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    
    /* 辅助色彩 */
    --secondary-color: #764ba2;
    --accent-color: #f093fb;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    
    /* 中性色彩 */
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-light: #9ca3af;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;
    --border-color: #e5e7eb;
    --border-light: #f3f4f6;
    
    /* 阴影系统 */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 25px rgba(0, 0, 0, 0.15);
    --shadow-xl: 0 16px 40px rgba(0, 0, 0, 0.2);
    --shadow-glow: 0 0 20px rgba(102, 126, 234, 0.3);
    
    /* 间距系统 */
    --spacing-xs: 0.5rem;
    --spacing-sm: 0.75rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    
    /* 圆角系统 */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 50%;
    
    /* 动画曲线 */
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
    --ease-elastic: cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* ====== 页面布局 ====== */
.design-library-page {
    min-height: 100vh;
    background: var(--bg-secondary);
    padding-bottom: 80px; /* 为底部导航留空间 */
}

/* ====== 页面头部 ====== */
.page-header {
    background: var(--primary-gradient);
    padding: var(--spacing-xl) var(--spacing-lg) var(--spacing-2xl);
    position: relative;
    overflow: hidden;
}

.page-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 100%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    animation: headerGlow 8s ease-in-out infinite alternate;
}

.header-content {
    position: relative;
    z-index: 2;
    text-align: center;
}

.page-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-md);
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.title-icon {
    font-size: 2.5rem;
    animation: iconFloat 3s ease-in-out infinite alternate;
}

.page-subtitle {
    margin: var(--spacing-md) 0 0;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 400;
    letter-spacing: 0.5px;
}

/* ====== 搜索区域 ====== */
.search-section {
    padding: var(--spacing-lg);
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-light);
}

.search-container {
    max-width: 600px;
    margin: 0 auto;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    padding: var(--spacing-md) var(--spacing-lg);
    border: 2px solid transparent;
    transition: all 0.3s var(--ease-smooth);
}

.search-input-wrapper:focus-within {
    border-color: var(--primary-color);
    background: var(--bg-primary);
    box-shadow: var(--shadow-glow);
}

.search-icon {
    color: var(--text-light);
    margin-right: var(--spacing-sm);
    font-size: 1.1rem;
    transition: color 0.3s var(--ease-smooth);
}

.search-input-wrapper:focus-within .search-icon {
    color: var(--primary-color);
}

.search-input {
    flex: 1;
    border: none;
    outline: none;
    background: none;
    font-size: 1rem;
    color: var(--text-primary);
    placeholder-color: var(--text-light);
}

.search-clear {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: var(--spacing-xs);
    border-radius: var(--radius-full);
    transition: all 0.3s var(--ease-smooth);
}

.search-clear:hover {
    background: var(--bg-tertiary);
    color: var(--error-color);
}

/* ====== 分类导航 ====== */
.category-nav {
    background: var(--bg-primary);
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--border-light);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.category-scroll {
    display: flex;
    gap: var(--spacing-md);
    min-width: max-content;
}

.category-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm) var(--spacing-lg);
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    cursor: pointer;
    transition: all 0.3s var(--ease-smooth);
    white-space: nowrap;
    border: 2px solid transparent;
}

.category-item:hover {
    background: var(--bg-tertiary);
    transform: translateY(-2px);
}

.category-item.active {
    background: var(--primary-gradient);
    color: white;
    box-shadow: var(--shadow-glow);
}

.category-label {
    font-weight: 500;
    font-size: 0.9rem;
}

.category-count {
    background: rgba(255, 255, 255, 0.3);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 600;
}

.category-item.active .category-count {
    background: rgba(255, 255, 255, 0.3);
}

/* ====== 设计网格容器 ====== */
.design-grid-container {
    padding: var(--spacing-lg);
    min-height: 400px;
}

/* ====== 加载状态 ====== */
.loading-state {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

.loading-content {
    text-align: center;
}

.loading-dots {
    display: flex;
    gap: 8px;
    margin-bottom: var(--spacing-lg);
    justify-content: center;
}

.loading-dots span {
    width: 12px;
    height: 12px;
    border-radius: var(--radius-full);
    background: var(--primary-color);
    animation: loadingDots 1.5s ease-in-out infinite;
}

.loading-dots span:nth-child(1) { animation-delay: 0s; }
.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

.loading-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0;
}

/* ====== 设计网格 ====== */
.design-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--spacing-lg);
    max-width: 1200px;
    margin: 0 auto;
}

/* ====== 设计卡片 ====== */
.design-card {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all 0.4s var(--ease-smooth);
    cursor: pointer;
    position: relative;
}

.design-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.design-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-gradient);
    transform: scaleX(0);
    transition: transform 0.3s var(--ease-smooth);
}

.design-card:hover::before {
    transform: scaleX(1);
}

.design-preview {
    height: 200px;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    position: relative;
    overflow: hidden;
}

.design-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s var(--ease-smooth);
}

.design-card:hover .design-preview img {
    transform: scale(1.05);
}

.design-info {
    padding: var(--spacing-lg);
}

.design-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 var(--spacing-sm);
    line-height: 1.4;
}

.design-meta {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.design-category {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    padding: 4px var(--spacing-sm);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
}

.design-stats {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    color: var(--text-light);
    font-size: 0.8rem;
}

.design-actions {
    display: flex;
    gap: var(--spacing-sm);
}

.design-btn {
    flex: 1;
    padding: var(--spacing-sm) var(--spacing-md);
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s var(--ease-smooth);
}

.btn-preview {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-preview:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-use {
    background: var(--primary-gradient);
    color: white;
    border: 1px solid transparent;
}

.btn-use:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* ====== 空状态 ====== */
.empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

.empty-content {
    text-align: center;
    max-width: 300px;
}

.empty-icon {
    font-size: 4rem;
    color: var(--text-light);
    margin-bottom: var(--spacing-lg);
}

.empty-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0 0 var(--spacing-sm);
}

.empty-desc {
    color: var(--text-light);
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0;
}

/* ====== 浮动操作按钮 ====== */
.floating-actions {
    position: fixed;
    bottom: 90px;
    right: var(--spacing-lg);
    z-index: 1000;
}

.fab {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-full);
    background: var(--primary-gradient);
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: all 0.3s var(--ease-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
}

.fab:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

.fab:active {
    transform: scale(0.95);
}

/* ====== 设计预览模态框 ====== */
.design-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s var(--ease-smooth);
}

.design-modal.active {
    display: flex;
    opacity: 1;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
}

.modal-container {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    position: relative;
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.3s var(--ease-bounce);
}

.design-modal.active .modal-container {
    transform: scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-secondary);
}

.modal-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.modal-close {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s var(--ease-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-body {
    padding: var(--spacing-lg);
    max-height: 60vh;
    overflow-y: auto;
}

/* ====== 响应式设计 ====== */
@media (max-width: 768px) {
    .page-title {
        font-size: 1.5rem;
    }
    
    .title-icon {
        font-size: 2rem;
    }
    
    .design-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: var(--spacing-md);
    }
    
    .floating-actions {
        bottom: 80px;
        right: var(--spacing-md);
    }
    
    .fab {
        width: 48px;
        height: 48px;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .design-grid {
        grid-template-columns: 1fr;
    }
    
    .search-section {
        padding: var(--spacing-md);
    }
    
    .category-nav {
        padding: var(--spacing-md);
    }
    
    .design-grid-container {
        padding: var(--spacing-md);
    }
}

/* ====== 动画定义 ====== */
@keyframes headerGlow {
    0% { transform: translateX(-20%) rotate(0deg); }
    100% { transform: translateX(0%) rotate(5deg); }
}

@keyframes iconFloat {
    0% { transform: translateY(0px); }
    100% { transform: translateY(-5px); }
}

@keyframes loadingDots {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ====== 深色模式支持 ====== */
@media (prefers-color-scheme: dark) {
    :root {
        --text-primary: #f9fafb;
        --text-secondary: #d1d5db;
        --text-light: #9ca3af;
        --bg-primary: #1f2937;
        --bg-secondary: #111827;
        --bg-tertiary: #374151;
        --border-color: #374151;
        --border-light: #4b5563;
    }
}

/* ====== 性能优化 ====== */
.design-card,
.category-item,
.fab {
    will-change: transform;
}

.design-preview img {
    will-change: transform;
}

/* 减少不必要的重绘 */
* {
    box-sizing: border-box;
}

/* 优化滚动性能 */
.category-nav {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.category-nav::-webkit-scrollbar {
    display: none;
}