/* ============================================
   Base Framework Stylesheet
   框架级公共样式（不含头部、内容、底部样式）

   包含：
   1. CSS Reset / 浏览器兼容性重置
   2. CSS Custom Properties / 主题变量
   3. Element Plus Theme Overrides / 组件主题覆写
   4. Global Typography / 全局排版
   5. Layout Utilities / 布局工具类
   6. Responsive Breakpoints / 响应式断点
   7. Browser Compatibility Fixes / 浏览器兼容修补
   ============================================ */

/* Vue CDN 模式：防止 Vue 挂载前组件原始 HTML 闪烁 */
[v-cloak] {
    display: none !important;
}


/* ============================================================
   1. CSS Reset / 浏览器兼容性重置
   ============================================================ */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body,
div,
span,
h1, h2, h3, h4, h5, h6,
p, blockquote, pre,
a, abbr, address, cite, code,
del, em, img, ins, kbd, q, s, samp, small, strong, sub, sup, var,
b, u, i,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, details, figcaption, figure,
footer, header, main, menu, nav, section, summary {
    margin: 0;
    padding: 0;
}

/* HTML5 语义元素块级显示 */
article, aside, details, figcaption, figure,
footer, header, main, menu, nav, section {
    display: block;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* 链接 */
a {
    background-color: transparent;
    text-decoration: none;
    color: inherit;
}

a:hover {
    text-decoration: none;
}

/* 图片 */
img {
    border: 0;
    max-width: 100%;
    height: auto;
    vertical-align: middle;
    -ms-interpolation-mode: bicubic;
}

/* 列表 */
ol, ul {
    list-style: none;
}

/* 表格 */
table {
    border-collapse: collapse;
    border-spacing: 0;
}

/* 表单 */
button, input, optgroup, select, textarea {
    font-family: inherit;
    font-size: 100%;
    line-height: 1.15;
    margin: 0;
}

button, input {
    overflow: visible;
    outline: none;
}

button, select {
    text-transform: none;
}

button,
[type="button"],
[type="reset"],
[type="submit"] {
    -webkit-appearance: button;
    appearance: button;
    cursor: pointer;
}

button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner {
    border-style: none;
    padding: 0;
}

button:-moz-focusring,
[type="button"]:-moz-focusring,
[type="reset"]:-moz-focusring,
[type="submit"]:-moz-focusring {
    outline: 1px dotted ButtonText;
}

textarea {
    overflow: auto;
    vertical-align: top;
    resize: vertical;
}

/* 清除 IE 输入框清除按钮 */
input::-ms-clear,
input::-ms-reveal {
    display: none;
}

/* Placeholder */
::-webkit-input-placeholder {
    color: #999;
    opacity: 1;
}

::-moz-placeholder {
    color: #999;
    opacity: 1;
}

:-ms-input-placeholder {
    color: #999;
    opacity: 1;
}

::placeholder {
    color: #999;
    opacity: 1;
}

/* 文字选中 */
::selection {
    background: var(--portal-primary, #c62828);
    color: #fff;
}

/* iOS 点击高亮 */
a, button, input, textarea {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

/* iOS 安全区域 */
@supports (padding: env(safe-area-inset-top)) {
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* Safari 弹窗锁定滚动修复 */
@supports (-webkit-touch-callout: none) {
    body.modal-open {
        position: fixed;
        width: 100%;
    }
}

/* Webkit 滚动条 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #999;
}


/* ============================================================
   2. CSS Custom Properties / 主题变量
   ============================================================ */

:root {
    /* 品牌色 */
    --portal-primary: #c62828;
    --portal-primary-light: #ef5350;
    --portal-primary-dark: #8e0000;
    --portal-secondary: #2468ed;
    --portal-secondary-light: #2c5f8a;
    --portal-accent: #1565c0;
    --portal-gold: #c9a84c;

    /* 中性色 */
    --portal-text: #333333;
    --portal-text-secondary: #0f0f0f;
    --portal-text-muted: #0f0f0f;
    --portal-border: #e0e0e0;
    --portal-bg: #ffffff;
    --portal-bg-white: #ffffff;
    --portal-bg-dark: #1a2332;
    --portal-bg-darker: #111827;

    /* 布局 */
    --portal-container-width: 1200px;
    --portal-header-height: 72px;
    --portal-utility-height: 36px;

    /* 字体 */
    --portal-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Helvetica Neue", Arial, sans-serif;
    --portal-font-size-xs: 11px;
    --portal-font-size-sm: 12px;
    --portal-font-size-base: 14px;
    --portal-font-size-md: 15px;
    --portal-font-size-lg: 16px;
    --portal-font-size-xl: 20px;
    --portal-font-size-xxl: 28px;

    /* 行高 */
    --portal-line-height-tight: 1.3;
    --portal-line-height-base: 1.6;
    --portal-line-height-loose: 1.8;

    /* 间距 */
    --portal-spacing-xs: 4px;
    --portal-spacing-sm: 8px;
    --portal-spacing-md: 16px;
    --portal-spacing-lg: 24px;
    --portal-spacing-xl: 32px;
    --portal-spacing-xxl: 48px;

    /* 圆角 */
    --portal-radius-sm: 2px;
    --portal-radius-base: 4px;
    --portal-radius-md: 6px;
    --portal-radius-lg: 8px;
    --portal-radius-round: 20px;
    --portal-radius-circle: 50%;

    /* 阴影 */
    --portal-shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.06);
    --portal-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    --portal-shadow-md: 0 4px 16px rgba(0, 0, 0, 0.1);
    --portal-shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12);

    /* 过渡 */
    --portal-transition-fast: all 0.15s ease;
    --portal-transition: all 0.3s ease;
    --portal-transition-slow: all 0.5s ease;

    /* 层级 */
    --portal-z-dropdown: 100;
    --portal-z-sticky: 200;
    --portal-z-fixed: 300;
    --portal-z-modal-backdrop: 400;
    --portal-z-modal: 500;
    --portal-z-popover: 600;
    --portal-z-tooltip: 700;
}


/* ============================================================
   3. Element Plus Theme Overrides / 组件主题覆写
   ============================================================ */

:root {
    --el-color-primary: var(--portal-primary);
    --el-color-primary-light-3: #d4524f;
    --el-color-primary-light-5: #e08987;
    --el-color-primary-light-7: #ecc0bf;
    --el-color-primary-light-8: #f3d8d7;
    --el-color-primary-light-9: #f9efee;
    --el-color-primary-dark-2: var(--portal-primary-dark);
    --el-font-size-base: var(--portal-font-size-base);
    --el-border-radius-base: var(--portal-radius-base);
    --el-font-family: var(--portal-font-family);
    --el-bg-color: var(--portal-bg-white);
    --el-bg-color-page: var(--portal-bg);
    --el-text-color-primary: var(--portal-text);
    --el-text-color-regular: var(--portal-text-secondary);
    --el-text-color-secondary: var(--portal-text-muted);
    --el-border-color: var(--portal-border);
    --el-border-color-light: #ebeef5;
    --el-fill-color-light: var(--portal-bg);
}


/* ============================================================
   4. Global Typography / 全局排版
   ============================================================ */

body {
    font-family: var(--portal-font-family);
    font-size: var(--portal-font-size-base);
    color: var(--portal-text);
    background-color: var(--portal-bg);
    line-height: var(--portal-line-height-base);
}

/* 标题 */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: var(--portal-line-height-tight);
    color: var(--portal-text);
}

h1 { font-size: var(--portal-font-size-xxl); }
h2 { font-size: var(--portal-font-size-xl); }
h3 { font-size: 18px; }
h4 { font-size: var(--portal-font-size-lg); }
h5 { font-size: var(--portal-font-size-md); }
h6 { font-size: var(--portal-font-size-base); }

/* 段落 */
p {
    margin-bottom: var(--portal-spacing-md);
    line-height: var(--portal-line-height-loose);
}

p:last-child {
    margin-bottom: 0;
}

/* 强调 */
strong, b { font-weight: 600; }

/* 小字 */
small { font-size: var(--portal-font-size-sm); }

/* 标记 */
mark {
    background: #fff3cd;
    padding: 2px 4px;
    border-radius: var(--portal-radius-base);
}

/* 引用 */
blockquote {
    border-left: 4px solid var(--portal-primary);
    padding: var(--portal-spacing-md) var(--portal-spacing-lg);
    margin: var(--portal-spacing-lg) 0;
    background: var(--portal-bg);
    color: var(--portal-text-secondary);
    font-style: italic;
}

/* 代码 */
code, pre {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
    font-size: 13px;
}

code {
    padding: 2px 6px;
    background: var(--portal-bg);
    border-radius: var(--portal-radius-base);
    color: var(--portal-primary);
}

pre {
    padding: var(--portal-spacing-lg);
    background: #282c34;
    color: #abb2bf;
    border-radius: var(--portal-radius-lg);
    overflow-x: auto;
    line-height: 1.5;
}

pre code {
    background: transparent;
    color: inherit;
    padding: 0;
}

/* 分割线 */
hr {
    border: none;
    border-top: 1px solid var(--portal-border);
    margin: var(--portal-spacing-xl) 0;
}


/* ============================================================
   5. Layout Utilities / 布局工具类
   ============================================================ */

/* 容器 */
.container,
.section-container {
    max-width: var(--portal-container-width);
    margin-left: auto;
    margin-right: auto;
    padding-left: 20px;
    padding-right: 20px;
}

.container--fluid {
    max-width: 100%;
}

/* Flex */
.flex { display: flex; }
.flex-inline { display: inline-flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.flex-shrink-0 { flex-shrink: 0; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.items-stretch { align-items: stretch; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-start { justify-content: flex-start; }
.justify-end { justify-content: flex-end; }
.gap-xs { gap: var(--portal-spacing-xs); }
.gap-sm { gap: var(--portal-spacing-sm); }
.gap-md { gap: var(--portal-spacing-md); }
.gap-lg { gap: var(--portal-spacing-lg); }
.gap-xl { gap: var(--portal-spacing-xl); }

/* Grid */
.grid { display: grid; }
.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); }

/* 文本 */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-primary { color: var(--portal-primary); }
.text-secondary { color: var(--portal-text-secondary); }
.text-muted { color: var(--portal-text-muted); }
.text-white { color: #fff; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-normal { font-weight: 400; }
.text-xs { font-size: var(--portal-font-size-xs); }
.text-sm { font-size: var(--portal-font-size-sm); }
.text-base { font-size: var(--portal-font-size-base); }
.text-lg { font-size: var(--portal-font-size-lg); }
.text-xl { font-size: var(--portal-font-size-xl); }
.text-ellipsis {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.text-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.text-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 间距 */
.mt-sm { margin-top: var(--portal-spacing-sm); }
.mt-md { margin-top: var(--portal-spacing-md); }
.mt-lg { margin-top: var(--portal-spacing-lg); }
.mt-xl { margin-top: var(--portal-spacing-xl); }
.mb-sm { margin-bottom: var(--portal-spacing-sm); }
.mb-md { margin-bottom: var(--portal-spacing-md); }
.mb-lg { margin-bottom: var(--portal-spacing-lg); }
.mb-xl { margin-bottom: var(--portal-spacing-xl); }
.pt-sm { padding-top: var(--portal-spacing-sm); }
.pt-md { padding-top: var(--portal-spacing-md); }
.pt-lg { padding-top: var(--portal-spacing-lg); }
.pb-sm { padding-bottom: var(--portal-spacing-sm); }
.pb-md { padding-bottom: var(--portal-spacing-md); }
.pb-lg { padding-bottom: var(--portal-spacing-lg); }

/* 显示 */
.hidden { display: none !important; }
.block { display: block !important; }

/* 浮动 */
.clearfix::after {
    content: '';
    display: table;
    clear: both;
}

/* 溢出 */
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }

/* 定位 */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }

/* 宽度 */
.w-full { width: 100%; }
.h-full { height: 100%; }

/* 圆角 */
.rounded-sm { border-radius: var(--portal-radius-sm); }
.rounded { border-radius: var(--portal-radius-base); }
.rounded-md { border-radius: var(--portal-radius-md); }
.rounded-lg { border-radius: var(--portal-radius-lg); }
.rounded-round { border-radius: var(--portal-radius-round); }
.rounded-circle { border-radius: var(--portal-radius-circle); }

/* 阴影 */
.shadow-sm { box-shadow: var(--portal-shadow-sm); }
.shadow { box-shadow: var(--portal-shadow); }
.shadow-md { box-shadow: var(--portal-shadow-md); }
.shadow-lg { box-shadow: var(--portal-shadow-lg); }

/* 过渡 */
.transition { transition: var(--portal-transition); }
.transition-fast { transition: var(--portal-transition-fast); }

/* 遮罩层 */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.overlay--dark {
    background: rgba(0, 0, 0, 0.7);
}

.overlay--light {
    background: rgba(255, 255, 255, 0.8);
}

/* 图片占位 */
.image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--portal-bg);
    color: var(--portal-text-muted);
    font-size: var(--portal-font-size-xl);
}

/* 屏幕阅读器专用 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* 隐藏但可聚焦 */
.sr-only-focusable:focus,
.sr-only-focusable:active {
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
}


/* ============================================================
   6. Responsive Breakpoints / 响应式断点
   ============================================================ */

/* 隐藏工具：桌面端隐藏 */
.hidden-desktop { display: none; }

/* 隐藏工具：平板端隐藏 */
@media (max-width: 1200px) {
    .hidden-tablet { display: none !important; }
}

/* 隐藏工具：移动端隐藏 */
@media (max-width: 768px) {
    .hidden-mobile { display: none !important; }
    .hidden-desktop { display: block; }

    /* 移动端网格降级 */
    .grid-cols-2,
    .grid-cols-3,
    .grid-cols-4 {
        grid-template-columns: 1fr;
    }

    /* 移动端 Flex 降级 */
    .flex-col-mobile {
        flex-direction: column;
    }

    /* 移动端容器 */
    .container,
    .section-container {
        padding-left: 16px;
        padding-right: 16px;
    }
}

/* 小屏手机 */
@media (max-width: 480px) {
    .container,
    .section-container {
        padding-left: 12px;
        padding-right: 12px;
    }
}


/* ============================================================
   7. Browser Compatibility Fixes / 浏览器兼容修补
   ============================================================ */

/* IE10+ Flex 布局修复 */
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
    .flex { display: flex; }
    .container { max-width: var(--portal-container-width); }
}

/* IE 输入框伪元素清除 */
input::-ms-clear,
input::-ms-reveal {
    display: none;
    width: 0;
    height: 0;
}

/* IE 链接虚线去除 */
a:focus,
button:focus {
    outline: none;
}

/* Firefox 按钮内边距修复 */
button::-moz-focus-inner {
    border: 0;
    padding: 0;
}

/* Safari 日期输入控件 */
input[type="date"],
input[type="time"],
input[type="datetime-local"] {
    -webkit-appearance: none;
    appearance: none;
}

/* Chrome 自动填充样式 */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 30px white inset;
    -webkit-text-fill-color: var(--portal-text);
}

/* iOS 橡皮筋效果控制 */
body {
    overscroll-behavior-y: none;
}

/* 触摸设备 hover 模拟修复 */
@media (hover: none) {
    a:hover,
    button:hover {
        opacity: 0.85;
    }
}

/* 微信浏览器 / 小程序 WebView */
@media (max-width: 768px) {
    /* 微信底部工具栏安全区域 */
    body.wechat-browser {
        padding-bottom: 50px;
    }
    
}
