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

/* 基础样式 */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

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

/* 页面头部 */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 20px 0;
    text-align: center;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}

.logo {
    font-size: 2.5rem;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.1rem;
    color: #666;
    font-weight: 400;
}

/* 主要内容区域 */
.main-content {
    padding: 40px 0;
    min-height: calc(100vh - 200px);
}

/* 步骤指示器 */
.steps-indicator {
    display: none;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    flex: 1;
    transition: all 0.3s ease;
}

.step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 25px;
    right: -20%;
    width: 40%;
    height: 2px;
    background: #ddd;
    transition: all 0.3s ease;
}

.step.active:not(:last-child)::after,
.step.completed:not(:last-child)::after {
    background: #667eea;
}

.step-number {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #ddd;
    color: #999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    margin-bottom: 10px;
}

.step.active .step-number {
    background: #667eea;
    color: white;
    transform: scale(1.1);
}

.step.completed .step-number {
    background: #4CAF50;
    color: white;
}

.step-text {
    font-size: 0.9rem;
    color: #666;
    font-weight: 500;
    transition: all 0.3s ease;
}

.step.active .step-text {
    color: #667eea;
    font-weight: 600;
}

/* 内容区域 */
.content-area {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    min-height: 500px;
}

.step-content {
    display: none;
    animation: fadeIn 0.5s ease;
}

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

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

/* 图片上传区域 */
.upload-section {
    text-align: center;
}

.upload-area {
    border: 3px dashed #ddd;
    border-radius: 20px;
    padding: 40px 30px;
    transition: all 0.3s ease;
    background: #fafafa;
    margin-top: 10px;
}

.upload-area:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

.upload-area.dragover {
    border-color: #667eea;
    background: #e8f0ff;
    transform: scale(1.02);
}

.upload-icon {
    color: #999;
    margin-bottom: 20px;
}

.upload-placeholder h3 {
    font-size: 1.5rem;
    color: #333;
    margin-bottom: 10px;
}

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

.upload-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

/* 图片预览 */
.upload-preview {
    text-align: center;
}

.upload-preview img {
    width: 300px;
    height: 300px;
    object-fit: cover;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    margin-bottom: 30px;
}

.preview-actions {
    display: flex;
    justify-content: center;
    gap: 20px;
}

/* 裁剪弹窗样式 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    width: 90%;
    max-width: 720px;
    box-shadow: 0 12px 36px rgba(0,0,0,0.2);
}

.cropper-container-wrap {
    width: 100%;
    max-height: 60vh;
    overflow: hidden;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 12px;
}

/* 按钮样式 */
.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
    padding: 12px 25px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
}

/* AI分析区域 */
.analysis-section {
    text-align: center;
}

.analysis-progress {
    margin-bottom: 40px;
}

.progress-circle {
    position: relative;
    display: inline-block;
    margin-bottom: 30px;
}

.progress-ring {
    transform: rotate(-90deg);
    color: #667eea;
}

.progress-ring-circle {
    transition: stroke-dasharray 0.3s ease;
    stroke-dasharray: 0 327;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.progress-percentage {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: #667eea;
}

.progress-label {
    display: block;
    font-size: 0.9rem;
    color: #666;
    margin-top: 5px;
}

.analysis-steps {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    max-width: 1000px;
    margin: 0 auto;
    flex-wrap: wrap;
}

.analysis-step {
    background: #f8f9ff;
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    transition: all 0.3s ease;
    flex: 1;
    min-width: 200px;
}

.analysis-step.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transform: scale(1.05);
}

.analysis-step.completed {
    background: #4CAF50;
    color: white;
}

.step-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 10px;
}

.step-name {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
}

.step-status {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* 卡片生成区域 */
.card-generation-section {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.card-generation h3 {
    font-size: 1.3rem;
    color: #333;
    margin-bottom: 20px;
    text-align: center;
}

.analysis-results h3,
.template-selection h3 {
    font-size: 1.3rem;
    color: #333;
    margin-bottom: 20px;
    text-align: center;
}

/* 标签页 */
.result-tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    background: #f0f0f0;
    border-radius: 25px;
    padding: 5px;
}

.tab-btn {
    background: none;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.tab-btn.active {
    background: #667eea;
    color: white;
}

.tab-content {
    display: none;
    padding: 20px;
    background: #f8f9ff;
    border-radius: 15px;
    min-height: 200px;
}

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

.aesthetic-analysis,
.style-analysis {
    line-height: 1.8;
    color: #555;
}

/* 正文区域左右扩展20px */
.analysis-display {
    padding-left: 20px;
    padding-right: 20px;
}

/* 标签容器 */
.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.tag {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    user-select: none;
}

.tag:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.tag.selected {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    border-color: #ff6b6b;
    transform: scale(1.05);
}

/* 模板选择 */
.template-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
    max-width: 1000px;
    margin: 0 auto;
}

.template-card {
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 15px;
    border-radius: 15px;
    border: 2px solid transparent;
}

.template-card:hover {
    transform: translateY(-5px);
}

.template-card.active {
    border-color: #667eea;
    background: #f0f4ff;
}

.template-preview {
    width: 100%;
    height: 120px;
    border-radius: 10px;
    margin-bottom: 10px;
    position: relative;
    overflow: hidden;
}

.template-image-placeholder {
    width: 60%;
    height: 60%;
    background: #ddd;
    border-radius: 5px;
    position: absolute;
    top: 10px;
    left: 10px;
}

.template-text {
    position: absolute;
    bottom: 10px;
    right: 10px;
    font-size: 0.8rem;
    color: #666;
}

.template-modern {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

.template-artistic {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
}

.template-elegant {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
}

.template-vibrant {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.template-minimalist {
    background: linear-gradient(135deg, #ffffff 0%, #f5f5f5 100%);
    border: 1px solid #ddd;
}

.template-retro {
    background: linear-gradient(135deg, #f4f1e8 0%, #deb887 100%);
}

.template-name {
    font-weight: 600;
    color: #333;
}

/* 导出区域 */
.export-section {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 30px;
    align-items: start;
}

.card-preview-area h3,
.export-actions h3 {
    font-size: 1.3rem;
    color: #333;
    margin-bottom: 20px;
    text-align: center;
}

.final-card-preview {
    background: #f8f9ff;
    border-radius: 15px;
    min-height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed #ddd;
    padding: 20px;
}

.export-options {
    margin-bottom: 20px;
}

.option-group {
    margin-bottom: 15px;
}

.option-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
}

.option-group select {
    width: 100%;
    padding: 8px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.option-group select:focus {
    border-color: #667eea;
    outline: none;
}

.export-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.export-buttons button {
    padding: 10px 16px;
    font-size: 0.9rem;
}

/* 操作按钮区域 */
.action-buttons {
    text-align: center;
    margin-top: 30px;
}

.action-buttons button {
    margin: 0 10px;
}

/* 页面底部 */
.footer {
    background: rgba(255, 255, 255, 0.9);
    text-align: center;
    padding: 20px 0;
    color: #666;
    backdrop-filter: blur(10px);
}

/* 加载提示 */
.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: 9999;
}

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

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

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

/* 模板选择样式 */
.template-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
    margin-bottom: 24px;
    max-width: 1000px;
    margin: 0 auto 24px auto;
}

.template-item {
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 12px;
    overflow: hidden;
}

.template-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.template-item.selected {
    border: 3px solid #ff2442;
    box-shadow: 0 0 0 2px rgba(255, 36, 66, 0.2);
}

.template-item.selected .template-preview {
    border-color: #ff2442;
}

/* 生成卡片按钮样式 */
.generate-card-section {
    text-align: center;
    margin: 20px 0;
}

.generate-card-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 20px 0;
    width: 100%;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.generate-card-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.generate-card-section {
    margin: 20px 0;
    text-align: center;
}

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

/* 卡片预览样式 */
.card-preview {
    background: #f8f9fa;
    border-radius: 16px;
    padding: 24px;
    margin: 20px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
}

.card-preview-container {
    max-width: 100%;
    overflow: hidden;
}

/* 小红书卡片样式增强 */
.xiaohongshu-card {
    box-shadow: 0 12px 40px rgba(0,0,0,0.1), 10px 10px 0px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.xiaohongshu-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 60px rgba(0,0,0,0.15), 12px 12px 0px rgba(0, 0, 0, 0.1);
}

/* 导出选项样式 */
.export-options {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.export-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.export-btn.primary {
    background: #ff2442;
    color: white;
}

.export-btn.primary:hover {
    background: #e01e3c;
    transform: translateY(-1px);
}

.export-btn.secondary {
    background: #f8f9fa;
    color: #666;
    border: 1px solid #ddd;
}

.export-btn.secondary:hover {
    background: #e9ecef;
    border-color: #ccc;
}

/* 平板设备响应式 */
@media (max-width: 1024px) {
    .template-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
        max-width: 800px;
    }
}

/* 移动设备响应式 */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .logo {
        font-size: 2rem;
    }
    
    .steps-indicator {
        flex-direction: column;
        gap: 20px;
    }
    
    .step:not(:last-child)::after {
        display: none;
    }
    
    .content-area {
        padding: 20px;
    }
    
    .card-generation-section,
    .export-section {
        flex-direction: column;
        gap: 20px;
    }
    
    .template-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .analysis-steps {
        grid-template-columns: 1fr;
    }
}

/* 预览按钮区域样式 */
.preview-button-section {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.preview-button-section .btn-secondary {
    padding: 12px 30px;
    font-size: 1rem;
    border-radius: 8px;
}

/* 编辑功能样式 */
.analysis-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.analysis-header h4 {
    margin: 0;
    font-size: 1.1rem;
    color: #333;
    font-weight: 600;
}

.edit-btn {
    background: #6c5ce7;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.edit-btn:hover {
    background: #5a4fcf;
    transform: translateY(-1px);
}

.analysis-display {
    display: block;
}

.analysis-editor {
    display: none;
}

.analysis-editor textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.95rem;
    line-height: 1.6;
    resize: vertical;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.analysis-editor textarea:focus {
    outline: none;
    border-color: #6c5ce7;
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1);
}

.edit-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    justify-content: flex-end;
}

.save-btn, .cancel-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.save-btn {
    background: #00b894;
    color: white;
}

.save-btn:hover {
    background: #00a085;
}

.cancel-btn {
    background: #ddd;
    color: #666;
}

.cancel-btn:hover {
    background: #ccc;
}

.edit-message {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #00b894;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    z-index: 1000;
    opacity: 0;
    transform: translateX(100px);
    transition: all 0.3s ease;
}

.edit-message.show {
    opacity: 1;
    transform: translateX(0);
}