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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 25%, #ffc3a0 50%, #ffafbd 75%, #ffd89b 100%);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    min-height: 100vh;
}

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





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

.section {
    display: block;
    animation: fadeIn 0.5s ease;
}

/* 上传介绍 */
.upload-intro {
    text-align: center;
    margin-bottom: 50px;
    color: #2c3e50;
}

.upload-intro h1 {
    font-family: 'Knewave', serif;
    font-size: 56px;
    font-weight: 400;
    margin: 0 0 20px 0;
    background: linear-gradient(45deg, #1a1a2e, #2d1b69, #16213e, #4a148c, #0f3460);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: magicFlow 4s ease-in-out infinite;
    letter-spacing: 0px;
    text-shadow: 0 2px 8px rgba(44, 62, 80, 0.2);
}

.upload-intro p {
    font-size: 16px;
    opacity: 0.8;
    max-width: 500px;
    margin: 0 auto;
    color: #34495e;
}

/* 上传表单 */
.upload-form {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 25px;
    padding: 35px;
    box-shadow: 0 15px 50px rgba(255, 107, 107, 0.15);
    margin-bottom: 30px;
}

.upload-group {
    margin-bottom: 25px;
}

.upload-area {
    border: 3px dashed #ff6b6b;
    border-radius: 20px;
    padding: 35px 25px;
    text-align: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    min-height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
}

.upload-area:hover {
    border-color: #ff6b6b;
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.1), rgba(78, 205, 196, 0.1));
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.2);
}

.upload-area.dragover {
    border-color: #4ecdc4;
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.15), rgba(78, 205, 196, 0.15));
    transform: scale(1.02) translateY(-3px);
    box-shadow: 0 12px 35px rgba(78, 205, 196, 0.3);
}

.upload-placeholder {
    pointer-events: none;
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 15px;
    filter: drop-shadow(0 4px 8px rgba(255, 107, 107, 0.3));
}

.upload-placeholder h3 {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.upload-placeholder p {
    color: #666;
    margin-bottom: 10px;
}

.upload-hint {
    font-size: 12px;
    color: #999;
}

.preview-image {
    max-width: 100%;
    max-height: 200px;
    border-radius: 10px;
    object-fit: cover;
}

/* 生成按钮 */
.generate-btn {
    width: 100%;
    padding: 18px;
    border: none;
    border-radius: 15px;
    background: linear-gradient(135deg, #1a1a2e 0%, #2d1b69 25%, #0f3460 50%, #4a148c 75%, #1a1a2e 100%);
    background-size: 300% 300%;
    color: white;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.4s ease;
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 1px;
    animation: magicFlow 4s ease infinite;
    box-shadow: 0 0 20px rgba(26, 26, 46, 0.3), inset 0 0 20px rgba(255, 255, 255, 0.1);
}

.generate-btn:enabled:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 12px 35px rgba(26, 26, 46, 0.6), 0 0 30px rgba(15, 52, 96, 0.4);
    animation: magicFlow 2s ease infinite, pulse 0.6s ease infinite;
}

.generate-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

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

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

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

@keyframes magicFlow {
    0% { background-position: 0% 0%; }
    25% { background-position: 100% 50%; }
    50% { background-position: 50% 100%; }
    75% { background-position: 0% 50%; }
    100% { background-position: 0% 0%; }
}

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

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

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

@keyframes rainbow {
    0% { filter: hue-rotate(0deg); }
    100% { filter: hue-rotate(360deg); }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 20px rgba(255, 154, 158, 0.4); }
    50% { box-shadow: 0 0 30px rgba(255, 195, 160, 0.6), 0 0 40px rgba(255, 154, 158, 0.4); }
}



/* 历史记录 */
.history-section {
    margin-top: 60px;
    padding-top: 40px;
    border-top: 2px solid rgba(255, 255, 255, 0.1);
}

.history-header {
    text-align: center;
    margin-bottom: 30px;
}

.history-header h2 {
    font-size: 28px;
    font-weight: 700;
    color: #333;
    margin-bottom: 10px;
}

.history-header p {
    font-size: 16px;
    opacity: 0.9;
}

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

.history-item {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 8px 30px rgba(255, 154, 158, 0.15);
    transition: all 0.4s ease;
    border: 1px solid rgba(255, 255, 255, 0.3);
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.history-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 195, 160, 0.3), transparent);
    transition: left 0.5s ease;
}

.history-item:hover::after {
    left: 100%;
}

.history-item:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 15px 40px rgba(255, 154, 158, 0.25);
}

.history-images {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin-bottom: 15px;
}

.history-image {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    position: relative;
}

.history-image.processing {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px dashed #6c757d;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    font-size: 12px;
    position: relative;
    overflow: hidden;
}

.hourglass-icon {
    font-size: 24px;
    animation: hourglass-rotation 2s linear infinite;
    margin-bottom: 4px;
}

.processing-text {
    font-size: 10px;
    font-weight: 500;
    opacity: 0.8;
}

@keyframes hourglass-rotation {
    0% { transform: rotate(0deg); }
    50% { transform: rotate(180deg); }
    100% { transform: rotate(360deg); }
}

.history-item.processing {
    opacity: 0.8;
    cursor: default;
}

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

/* NEW标签样式 */
.new-tag {
    position: absolute;
    top: 8px;
    right: 8px;
    background: linear-gradient(45deg, #ff6b6b, #feca57);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: bold;
    text-transform: uppercase;
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
    animation: newTagGlow 2s ease-in-out infinite;
    z-index: 10;
}

@keyframes newTagGlow {
    0%, 100% { transform: scale(1); box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3); }
    50% { transform: scale(1.05); box-shadow: 0 4px 16px rgba(255, 107, 107, 0.5); }
}

/* 弹窗样式 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: white;
    border-radius: 20px;
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 1px solid #eee;
    background: linear-gradient(45deg, #ff9a9e, #fecfef);
    color: white;
}

.modal-header h3 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 30px;
    color: white;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s ease;
}

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

.modal-body {
    padding: 30px;
    text-align: center;
}

.modal-image {
    max-width: 100%;
    max-height: 60vh;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.modal-footer {
    display: flex;
    gap: 15px;
    padding: 20px 30px;
    border-top: 1px solid #eee;
    background: #f8f9fa;
}

.modal-btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-btn.delete-btn {
    background: linear-gradient(45deg, #ff6b6b, #ff8e8e);
    color: white;
}

.modal-btn.delete-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 107, 107, 0.4);
}

.modal-btn.download-btn {
    background: linear-gradient(45deg, #4ecdc4, #44a08d);
    color: white;
}

.modal-btn.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(78, 205, 196, 0.4);
}

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

.history-date {
    font-size: 12px;
    color: #666;
    text-align: center;
}

.history-actions {
    margin-top: 10px;
    text-align: center;
}

.history-delete-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ff9a9e;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.history-delete-btn:hover {
    background: rgba(255, 154, 158, 0.2);
    border-color: #ff9a9e;
    transform: scale(1.05);
}

/* 加载覆盖层 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-content {
    text-align: center;
    color: white;
}

.loading-animation {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
}

.loading-circle {
    width: 15px;
    height: 15px;
    background: linear-gradient(45deg, #ff9a9e, #ffc3a0, #ffd89b);
    border-radius: 50%;
    animation: bounce 1.4s ease-in-out infinite both, rainbow 3s linear infinite;
    box-shadow: 0 0 10px rgba(255, 154, 158, 0.5);
}

.loading-circle:nth-child(1) { animation-delay: -0.32s; }
.loading-circle:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

.loading-content h3 {
    font-size: 20px;
    margin-bottom: 10px;
}

.loading-content p {
    font-size: 14px;
    opacity: 0.8;
}

/* 消息提示 */
.message-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #333;
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    transform: translateX(400px);
    transition: transform 0.3s ease;
    z-index: 1001;
    max-width: 300px;
}

.message-toast.show {
    transform: translateX(0);
}

.message-toast.success {
    background: white;
    color: black;
    border: 1px solid #ddd;
}

.message-toast.error {
    background: linear-gradient(45deg, #ff9a9e, #ffafbd);
    animation: glow 2s ease infinite;
}

.message-toast.warning {
    background: linear-gradient(45deg, #ff9800, #feca57);
    animation: glow 2s ease infinite;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .header .container {
        padding: 10px 15px;
    }
    
    .logo h1 {
        font-size: 20px;
    }
    
    .upload-form {
        padding: 20px;
        border-radius: 15px;
    }
    
    .upload-area {
        padding: 20px 15px;
        min-height: 150px;
    }
    
    .upload-icon {
        font-size: 36px;
    }
    
    .upload-placeholder h3 {
        font-size: 16px;
    }
    
    .upload-intro h2 {
        font-size: 24px;
    }
    
    .result-actions {
        flex-direction: column;
    }
    
    .action-btn {
        min-width: auto;
    }
    
    .history-list {
        grid-template-columns: 1fr;
    }
    
    .message-toast {
        right: 15px;
        left: 15px;
        max-width: none;
        transform: translateY(-100px);
    }
    
    .message-toast.show {
        transform: translateY(0);
    }
}

@media (max-width: 480px) {
    .main {
        padding: 20px 0;
    }
    
    .upload-intro {
        margin-bottom: 25px;
    }
    
    .upload-intro h2 {
        font-size: 22px;
    }
    
    .upload-intro p {
        font-size: 14px;
    }
    
    .nav-btn {
        padding: 6px 15px;
        font-size: 13px;
    }
    
    .result-info {
        flex-direction: column;
        gap: 10px;
    }
}