﻿/* 模板页面专用样式 - 现代化设计 */

/* ====== CSS变量系统 ====== */
:root {
    /* 主色调 */
    --template-primary: #667eea;
    --template-primary-light: #8b9aed;
    --template-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    
    /* 辅助色彩 */
    --template-secondary: #764ba2;
    --template-accent: #f093fb;
    --template-success: #10b981;
    --template-warning: #f59e0b;
    --template-error: #ef4444;
    
    /* 中性色彩 */
    --template-text-primary: #1f2937;
    --template-text-secondary: #6b7280;
    --template-text-light: #9ca3af;
    --template-bg-primary: #ffffff;
    --template-bg-secondary: #f9fafb;
    --template-bg-tertiary: #f3f4f6;
    --template-border-color: #e5e7eb;
    --template-border-light: #f3f4f6;
    
    /* 阴影系统 */
    --template-shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --template-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --template-shadow-lg: 0 8px 25px rgba(0, 0, 0, 0.15);
    --template-shadow-xl: 0 16px 40px rgba(0, 0, 0, 0.2);
    --template-shadow-glow: 0 0 20px rgba(102, 126, 234, 0.3);
    
    /* 间距系统 */
    --template-spacing-xs: 0.5rem;
    --template-spacing-sm: 0.75rem;
    --template-spacing-md: 1rem;
    --template-spacing-lg: 1.5rem;
    --template-spacing-xl: 2rem;
    
    /* 圆角系统 */
    --template-radius-sm: 8px;
    --template-radius-md: 12px;
    --template-radius-lg: 16px;
    --template-radius-xl: 20px;
    --template-radius-full: 50%;
    
    /* 动画曲线 */
    --template-ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --template-ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* ====== 页面布局 ====== */
.template-page {
    min-height: calc(100vh + 500px) !important; /* 确保页面有足够的高度可以滚动 */
    height: auto !important;
    background: var(--template-bg-secondary);
    padding-bottom: 100px !important;
    overflow-y: visible !important;
}

/* ====== 专门针对template页面消除顶部空白 ====== */
.template-page .page-header {
    margin-top: -5px !important; /* 🔧 稍微向下移动（从-10px改为-5px） */
    padding-top: 0 !important; /* 消除顶部内边距 */
}

.template-page .main-content {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* ====== 页面头部 ====== */
.page-header {
    background: var(--template-gradient);
    padding: var(--template-spacing-xs) var(--template-spacing-lg);
    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: 10 !important; /* 确保头部内容层级足够高 */
    text-align: center;
}

/* ====== 导航栏样式 ====== */
.nav-tabs-container {
    position: relative;
    width: 100%;
    z-index: 10 !important; /* 确保容器层级足够高 */
}

.nav-tabs {
    display: flex;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--template-radius-lg);
    padding: 6px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
    z-index: 10 !important; /* 确保导航栏容器层级足够高 */
}

.nav-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--template-radius-md);
    cursor: pointer;
    transition: all 0.3s var(--template-ease-smooth);
    position: relative;
    z-index: 11 !important; /* 确保每个导航按钮层级足够高 */
    min-height: 44px;
}

.nav-tab:hover:not(.active) {
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.nav-tab.active {
    color: var(--template-primary);
    background: #ffffff;
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.1),
        0 2px 4px rgba(0, 0, 0, 0.06);
    transform: translateY(-1px);
}

.nav-tab.active .tab-icon {
    transform: scale(1.1);
}

.tab-icon {
    font-size: 16px;
    transition: transform 0.3s var(--template-ease-bounce);
    line-height: 1;
}

.tab-text {
    font-weight: 600;
    white-space: nowrap;
}

.tab-indicator {
    position: absolute;
    bottom: -1px;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 60%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--template-primary), transparent);
    border-radius: 2px;
    transition: transform 0.3s var(--template-ease-smooth);
}

.nav-tab.active .tab-indicator {
    transform: translateX(-50%) scaleX(1);
}

/* ====== 内容区域切换 ====== */
.tab-content {
    opacity: 1;
    transform: translateY(0);
    transition: all 0.4s var(--template-ease-smooth);
}

.tab-content:not(.active) {
    display: none;
}

/* ====== Prompt介绍卡片样式 ====== */
.prompt-intro-section {
    background: var(--template-bg-primary);
    padding: 0 var(--template-spacing-lg) var(--template-spacing-xs);
    border-bottom: 1px solid var(--template-border-light);
    position: relative;
    margin-top: -12px;
}

.prompt-intro-container {
    max-width: 800px;
    margin: 0 auto;
}

.prompt-intro-card {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: var(--template-radius-lg);
    padding: var(--template-spacing-sm) var(--template-spacing-sm) var(--template-spacing-xs);
    border: 1px solid var(--template-border-light);
    position: relative;
    overflow: hidden;
    margin: 0 auto;
    max-width: 500px;
}

.prompt-intro-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--template-gradient);
}

.prompt-intro-content {
    position: relative;
    z-index: 2;
    text-align: center;
}

.prompt-intro-icon {
    font-size: 2rem;
    line-height: 1;
    display: block;
    margin: 0 0 var(--template-spacing-xs) 0;
}

.prompt-intro-text h2 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--template-text-primary);
    margin: 0 0 var(--template-spacing-xs) 0;
    line-height: 1.5;
    background: linear-gradient(135deg, var(--template-primary), var(--template-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.prompt-intro-text p {
    font-size: 0.85rem;
    line-height: 1.4;
    color: var(--template-text-primary);
    text-align: center;
    margin: 0;
    white-space: pre-line;
    font-weight: 500;
    letter-spacing: 0.2px;
}

/* ====== Prompt图片展示区域 ====== */
.prompt-gallery-section {
    padding: var(--template-spacing-lg);
    background: var(--template-bg-primary);
}

.prompt-gallery-container {
    max-width: 1200px;
    margin: 0 auto;
}

.prompt-gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--template-spacing-lg);
    margin-bottom: var(--template-spacing-lg);
}

/* Prompt单项样式 */
.prompt-item {
    background: #ffffff;
    border-radius: var(--template-radius-lg);
    overflow: hidden;
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.05),
        0 2px 6px rgba(0, 0, 0, 0.08);
    transition: all var(--template-transition-smooth);
    cursor: pointer;
    position: relative;
}

.prompt-item:hover {
    transform: translateY(-4px);
    box-shadow: 
        0 12px 24px rgba(0, 0, 0, 0.12),
        0 8px 16px rgba(0, 0, 0, 0.08);
}

.prompt-item-image {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: var(--template-bg-secondary);
}

.prompt-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--template-transition-smooth);
}

.prompt-item:hover .prompt-item-image img {
    transform: scale(1.05);
}

.prompt-item-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.8), rgba(118, 75, 162, 0.8));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    opacity: 0;
    transition: all var(--template-transition-smooth);
    backdrop-filter: blur(2px);
}

.prompt-item:hover .prompt-item-overlay {
    opacity: 1;
}

.prompt-item-overlay i {
    font-size: 2rem;
    margin-bottom: var(--template-spacing-xs);
    animation: bounceIcon 2s ease-in-out infinite;
}

.prompt-item-overlay span {
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.prompt-item-name {
    padding: var(--template-spacing-md);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--template-text-primary);
    text-align: center;
    line-height: 1.4;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-top: 1px solid var(--template-border-light);
    background: linear-gradient(to bottom, #ffffff, #f8fafc);
}

/* 换一批按钮 */
.prompt-gallery-footer {
    text-align: center;
    margin-top: var(--template-spacing-xl);
}

.refresh-gallery-btn {
    background: linear-gradient(135deg, var(--template-primary), var(--template-secondary));
    color: white;
    border: none;
    padding: var(--template-spacing-md) var(--template-spacing-xl);
    border-radius: var(--template-radius-lg);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: var(--template-spacing-sm);
    transition: all var(--template-transition-smooth);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.refresh-gallery-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

.refresh-gallery-btn i {
    transition: transform var(--template-transition-smooth);
}

.refresh-gallery-btn:hover i {
    transform: rotate(180deg);
}

/* ====== Prompt弹窗样式 ====== */
.prompt-modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 99999 !important;
    display: none !important;
    align-items: center !important;
    justify-content: center !important;
    padding: var(--template-spacing-lg) !important;
    opacity: 0 !important;
    transition: opacity 0.3s ease-out !important;
}

.prompt-modal.active {
    display: flex !important;
    opacity: 1 !important;
}

.prompt-modal-backdrop {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: rgba(0, 0, 0, 0.6) !important;
    backdrop-filter: blur(4px) !important;
    animation: fadeIn 0.3s ease-out;
    z-index: 1 !important;
}

.prompt-modal-content {
    background: #ffffff !important;
    border-radius: var(--template-radius-xl) !important;
    max-width: 800px !important;
    width: 95% !important;
    max-height: 85vh !important;
    overflow-y: auto !important;
    position: relative !important;
    z-index: 100000 !important;
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.15),
        0 8px 24px rgba(0, 0, 0, 0.12) !important;
    animation: slideUp 0.3s ease-out;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    transform: translateY(0) scale(1) !important;
}

.prompt-modal-header {
    padding: var(--template-spacing-lg) !important;
    border-bottom: 1px solid var(--template-border-light) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%) !important;
    border-radius: var(--template-radius-xl) var(--template-radius-xl) 0 0 !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.prompt-modal-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--template-text-primary);
    background: linear-gradient(135deg, var(--template-primary), var(--template-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.prompt-modal-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--template-text-secondary);
    cursor: pointer;
    padding: var(--template-spacing-xs);
    border-radius: var(--template-radius-sm);
    transition: all var(--template-transition-smooth);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.prompt-modal-close:hover {
    background: rgba(0, 0, 0, 0.1);
    transform: rotate(90deg);
}

.prompt-modal-body {
    padding: var(--template-spacing-lg) !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.prompt-preview-image {
    text-align: center;
    margin-bottom: var(--template-spacing-lg);
    background: var(--template-bg-secondary);
    border-radius: var(--template-radius-lg);
    overflow: hidden;
}

.prompt-preview-image img {
    max-width: 100%;
    height: auto;
    max-height: 300px;
    object-fit: contain;
    border-radius: var(--template-radius-lg);
}

.prompt-text-container {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: var(--template-radius-lg);
    padding: var(--template-spacing-lg);
    border: 1px solid var(--template-border-light);
}

.prompt-text-header {
    margin-bottom: var(--template-spacing-md);
    padding-bottom: var(--template-spacing-sm);
    border-bottom: 2px solid var(--template-primary);
}

.prompt-text-header h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--template-text-primary);
}

.prompt-text-content {
    background: #ffffff;
    border: 1px solid var(--template-border-light);
    border-radius: var(--template-radius-md);
    padding: var(--template-spacing-md);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--template-text-primary);
    margin-bottom: var(--template-spacing-lg);
    min-height: 80px;
    word-wrap: break-word;
    white-space: pre-wrap;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    position: relative;
    border-left: 4px solid var(--template-primary);
}

.prompt-text-actions {
    display: flex;
    gap: var(--template-spacing-md);
    justify-content: center;
    flex-wrap: wrap;
}

.copy-prompt-btn,
.close-modal-btn {
    padding: var(--template-spacing-sm) var(--template-spacing-lg);
    border: none;
    border-radius: var(--template-radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: var(--template-spacing-xs);
    transition: all var(--template-transition-smooth);
    min-width: 120px;
    justify-content: center;
}

.copy-prompt-btn {
    background: linear-gradient(135deg, var(--template-primary), var(--template-secondary));
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.copy-prompt-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

.close-modal-btn {
    background: #f1f5f9;
    color: var(--template-text-secondary);
    border: 1px solid var(--template-border-light);
}

.close-modal-btn:hover {
    background: #e2e8f0;
    color: var(--template-text-primary);
}

/* 动画效果 */
@keyframes bounceIcon {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-4px);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ====== 总结文字区域 ====== */
.summary-section {
    background: var(--template-bg-primary);
    padding: 0 var(--template-spacing-lg) var(--template-spacing-xs);
    border-bottom: 1px solid var(--template-border-light);
    position: relative;
    margin-top: -12px;
}

.summary-container {
    max-width: 800px;
    margin: 0 auto;
}

.summary-content {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: var(--template-radius-lg);
    padding: var(--template-spacing-sm) var(--template-spacing-sm) var(--template-spacing-xs);
    border: 1px solid var(--template-border-light);
    position: relative;
    overflow: hidden;
    margin: 0 auto;
    max-width: 500px;
}

.summary-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--template-gradient);
}

.summary-text {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--template-text-primary);
    text-align: center;
    margin: 0;
    white-space: pre-line;
    font-weight: 500;
    letter-spacing: 0.2px;
}

.summary-highlight {
    background: linear-gradient(135deg, var(--template-primary) 0%, var(--template-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
}

.summary-loading {
    text-align: center;
    padding: var(--template-spacing-lg);
}

.summary-loading .loading-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: var(--template-spacing-md);
}

.summary-loading .loading-dots span {
    width: 10px;
    height: 10px;
    border-radius: var(--template-radius-full);
    background: var(--template-primary);
    animation: summaryLoadingDots 1.5s ease-in-out infinite;
}

.summary-loading .loading-dots span:nth-child(1) { animation-delay: 0s; }
.summary-loading .loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.summary-loading .loading-dots span:nth-child(3) { animation-delay: 0.4s; }

.summary-loading p {
    color: var(--template-text-secondary);
    font-size: 0.9rem;
    margin: 0;
}



/* ====== 分类区域 ====== */
.category-section {
    background: var(--template-bg-primary);
    padding: var(--template-spacing-xs);
    border-bottom: 1px solid var(--template-border-light);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.category-scroll {
    display: flex;
    gap: var(--template-spacing-sm);
    min-width: max-content;
    padding-bottom: 2px;
}

.category-item {
    display: flex;
    align-items: center;
    gap: var(--template-spacing-xs);
    padding: var(--template-spacing-xs) var(--template-spacing-md);
    background: var(--template-bg-secondary);
    border-radius: var(--template-radius-lg);
    cursor: pointer;
    transition: all 0.3s var(--template-ease-smooth);
    white-space: nowrap;
    border: 2px solid transparent;
    min-width: 60px;
    justify-content: center;
    font-size: 0.85rem;
}

.category-item:hover {
    background: var(--template-bg-tertiary);
    transform: translateY(-2px);
}

.category-item.active {
    background: var(--template-gradient);
    color: white;
    box-shadow: var(--template-shadow-glow);
}

.category-name {
    font-weight: 500;
    font-size: 0.8rem;
}

.category-badge {
    background: rgba(255, 255, 255, 0.3);
    padding: 1px 6px;
    border-radius: var(--template-radius-full);
    font-size: 0.7rem;
    font-weight: 600;
    min-width: 18px;
    text-align: center;
}

.category-item.active .category-badge {
    background: rgba(255, 255, 255, 0.3);
}

/* ====== 模板网格容器 ====== */
.template-grid-container {
    padding: var(--template-spacing-sm) var(--template-spacing-md);
    max-width: 1200px;
    margin: 0 auto;
}

.template-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--template-spacing-sm);
    margin-bottom: var(--template-spacing-lg);
}

/* ====== 模板卡片 ====== */
.template-card {
    background: var(--template-bg-primary);
    border-radius: var(--template-radius-lg);
    overflow: hidden;
    box-shadow: var(--template-shadow-sm);
    transition: all 0.4s var(--template-ease-smooth);
    cursor: pointer;
    position: relative;
}

.template-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--template-shadow-lg);
}

.template-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--template-gradient);
    transform: scaleX(0);
    transition: transform 0.3s var(--template-ease-smooth);
}

.template-card:hover::before {
    transform: scaleX(1);
}

.template-image {
    width: 100%;
    height: auto;
    min-height: 200px;
    background: white;
    position: relative;
    overflow: hidden;
    border-radius: var(--template-radius-md) var(--template-radius-md) 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.template-image img {
    width: 100%;
    height: auto;
    max-height: 300px;
    object-fit: contain;
    background: white;
    transition: transform 0.3s var(--template-ease-smooth);
}

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

.template-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.7) 100%);
    opacity: 0;
    transition: opacity 0.3s var(--template-ease-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
}

.template-card:hover .template-overlay {
    opacity: 1;
}

.view-icon {
    color: white;
    font-size: 2rem;
    animation: pulse 2s infinite;
}

.template-info {
    padding: var(--template-spacing-sm);
}

.template-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--template-text-primary);
    margin: 0;
    line-height: 1.2;
    text-align: center;
    padding: var(--template-spacing-xs) 0;
}

/* ====== 懒加载区域 ====== */
.load-more-section {
    text-align: center;
    margin-top: var(--template-spacing-lg);
    padding: var(--template-spacing-lg);
}

.lazy-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--template-spacing-md);
}

.lazy-loading .loading-dots {
    display: flex;
    gap: 8px;
}

.lazy-loading .loading-dots span {
    width: 8px;
    height: 8px;
    border-radius: var(--template-radius-full);
    background: var(--template-primary);
    animation: lazyLoadingDots 1.5s ease-in-out infinite;
}

.lazy-loading .loading-dots span:nth-child(1) { animation-delay: 0s; }
.lazy-loading .loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.lazy-loading .loading-dots span:nth-child(3) { animation-delay: 0.4s; }

.lazy-loading p {
    color: var(--template-text-secondary);
    font-size: 0.9rem;
    margin: 0;
}

/* ====== 大图查看模态框 ====== */
.image-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(--template-ease-smooth);
}

.image-modal.active {
    display: flex;
    opacity: 1;
}

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

.modal-content {
    background: transparent;
    border-radius: 0;
    width: 96vw;
    max-width: 900px;
    max-height: 96vh;
    position: relative;
    box-shadow: none;
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.3s var(--template-ease-bounce);
    display: flex;
    flex-direction: column;
}

.image-modal.active .modal-content {
    transform: scale(1);
}

.modal-header {
    display: none;
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--template-text-primary);
    margin: 0;
}

.modal-close {
    width: 40px;
    height: 40px;
    border-radius: var(--template-radius-full);
    background: none;
    border: none;
    color: var(--template-text-light);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s var(--template-ease-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: var(--template-bg-tertiary);
    color: var(--template-text-primary);
}

.modal-body {
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-height: 96vh;
    overflow: hidden;
    position: relative;
}

/* 模态框关闭按钮 */
.modal-close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.modal-close-btn:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

.image-container {
    position: relative;
    text-align: center;
    margin: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    max-height: 96vh;
}

#modalImage {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    background: white;
    display: block;
}

.image-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--template-bg-tertiary);
    border-top-color: var(--template-primary);
    border-radius: var(--template-radius-full);
    animation: spin 1s linear infinite;
}

.template-actions {
    display: none;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--template-spacing-xs);
    padding: var(--template-spacing-md);
    background: var(--template-bg-secondary);
    border: 1px solid var(--template-border-color);
    border-radius: var(--template-radius-md);
    cursor: pointer;
    transition: all 0.3s var(--template-ease-smooth);
    min-width: 80px;
}

.action-btn:hover {
    background: var(--template-primary);
    color: white;
    border-color: var(--template-primary);
    transform: translateY(-2px);
}

.action-btn i {
    font-size: 1.2rem;
}

.action-btn span {
    font-size: 0.8rem;
    font-weight: 500;
}

/* ====== 响应式设计 ====== */
@media (max-width: 768px) {
    .page-title {
        font-size: 1.5rem;
    }
    
    .summary-content {
        max-width: 450px;
        padding: var(--template-spacing-sm);
    }
    
    .summary-text {
        font-size: 0.85rem;
        line-height: 1.4;
    }
    
    .template-grid {
        gap: var(--template-spacing-md);
    }
    
    .template-image {
        min-height: 180px;
    }
    
    .modal-content {
        width: 96vw;
        max-height: 92vh;
        max-width: 760px;
    }
    
    #modalImage {
        max-height: 85vh;
    }
    
    .template-actions {
        flex-wrap: wrap;
        justify-content: space-around;
    }
    
    .action-btn {
        min-width: 70px;
        padding: var(--template-spacing-sm);
    }
}

/* 超小屏幕优化 (小于400px) */
@media (max-width: 400px) {
    .prompt-gallery-grid {
        grid-template-columns: 1fr;
        gap: var(--template-spacing-sm);
    }
    
    .prompt-item-image {
        height: 180px;
    }
    
    .prompt-modal {
        padding: var(--template-spacing-sm);
    }
    
    .prompt-modal-content {
        border-radius: var(--template-radius-md);
    }
    
    .prompt-text-content {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .page-header {
        padding: var(--template-spacing-xs) var(--template-spacing-md);
    }
    
    /* 移动端template页面消除顶部空白 */
    .template-page .page-header {
        margin-top: -8px !important; /* 🔧 稍微向下移动（从-12px改为-8px） */
        padding-top: 0 !important;
    }
    
    /* 移动端导航栏优化 */
    .nav-tabs {
        padding: 4px;
    }
    
    .nav-tab {
        padding: 10px 12px;
        font-size: 13px;
        min-height: 40px;
        gap: 6px;
    }
    
    .tab-icon {
        font-size: 14px;
    }
    
    .tab-text {
        font-size: 13px;
    }
    
    /* 移动端Prompt介绍卡片优化 */
    .prompt-intro-section {
        padding: var(--template-spacing-xs) var(--template-spacing-md);
    }
    
    .prompt-intro-card {
        max-width: none;
    }
    
    .prompt-intro-text h2 {
        font-size: 0.9rem;
    }
    
    .prompt-intro-text p {
        font-size: 0.8rem;
    }
    
    /* 移动端Prompt图片网格优化 */
    .prompt-gallery-section {
        padding: var(--template-spacing-md);
    }
    
    .prompt-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--template-spacing-md);
    }
    
    .prompt-item-image {
        height: 160px;
    }
    
    .prompt-item-name {
        font-size: 0.8rem;
        min-height: 50px;
        padding: var(--template-spacing-sm);
    }
    
    .refresh-gallery-btn {
        padding: var(--template-spacing-sm) var(--template-spacing-lg);
        font-size: 0.9rem;
    }
    
    /* 移动端弹窗优化 */
    .prompt-modal {
        padding: var(--template-spacing-md);
    }
    
    .prompt-modal-content {
        max-height: 85vh;
        border-radius: var(--template-radius-lg);
    }
    
    .prompt-modal-header {
        padding: var(--template-spacing-md);
    }
    
    .prompt-modal-header h3 {
        font-size: 1rem;
    }
    
    .prompt-modal-body {
        padding: var(--template-spacing-md);
    }
    
    .prompt-preview-image img {
        max-height: 200px;
    }
    
    .prompt-text-container {
        padding: var(--template-spacing-md);
    }
    
    .prompt-text-content {
        font-size: 0.9rem;
        padding: var(--template-spacing-sm);
    }
    
    .prompt-text-actions {
        flex-direction: column;
        gap: var(--template-spacing-sm);
    }
    
    .copy-prompt-btn,
    .close-modal-btn {
        width: 100%;
        padding: var(--template-spacing-md);
        font-size: 0.9rem;
    }
    
    .summary-section {
        padding: var(--template-spacing-xs) var(--template-spacing-md);
    }
    
    .summary-content {
        max-width: 380px;
        padding: var(--template-spacing-sm);
    }
    
    .summary-text {
        font-size: 0.8rem;
        line-height: 1.35;
    }
    
    .category-section {
        padding: var(--template-spacing-xs);
    }
    
    .template-grid-container {
        padding: var(--template-spacing-xs) var(--template-spacing-sm);
    }
    
    .template-image {
        min-height: 160px;
    }
    
    .template-grid {
        gap: var(--template-spacing-xs);
    }
    
    .modal-content {
        width: 96vw;
        max-height: 90vh;
        max-width: 460px;
    }
    
    #modalImage {
        max-height: 86vh;
    }
}

/* ====== 动画定义 ====== */
@keyframes lazyLoadingDots {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes summaryLoadingDots {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes headerGlow {
    0% { transform: translateX(-20%) rotate(0deg); }
    100% { transform: translateX(0%) rotate(5deg); }
}

@keyframes iconFloat {
    0% { transform: translateY(0px); }
    100% { transform: translateY(-3px); }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes cardFloat {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-8px);
    }
}

@keyframes iconBounce {
    0%, 100% {
        transform: translateY(0px) scale(1);
    }
    50% {
        transform: translateY(-5px) scale(1.05);
    }
}

@keyframes dotPulse {
    0%, 100% {
        opacity: 0.3;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.2);
    }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ====== 深色模式支持 ====== */
@media (prefers-color-scheme: dark) {
    :root {
        --template-text-primary: #f9fafb;
        --template-text-secondary: #d1d5db;
        --template-text-light: #9ca3af;
        --template-bg-primary: #1f2937;
        --template-bg-secondary: #111827;
        --template-bg-tertiary: #374151;
        --template-border-color: #374151;
        --template-border-light: #4b5563;
    }
}

/* ====== 返回顶部按钮 ====== */
.back-to-top-btn {
    position: fixed !important;
    bottom: 95px !important;
    right: 20px !important;
    width: 40px !important;
    height: 40px !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    border: none !important;
    border-radius: 50% !important;
    color: white !important;
    font-size: 16px !important;
    font-weight: bold !important;
    cursor: pointer !important;
    z-index: 9997 !important;
    display: none !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 2px 12px rgba(102, 126, 234, 0.15) !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    opacity: 0 !important;
    transform: scale(0.8) translateY(20px) !important;
    text-align: center !important;
    line-height: 1 !important;
}

.back-to-top-btn.show {
    opacity: 1 !important;
    transform: scale(1) translateY(0) !important;
}

.back-to-top-btn:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #667eea 100%) !important;
    transform: scale(1.05) translateY(-1px) !important;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.2) !important;
}

.back-to-top-btn:active {
    transform: scale(0.95) translateY(0) !important;
}

/* 在大屏幕上调整位置 */
@media (min-width: 431px) {
    .back-to-top-btn {
        right: calc(50% - 215px + 20px) !important;
    }
}

/* 确保不被底部导航遮挡 */
@media (max-width: 480px) {
    .back-to-top-btn {
        bottom: 85px !important;
        right: 15px !important;
        width: 45px !important;
        height: 45px !important;
        font-size: 18px !important;
    }
}

/* ====== 性能优化 ====== */
.template-card,
.category-item,
.action-btn {
    will-change: transform;
}

.template-image img {
    will-change: transform;
}

/* 优化滚动性能 */
.category-section {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.category-section::-webkit-scrollbar {
    display: none;
}

/* 减少不必要的重绘 */
* {
    box-sizing: border-box;
}

/* ====== 主题系统兼容性修复 ====== */
/* 防止主题系统对导航栏造成重叠问题 */

/* 🔧 修复主题切换后导航栏重叠问题 - 超高优先级 */
html[data-theme-loaded="true"] .template-page .page-header,
html[data-theme-loaded="true"] .template-page .header-content,
html[data-theme-loaded="true"] .template-page .nav-tabs-container,
html[data-theme-loaded="true"] .template-page .nav-tabs,
html[data-theme-loaded="true"] .template-page .nav-tab,
body[class*="theme-"] .template-page .page-header,
body[class*="theme-"] .template-page .header-content,
body[class*="theme-"] .template-page .nav-tabs-container,
body[class*="theme-"] .template-page .nav-tabs,
body[class*="theme-"] .template-page .nav-tab {
    position: relative !important;
    z-index: 15 !important; /* 比主题系统的z-index更高 */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* 🔧 确保导航栏容器不会被压缩或重叠 */
html[data-theme-loaded="true"] .template-page .nav-tabs-container,
body[class*="theme-"] .template-page .nav-tabs-container {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 300px !important;
    height: auto !important;
    min-height: 56px !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
}

/* 🔧 确保导航栏本身的布局正确 */
html[data-theme-loaded="true"] .template-page .nav-tabs,
body[class*="theme-"] .template-page .nav-tabs {
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 0 !important;
    padding: 6px !important;
    border-radius: 16px !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
}

/* 🔧 确保每个导航按钮的布局正确 */
html[data-theme-loaded="true"] .template-page .nav-tab,
body[class*="theme-"] .template-page .nav-tab {
    flex: 1 !important;
    flex-basis: 50% !important;
    max-width: 50% !important;
    min-width: 120px !important;
    height: 44px !important;
    min-height: 44px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    padding: 12px 16px !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 12px !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    box-sizing: border-box !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

/* 🔧 确保导航按钮文字和图标正确显示 */
html[data-theme-loaded="true"] .template-page .nav-tab .tab-icon,
html[data-theme-loaded="true"] .template-page .nav-tab .tab-text,
body[class*="theme-"] .template-page .nav-tab .tab-icon,
body[class*="theme-"] .template-page .nav-tab .tab-text {
    display: inline-block !important;
    line-height: 1 !important;
    vertical-align: middle !important;
    z-index: 16 !important;
}

/* 🔧 确保活动状态的导航按钮正确显示 */
html[data-theme-loaded="true"] .template-page .nav-tab.active,
body[class*="theme-"] .template-page .nav-tab.active {
    background: #ffffff !important;
    color: #667eea !important;
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.1),
        0 2px 4px rgba(0, 0, 0, 0.06) !important;
    transform: translateY(-1px) !important;
    z-index: 17 !important;
}