/* ============ 现代化设计系统 ============ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #4f46e5;
    --primary-light: #6366f1;
    --primary-dark: #4338ca;
    --primary-glow: rgba(79, 70, 229, 0.15);
    --accent: #06b6d4;
    --accent-light: #22d3ee;
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --background: #f8fafc;
    --surface: #ffffff;
    --surface-alt: #f1f5f9;
    --foreground: #0f172a;
    --foreground-muted: #475569;
    --foreground-subtle: #94a3b8;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.08), 0 8px 10px -6px rgba(0,0,0,0.04);
    --shadow-primary: 0 4px 14px rgba(79,70,229,0.25);
    --radius-sm: 0.5rem;
    --radius: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.25rem;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
    background-color: var(--background);
    color: var(--foreground);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 容器 */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.25rem;
}

.min-h-screen { min-height: 100vh; }

/* ============ 背景 ============ */
.bg-background { background-color: var(--background); }
.bg-white { background-color: var(--surface); }
.bg-gray-50 { background-color: #f9fafb; }
.bg-primary { background-color: var(--primary); }
.bg-primary\/10 { background-color: var(--primary-glow); }
.bg-primary\/90 { background-color: rgba(79,70,229,0.9); }
.bg-red-50 { background-color: var(--danger-light); }
.bg-red-100 { background-color: #fee2e2; }
.bg-green-100 { background-color: var(--success-light); }
.bg-yellow-100 { background-color: var(--warning-light); }
.bg-blue-50 { background-color: #eff6ff; }

/* ============ 文字颜色 ============ */
.text-primary { color: var(--primary); }
.text-white { color: #fff; }
.text-foreground { color: var(--foreground); }
.text-gray-500 { color: var(--foreground-subtle); }
.text-gray-600 { color: var(--foreground-muted); }
.text-red-500 { color: var(--danger); }
.text-red-600 { color: #dc2626; }
.text-red-700 { color: #b91c1c; }
.text-green-600 { color: var(--success); }
.text-green-700 { color: #15803d; }
.text-yellow-600 { color: var(--warning); }
.text-blue-600 { color: #2563eb; }
.text-blue-700 { color: #1d4ed8; }
.text-blue-800 { color: #1e40af; }
.text-muted-foreground { color: var(--foreground-muted); }

/* ============ 边框 ============ */
.border { border: 1px solid var(--border); }
.border-t { border-top: 1px solid var(--border); }
.border-b { border-bottom: 1px solid var(--border); }
.border-primary { border-color: var(--primary); }
.border-gray-200 { border-color: var(--border); }
.border-gray-300 { border-color: #d1d5db; }
.border-blue-200 { border-color: #bfdbfe; }
.border-2 { border-width: 2px; }
.border-dashed { border-style: dashed; }
.rounded { border-radius: var(--radius-sm); }
.rounded-lg { border-radius: var(--radius); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-full { border-radius: 9999px; }

/* ============ 阴影 ============ */
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.shadow-xl { box-shadow: var(--shadow-xl); }

/* ============ 布局 ============ */
.flex { display: flex; }
.grid { display: grid; }
.hidden { display: none; }
.inline-block { display: inline-block; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.gap-8 { gap: 2rem; }
.gap-10 { gap: 2.5rem; }
.space-x-2 > * + * { margin-left: 0.5rem; }
.space-x-4 > * + * { margin-left: 1rem; }
.space-x-8 > * + * { margin-left: 2rem; }
.space-y-1 > * + * { margin-top: 0.25rem; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }
.space-y-8 > * + * { margin-top: 2rem; }
.space-y-12 > * + * { margin-top: 3rem; }
.space-y-16 > * + * { margin-top: 4rem; }

/* ============ 网格 ============ */
.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
.col-span-1 { grid-column: span 1; }
.col-span-2 { grid-column: span 2; }
.col-span-3 { grid-column: span 3; }
.col-span-4 { grid-column: span 4; }
.col-span-full { grid-column: 1 / -1; }

/* ============ 间距 ============ */
.p-0 { padding: 0; }
.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-5 { padding: 1.25rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }
.p-10 { padding: 2.5rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-5 { padding-left: 1.25rem; padding-right: 1.25rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.px-8 { padding-left: 2rem; padding-right: 2rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-6 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.py-12 { padding-top: 3rem; padding-bottom: 3rem; }
.pt-2 { padding-top: 0.5rem; }
.pt-8 { padding-top: 2rem; }
.pb-1 { padding-bottom: 0.25rem; }
.mx-auto { margin-left: auto; margin-right: auto; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.mt-12 { margin-top: 3rem; }
.mt-16 { margin-top: 4rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mb-12 { margin-bottom: 3rem; }
.ml-2 { margin-left: 0.5rem; }
.mr-2 { margin-right: 0.5rem; }

/* ============ 排版 ============ */
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-base { font-size: 1rem; line-height: 1.5rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
.text-3xl { font-size: 1.875rem; line-height: 2.25rem; }
.text-4xl { font-size: 2.25rem; line-height: 2.5rem; }
.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.leading-none { line-height: 1; }
.leading-relaxed { line-height: 1.625; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============ 交互 ============ */
.cursor-pointer { cursor: pointer; }
.hover\:bg-gray-50:hover { background-color: #f9fafb; }
.hover\:bg-gray-100:hover { background-color: #f3f4f6; }
.hover\:bg-primary\/90:hover { background-color: rgba(79,70,229,0.9); }
.hover\:text-primary:hover { color: var(--primary); }
.hover\:underline:hover { text-decoration: underline; }
.hover\:shadow-lg:hover { box-shadow: var(--shadow-lg); }
.hover\:shadow-xl:hover { box-shadow: var(--shadow-xl); }
.focus\:outline-none:focus { outline: none; }
.focus\:border-primary:focus { border-color: var(--primary); }
.focus\:ring-2:focus { box-shadow: 0 0 0 3px var(--primary-glow); }
.transition { transition: all 0.2s ease; }
.transition-transform { transition: transform 0.2s ease; }

/* ============ 表单基础 ============ */
input, textarea, select {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
input:focus, textarea:focus, select:focus { outline: none; }
.form-input {
    width: 100%;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
    transition: all 0.2s;
    background: var(--surface);
}
.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

/* ============ 按钮基础 ============ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    padding: 0.625rem 1.25rem;
    font-size: 0.9375rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    text-decoration: none;
    line-height: 1.5;
}
.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    box-shadow: var(--shadow-primary);
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(79,70,229,0.35);
}
.btn-outline {
    background: var(--surface);
    color: var(--foreground);
    border: 1.5px solid var(--border);
}
.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-glow);
}
.btn-danger {
    background: var(--danger);
    color: #fff;
}
.btn-danger:hover {
    background: #dc2626;
}
.btn-ghost {
    background: transparent;
    color: var(--foreground-muted);
}
.btn-ghost:hover {
    background: var(--surface-alt);
    color: var(--foreground);
}
.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    border-radius: var(--radius-sm);
}
.btn-lg {
    padding: 0.75rem 1.75rem;
    font-size: 1.0625rem;
    border-radius: var(--radius);
}

/* ============ 卡片 ============ */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}
.card-hover:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}
.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
}
.card-body {
    padding: 1.5rem;
}

/* ============ 定位 ============ */
.fixed { position: fixed; }
.sticky { position: sticky; }
.relative { position: relative; }
.absolute { position: absolute; }
.top-0 { top: 0; }
.right-6 { right: 1.5rem; }
.bottom-6 { bottom: 1.5rem; }
.z-40 { z-index: 40; }
.z-50 { z-index: 50; }

/* ============ 尺寸 ============ */
.w-full { width: 100%; }
.w-auto { width: auto; }
.w-6 { width: 1.5rem; }
.w-8 { width: 2rem; }
.w-10 { width: 2.5rem; }
.w-12 { width: 3rem; }
.w-16 { width: 4rem; }
.w-20 { width: 5rem; }
.w-32 { width: 8rem; }
.w-96 { width: 24rem; }
.max-w-3xl { max-width: 48rem; }
.max-w-4xl { max-width: 56rem; }
.max-w-5xl { max-width: 64rem; }
.max-w-lg { max-width: 32rem; }
.h-6 { height: 1.5rem; }
.h-8 { height: 2rem; }
.h-10 { height: 2.5rem; }
.h-12 { height: 3rem; }
.h-14 { height: 3.5rem; }
.h-16 { height: 4rem; }
.h-20 { height: 5rem; }
.h-40 { height: 10rem; }
.min-h-16 { min-height: 4rem; }

/* ============ 溢出 ============ */
.overflow-hidden { overflow: hidden; }
.overflow-x-auto { overflow-x: auto; }

/* ============ 滚动边距 ============ */
.scroll-mt-20 { scroll-margin-top: 5rem; }

/* 字体 */
.font-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }

/* 背景模糊 */
.backdrop-blur { backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }

/* ============ 动画 ============ */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}
.animate-fade-in { animation: fadeIn 0.5s ease forwards; }
.animate-fade-up { animation: fadeInUp 0.5s ease forwards; }
.animate-scale-in { animation: scaleIn 0.3s ease forwards; }

/* ============ 响应式 ============ */
@media (min-width: 768px) {
    .md\:flex { display: flex; }
    .md\:hidden { display: none; }
    .md\:col-span-1 { grid-column: span 1; }
    .md\:col-span-2 { grid-column: span 2; }
    .md\:col-span-3 { grid-column: span 3; }
    .md\:grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
    .md\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
    .md\:grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
    .md\:text-base { font-size: 1rem; }
    .md\:text-lg { font-size: 1.125rem; }
    .md\:text-2xl { font-size: 1.5rem; }
    .md\:text-3xl { font-size: 1.875rem; }
    .md\:text-6xl { font-size: 3.75rem; }
}
@media (min-width: 1024px) {
    .lg\:grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
}

/* ============ 移动端断点 ============ */
@media (max-width: 767px) {
    .container { padding: 0 1rem; }
    .card { border-radius: var(--radius); }
    .card-header { padding: 1rem 1.25rem; }
    .card-body { padding: 1.25rem; }

    /* 网格强制单列 */
    .grid-cols-2, .grid-cols-3, .grid-cols-4 { grid-template-columns: repeat(1, 1fr) !important; }
    .md\:grid-cols-2, .md\:grid-cols-3, .md\:grid-cols-4 { grid-template-columns: repeat(1, 1fr) !important; }

    /* 间距缩小 */
    .p-6 { padding: 1rem; }
    .p-8 { padding: 1.25rem; }
    .p-10 { padding: 1.5rem; }
    .px-6 { padding-left: 1rem; padding-right: 1rem; }
    .px-8 { padding-left: 1.25rem; padding-right: 1.25rem; }
    .py-8 { padding-top: 1.25rem; padding-bottom: 1.25rem; }
    .py-12 { padding-top: 2rem; padding-bottom: 2rem; }
    .gap-6 { gap: 1rem; }
    .gap-8 { gap: 1.25rem; }
    .gap-10 { gap: 1.5rem; }

    /* 宽度自适应 */
    .w-96 { width: 100% !important; max-width: 24rem; }

    /* 字号缩小 */
    .text-3xl { font-size: 1.5rem; line-height: 1.75rem; }
    .text-4xl { font-size: 1.75rem; line-height: 2rem; }
    .text-xl { font-size: 1.1rem; }

    /* 按钮全宽 */
    .btn-lg { padding: 0.625rem 1.25rem; font-size: 0.95rem; }

    /* 弹性布局换行 */
    .flex.responsive-wrap { flex-wrap: wrap; }
    .flex.responsive-col { flex-direction: column; }
}

/* 极小屏 (iPhone SE 等) */
@media (max-width: 400px) {
    .container { padding: 0 0.75rem; }
    .p-4 { padding: 0.75rem; }
    .px-4 { padding-left: 0.75rem; padding-right: 0.75rem; }
    .text-2xl { font-size: 1.25rem; }
    .mt-8 { margin-top: 1rem; }
    .mb-8 { margin-bottom: 1rem; }
    .gap-4 { gap: 0.75rem; }
}
/* 移动端底部导航占位 */
.mobile-nav-spacer { display: none; }
@media (max-width: 767px) {
    .mobile-nav-spacer { display: block; height: 72px; }
}

/* ============ 移动端底部导航栏（现代App风格） ============ */
.mobile-bottom-nav {
    display: none;
}
@media (max-width: 767px) {
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0; left: 0; right: 0;
        z-index: 100;
        height: 64px;
        padding: 0 16px env(safe-area-inset-bottom, 0);
        background: rgba(255,255,255,0.85);
        backdrop-filter: saturate(180%) blur(20px);
        -webkit-backdrop-filter: saturate(180%) blur(20px);
        border-top: 1px solid rgba(255,255,255,0.6);
        box-shadow: 0 -1px 0 rgba(0,0,0,0.05), 0 -8px 32px rgba(0,0,0,0.08);
        justify-content: space-around;
        align-items: center;
    }
    .mobile-bottom-nav .mnav-item {
        position: relative;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        padding: 6px 12px;
        border-radius: 14px;
        text-decoration: none;
        font-size: 10px;
        font-weight: 600;
        color: #94a3b8;
        transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
        min-width: 56px;
        -webkit-tap-highlight-color: transparent;
        user-select: none;
        -webkit-user-select: none;
    }
    .mobile-bottom-nav .mnav-item .mnav-icon {
        width: 24px; height: 24px;
        display: flex; align-items: center; justify-content: center;
        transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    }
    .mobile-bottom-nav .mnav-item .mnav-icon svg {
        width: 22px; height: 22px;
        transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    }
    .mobile-bottom-nav .mnav-item .mnav-label {
        transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    }
    /* 选中态 - 胶囊背景 */
    .mobile-bottom-nav .mnav-item.active {
        color: #4f46e5;
    }
    .mobile-bottom-nav .mnav-item.active::before {
        content: '';
        position: absolute;
        top: 4px;
        left: 50%;
        transform: translateX(-50%);
        width: 48px; height: 32px;
        border-radius: 16px;
        background: linear-gradient(135deg, rgba(79,70,229,0.12), rgba(99,102,241,0.08));
        z-index: -1;
        animation: navPillIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    .mobile-bottom-nav .mnav-item.active .mnav-icon svg {
        stroke: #4f46e5;
        filter: drop-shadow(0 2px 4px rgba(79,70,229,0.25));
    }
    .mobile-bottom-nav .mnav-item:active {
        transform: scale(0.92);
        transition: transform 0.1s;
    }
}

@keyframes navPillIn {
    from { opacity: 0; transform: translateX(-50%) scale(0.6); }
    to   { opacity: 1; transform: translateX(-50%) scale(1); }
}
