/* ============================================
   AI Works - 秒哒风格 UI 视觉系统 v2.0
   轻量化简约科技风 · 浅白底色 + 淡青科技辅色
   ============================================ */

/* === 色彩变量 === */
:root {
    --primary: #4A90E2;
    --primary-hover: #357ABD;
    --primary-light: #6CB4EE;
    --primary-bg: rgba(74, 144, 226, 0.08);
    --primary-bg-deep: rgba(74, 144, 226, 0.12);
    
    --success: #2ECC71;
    --warning: #F39C12;
    --danger: #E74C3C;
    --info: #3498DB;
    
    --bg-primary: #FAFBFD;
    --bg-secondary: #FFFFFF;
    --bg-surface: #F5F6F8;
    --bg-hover: #F0F2F7;
    --bg-active: #EBEEF5;
    
    --text-primary: #1A1D26;
    --text-secondary: #6B7280;
    --text-tertiary: #9CA3AF;
    --text-disabled: #D1D5DB;
    
    --border: #E5E7EB;
    --border-focus: #4A90E2;
    
    --shadow-card: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.02);
    --shadow-hover: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.1), 0 4px 8px rgba(0,0,0,0.04);
    --shadow-float: 0 12px 36px rgba(0,0,0,0.12);
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;
    --radius-full: 9999px;
}

/* === 全局基础 === */
* { box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* === 过渡动效 === */
.fade-in { animation: fadeIn 0.3s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.slide-up { animation: slideUp 0.4s ease-out; }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

.scale-in { animation: scaleIn 0.25s ease-out; }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }

.pulse-dot { animation: pulseDot 2s infinite; }
@keyframes pulseDot { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* === 顶部导航栏 === */
.topbar {
    height: 56px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 0 rgba(0,0,0,0.03);
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    padding: 0 20px;
}

.topbar-brand {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.5px;
}

.topbar-nav { margin-left: 40px; display: flex; gap: 4px; }
.topbar-nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: all 0.15s ease;
}
.topbar-nav-link:hover { background: var(--bg-hover); color: var(--text-primary); }
.topbar-nav-link.active { background: var(--primary-bg); color: var(--primary); font-weight: 500; }

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

/* === 侧边菜单 === */
.sidebar-wrapper { position: fixed; top: 56px; left: 0; bottom: 0; width: 210px; background: var(--bg-secondary); border-right: 1px solid var(--border); z-index: 900; overflow-y: auto; padding-top: 12px; }

.sidebar-section { padding: 0 10px; margin-bottom: 8px; }
.sidebar-section-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 12px 4px;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13.5px;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}
.sidebar-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.sidebar-item.active { background: var(--primary-bg); color: var(--primary); font-weight: 500; }
.sidebar-item i { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.85; }
.sidebar-item .badge-count {
    margin-left: auto;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    padding: 1px 6px;
    border-radius: var(--radius-full);
    font-weight: 600;
}

/* === 主内容区 === */
.main-wrapper { margin-left: 210px; margin-top: 56px; min-height: calc(100vh - 56px); }
.main-content { padding: 24px; max-width: 1200px; }
.main-content.full-width { max-width: 100%; }

/* === 卡片组件 === */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: box-shadow 0.2s ease, transform 0.15s ease;
}
.card:hover { box-shadow: var(--shadow-hover); }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-body { padding: 20px; }
.card-footer { padding: 12px 20px; border-top: 1px solid var(--border); background: var(--bg-surface); }

/* === 统计卡片 === */
.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: all 0.2s ease;
    cursor: default;
}
.stat-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); border-color: transparent; }
.stat-card .stat-icon {
    width: 40px; height: 40px;
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    margin-bottom: 12px;
}
.stat-card .stat-value { font-size: 28px; font-weight: 700; color: var(--text-primary); line-height: 1.2; }
.stat-card .stat-label { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }
.stat-card .stat-trend { font-size: 12px; margin-top: 8px; }
.stat-card .stat-trend.up { color: var(--success); }
.stat-card .stat-trend.down { color: var(--danger); }

/* === 按钮系统 === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s ease;
    white-space: nowrap;
    text-decoration: none;
    line-height: 1.5;
}
.btn:active { transform: scale(0.98); }

.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }

.btn-outline { background: transparent; border-color: var(--border); color: var(--text-secondary); }
.btn-outline:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--text-tertiary); }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(0.9); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(0.9); }

.btn-warning { background: var(--warning); color: #fff; }

.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: var(--radius-sm); }
.btn-lg { padding: 11px 22px; font-size: 15px; border-radius: var(--radius-md); }
.btn-block { width: 100%; }
.btn-icon { padding: 8px; }

/* === 表单组件 === */
.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-secondary);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    outline: none;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-bg); }
.form-control::placeholder { color: var(--text-tertiary); }

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

.form-hint { font-size: 12px; color: var(--text-tertiary); margin-top: 4px; }

.input-group { display: flex; gap: 8px; }

/* === 标签系统 === */
.tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 11.5px;
    font-weight: 500;
    line-height: 1.5;
}
.tag-free { background: #E8F8F0; color: #2E7D50; }
.tag-paid { background: #FFF3E0; color: #D97706; }
.tag-hot { background: #FEE2E2; color: #DC2626; }
.tag-vip { background: #EDE9FE; color: #7C3AED; }
.tag-new { background: #DBEAFE; color: #2563EB; }
.tag-default { background: var(--bg-surface); color: var(--text-secondary); }

/* === 表格样式 === */
.table-wrap { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.table-wrap table { width: 100%; border-collapse: collapse; }
.table-wrap th {
    padding: 12px 16px;
    text-align: left;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.table-wrap td { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 13.5px; vertical-align: middle; }
.table-wrap tr:last-child td { border-bottom: none; }
.table-wrap tr:hover td { background: var(--bg-hover); }

/* === 搜索栏 === */
.search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: all 0.15s ease;
}
.search-bar:focus-within { border-color: var(--primary); background: var(--bg-secondary); box-shadow: 0 0 0 3px var(--primary-bg); }
.search-bar input { border: none; background: transparent; outline: none; flex: 1; font-size: 14px; color: var(--text-primary); }
.search-bar input::placeholder { color: var(--text-tertiary); }
.search-bar .search-icon { color: var(--text-tertiary); flex-shrink: 0; }

/* === Tab 标签切换 === */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); }
.tab-item {
    padding: 10px 18px;
    font-size: 13.5px;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.15s ease;
    user-select: none;
}
.tab-item:hover { color: var(--text-primary); }
.tab-item.active { color: var(--primary); font-weight: 500; border-bottom-color: var(--primary); }

/* === 分类筛选栏 === */
.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; }
.chip {
    padding: 5px 12px;
    border-radius: var(--radius-full);
    font-size: 13px;
    color: var(--text-secondary);
    background: var(--bg-surface);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
}
.chip:hover { background: var(--bg-hover); color: var(--text-primary); }
.chip.active { background: var(--primary); color: #fff; }

/* === Toast 通知 === */
.toast-container { position: fixed; top: 68px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
    padding: 12px 18px;
    border-radius: var(--radius-md);
    font-size: 13.5px;
    box-shadow: var(--shadow-float);
    animation: toastIn 0.3s ease-out;
    display: flex; align-items: center; gap: 8px;
    max-width: 360px;
    min-width: 240px;
}
.toast.hide { animation: toastOut 0.3s ease-in forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(40px); } }
.toast-success { background: #DCFCE7; color: #166534; border: 1px solid #BBF7D0; }
.toast-error { background: #FEE2E2; color: #991B1B; border: 1px solid #FECACA; }
.toast-warning { background: #FEF3C7; color: #92400E; border: 1px solid #FDE68A; }
.toast-info { background: #DBEAFE; color: #1E40AF; border: 1px solid #BFDBFE; }

/* === Loading 骨架屏 === */
.skeleton { background: linear-gradient(90deg, var(--bg-surface) 25%, var(--bg-hover) 50%, var(--bg-surface) 75%); background-size: 200% 100%; animation: skeletonShimmer 1.5s infinite; border-radius: var(--radius-sm); }
@keyframes skeletonShimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.spinner {
    display: inline-block;
    width: 18px; height: 18px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* === 折叠面板 === */
.accordion-item { border: 1px solid var(--border); border-radius: var(--radius-md); margin-bottom: 8px; background: var(--bg-secondary); }
.accordion-header { padding: 14px 16px; cursor: pointer; display: flex; align-items: center; justify-content: space-between; font-weight: 500; transition: background 0.15s; user-select: none; }
.accordion-header:hover { background: var(--bg-hover); }
.accordion-body { padding: 0 16px; max-height: 0; overflow: hidden; transition: max-height 0.3s ease, padding 0.3s ease; }
.accordion-item.open .accordion-body { max-height: 500px; padding: 0 16px 16px; }
.accordion-arrow { transition: transform 0.2s ease; }
.accordion-item.open .accordion-arrow { transform: rotate(180deg); }

/* === Hero 区域 === */
.hero-section {
    text-align: center;
    padding: 60px 20px 40px;
    background: linear-gradient(180deg, var(--bg-primary) 0%, #EEF4FF 100%);
}
.hero-title {
    font-size: 36px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary) 0%, #7C3AED 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
}
.hero-subtitle { font-size: 16px; color: var(--text-secondary); margin-bottom: 32px; }

/* === Prompt 输入框（Hero 核心） === */
.prompt-input {
    max-width: 640px;
    margin: 0 auto;
    background: var(--bg-secondary);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow-lg);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.prompt-input:focus-within { border-color: var(--primary); box-shadow: var(--shadow-lg), 0 0 0 3px var(--primary-bg); }
.prompt-input textarea {
    flex: 1; border: none; outline: none; resize: none; font-size: 15px;
    font-family: inherit; color: var(--text-primary); background: transparent;
    min-height: 24px; max-height: 120px; line-height: 1.5;
}
.prompt-input textarea::placeholder { color: var(--text-tertiary); }
.prompt-send-btn {
    padding: 6px 14px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}
.prompt-send-btn:hover { background: var(--primary-hover); }

/* === 应用广场卡片 === */
.app-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all 0.2s ease;
    cursor: pointer;
}
.app-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-3px); border-color: transparent; }
.app-card-img { width: 100%; aspect-ratio: 16/10; object-fit: cover; background: var(--bg-surface); }
.app-card-body { padding: 14px; }
.app-card-title { font-size: 14px; font-weight: 600; margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-card-desc { font-size: 12px; color: var(--text-secondary); margin-bottom: 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.app-card-footer { display: flex; align-items: center; justify-content: space-between; }
.app-card-meta { display: flex; gap: 10px; font-size: 11px; color: var(--text-tertiary); }

/* === 空状态 === */
.empty-state { text-align: center; padding: 48px 20px; }
.empty-state-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.4; }
.empty-state-text { color: var(--text-secondary); font-size: 14px; margin-bottom: 16px; }

/* === 分页 === */
.pagination { display: flex; gap: 4px; justify-content: center; padding: 16px 0; }
.page-btn {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}
.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* === 模态弹窗 === */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex; align-items: center; justify-content: center;
    animation: fadeIn 0.2s ease-out;
}
.modal-box {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-float);
    width: 90%;
    max-width: 500px;
    max-height: 85vh;
    overflow-y: auto;
    animation: scaleIn 0.2s ease-out;
}
.modal-header { padding: 18px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 16px; font-weight: 600; }
.modal-close { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); cursor: pointer; color: var(--text-tertiary); transition: all 0.15s; }
.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.modal-body { padding: 20px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }

/* === Chat 对话气泡 === */
.chat-bubble { padding: 10px 14px; border-radius: var(--radius-md); margin-bottom: 8px; max-width: 85%; font-size: 14px; line-height: 1.6; }
.chat-bubble.user { background: var(--primary); color: #fff; margin-left: auto; border-bottom-right-radius: 2px; }
.chat-bubble.ai { background: var(--bg-surface); color: var(--text-primary); border: 1px solid var(--border); margin-right: auto; border-bottom-left-radius: 2px; }

/* === 进度条 === */
.progress-bar { height: 4px; background: var(--bg-surface); border-radius: var(--radius-full); overflow: hidden; }
.progress-bar-fill { height: 100%; background: var(--primary); border-radius: var(--radius-full); transition: width 0.5s ease; }

/* === 响应式 === */
@media (max-width: 768px) {
    .sidebar-wrapper { display: none; }
    .main-wrapper { margin-left: 0; }
    .hero-title { font-size: 26px; }
    .hero-subtitle { font-size: 14px; }
    .prompt-input { flex-direction: column; }
    .prompt-input textarea { width: 100%; }
    .main-content { padding: 16px; }
    .topbar-nav { display: none; }
}

/* 移除 Bootstrap 默认 bg-light 冲突 */
.bg-light { background-color: var(--bg-primary) !important; }
