/*
 * ============================================
 * AI 需求收集系统 - 全局样式
 * ============================================
 * 
 * 基于 0045_视觉风格指南.md 的 Design Tokens
 * 风格: Minimalist Modern (极简现代)
 * 主色: Electric Blue (#0052FF)
 */

/* ============================================
   CSS 变量定义 (Design Tokens)
   ============================================ */
:root {
    /* 配色系统 */
    --background: #FAFAFA;
    /* 页面主背景（暖白） */
    --foreground: #0F172A;
    /* 主要文字 (Slate-900) */
    --muted: #F1F5F9;
    /* 次级背景/填充 (Slate-100) */
    --muted-foreground: #64748B;
    /* 次级文字 (Slate-500) */
    --accent: #0052FF;
    /* 核心主色 (Electric Blue) */
    --accent-secondary: #4D7CFF;
    /* 渐变辅助色 */
    --accent-light: #E6EDFF;
    /* 主色浅色版本 */
    --border: #E2E8F0;
    /* 边框颜色 (Slate-200) */
    --card: #FFFFFF;
    /* 卡片背景（纯白） */
    --ring: #0052FF;
    /* 聚焦光环颜色 */

    /* 语义色 */
    --success: #10B981;
    /* 成功绿 */
    --warning: #F59E0B;
    /* 警告橙 */
    --error: #EF4444;
    /* 错误红 */
    --info: #3B82F6;
    /* 信息蓝 */

    /* 圆角系统 */
    --radius-sm: 0.25rem;
    /* 4px - 小标签 */
    --radius-md: 0.5rem;
    /* 8px - 输入框、按钮 */
    --radius-lg: 0.75rem;
    /* 12px - 卡片、模态框 */
    --radius-xl: 1rem;
    /* 16px - 大卡片 */
    --radius-full: 9999px;
    /* 圆形 */

    /* 阴影系统 */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-card: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-elevated: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --shadow-glow: 0 0 20px rgba(0, 82, 255, 0.3);

    /* 间距系统 */
    --spacing-xs: 0.25rem;
    /* 4px */
    --spacing-sm: 0.5rem;
    /* 8px */
    --spacing-md: 1rem;
    /* 16px */
    --spacing-lg: 1.5rem;
    /* 24px */
    --spacing-xl: 2rem;
    /* 32px */
    --spacing-2xl: 3rem;
    /* 48px */

    /* 字体系统 */
    --font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    /* 字体大小 */
    --text-xs: 0.75rem;
    /* 12px */
    --text-sm: 0.875rem;
    /* 14px */
    --text-base: 1rem;
    /* 16px */
    --text-lg: 1.125rem;
    /* 18px */
    --text-xl: 1.25rem;
    /* 20px */
    --text-2xl: 1.5rem;
    /* 24px */
    --text-3xl: 1.875rem;
    /* 30px */
    --text-4xl: 2.25rem;
    /* 36px */

    /* 行高 */
    --leading-tight: 1.25;
    --leading-normal: 1.5;
    --leading-relaxed: 1.75;

    /* 过渡动画 */
    --transition-fast: 150ms ease;
    --transition-normal: 200ms ease;
    --transition-slow: 300ms ease;

    /* 布局 */
    --sidebar-width: 280px;
    --header-height: 64px;
    --max-content-width: 1200px;
}

/* ============================================
   基础重置与全局样式
   ============================================ */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: var(--foreground);
    background-color: var(--background);
    min-height: 100vh;
}

/* 链接样式 */
a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-secondary);
    text-decoration: underline;
}

/* 图片响应式 */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* 列表重置 */
ul,
ol {
    list-style: none;
}

/* 表单元素继承字体 */
button,
input,
select,
textarea {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
}

/* 隐藏元素 */
[hidden],
.hidden {
    display: none !important;
}

/* ============================================
   字体加载 (Google Fonts - Inter)
   ============================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ============================================
   实用工具类
   ============================================ */

/* 文本对齐 */
.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

/* 文本颜色 */
.text-muted {
    color: var(--muted-foreground);
}

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

.text-success {
    color: var(--success);
}

.text-warning {
    color: var(--warning);
}

.text-error {
    color: var(--error);
}

/* 文本大小 */
.text-xs {
    font-size: var(--text-xs);
}

.text-sm {
    font-size: var(--text-sm);
}

.text-lg {
    font-size: var(--text-lg);
}

.text-xl {
    font-size: var(--text-xl);
}

.text-2xl {
    font-size: var(--text-2xl);
}

.text-3xl {
    font-size: var(--text-3xl);
}

/* 字重 */
.font-light {
    font-weight: 300;
}

.font-normal {
    font-weight: 400;
}

.font-medium {
    font-weight: 500;
}

.font-semibold {
    font-weight: 600;
}

.font-bold {
    font-weight: 700;
}

/* Flex 布局 */
.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.flex-wrap {
    flex-wrap: wrap;
}

.items-center {
    align-items: center;
}

.items-start {
    align-items: flex-start;
}

.items-end {
    align-items: flex-end;
}

.justify-center {
    justify-content: center;
}

.justify-between {
    justify-content: space-between;
}

.justify-end {
    justify-content: flex-end;
}

.gap-sm {
    gap: var(--spacing-sm);
}

.gap-md {
    gap: var(--spacing-md);
}

.gap-lg {
    gap: var(--spacing-lg);
}

/* 间距 */
.m-0 {
    margin: 0;
}

.mt-sm {
    margin-top: var(--spacing-sm);
}

.mt-md {
    margin-top: var(--spacing-md);
}

.mt-lg {
    margin-top: var(--spacing-lg);
}

.mb-sm {
    margin-bottom: var(--spacing-sm);
}

.mb-md {
    margin-bottom: var(--spacing-md);
}

.mb-lg {
    margin-bottom: var(--spacing-lg);
}

.p-0 {
    padding: 0;
}

.p-sm {
    padding: var(--spacing-sm);
}

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

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

.p-xl {
    padding: var(--spacing-xl);
}

/* 宽度 */
.w-full {
    width: 100%;
}

.max-w-none {
    max-width: none !important;
}

.max-w-sm {
    max-width: 24rem;
}

.max-w-md {
    max-width: 28rem;
}

.max-w-lg {
    max-width: 32rem;
}

.max-w-xl {
    max-width: 36rem;
}

/* ============================================
   布局组件 (Layout)
   ============================================ */

.layout {
    display: flex;
    min-height: 100vh;
    background: var(--background);
}

.sidebar {
    width: var(--sidebar-width);
    background: #FFFFFF;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 50;
    transition: transform var(--transition-normal);
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: var(--spacing-xl);
    min-height: 100vh;
    transition: margin-left var(--transition-normal);
}

/* 响应式调整 */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .main-content {
        margin-left: 0;
    }

    .layout.sidebar-open .sidebar {
        transform: translateX(0);
    }
}

/* ============================================
   渐变背景
   ============================================ */

/* 登录页面渐变背景 */
.gradient-bg {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

/* 主色渐变背景 */
.gradient-accent {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-secondary) 100%);
}

/* 微妙渐变背景 */
.gradient-subtle {
    background: linear-gradient(180deg, var(--background) 0%, var(--muted) 100%);
}

/* ============================================
   动画关键帧
   ============================================ */

/* 淡入动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 呼吸动画（用于加载状态） */
@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* 旋转动画 */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* 上浮动画 */
@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

/* 闪烁光标 */
@keyframes blink {

    0%,
    50% {
        opacity: 1;
    }

    51%,
    100% {
        opacity: 0;
    }
}

/* 动画类 */
.animate-fadeIn {
    animation: fadeIn 0.3s ease-out;
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.animate-spin {
    animation: spin 1s linear infinite;
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}

/* ============================================
   响应式断点
   ============================================ */

/* 移动端优先 */
@media (max-width: 640px) {
    :root {
        --text-base: 0.9375rem;
        /* 15px */
    }

    .hide-mobile {
        display: none !important;
    }
}

/* 平板 */
@media (min-width: 641px) and (max-width: 1024px) {
    .hide-tablet {
        display: none !important;
    }
}

/* 桌面 */
@media (min-width: 1025px) {
    .hide-desktop {
        display: none !important;
    }
}

/* ============================================
   滚动条样式
   ============================================ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--muted);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--muted-foreground);
}

/* ============================================
   选择高亮样式
   ============================================ */
::selection {
    background: var(--accent-light);
    color: var(--accent);
}

/* ============================================
   补充实用工具类 (Missing Utilities)
   ============================================ */

/* 定位 */
.relative {
    position: relative;
}

.absolute {
    position: absolute;
}

.fixed {
    position: fixed;
}

.inset-0 {
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}

/* 尺寸 */
.h-full {
    height: 100%;
}

.w-full {
    width: 100%;
}

.min-h-0 {
    min-height: 0;
}

/* Flex 增强 */
.flex-1 {
    flex: 1 1 0%;
}

.shrink-0 {
    flex-shrink: 0;
}

.grow {
    flex-grow: 1;
}

/* 溢出与重置 */
.overflow-hidden {
    overflow: hidden;
}

.overflow-y-auto {
    overflow-y: auto;
}

.resize-none {
    resize: none;
}

/* 响应式 Flex */
@media (min-width: 1025px) {
    .lg\:flex-row {
        flex-direction: row !important;
    }

    .lg\:hidden {
        display: none !important;
    }
}


/* ============================================
   焦点可见样式（无障碍）
   ============================================ */
:focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
}

/* 移除默认焦点框 */
:focus:not(:focus-visible) {
    outline: none;
}

/* ============================================
   排版样式 (Typography / Prose)
   用于渲染 Markdown 内容
   ============================================ */

.prose {
    color: var(--foreground);
    max-width: 65ch;
    line-height: var(--leading-relaxed);
}

.prose> :first-child {
    margin-top: 0;
}

.prose> :last-child {
    margin-bottom: 0;
}

/* 标题 */
.prose h1,
.prose h2,
.prose h3,
.prose h4 {
    color: var(--foreground);
    font-weight: 600;
    line-height: var(--leading-tight);
    margin-top: var(--spacing-xl);
    margin-bottom: var(--spacing-md);
}

.prose h1 {
    font-size: var(--text-2xl);
}

.prose h2 {
    font-size: var(--text-xl);
    padding-bottom: var(--spacing-sm);
    border-bottom: 1px solid var(--border);
}

.prose h3 {
    font-size: var(--text-lg);
}

.prose h4 {
    font-size: var(--text-base);
}

/* 段落 */
.prose p {
    margin-bottom: var(--spacing-md);
}

/* 链接 */
.prose a {
    color: var(--accent);
    text-decoration: underline;
    font-weight: 500;
}

.prose a:hover {
    color: var(--accent-secondary);
}

/* 列表 */
.prose ul,
.prose ol {
    margin-bottom: var(--spacing-md);
    padding-left: var(--spacing-lg);
}

.prose ul {
    list-style-type: disc;
}

.prose ol {
    list-style-type: decimal;
}

.prose li {
    margin-bottom: var(--spacing-xs);
}

/* 引用 */
.prose blockquote {
    font-style: italic;
    color: var(--muted-foreground);
    border-left: 4px solid var(--accent-light);
    padding-left: var(--spacing-md);
    margin-left: 0;
    margin-bottom: var(--spacing-md);
}

/* 代码 */
.prose code {
    font-family: var(--font-mono);
    font-size: 0.875em;
    color: var(--accent);
    background: var(--muted);
    padding: 0.2em 0.4em;
    border-radius: var(--radius-sm);
}

.prose pre {
    background: #1e293b;
    color: #f8fafc;
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin-bottom: var(--spacing-md);
}

.prose pre code {
    background: transparent;
    padding: 0;
    color: inherit;
    font-size: 0.875em;
}

/* 表格 */
.prose table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: var(--spacing-lg);
    font-size: var(--text-sm);
}

.prose th,
.prose td {
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid var(--border);
    text-align: left;
}

.prose th {
    background: var(--muted);
    font-weight: 600;
    color: var(--foreground);
}

.prose tr:nth-child(even) {
    background: #f8fafc;
}

/* 分割线 */
.prose hr {
    border: 0;
    border-top: 1px solid var(--border);
    margin: var(--spacing-xl) 0;
}