/**
 * AI证件照/生活照生成工具 - 样式表
 * 2025 极简暗黑风格
 */

:root {
    --bg-dark: #0a0e17;       /* 深蓝黑色背景 */
    --bg-panel: #131a28;      /* 面板背景 */
    --bg-hover: #1d263a;
    
    /* 默认主题色 (会被 data-theme 覆盖) */
    --primary-blue: #406FFF;
    --primary-gradient: linear-gradient(135deg, #5E89FF 0%, #406FFF 100%);
    
    --accent-purple: #8b5cf6; 
    --text-main: #ffffff;
    --text-sub: #94a3b8;
    --border-color: #1e293b;
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --success-green: #10b981;
}

/* 证件照主题 */
[data-theme="id"] {
    --primary-blue: #406FFF;
    --primary-gradient: linear-gradient(135deg, #5E89FF 0%, #406FFF 100%);
}

/* 形象照主题 */
[data-theme="lifestyle"] {
    --primary-blue: #905CFF;
    --primary-gradient: linear-gradient(135deg, #B085FF 0%, #905CFF 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden; /* 防止整个页面滚动 */
}

/* ========== Navbar ========== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 70px;
    padding: 0 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    background: transparent;
    transition: background 0.3s;
}

.navbar.scrolled {
    background: rgba(10, 14, 23, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-back-icon {
    display: none; /* Hidden by default on landing page */
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.2s;
}

.nav-back-icon:hover {
    background: rgba(255, 255, 255, 0.1);
}

.logo {
    font-size: 22px;
    font-weight: 700;
    background: linear-gradient(90deg, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 8px;
}

.lang-toggle {
    display: flex;
    background: rgba(255,255,255,0.1);
    border-radius: 20px;
    padding: 2px;
}

.lang-btn {
    padding: 6px 12px;
    border-radius: 18px;
    border: none;
    background: transparent;
    color: var(--text-sub);
    font-size: 13px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
}

.lang-btn.active {
    background: white;
    color: black;
}

/* ========== Landing Page ========== */
.landing-page {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    background: radial-gradient(circle at center, #1e293b 0%, #0a0e17 70%);
    position: relative;
    overflow: hidden;
}

/* Abstract Background Shapes */
.landing-page::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(64, 111, 255, 0.15) 0%, transparent 70%);
    top: -100px;
    left: -100px;
    border-radius: 50%;
    filter: blur(60px);
}

.landing-page::after {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.15) 0%, transparent 70%);
    bottom: -50px;
    right: -50px;
    border-radius: 50%;
    filter: blur(60px);
}

.hero-content {
    z-index: 1;
    max-width: 800px;
    padding: 0 20px;
    animation: fadeIn 0.8s ease-out;
}

.hero-title {
    font-size: 56px;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #fff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -1px;
}

.hero-sub {
    font-size: 20px;
    color: var(--text-sub);
    margin-bottom: 40px;
    line-height: 1.6;
}

.hero-btn {
    width: 200px;
    height: 56px;
    margin: 0 auto;
    font-size: 18px;
    border-radius: 28px; /* Pill shape */
    background: linear-gradient(90deg, #406FFF, #8b5cf6);
    box-shadow: 0 10px 25px rgba(64, 111, 255, 0.3);
}

.hero-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 35px rgba(64, 111, 255, 0.4);
}

/* 布局容器 */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* ========== 左侧配置面板 ========== */
.config-panel {
    width: 40%;
    min-width: 320px;
    background-color: var(--bg-panel);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 0; /* Padding moved to content */
    gap: 0; /* Controlled by children */
    overflow: hidden; /* Prevent main scroll */
    padding-top: 60px; /* Add space for navbar if fixed, or just design choice */
}

.config-scroll-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px; /* Increased from 20px */
    /* Removed large bottom padding since button is now in flow */
    padding-bottom: 24px; 
    display: flex;
    flex-direction: column;
    gap: 24px; /* Increased from 16px */
    /* 隐藏滚动条但保留功能 */
    scrollbar-width: none; /* Firefox */
}

.config-scroll-content::-webkit-scrollbar {
    display: none;
}

/* Tabs */
.mode-tabs {
    display: flex;
    background: var(--bg-dark);
    padding: 4px;
    border-radius: var(--radius-sm);
    gap: 4px;
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: 1px solid transparent; /* Prepare for hover border */
    color: var(--text-sub);
    padding: 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.tab-btn:not(.active):hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
}

.tab-btn.active {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Upload Area */
.upload-preview-area {
    position: relative;
    width: 100%;
    height: 150px; /* Reduced height from 180px */
    flex-shrink: 0; /* Prevent shrinking when content overflows */
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.02);
    transition: all 0.3s;
    overflow: hidden;
}

.upload-preview-area:hover {
    border-color: var(--primary-blue);
    background: rgba(37, 99, 235, 0.05);
    /* Outline style hover */
    box-shadow: 0 0 0 1px var(--primary-blue), 0 4px 20px rgba(0, 0, 0, 0.2); 
    transform: translateY(-1px);
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text-sub);
    cursor: pointer;
    width: 100%;
    height: 100%;
    justify-content: center;
}

.upload-icon {
    color: var(--primary-blue);
    margin-bottom: 4px;
    font-size: 48px;
}

.sub-text {
    font-size: 12px;
    opacity: 0.6;
}

.image-preview {
    width: 100%;
    height: 100%;
    position: relative;
}

.image-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.remove-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    background: rgba(0,0,0,0.6);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

/* Options */
.options-group {
    display: flex;
    flex-direction: column;
    gap: 20px; /* Increased from 12px for better spacing */
    flex: 1; /* 填充剩余空间 */
}

.option-section {
    display: flex;
    flex-direction: column;
    gap: 10px; /* Increased from 6px */
}

.option-title {
    font-size: 13px; /* Reduced from 14px */
    color: var(--text-sub);
    font-weight: 500;
}

.grid-options {
    display: grid;
    gap: 8px;
}

.size-options { grid-template-columns: repeat(3, 1fr); }
.clothing-options { grid-template-columns: repeat(4, 1fr); }
.ratio-options { grid-template-columns: repeat(4, 1fr); }
.color-mode-options { grid-template-columns: repeat(2, 1fr); }
.shot-options { grid-template-columns: repeat(3, 1fr); }
.bg-style-options { grid-template-columns: repeat(3, 1fr); }
.clothing-style-options { grid-template-columns: repeat(4, 1fr); }


/* 样式化比例图标 */
.ratio-icon {
    display: inline-block;
    border: 1px solid currentColor;
    margin-bottom: 4px;
    opacity: 0.8;
}

.option-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 48px; /* Reduced height from 60px */
    background: var(--bg-hover);
    border: 1px solid transparent;
    color: var(--text-sub);
    padding: 6px 4px; /* Reduced padding */
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px; /* Slightly smaller font */
    transition: all 0.2s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ratio-1-1 { width: 16px; height: 16px; }
.ratio-3-4 { width: 12px; height: 16px; }
.ratio-4-3 { width: 16px; height: 12px; }
.ratio-16-9 { width: 16px; height: 9px; }
.ratio-9-16 { width: 9px; height: 16px; }
.ratio-2-3 { width: 10px; height: 15px; }
.ratio-3-2 { width: 15px; height: 10px; }
.ratio-4-5 { width: 12px; height: 15px; }
.ratio-5-4 { width: 15px; height: 12px; }

/* 样式化大按钮 (风格、构图) - 默认 3 列 */
.style-large-btns {
    grid-template-columns: repeat(3, 1fr);
}

.style-large-btns.cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.style-large-btns.cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

.style-large-btns.cols-5 {
    grid-template-columns: repeat(5, 1fr);
}

.style-large-btns .option-btn {
    height: 42px; /* Reduced from 48px */
    font-size: 13px; /* Reduced font size */
    flex-direction: row;
}

/* 统一服装类型按钮高度和其他一致 (42px) */
.clothing-style-options .option-btn,
.clothing-options .option-btn,
.expression-options .option-btn { /* Add expression-options here */
    height: 42px; /* Reduced from 48px */
    justify-content: center; /* 确保文字垂直居中 */
    flex-direction: column;
    font-size: 13px;
}

.style-large-btns .option-btn.active {
    /* 保持选中样式 */
}

.option-btn:hover {
    background: rgba(255,255,255,0.05);
    transform: translateY(-2px);
    /* Outline style hover */
    box-shadow: 0 0 0 1px var(--primary-blue);
    border-color: transparent; /* Let shadow handle outline */
}

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

/* Color Options */
.color-options {
    display: flex;
    gap: 12px;
}

.color-btn {
    width: 32px;
    height: 32px;
    border-radius: 10px; /* Squircle */
    border: 2px solid rgba(255,255,255,0.1);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.color-btn:hover {
    transform: scale(1.1);
    z-index: 2;
}

.color-btn.active {
    border-color: var(--primary-blue) !important; /* Force override inline styles */
    transform: scale(1.1);
    box-shadow: 0 0 0 2px var(--bg-panel), 0 0 0 4px var(--primary-blue); /* Double ring effect */
}

/* Global Hover Effects */
.upload-preview-area, .option-btn, .primary-btn, .tab-btn, .color-btn {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Checkbox */
.checkbox-container {
    display: flex;
    align-items: center;
    cursor: pointer;
    gap: 4px; /* Reduced gap since icon handles its own margin */
    user-select: none;
}

.checkbox-container input {
    display: none;
}

.checkmark {
    display: none;
}

.label-text {
    font-size: 14px;
    color: var(--text-main);
}

.hint {
    font-size: 12px;
    color: var(--text-sub);
    opacity: 0.7;
}

/* Custom Checkbox SVG Styling */
.custom-checkbox-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin-right: 4px;
    cursor: pointer;
}

/* Hover state for unchecked icon handled by parent hover usually, or specific class */
.checkbox-container:hover .icon-unchecked g#编组-14 {
    stroke: #905DFF !important; /* Force hover color */
}

/* Logic to toggle SVG visibility */
.checkbox-container input:checked ~ .custom-checkbox-icon .icon-unchecked {
    display: none;
}

.checkbox-container input:checked ~ .custom-checkbox-icon .icon-checked {
    display: block !important;
}

/* Hide default checkmark if using custom icon */
.checkbox-container.small-checkbox .checkmark {
    display: none;
}

.action-area {
    margin-top: 20px;
    padding-top: 0;
    /* Reset from previous absolute positioning */
    background: none;
    position: static;
    width: 100%;
    z-index: auto;
}

.primary-btn {
    width: 100%;
    padding: 12px; /* Reduced padding from 14px */
    background: var(--primary-gradient);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 15px; /* Reduced from 16px */
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: opacity 0.2s;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.primary-btn:hover {
    opacity: 0.9;
}

.primary-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--bg-hover);
    box-shadow: none;
}

/* ========== 右侧展示面板 ========== */
.preview-panel {
    width: 60%;
    flex: none; /* 防止 flex-grow 影响宽度 */
    background: var(--bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    /* 星空背景效果 (可选) */
    background-image: 
        radial-gradient(white, rgba(255,255,255,.2) 2px, transparent 3px),
        radial-gradient(white, rgba(255,255,255,.15) 1px, transparent 2px),
        radial-gradient(white, rgba(255,255,255,.1) 2px, transparent 3px);
    background-size: 550px 550px, 350px 350px, 250px 250px;
    background-position: 0 0, 40px 60px, 130px 270px;
}

.state-view {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.4s ease-out;
}

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

/* State 1: Ready */
.state-ready {
    color: var(--text-sub);
    text-align: center;
    /* Ensure content doesn't collapse */
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 400px;
    padding-bottom: 80px; /* Shift content upwards */
}

.empty-state-icon {
    width: 280px; /* Increased size to match landing */
    height: 280px;
    background: transparent; /* Remove circle background if using large image */
    /* border-radius: 50%; Remove border radius if square image */
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px !important; /* Reduced margin */
    color: #4a5568;
    overflow: visible; /* Allow image to show fully */
}

.empty-state-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.state-ready h2 {
    font-size: 24px;
    margin-bottom: 8px;
    color: var(--text-main);
}

/* State 2: Processing */
.processing-content {
    width: 400px;
    text-align: left;
}

.processing-content h2 {
    font-size: 24px;
    margin-bottom: 8px;
}

.sub-status {
    color: var(--text-sub);
    font-size: 14px;
    margin-bottom: 24px;
}

.progress-container {
    display: flex;
    align-items: center;
    gap: 16px;
}

.progress-bar-track {
    flex: 1;
    height: 12px;
    background: rgba(255,255,255,0.1);
    border-radius: 6px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    border-radius: 6px;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.5);
}

.progress-text {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-main);
    width: 60px;
    text-align: right;
}

/* State 3: Result */
.result-image-container {
    position: relative;
    max-height: 70vh;
    max-width: 80%;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 30px;
}

#resultImage {
    max-height: 70vh;
    width: auto;
    display: block;
}

.watermark-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: auto; /* Allow overlay to intercept clicks */
    z-index: 10; /* Ensure it is above image */
}

.result-image-container img {
    pointer-events: none; /* Disable interaction with the image itself */
    user-select: none;
    -webkit-user-drag: none;
}

.result-actions {
    display: flex;
    gap: 16px;
}

.action-btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

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

.download-btn:hover {
    background: #1d4ed8;
}

.retry-btn {
    background: rgba(255,255,255,0.1);
    color: white;
}

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

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    padding: 40px; /* Increased padding */
    border-radius: var(--radius-lg);
    width: 420px; /* Slightly wider */
    text-align: center;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    gap: 15px; /* Add gap between elements */
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    color: var(--text-sub);
    font-size: 24px;
    cursor: pointer;
}

.modal-title {
    font-size: 18px;
    margin-bottom: 10px;
}

.modal-price {
    font-size: 28px;
    color: var(--primary-blue);
    font-weight: bold;
    margin-bottom: 20px;
}

.original-price {
    font-size: 14px;
    color: var(--text-sub);
    text-decoration: line-through;
    margin-left: 8px;
    font-weight: normal;
}

.payment-tabs {
    display: flex;
    background: var(--bg-dark);
    padding: 4px;
    border-radius: 6px;
    margin-bottom: 20px;
    }

.pay-tab {
    flex: 1;
    padding: 8px;
    border: none;
    background: transparent;
    color: var(--text-sub);
    cursor: pointer;
    border-radius: 4px;
}

.pay-tab.active {
    background: var(--bg-hover);
    color: white;
    }

.qr-container {
    background: white;
    padding: 10px;
    border-radius: 8px;
    width: 200px;
    height: 200px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

#paymentQRCode {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.pay-hint {
    color: var(--text-sub);
    font-size: 14px;
    margin-bottom: 20px;
    }

.confirm-pay-btn {
        width: 100%;
    padding: 12px;
    background: var(--success-green);
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    }

.confirm-pay-btn:hover {
    background: #059669;
    }

/* Toast */
.toast-message {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid rgba(16, 185, 129, 0.5);
    color: var(--success-green);
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 500;
    backdrop-filter: blur(10px);
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
}

.toast-message.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast-message.error {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
    color: #ef4444;
    }

    .upload-area {
        padding: var(--spacing-lg);
    }

    .upload-icon {
        font-size: 3rem;
}

.result-actions {
        flex-direction: column;
}

.download-btn,
.new-photo-btn {
        width: 100%;
    }

    .processing-steps {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .title {
        font-size: 1.5rem;
    }

    .upload-area {
        padding: var(--spacing-md);
    }

    .result-container {
        padding: var(--spacing-md);
    }
}

/* ========== 加载优化（针对印度地区） ========== */
/* 预加载关键资源 */
.upload-area,
.process-btn,
.download-btn {
    will-change: transform;
}

/* 减少重绘 */
#previewImage,
#resultImage {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 15px; /* Reduced from 16px */
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: opacity 0.2s;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.primary-btn:hover {
    opacity: 0.9;
}

.primary-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--bg-hover);
    box-shadow: none;
}

/* ========== 右侧展示面板 ========== */
.preview-panel {
    width: 60%;
    flex: none; /* 防止 flex-grow 影响宽度 */
    background: var(--bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    /* 星空背景效果 (可选) */
    background-image: 
        radial-gradient(white, rgba(255,255,255,.2) 2px, transparent 3px),
        radial-gradient(white, rgba(255,255,255,.15) 1px, transparent 2px),
        radial-gradient(white, rgba(255,255,255,.1) 2px, transparent 3px);
    background-size: 550px 550px, 350px 350px, 250px 250px;
    background-position: 0 0, 40px 60px, 130px 270px;
}

.state-view {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.4s ease-out;
}

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

/* State 1: Ready */
.state-ready {
    color: var(--text-sub);
    text-align: center;
    /* Ensure content doesn't collapse */
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 400px;
    padding-bottom: 80px; /* Shift content upwards */
}

.empty-state-icon {
    width: 280px; /* Increased size to match landing */
    height: 280px;
    background: transparent; /* Remove circle background if using large image */
    /* border-radius: 50%; Remove border radius if square image */
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px !important; /* Reduced margin */
    color: #4a5568;
    overflow: visible; /* Allow image to show fully */
}

.empty-state-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.state-ready h2 {
    font-size: 24px;
    margin-bottom: 8px;
    color: var(--text-main);
}

/* State 2: Processing */
.processing-content {
    width: 400px;
    text-align: left;
}

.processing-content h2 {
    font-size: 24px;
    margin-bottom: 8px;
}

.sub-status {
    color: var(--text-sub);
    font-size: 14px;
    margin-bottom: 24px;
}

.progress-container {
    display: flex;
    align-items: center;
    gap: 16px;
}

.progress-bar-track {
    flex: 1;
    height: 12px;
    background: rgba(255,255,255,0.1);
    border-radius: 6px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    border-radius: 6px;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.5);
}

.progress-text {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-main);
    width: 60px;
    text-align: right;
}

/* State 3: Result */
.result-image-container {
    position: relative;
    max-height: 70vh;
    max-width: 80%;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 30px;
}

#resultImage {
    max-height: 70vh;
    width: auto;
    display: block;
}

.watermark-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: auto; /* Allow overlay to intercept clicks */
    z-index: 10; /* Ensure it is above image */
}

.result-image-container img {
    pointer-events: none; /* Disable interaction with the image itself */
    user-select: none;
    -webkit-user-drag: none;
}

.result-actions {
    display: flex;
    gap: 16px;
}

.action-btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

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

.download-btn:hover {
    background: #1d4ed8;
}

.retry-btn {
    background: rgba(255,255,255,0.1);
    color: white;
}

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

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    padding: 40px; /* Increased padding */
    border-radius: var(--radius-lg);
    width: 420px; /* Slightly wider */
    text-align: center;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    gap: 15px; /* Add gap between elements */
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    color: var(--text-sub);
    font-size: 24px;
    cursor: pointer;
}

.modal-title {
    font-size: 18px;
    margin-bottom: 10px;
}

.modal-price {
    font-size: 28px;
    color: var(--primary-blue);
    font-weight: bold;
    margin-bottom: 20px;
}

.original-price {
    font-size: 14px;
    color: var(--text-sub);
    text-decoration: line-through;
    margin-left: 8px;
    font-weight: normal;
}

.payment-tabs {
    display: flex;
    background: var(--bg-dark);
    padding: 4px;
    border-radius: 6px;
    margin-bottom: 20px;
    }

.pay-tab {
    flex: 1;
    padding: 8px;
    border: none;
    background: transparent;
    color: var(--text-sub);
    cursor: pointer;
    border-radius: 4px;
}

.pay-tab.active {
    background: var(--bg-hover);
    color: white;
    }

.qr-container {
    background: white;
    padding: 10px;
    border-radius: 8px;
    width: 200px;
    height: 200px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    }

#paymentQRCode {
    width: 100%;
    height: 100%;
    object-fit: contain;
    }

.pay-hint {
    color: var(--text-sub);
    font-size: 14px;
    margin-bottom: 20px;
    }

.confirm-pay-btn {
        width: 100%;
    padding: 12px;
    background: var(--success-green);
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    }

.confirm-pay-btn:hover {
    background: #059669;
    }

/* Toast */
.toast-message {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid rgba(16, 185, 129, 0.5);
    color: var(--success-green);
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 500;
    backdrop-filter: blur(10px);
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
}

.toast-message.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast-message.error {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
    color: #ef4444;
    }

    .upload-area {
        padding: var(--spacing-lg);
    }

    .upload-icon {
        font-size: 3rem;
    }

    .result-actions {
        flex-direction: column;
    }

    .download-btn,
    .new-photo-btn {
        width: 100%;
    }

    .processing-steps {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .title {
        font-size: 1.5rem;
    }

    .upload-area {
        padding: var(--spacing-md);
    }

    .result-container {
        padding: var(--spacing-md);
    }
}

/* ========== 加载优化（针对印度地区） ========== */
/* 预加载关键资源 */
.upload-area,
.process-btn,
.download-btn {
    will-change: transform;
}

/* 减少重绘 */
#previewImage,
#resultImage {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}
