/* ============================================
   AI图像工厂 - 公共样式（首页/充值/历史/个人中心/登录等通用）
   ============================================ */

* { 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;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding-bottom: 70px;
    color: #333;
}

/* ========== 顶部导航栏 ========== */
.top-nav {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    height: 56px;
}

.nav-logo { font-size: 17px; font-weight: bold; }

.nav-right { display: flex; align-items: center; gap: 12px; }

.nav-points { font-size: 13px; }

.nav-points .points-num {
    font-size: 18px;
    font-weight: bold;
    margin-left: 4px;
}

.nav-score span {
    font-weight: bold;
    color: #667eea;
    background: #ffffff;
    padding: 4px 8px;
    border-radius: 12px;
    display: inline-block;
}

/* ========== 返回首页按钮（通用） ========== */
.home-link {
    position: fixed;
    top: 15px;
    left: 15px;
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 20px;
    z-index: 99;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: transform 0.2s;
}

.home-link:active { transform: scale(0.9); }

/* ========== 底部导航栏 ========== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    display: flex;
    justify-content: space-around;
    padding: 6px 0;
    padding-bottom: calc(6px + env(safe-area-inset-bottom));
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    z-index: 100;
}

.tab-item {
    text-decoration: none;
    color: #999;
    text-align: center;
    font-size: 10px;
    flex: 1;
    padding: 4px 0;
}

.tab-item.active { color: #667eea; }

.tab-icon { font-size: 22px; display: block; margin-bottom: 2px; }

/* ========== 首页功能卡片 ========== */
.features {
    padding: 15px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.feature-card {
    position: relative;
    overflow: hidden;
    height: 280px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: #333;
}

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

.feature-card .card-image {
    height: 160px;
    overflow: hidden;
    flex-shrink: 0;
}

.feature-card .card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.feature-card .card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 12px;
    text-align: center;
    color: #333;
}

.feature-card .card-title { font-size: 15px; font-weight: bold; margin: 0 0 4px 0; }
.feature-card .card-desc { font-size: 13px; margin: 0 0 8px 0; color: #666; }
.feature-card .card-price { font-size: 14px; font-weight: bold; color: #667eea; margin: 0; }

/* ========== 功能介绍页 / 图片处理页 ========== */
.functions-page { padding: 15px; max-width: 500px; margin: 0 auto; }

.module-title {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    margin: 15px 0 12px;
    padding-left: 5px;
    border-left: 3px solid #667eea;
}

.function-item {
    background: white;
    border-radius: 15px;
    padding: 18px;
    margin-bottom: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    transition: transform 0.2s;
}

.function-item:active { transform: scale(0.98); }

.function-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.function-icon { font-size: 28px; }
.function-title { font-size: 16px; font-weight: bold; color: #333; }
.function-desc { font-size: 13px; color: #666; margin-bottom: 10px; line-height: 1.5; }

.function-link {
    display: inline-block;
    padding: 8px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 20px;
    text-decoration: none;
    font-size: 13px;
    font-weight: bold;
}

/* ========== 历史页 ========== */
.history-list {
    padding: 15px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.history-item {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 5px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
}

.history-thumb {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    background: #f5f5f5;
    display: block;
    cursor: pointer;
}

.history-info { padding: 8px 10px 10px; }

.history-title {
    font-size: 13px;
    font-weight: bold;
    color: #333;
    margin-bottom: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-time { font-size: 11px; color: #999; margin-bottom: 2px; }

.history-status { font-size: 11px; padding: 1px 6px; border-radius: 8px; }
.status-success { background: #e8f5e9; color: #4caf50; }
.status-failed  { background: #ffebee; color: #f44336; }

.empty-tip { text-align: center; color: #999; padding: 60px 20px; font-size: 14px; white-space: nowrap; }

/* ========== 个人中心 ========== */
.profile-section {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.profile-header { text-align: center; padding: 15px 0; }

.avatar {
    width: 70px; height: 70px;
    border-radius: 50%;
    background: #667eea;
    color: white;
    display: flex; align-items: center; justify-content: center;
    font-size: 32px;
    margin: 0 auto 12px;
}

.profile-name { font-size: 18px; font-weight: bold; color: #333; }

.profile-stats {
    display: flex;
    justify-content: space-around;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.stat-item { text-align: center; }
.stat-value { font-size: 20px; font-weight: bold; color: #667eea; }
.stat-label { font-size: 12px; color: #999; margin-top: 4px; }

.menu-list { list-style: none; }

.menu-item {
    padding: 14px 0;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.menu-item:last-child { border-bottom: none; }

.menu-link {
    display: block;
    width: 100%;
    padding: 15px;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.menu-arrow { color: #ccc; }

.footer-links { padding: 15px; text-align: center; }

.footer-link {
    display: inline-block;
    margin: 5px 10px;
    color: #667eea;
    text-decoration: none;
    font-size: 12px;
}

/* ========== 充值页面 ========== */
.recharge-header {
    text-align: center;
    color: white;
    padding: 30px 20px 20px;
}

.recharge-header h1 { font-size: 24px; margin-bottom: 5px; }

.balance-card {
    background: rgba(255,255,255,0.2);
    border-radius: 15px;
    padding: 20px;
    margin: 0 20px 20px;
    text-align: center;
    color: white;
}

.balance-label { font-size: 14px; opacity: 0.9; }
.balance-amount { font-size: 36px; font-weight: bold; margin: 8px 0; }

.pricing-grid { display: flex; gap: 12px; padding: 0 20px; margin-bottom: 20px; }

.pricing-card {
    flex: 1;
    background: white;
    border-radius: 15px;
    padding: 20px 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    border: 3px solid transparent;
}

.pricing-card.selected { border-color: #667eea; background: #f8f9ff; }
.pricing-card:active { transform: scale(0.98); }

.pricing-points { font-size: 24px; font-weight: bold; color: #667eea; margin-bottom: 5px; }
.pricing-price  { font-size: 16px; color: #333; margin-bottom: 8px; }
.pricing-desc   { font-size: 11px; color: #999; }

.popular-badge {
    display: inline-block;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 10px;
    margin-bottom: 8px;
}

.btn-pay {
    width: calc(100% - 40px);
    max-width: 460px;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    margin: 0 auto;
    display: block;
}

.btn-pay:disabled { opacity: 0.6; cursor: not-allowed; }

.success-message {
    display: none;
    background: rgba(255,255,255,0.95);
    border-radius: 15px;
    padding: 30px;
    text-align: center;
    margin: 20px;
}

.success-message.show { display: block; }

/* ========== 分页 ========== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.pagination button {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    background: #667eea;
    color: #fff;
    cursor: pointer;
    font-size: 14px;
}

.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }

.pagination .page-info { color: #666; font-size: 13px; }

/* ========== 返回首页（订单页圆形按钮） ========== */
.home-btn {
    position: fixed;
    top: 15px;
    left: 15px;
    width: 40px;
    height: 40px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    z-index: 1000;
    font-size: 20px;
    text-decoration: none;
}

.home-btn:hover { transform: scale(1.1); }

/* ========== 充值套餐 ========== */
#plansContainer {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
    width: 100%;
}

.plan-card {
    background: #fff;
    border-radius: 15px;
    padding: 20px;
    width: 220px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.plan-info { display: flex; flex-direction: column; gap: 4px; }
.plan-name  { font-size: 18px; font-weight: bold; color: #333; margin-bottom: 8px; }
.plan-points { font-size: 28px; font-weight: bold; color: #667eea; }
.plan-points-label { font-size: 13px; color: #999; }
.plan-price { font-size: 20px; font-weight: bold; color: #333; margin: 5px 0; }
.plan-desc  { font-size: 12px; color: #666; margin-bottom: 10px; }
.plan-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    border: none;
    border-radius: 20px;
    font-weight: bold;
    cursor: pointer;
    margin-top: auto;
}

@media (max-width: 768px) {
    #plansContainer { flex-direction: column; align-items: center; }
    .plan-card { width: 100%; max-width: 320px; flex-direction: row; align-items: center; justify-content: space-between; padding: 16px; }
    .plan-info  { flex-direction: row; align-items: center; gap: 12px; flex: 1; }
    .plan-btn   { width: auto; margin-top: 0; white-space: nowrap; }
}

/* ========== 充值页提示 ========== */
.pay-tip {
    background: #f0f4ff;
    border-left: 4px solid #667eea;
    padding: 12px 16px;
    border-radius: 0 8px 8px 0;
    margin-bottom: 20px;
    font-size: 14px;
    color: #333;
}

.pay-methods {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.pay-methods h3 { margin: 0 0 12px 0; color: #333; font-size: 16px; }
.pay-methods ul { margin: 0; padding-left: 20px; color: #666; font-size: 14px; line-height: 1.8; }
.pay-bottom-hint { text-align: center; padding: 15px; color: #999; font-size: 13px; margin-top: 20px; }
.pay-bottom-hint a { color: #667eea; text-decoration: none; }

/* ========== FAQ（个人中心充值教程） ========== */
.faq-container { padding: 15px; }
.faq-item { margin-bottom: 12px; background: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.faq-question { padding: 15px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; font-weight: 500; color: #333; transition: background 0.2s; }
.faq-question:hover { background: #f8f9fa; }
.faq-question::after { content: '\25BC'; font-size: 20px; color: #667eea; transition: transform 0.3s; }
.faq-item.active .faq-question::after { content: '\25B2'; }
.faq-answer { padding: 0 15px; max-height: 0; overflow: hidden; transition: all 0.3s ease; color: #666; font-size: 14px; line-height: 1.6; }
.faq-item.active .faq-answer { padding: 0 15px 15px; max-height: 500px; }
.faq-answer ul, .faq-answer ol { margin: 8px 0; padding-left: 20px; }
.faq-answer li { margin: 5px 0; }

/* ========== 按钮 ========== */
.btn-recharge {
    background: white;
    color: #667eea;
    border: none;
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    text-decoration: none;
    transition: opacity 0.2s;
}

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

.btn-customer {
    background: #10b981;
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

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

.btn-login, .btn-profile {
    background: transparent;
    color: #ffffff;
    border: 2px solid #7b68ee;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-login:hover, .btn-profile:hover { background: rgba(102,126,234,0.1); }

/* ========== 图片弹窗 ========== */
.image-modal {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,.85);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.image-modal.show { display: flex; }

.image-modal img {
    max-width: 92vw;
    max-height: 78vh;
    border-radius: 8px;
    box-shadow: 0 4px 30px rgba(0,0,0,.5);
}

.image-modal .modal-actions { margin-top: 20px; display: flex; gap: 15px; }

.image-modal .modal-close {
    position: absolute;
    top: 20px; right: 20px;
    width: 44px; height: 44px;
    background: rgba(255,255,255,.2);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.modal-btn {
    padding: 10px 24px;
    border: none;
    border-radius: 25px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}

.modal-btn-primary  { background: linear-gradient(135deg, #667eea, #764ba2); color: #fff; }
.modal-btn-secondary { background: rgba(255,255,255,.2); color: #fff; }

/* ========== 登录/注册 ========== */
.auth-container {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.auth-box {
    background: white;
    border-radius: 20px;
    padding: 30px 25px;
    max-width: 380px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.auth-box h2 { text-align: center; margin-bottom: 25px; color: #333; }

.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 13px; color: #666; margin-bottom: 6px; }
.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
}

.form-group input:focus { border-color: #667eea; }

.btn-auth {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 10px;
}

.btn-auth:disabled { opacity: 0.6; cursor: not-allowed; }

.auth-switch { text-align: center; margin-top: 20px; font-size: 13px; color: #666; }
.auth-switch a { color: #667eea; text-decoration: none; font-weight: bold; }

.auth-error { color: #f44336; font-size: 13px; text-align: center; margin-top: 10px; display: none; }
.auth-error.show { display: block; }

/* ========== 法律页面 ========== */
.legal-content {
    padding: 20px;
    background: white;
    border-radius: 15px;
    margin: 15px;
    line-height: 1.8;
}

.legal-content h2 { color: #667eea; margin: 20px 0 10px; font-size: 17px; }
.legal-content p  { color: #555; font-size: 13px; margin-bottom: 10px; }

/* ========== 页面背景色 ========== */
.bg-purple { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.bg-pink   { background: linear-gradient(135deg, #a18cd1 0%, #fbc2eb 100%); }
.bg-red    { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); }
.bg-orange { background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%); }

/* ========== 提交按钮 ========== */
.btn-submit {
    width: 100%;
    padding: 14px;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s;
}

/* ========== 历史页任务处理时间提示 ========== */
.processing-hint {
    margin: 0 15px 12px;
    background: #fff5f5;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 15px;
    color: #e74c3c;
    text-align: center;
    font-weight: 500;
}

.btn-submit:hover { transform: translateY(-2px); }
.btn-submit:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.status-pending { background: #f59e0b; color: #fff; }