/**
 * AI智能平台 - 统一样式
 * 所有功能页面共用此样式文件
 * 
 * 【重要】本文件已整合 Design System
 * 统一组件规范请参考 design-system.css
 */

@import url('css/fontawesome.min.css');
@import url('design-system.css');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    /*
     * 关键模块主色：午夜蓝黑 #141521（按钮/海报/选中态等），其余大面积留白 #fff / 浅灰
     */
    --primary: #141521;
    --primary-light: #1e2433;
    --accent: #141521;
    --accent-light: #252a3d;
    --accent-subtle: rgba(20, 21, 33, 0.08);
    
    /* 背景色 */
    --bg-primary: #ffffff;
    --bg-secondary: #f7f7f8;
    --bg-card: #ffffff;
    
    /* 文字色 */
    --text-primary: #141521;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --text-inverse: #ffffff;
    
    /* 边框和阴影 */
    --border-light: rgba(0, 0, 0, 0.06);
    --border-medium: rgba(0, 0, 0, 0.1);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.12);
    
    /* 状态色 */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    
    /* ========================================
       统一间距系统 (8/12/16/24) - Design System
       ======================================== */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    
    /* 页面边距 - 统一 16px */
    --page-padding: 16px;
    
    /* 模块间距 - 统一 16px */
    --section-gap: 16px;
    
    /* 卡片间距 - 统一 12px */
    --card-gap: 12px;
    
    /* ========================================
       统一圆角 - 全部 16px
       ======================================== */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 16px; /* 统一为 16px */
    
    /* 安全区域 */
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);

    /* ========================================
       BannerCard 规范 - 紧凑布局
       边距更小，卡片占比更大
       ======================================== */
    --banner-aspect-ratio: 2.1 / 1;
    --banner-padding: 20px;
    
    /* ========================================
       FeatureCard 规范 - 固定高度
       ======================================== */
    --feature-card-height: 110px;
    --feature-card-padding: 12px;
    
    /* ========================================
       VipCard 规范 - 固定高度
       紧凑布局
       ======================================== */
    --vip-card-height: 160px;
    --vip-card-padding: 16px;

    /* 全站统一海报：同系深蓝黑渐变，无跳色 */
    --page-hero-gradient: linear-gradient(145deg, #141521 0%, #1a2230 52%, #141521 100%);
    --page-hero-text: rgba(255, 255, 255, 0.98);
    --page-hero-text-muted: rgba(255, 255, 255, 0.72);
}

/* ========== 全站统一顶部海报 - BannerCard 规范 ========== */
/**
 * 【Design System 规范】
 * - 紧凑布局，边距更小，卡片占比更大
 * - 统一圆角 12px
 * - 统一 padding 20px
 */
.hero-card,
.agent-hero-card,
.hero-banner {
    width: 100%;
    aspect-ratio: 2.1 / 1;
    padding: var(--banner-padding);
    border-radius: 12px;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
    background: var(--page-hero-gradient);
    border: none;
    box-shadow: none;
}

/* 颗粒感噪点层 */
.hero-card .hero-noise,
.agent-hero-card .hero-noise,
.hero-banner .hero-noise {
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    opacity: 0.035;
    pointer-events: none;
    z-index: 0;
}

/* 右上角光斑 */
.hero-card::before,
.agent-hero-card::before,
.hero-banner::before {
    content: '';
    position: absolute;
    top: -48%;
    right: -18%;
    width: min(300px, 78vw);
    height: min(300px, 78vw);
    background: radial-gradient(circle, rgba(255, 255, 255, 0.07) 0%, transparent 68%);
    pointer-events: none;
    z-index: 1;
}

/* 左下角光斑 */
.hero-card::after,
.agent-hero-card::after,
.hero-banner::after {
    content: '';
    position: absolute;
    bottom: -38%;
    left: -12%;
    width: min(240px, 62vw);
    height: min(240px, 62vw);
    background: radial-gradient(circle, rgba(255, 255, 255, 0.045) 0%, transparent 72%);
    pointer-events: none;
    z-index: 1;
}

/* 星星装饰 */
.hero-stars {
    position: absolute;
    top: 16px;
    right: 20px;
    font-size: 24px;
    color: rgba(255, 255, 255, 0.15);
    z-index: 2;
    pointer-events: none;
}
.hero-stars::before {
    content: '✦';
    position: absolute;
    top: 0;
    right: 0;
    font-size: 20px;
    opacity: 0.6;
}
.hero-stars::after {
    content: '✦';
    position: absolute;
    top: 24px;
    right: 28px;
    font-size: 12px;
    opacity: 0.4;
}

.hero-card,
.agent-hero-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.hero-card {
    align-items: stretch;
    text-align: left;
}

.agent-hero-card {
    align-items: flex-start;
    text-align: left;
}

.hero-banner {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.hero-content,
.agent-hero-content {
    position: relative;
    z-index: 1;
}

.hero-banner > * {
    position: relative;
    z-index: 1;
}

/* 徽章：半透明胶囊 + 霓虹绿点 */
.hero-badge,
.agent-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    margin: 0 0 12px 0;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--page-hero-text);
    background: rgba(0, 0, 0, 0.38);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 100px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.hero-badge .hero-badge-dot,
.agent-hero-badge .hero-badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.65);
    flex-shrink: 0;
    animation: hero-badge-pulse 2.2s ease-in-out infinite;
}

@keyframes hero-badge-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.85; transform: scale(1.08); }
}

/* 标题 / 副标题：全站同一层级 */
.hero-title,
.agent-hero-title {
    font-size: clamp(1.25rem, 4.2vw, 1.625rem);
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.03em;
    color: var(--page-hero-text);
    margin: 0 0 8px 0;
}

.hero-subtitle,
.agent-hero-subtitle {
    font-size: 14px;
    font-weight: 400;
    line-height: 1.55;
    color: var(--page-hero-text-muted);
    margin: 0;
}

.hero-banner .hero-title {
    max-width: 22em;
}

.hero-banner .hero-subtitle {
    max-width: 24em;
}

/* 功能页顶部 emoji / 图标区 */
.hero-emoji {
    font-size: 2.5rem;
    line-height: 1;
    margin: 0 0 12px 0;
    filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.2));
}

/* 首页海报主标题可略大（仍同一套比例） */
.hero-card .hero-title {
    font-size: clamp(1.375rem, 4.5vw, 1.75rem);
    margin-bottom: 10px;
}

.hero-card .hero-subtitle {
    margin-bottom: var(--space-lg);
    max-width: 26em;
}

/* ========== VipCard 规范 - 会员卡组件 ========== */
/**
 * 【Design System 规范】
 * - 固定高度 150px (唯一允许写死高度的卡片)
 * - 统一圆角 16px
 * - 统一 padding 16px
 */
.profile-card {
    width: 100%;
    height: var(--vip-card-height);
    border-radius: var(--radius-lg);
    padding: var(--vip-card-padding);
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 主容器 */
.app-container {
    height: 100%;
    display: flex;
    flex-direction: column;
    max-width: 430px;
    margin: 0 auto;
    background: var(--bg-primary);
}

@media (min-width: 431px) {
    .app-container {
        box-shadow: 0 0 40px rgba(0, 0, 0, 0.08);
    }
}

/* 顶部导航 */
.nav-header {
    display: flex;
    align-items: center;
    padding: 12px var(--space-md);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-back {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
}

.nav-back:active {
    background: var(--bg-secondary);
}

.nav-title {
    flex: 1;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    margin-right: 36px;
    letter-spacing: -0.3px;
}

/* 主内容区 */
.main-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: var(--space-lg) var(--space-md);
    padding-bottom: calc(var(--space-lg) + var(--safe-bottom));
}

/* 提示卡片 */
.tips-card {
    background: var(--accent-subtle);
    border: 1px solid rgba(20, 21, 33, 0.12);
    border-radius: var(--radius-lg);
    padding: 14px var(--space-md);
    margin-bottom: var(--space-md);
}

.tips-text {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.tips-text strong {
    color: var(--accent);
}

/* 表单卡片 */
.form-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-md);
}

.form-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 600;
    margin-bottom: var(--space-md);
    color: var(--text-primary);
}

.form-title-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-inverse);
    font-size: 14px;
}

.form-group {
    margin-bottom: var(--space-md);
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

.form-label .required {
    color: var(--danger);
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    font-size: 14px;
    color: var(--text-primary);
    outline: none;
    transition: all 0.2s;
    font-family: inherit;
}

.form-textarea {
    resize: none;
    min-height: 100px;
    line-height: 1.6;
}

.form-input:focus,
.form-textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-muted);
}

/* 选项按钮组 */
.option-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-sm);
}

.option-grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

.option-btn {
    padding: 10px var(--space-sm);
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
}

.option-btn:active {
    transform: scale(0.98);
}

.option-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--text-inverse);
    border-color: transparent;
}

/* 主按钮 */
.submit-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--text-inverse);
    border: none;
    border-radius: 100px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.submit-btn:active:not(:disabled) {
    transform: scale(0.98);
}

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

/* 结果区域 */
.result-section {
    display: none;
}

.result-section.show {
    display: block;
}

.result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-md);
}

.result-title {
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}

.result-title i,
.result-title svg {
    color: var(--accent);
}

/* 结果卡片 */
.result-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: var(--space-md);
}

.result-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px var(--space-md);
    border-bottom: 1px solid var(--border-light);
}

.result-card-content {
    padding: var(--space-md);
    font-size: 14px;
    line-height: 1.8;
    white-space: pre-wrap;
    word-break: break-word;
}

/* 列表项 */
.list-item {
    padding: 14px var(--space-md);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

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

.list-item-num {
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--text-inverse);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

.list-item-content {
    flex: 1;
    font-size: 14px;
    line-height: 1.6;
}

/* 操作按钮 */
.action-btn {
    padding: 6px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 100px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}

.action-btn:active {
    transform: scale(0.95);
}

.action-btn.primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--text-inverse);
    border: none;
}

.copy-btn {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    padding: 4px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* 标签 */
.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.tag-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    background: var(--accent-subtle);
    border: 1px solid rgba(20, 21, 33, 0.16);
    border-radius: 100px;
    font-size: 13px;
    color: var(--accent);
    cursor: pointer;
    transition: all 0.2s;
}

.tag-item:active {
    transform: scale(0.95);
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: var(--space-md);
}

.stat-item {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 14px;
    text-align: center;
}

.stat-num {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.stat-num.danger { color: var(--danger); }
.stat-num.warning { color: var(--warning); }
.stat-num.success { color: var(--success); }

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
}

/* 问题项 */
.issue-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
}

.issue-item:last-child {
    margin-bottom: 0;
}

.issue-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
}

.issue-icon.danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.issue-icon.warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.issue-content {
    flex: 1;
}

.issue-word {
    font-weight: 600;
    color: var(--danger);
}

.issue-type {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* 加载状态 */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    flex-direction: column;
    gap: var(--space-md);
}

.loading-overlay.show {
    display: flex;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Toast提示 */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: var(--text-inverse);
    padding: 12px 24px;
    border-radius: 100px;
    font-size: 14px;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
}

/* 图片网格 */
.images-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
}

.image-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-secondary);
}

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

.image-download {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 错误提示 */
.error-msg {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: var(--danger);
    padding: 12px var(--space-md);
    border-radius: var(--radius-md);
    font-size: 14px;
    margin-bottom: var(--space-md);
    display: none;
}

.error-msg.show {
    display: block;
}

/* 字符计数 */
.char-count {
    position: absolute;
    bottom: 10px;
    right: 14px;
    font-size: 12px;
    color: var(--text-muted);
}

.textarea-wrapper {
    position: relative;
}

/* 分组标题 */
.group-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* 隐藏的文件输入 */
#fileInput {
    display: none;
}

/* 上传区域 */
.upload-card {
    background: var(--bg-card);
    border: 2px dashed var(--border-medium);
    border-radius: var(--radius-lg);
    padding: 40px var(--space-lg);
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: var(--space-md);
}

.upload-card:active {
    border-color: var(--accent);
    background: var(--accent-subtle);
}

.upload-card.has-image {
    padding: var(--space-md);
    border-style: solid;
}

.upload-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-md);
    color: var(--text-inverse);
    font-size: 28px;
}

.upload-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: var(--space-sm);
}

.upload-desc {
    font-size: 14px;
    color: var(--text-muted);
}

.preview-image {
    width: 100%;
    max-height: 300px;
    object-fit: contain;
    border-radius: var(--radius-md);
}

.image-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}
