/**
 * Telegram Emoji Generator CSS
 * 军工级UI标准 - 现代、美观、简约
 */

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

/* Telegram WebApp 变量 */
:root {
    --tg-theme-bg-color: var(--tg-color-scheme-bg-color, #ffffff);
    --tg-theme-text-color: var(--tg-color-scheme-text-color, #000000);
    --tg-theme-hint-color: var(--tg-color-scheme-hint-color, #999999);
    --tg-theme-link-color: var(--tg-color-scheme-link-color, #2481cc);
    --tg-theme-button-color: var(--tg-color-scheme-button-color, #2481cc);
    --tg-theme-button-text-color: var(--tg-color-scheme-button-text-color, #ffffff);
    --tg-theme-secondary-bg-color: var(--tg-color-scheme-secondary-bg-color, #f1f1f1);
    
    /* 自定义变量 */
    --primary-color: #2481cc;
    --secondary-color: #f1f1f1;
    --success-color: #4caf50;
    --warning-color: #ff9800;
    --error-color: #f44336;
    --border-radius: 12px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

/* 基础样式 */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--tg-theme-bg-color);
    color: var(--tg-theme-text-color);
    line-height: 1.6;
    overflow-x: hidden;
}

/* 应用容器 */
#app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 加载屏幕 */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--tg-theme-bg-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--tg-theme-secondary-bg-color);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

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

/* 主应用 */
.main-app {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* 状态栏 */
.status-bar {
    background: var(--tg-theme-secondary-bg-color);
    padding: 8px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.user-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    color: var(--tg-theme-hint-color);
}

/* 内容区域 */
.content-area {
    flex: 1;
    position: relative;
    padding-bottom: 80px; /* 为底部导航留空间 */
}

.tab-content {
    display: none;
    padding: 16px 16px 80px;
    min-height: calc(100vh - 140px);
}

.tab-content.active {
    display: block;
}

/* 首页样式 */
.home-section {
    max-width: 600px;
    margin: 0 auto;
}

.intro-module {
    text-align: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: var(--border-radius);
    color: white;
    margin-bottom: 24px;
}

.intro-module h1 {
    font-size: 28px;
    margin-bottom: 12px;
    font-weight: 600;
}

.intro-module p {
    font-size: 16px;
    opacity: 0.9;
    margin-bottom: 24px;
}

.primary-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid white;
    color: white;
    padding: 12px 24px;
    border-radius: var(--border-radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

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

.usage-module {
    background: var(--tg-theme-secondary-bg-color);
    border-radius: var(--border-radius);
    padding: 24px;
}

.usage-module h3 {
    margin-bottom: 20px;
    color: var(--tg-theme-text-color);
}

.usage-steps {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.step {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.step-number {
    width: 32px;
    height: 32px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
}

.step-content h4 {
    margin-bottom: 4px;
    color: var(--tg-theme-text-color);
}

.step-content p {
    color: var(--tg-theme-hint-color);
    font-size: 14px;
}

/* 创建页面样式 */
.create-section {
    max-width: 600px;
    margin: 0 auto;
}

.type-tabs {
    display: flex;
    background: var(--tg-theme-secondary-bg-color);
    border-radius: var(--border-radius);
    padding: 4px;
    margin-bottom: 20px;
}

.type-tab {
    flex: 1;
    padding: 12px;
    border: none;
    background: transparent;
    color: var(--tg-theme-hint-color);
    border-radius: calc(var(--border-radius) - 4px);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.type-tab.active {
    background: var(--primary-color);
    color: white;
}

.creator-panel {
    display: none;
}

.creator-panel.active {
    display: block;
}

.mode-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.mode-tab {
    padding: 8px 16px;
    border: 2px solid var(--tg-theme-secondary-bg-color);
    background: transparent;
    color: var(--tg-theme-text-color);
    border-radius: var(--border-radius);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.mode-tab.active {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
}

/* 输入模块 */
.input-module {
    background: var(--tg-theme-secondary-bg-color);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
}

.text-input {
    width: 100%;
    padding: 16px;
    border: 2px solid transparent;
    border-radius: var(--border-radius);
    font-size: 18px;
    background: white;
    color: var(--tg-theme-text-color);
    margin-bottom: 16px;
    transition: var(--transition);
}

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

.input-options {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    gap: 12px;
    align-items: center;
}

.font-select {
    padding: 8px 12px;
    border: 1px solid var(--tg-theme-secondary-bg-color);
    border-radius: var(--border-radius);
    background: white;
    color: var(--tg-theme-text-color);
}

.color-picker {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
}

.size-slider {
    width: 80px;
}

/* 预览模块 */
.preview-module {
    margin-bottom: 20px;
    overflow-x: auto;
    overflow-y: hidden;
    /* 添加水平滚动功能 */
    -webkit-overflow-scrolling: touch; /* iOS平滑滚动 */
    scrollbar-width: thin; /* Firefox滚动条样式 */
    scrollbar-color: var(--primary-color) transparent;
}

/* 为预览模块添加滚动条样式（Webkit浏览器） */
.preview-module::-webkit-scrollbar {
    height: 6px;
}

.preview-module::-webkit-scrollbar-track {
    background: transparent;
}

.preview-module::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

.preview-module::-webkit-scrollbar-thumb:hover {
    background: #fb00ff;
}

.preview-box {
    background: var(--tg-theme-secondary-bg-color);
    border-radius: var(--border-radius);
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.name-preview .preview-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    width: 100px;
    height: 100px;
}

.text-preview .preview-chars {
    display: flex;
    gap: 0;
}

.preview-char {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 24px;
    font-weight: 600;
    color: var(--tg-theme-text-color);
    min-width: 40px;
    min-height: 40px;
    flex: 1;
    text-align: center;
}

/* 选项模块 */
.option-module {
    margin-bottom: 20px;
}

.option-module h4 {
    margin-bottom: 12px;
    color: var(--tg-theme-text-color);
    font-weight: 600;
}

.option-slider {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 4px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.option-slider::-webkit-scrollbar {
    display: none;
}

.option-item {
    padding: 12px 16px;
    background: var(--tg-theme-secondary-bg-color);
    border: 2px solid transparent;
    border-radius: var(--border-radius);
    color: var(--tg-theme-text-color);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    flex-shrink: 0;
}

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

.option-item:hover {
    border-color: var(--primary-color);
}

/* 生成模块 */
.generate-module {
    margin-top: 32px;
}

.generate-btn {
    width: 100%;
    padding: 16px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.generate-btn:hover {
    background: #fb00ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(251, 0, 255, 0.3);
}

.generate-btn:disabled {
    background: var(--tg-theme-hint-color);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 我的页面样式 */
.my-section {
    max-width: 600px;
    margin: 0 auto;
}

.profile-module {
    background: var(--tg-theme-secondary-bg-color);
    border-radius: var(--border-radius);
    padding: 24px;
    margin-bottom: 20px;
}

.profile-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.avatar {
    width: 60px;
    height: 60px;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    font-weight: 600;
}

.profile-details h3 {
    margin-bottom: 4px;
    color: var(--tg-theme-text-color);
}

.profile-details p {
    color: var(--tg-theme-hint-color);
    font-size: 14px;
}

.stats-module {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.stat-item {
    background: var(--tg-theme-secondary-bg-color);
    border-radius: var(--border-radius);
    padding: 20px;
    text-align: center;
}

.stat-number {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 4px;
}

.stat-label {
    color: var(--tg-theme-hint-color);
    font-size: 14px;
}

/* 历史记录样式 */
.history-module {
    background: var(--tg-theme-secondary-bg-color);
    border-radius: var(--border-radius);
    padding: 20px;
}

.history-module h3 {
    margin-bottom: 16px;
    color: var(--tg-theme-text-color);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* 简化的历史记录条目 */
.history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: white;
    border-radius: 12px;
    padding: 12px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    transition: all 0.2s ease;
}

.history-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.history-video {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: #f5f5f5;
}

.history-video video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.history-info {
    flex: 1;
    min-width: 0;
}

.history-text {
    font-size: 16px;
    font-weight: 500;
    color: var(--tg-theme-text-color);
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.type-tag, .size-tag, .time-tag {
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.05);
    color: var(--tg-theme-hint-color);
}

.type-tag.name {
    background: rgba(52, 152, 219, 0.1);
    color: #3498db;
}

.type-tag.text {
    background: rgba(155, 89, 182, 0.1);
    color: #9b59b6;
}

.history-send-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--primary-color);
    color: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.history-send-btn:hover {
    background: var(--primary-color-dark);
    transform: translateY(-1px);
}

.history-send-btn svg {
    width: 18px;
    height: 18px;
}

.load-more-btn {
    text-align: center;
    margin-top: 16px;
}

.load-more-button {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.load-more-button:hover {
    background: var(--primary-color);
    color: white;
}

/* 底部导航 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--tg-theme-bg-color);
    border-top: 1px solid var(--tg-theme-secondary-bg-color);
    display: flex;
    padding: 8px 0;
    z-index: 1000;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px;
    border: none;
    background: transparent;
    color: var(--tg-theme-hint-color);
    cursor: pointer;
    transition: var(--transition);
}

.nav-item.active {
    color: var(--primary-color);
}

.nav-icon {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.nav-item span {
    font-size: 12px;
    font-weight: 500;
}

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

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--tg-theme-bg-color);
    border-radius: var(--border-radius);
    max-width: 400px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
}

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

.modal-header h3 {
    color: var(--tg-theme-text-color);
}

.close-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--tg-theme-secondary-bg-color);
    border-radius: 50%;
    color: var(--tg-theme-text-color);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-body {
    padding: 20px;
}

.progress-info {
    text-align: center;
    padding: 40px 20px;
}

.progress-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--tg-theme-secondary-bg-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

.progress-info h3 {
    margin-bottom: 8px;
    color: var(--tg-theme-text-color);
}

.progress-info p {
    color: var(--tg-theme-hint-color);
}

/* 结果展示 */
.result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.result-item {
    background: var(--tg-theme-secondary-bg-color);
    border-radius: var(--border-radius);
    padding: 16px;
    text-align: center;
}

.result-char {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--tg-theme-text-color);
}

.result-size {
    font-size: 12px;
    color: var(--tg-theme-hint-color);
    margin-bottom: 12px;
}

.result-download {
    width: 100%;
    padding: 8px;
    background: var(--success-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 12px;
    cursor: pointer;
}

/* 图标样式 */
.icon {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* 响应式设计 */
@media (max-width: 480px) {
    .content-area {
        padding: 10px;
    }
    
    /* 移动端预览模块滚动优化 */
    .preview-module {
        /* 增强移动端滚动指示 */
        position: relative;
    }
    
    .preview-module.scrollable::after {
        content: '← 可左右滑动查看 →';
        position: absolute;
        bottom: -20px;
        left: 50%;
        transform: translateX(-50%);
        font-size: 12px;
        color: var(--tg-theme-hint-color);
        opacity: 0.7;
        transition: opacity 0.3s ease;
        pointer-events: none;
        white-space: nowrap;
    }
    
    /* 当用户交互时增强提示的可见性 */
    .preview-module.scrollable:hover::after,
    .preview-module.scrollable:focus-within::after {
        opacity: 1;
    }
    
    .input-options {
        flex-direction: column;
        gap: 8px;
    }
    
    .option-slider {
        gap: 8px;
    }
    
    .option-item {
        min-width: 60px;
        padding: 8px;
    }
    
    /* 历史记录移动端优化 */
    .history-item {
        margin: 0 -4px;
        padding: 8px;
        gap: 8px;
    }
    
    .history-video {
        width: 40px;
        height: 40px;
        border-radius: 6px;
    }
    
    .history-text {
        font-size: 14px;
    }

    .history-meta {
        gap: 4px;
    }
    
    .type-tag, .size-tag, .time-tag {
        font-size: 10px;
        padding: 1px 4px;
    }

    .history-send-btn {
        width: 32px;
        height: 32px;
        border-radius: 6px;
    }
    
    .history-send-btn svg {
        width: 16px;
        height: 16px;
    }

    .load-more-button {
        padding: 8px 12px;
        font-size: 13px;
    }
}

/* 暗色主题适配 */
@media (prefers-color-scheme: dark) {
    :root {
        --tg-theme-bg-color: #1a1a1a;
        --tg-theme-text-color: #ffffff;
        --tg-theme-hint-color: #999999;
        --tg-theme-secondary-bg-color: #2a2a2a;
    }
    
    .text-input,
    .font-select {
        color: white;
        border-color: #444;
    }
    
    .preview-char {
        color: white;
    }
    
    .history-item {
        background: #2a2a2a;
        border-color: rgba(255, 255, 255, 0.1);
    }
}

/* 预览动画效果 - 严格按照需求文档实现 */

/* 背景动画 */
@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

@keyframes particleMove {
    0% { background-position: 0 0; }
    100% { background-position: 20px 20px; }
}

@keyframes flowingLight {
    0% { background-position: -100% 0; }
    100% { background-position: 100% 0; }
}

/* 文字动画效果 - 修复彩虹渐变和波浪运动 */
@keyframes fadeInOut {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

@keyframes typewriter {
    0% { opacity: 0; }
    50% { opacity: 1; }
    100% { opacity: 0; }
}

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

/* 修复彩虹渐变动画 - 使用background-clip实现真正的彩虹文字效果 */
@keyframes rainbow {
    0% { 
        background-position: 0% 50%;
    }
    50% { 
        background-position: 100% 50%;
    }
    100% { 
        background-position: 0% 50%;
    }
}

/* 波浪运动动画 - 修复实现 */
@keyframes waveMotion {
    0% { 
        transform: translateY(0px) rotate(0deg);
    }
    25% { 
        transform: translateY(-3px) rotate(1deg);
    }
    50% { 
        transform: translateY(0px) rotate(0deg);
    }
    75% { 
        transform: translateY(3px) rotate(-1deg);
    }
    100% { 
        transform: translateY(0px) rotate(0deg);
    }
}

/* 霓虹发光动画 - 更透明的光效 */
@keyframes neonGlow {
    0%, 100% { 
        text-shadow: 
            0 0 1px rgba(255, 255, 255, 0.3),
            0 0 2px rgba(255, 255, 255, 0.2),
            0 0 3px rgba(255, 255, 255, 0.1);
        filter: brightness(1.05);
    }
    50% { 
        text-shadow: 
            0 0 2px rgba(255, 255, 255, 0.4),
            0 0 4px rgba(255, 255, 255, 0.3),
            0 0 6px rgba(255, 255, 255, 0.2),
            0 0 8px rgba(255, 255, 255, 0.1);
        filter: brightness(1.15);
    }
}

/* 3D旋转动画 */
@keyframes rotate3D {
    0% { transform: perspective(400px) rotateY(0deg); }
    100% { transform: perspective(400px) rotateY(360deg); }
}

@keyframes scaleAnimation {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* 遮罩动画效果 */
@keyframes linearScan {
    0% { mask-position: -100% 0; -webkit-mask-position: -100% 0; }
    100% { mask-position: 100% 0; -webkit-mask-position: 100% 0; }
}

@keyframes circleExpand {
    0% { mask-size: 0% 0%; -webkit-mask-size: 0% 0%; }
    50% { mask-size: 100% 100%; -webkit-mask-size: 100% 100%; }
    100% { mask-size: 0% 0%; -webkit-mask-size: 0% 0%; }
}

@keyframes heartBeat {
    0%, 100% { transform: scale(1); }
    25% { transform: scale(1.1); }
    50% { transform: scale(1.2); }
    75% { transform: scale(1.1); }
}

@keyframes ripple {
    0% { mask-size: 0% 0%; -webkit-mask-size: 0% 0%; }
    100% { mask-size: 200% 200%; -webkit-mask-size: 200% 200%; }
}

/* 预览字符优化 - 确保每个字在各自区域的正中间 */
.preview-char {
    display: flex !important;
    align-items: center;
    justify-content: center;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    vertical-align: top;
    line-height: 1;
    flex: 1;
    text-align: center;
}

/* 文字预览容器优化 - 根据需求文档动态调整宽度 */
.text-preview .preview-chars {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 0 !important;
    margin: 0;
    padding: 0;
    line-height: 1;
    width: 100%;
    height: 100%;
}

/* 姓名预览网格优化 */
.name-preview .preview-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 0 !important;
    width: 100px;
    height: 100px;
    margin: 0;
    padding: 0;
}

.name-preview .preview-grid .preview-char {
    width: 100%;
    height: 100%;
    border-radius: 0 !important;
    box-shadow: none !important;
}

/* 8字模式双预览框容器 */
.name-preview-container {
    display: flex;
    gap: 16px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    overflow: hidden;
}

.name-preview-container .preview-box {
    flex: 0 0 auto;
}

/* 8字模式样式已移除 - 现在使用单个预览框轮换显示 */

/* ===== 改进的背景选择器样式 ===== */
.background-selector {
    margin-top: 12px;
}

.background-type-tabs {
    display: flex;
    background: var(--tg-theme-secondary-bg-color);
    border-radius: 8px;
    padding: 4px;
    margin-bottom: 16px;
}

.bg-type-tab {
    flex: 1;
    background: none;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    color: var(--tg-theme-hint-color);
    cursor: pointer;
    transition: var(--transition);
}

.bg-type-tab.active {
    background: var(--primary-color);
    color: white;
}

.background-panel {
    display: none;
}

.background-panel.active {
    display: block;
}

/* 背景预览样式 */
.bg-preview {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    margin-bottom: 8px;
    border: 2px solid transparent;
    transition: var(--transition);
}

.transparent-bg {
    background: 
        linear-gradient(45deg, #ccc 25%, transparent 25%), 
        linear-gradient(-45deg, #ccc 25%, transparent 25%), 
        linear-gradient(45deg, transparent 75%, #ccc 75%), 
        linear-gradient(-45deg, transparent 75%, #ccc 75%);
    background-size: 8px 8px;
    background-position: 0 0, 0 4px, 4px -4px, -4px 0px;
}

.aurora-bg {
    background: linear-gradient(45deg, #00c9ff, #92fe9d, #ff9a9e);
    background-size: 400% 400%;
    animation: auroraShift 3s ease-in-out infinite;
}

.nebula-bg {
    background: radial-gradient(circle, #667eea 0%, #764ba2 50%, #f093fb 100%);
    animation: nebulaGlow 4s ease-in-out infinite;
}

.ocean-bg {
    background: linear-gradient(45deg, #0077be, #00a8cc, #0077be);
    background-size: 200% 200%;
    animation: oceanWave 2s ease-in-out infinite;
}

.crystal-bg {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
    overflow: hidden;
}

.crystal-bg::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: crystalShine 3s linear infinite;
}

.fire-bg {
    background: radial-gradient(circle, #ff6b6b, #ee5a24, #ff6b6b);
    animation: fireFlicker 1.5s ease-in-out infinite;
}

/* 颜色选择器样式 */
.color-picker-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
}

.advanced-color-picker {
    width: 80px;
    height: 80px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.advanced-color-picker:hover {
    transform: scale(1.05);
}

.color-presets {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    width: 100%;
    max-width: 200px;
}

.color-preset {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: var(--transition);
}

.color-preset:hover {
    transform: scale(1.1);
    border-color: var(--primary-color);
}

/* 渐变控制器样式 */
.gradient-controls {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.gradient-colors {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.gradient-colors label {
    font-size: 14px;
    color: var(--tg-theme-text-color);
    min-width: 60px;
}

.gradient-color-picker {
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.gradient-color-picker:hover {
    transform: scale(1.05);
}

.gradient-direction {
    display: flex;
    align-items: center;
    gap: 12px;
}

.gradient-direction label {
    font-size: 14px;
    color: var(--tg-theme-text-color);
    min-width: 40px;
}

.gradient-direction select {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--tg-theme-secondary-bg-color);
    border-radius: 8px;
    background: var(--tg-theme-bg-color);
    color: var(--tg-theme-text-color);
    font-size: 14px;
}

.gradient-preview {
    width: 100%;
    height: 60px;
    border-radius: 8px;
    border: 2px solid var(--tg-theme-secondary-bg-color);
    background: linear-gradient(45deg, #2481cc, #fb00ff);
}

/* ===== 改进的动画选择器样式 ===== */
.animation-selector {
    margin-top: 12px;
    overflow: hidden;
}

.animation-selector .option-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-width: 80px;
    padding: 12px 8px;
}

.animation-selector .option-item span {
    font-size: 12px;
    text-align: center;
    line-height: 1.2;
}

/* 动画预览样式 */
.animation-preview {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--primary-color);
    position: relative;
    overflow: hidden;
}

.static-preview {
    background: var(--tg-theme-secondary-bg-color);
}

.fade-preview {
    animation: fadeInOut 2s ease-in-out infinite;
}

.typewriter-preview::after {
    content: 'ABC';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 10px;
    color: white;
    animation: typewriterDemo 3s ease-in-out infinite;
}



.rainbow-preview {
    background: linear-gradient(45deg, #ff0000, #ff7f00, #ffff00, #00ff00, #0000ff, #4b0082, #9400d3);
    background-size: 400% 400%;
    animation: rainbowShift 3s linear infinite;
}

.scale-preview {
    animation: scaleDemo 2s ease-in-out infinite;
}

.neon-preview {
    background: #00ffff;
    box-shadow: 0 0 10px #00ffff, 0 0 20px #00ffff, 0 0 30px #00ffff;
    animation: neonGlow 2s ease-in-out infinite;
}

.wave-preview {
    background: linear-gradient(90deg, var(--primary-color), #fb00ff, var(--primary-color));
    background-size: 200% 100%;
    animation: waveMotion 2s ease-in-out infinite;
}

.rotate-preview {
    background: conic-gradient(from 0deg, var(--primary-color), #fb00ff, var(--primary-color));
    animation: rotate3D 3s linear infinite;
}

/* 遮罩预览样式 */
.mask-preview {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--primary-color);
    position: relative;
    overflow: hidden;
}

.no-mask-preview {
    background: var(--tg-theme-secondary-bg-color);
}

.linear-scan-preview {
    background: linear-gradient(90deg, transparent, var(--primary-color), transparent);
    background-size: 200% 100%;
    animation: linearScanDemo 2s ease-in-out infinite;
}

.spiral-vortex-preview {
    background: conic-gradient(from 0deg, var(--primary-color), transparent, var(--primary-color));
    background-size: 150% 150%;
    background-position: center;
    animation: spiralVortexDemo 3s linear infinite;
    overflow: hidden;
}

/* 新增动画关键帧 */
@keyframes auroraShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

@keyframes nebulaGlow {
    0%, 100% { filter: brightness(1) hue-rotate(0deg); }
    50% { filter: brightness(1.2) hue-rotate(180deg); }
}

@keyframes oceanWave {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

@keyframes crystalShine {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

@keyframes fireFlicker {
    0%, 100% { filter: brightness(1) hue-rotate(0deg); }
    25% { filter: brightness(1.2) hue-rotate(10deg); }
    50% { filter: brightness(0.9) hue-rotate(-5deg); }
    75% { filter: brightness(1.1) hue-rotate(5deg); }
}

@keyframes typewriterDemo {
    0% { content: ''; }
    33% { content: 'A'; }
    66% { content: 'AB'; }
    100% { content: 'ABC'; }
}



@keyframes rainbowShift {
    0% { background-position: 0% 50%; }
    100% { background-position: 100% 50%; }
}

@keyframes scaleDemo {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

@keyframes linearScanDemo {
    0% { background-position: -100% 50%; }
    100% { background-position: 200% 50%; }
}

@keyframes spiralVortexDemo {
    0% { transform: rotate(0deg) scale(1.5); opacity: 0.6; }
    50% { opacity: 0.8; }
    100% { transform: rotate(360deg) scale(1.5); opacity: 0.6; }
}

/* 遮罩层基础样式 */
.mask-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    border-radius: inherit;
}

/* 成功提示框样式 */
.success-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

.success-content {
    background: var(--tg-theme-bg-color, #ffffff);
    border-radius: 16px;
    padding: 32px 24px;
    text-align: center;
    max-width: 300px;
    margin: 0 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    animation: slideIn 0.3s ease;
}

.success-icon {
    font-size: 48px;
    margin-bottom: 16px;
    color: var(--success-color);
    display: flex;
    justify-content: center;
    align-items: center;
}

.success-icon svg {
    width: 48px;
    height: 48px;
    color: var(--success-color);
}

.success-content p {
    color: var(--tg-theme-text-color, #000000);
    font-size: 16px;
    margin: 0 0 24px 0;
    line-height: 1.4;
}

.success-content button {
    background: var(--tg-theme-button-color, #0088cc);
    color: var(--tg-theme-button-text-color, #ffffff);
    border: none;
    border-radius: 12px;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.success-content button:hover {
    opacity: 0.8;
}

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

@keyframes slideIn {
    0% { transform: translateY(20px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

/* ===== 人工服务样式 ===== */

/* 首页人工服务推荐模块 */
.manual-service-module {
    margin-bottom: 24px;
}

.service-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: var(--border-radius);
    padding: 20px;
    color: white;
    position: relative;
    overflow: hidden;
}

.service-card::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #667eea, #764ba2, #667eea);
    z-index: -1;
    border-radius: var(--border-radius);
    animation: gradientRotate 3s linear infinite;
}

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

.service-icon {
    font-size: 24px;
    margin-bottom: 12px;
    display: block;
}

.service-content h4 {
    font-size: 18px;
    margin-bottom: 8px;
    font-weight: 600;
}

.service-content p {
    opacity: 0.9;
    margin-bottom: 12px;
    line-height: 1.5;
}

.service-features {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.feature-tag {
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    backdrop-filter: blur(10px);
}

.service-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 10px 16px;
    border-radius: 8px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    backdrop-filter: blur(10px);
}

.service-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.service-btn .icon {
    width: 16px;
    height: 16px;
}

/* 生成按钮下方的人工服务提示 */
.manual-service-tip {
    margin-top: 12px;
    text-align: center;
    padding: 12px;
    background: rgba(var(--primary-color-rgb, 36, 129, 204), 0.05);
    border-radius: 8px;
    border: 1px solid rgba(var(--primary-color-rgb, 36, 129, 204), 0.1);
}

.manual-service-tip p {
    margin: 0;
    font-size: 14px;
    color: var(--tg-theme-hint-color);
}

.manual-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.manual-link:hover {
    text-decoration: underline;
    color: #1976d2;
}

/* 我的页面专业服务推荐 */
.professional-service-module {
    margin-top: 24px;
}

.service-banner {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    border-radius: var(--border-radius);
    padding: 24px;
    color: white;
    position: relative;
    overflow: hidden;
}

.service-banner::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: shine 2s infinite;
}

@keyframes shine {
    0% { left: -100%; }
    100% { left: 100%; }
}

.banner-content h4 {
    font-size: 20px;
    margin-bottom: 12px;
    font-weight: 600;
}

.banner-content p {
    opacity: 0.9;
    margin-bottom: 16px;
    line-height: 1.5;
}

.service-benefits {
    list-style: none;
    margin-bottom: 20px;
}

.service-benefits li {
    padding: 4px 0;
    font-size: 14px;
    opacity: 0.95;
    display: flex;
    align-items: center;
    gap: 8px;
}

.upgrade-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid white;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 16px;
    font-weight: 600;
    transition: var(--transition);
    display: inline-block;
    backdrop-filter: blur(10px);
}

.upgrade-btn:hover {
    background: white;
    color: #ee5a24;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* 响应式设计 */
@media (max-width: 480px) {
    .service-card,
    .service-banner {
        padding: 16px;
    }
    
    .service-content h4,
    .banner-content h4 {
        font-size: 16px;
    }
    
    .service-features {
        gap: 6px;
    }
    
    .feature-tag {
        font-size: 11px;
        padding: 3px 6px;
    }
    
    .service-btn,
    .upgrade-btn {
        font-size: 14px;
        padding: 10px 16px;
    }
}

/* ===== 错误弹窗样式 ===== */
.error-modal .modal-content {
    max-width: 400px;
    background: linear-gradient(145deg, #ff4757, #ff3838);
    color: white;
    border: none;
}

.error-modal .modal-header h3 {
    color: white;
    margin: 0;
}

.error-modal .close-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.error-modal .close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.error-content {
    padding: 8px 0;
}

.error-message {
    background: rgba(255, 255, 255, 0.1);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.error-solution {
    background: rgba(255, 255, 255, 0.05);
    padding: 16px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.error-solution h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
}

.error-solution p {
    margin: 0 0 12px 0;
    font-size: 14px;
    opacity: 0.9;
}

.solution-benefits {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.benefit-item {
    background: rgba(255, 255, 255, 0.15);
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.error-actions {
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

.retry-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 10px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: var(--transition);
    flex: 1;
}

.retry-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.manual-service-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: white;
    padding: 10px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    flex: 1;
    text-align: center;
    display: inline-block;
}

.manual-service-btn:hover {
    background: white;
    color: #ff4757;
    transform: translateY(-1px);
}

/* 响应式调整 */
@media (max-width: 480px) {
    .error-modal .modal-content {
        margin: 20px;
        max-width: none;
    }
    
    .error-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .solution-benefits {
        gap: 6px;
    }
    
    .benefit-item {
        font-size: 11px;
        padding: 3px 6px;
    }
} 