/* 主样式文件 - 包含全局样式和布局 */
/* 引入全局变量 */
@import url('variables.css');

/* 补充变量定义 */
:root {
    /* 字体变量 */
    --font-family-base: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --line-height-base: 1.5;
    
    /* 边框变量 */
    --border-width: 1px;
    --border-color: #dee2e6;
    
    /* 阴影变量 */
    --box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --box-shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --box-shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);
    
    /* 过渡变量 */
    --transition-base: all 0.2s ease-in-out;
    --transition-fade: opacity 0.15s linear;
    --transition-collapse: height 0.35s ease;
}

/* 暗色主题变量 */
[data-bs-theme="dark"] {
    --bs-body-color: #adb5bd;
    --bs-body-bg: #212529;
    --bs-emphasis-color: #fff;
    --bs-secondary-color: rgba(173, 181, 189, 0.75);
    --bs-tertiary-color: rgba(173, 181, 189, 0.5);
    --bs-border-color: #495057;
    --bs-border-color-translucent: rgba(255, 255, 255, 0.15);
    --bs-form-valid-color: #75b798;
    --bs-form-invalid-color: #f1aeb5;
}

/* 全局样式 */
* {
    box-sizing: border-box;
}

html {
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
}

body {
    margin: 0;
    font-family: var(--font-family-base);
    font-size: var(--font-size-base);
    font-weight: 400;
    line-height: var(--line-height-base);
    color: var(--text-primary);
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

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

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

/* 标题样式 */
h1, h2, h3, h4, h5, h6 {
    margin-top: 0;
    margin-bottom: var(--spacing-sm);
    font-weight: 500;
    line-height: 1.2;
    color: var(--text-primary);
}

h1 { font-size: var(--font-size-3xl); }
h2 { font-size: var(--font-size-2xl); }
h3 { font-size: var(--font-size-xl); }
h4 { font-size: var(--font-size-lg); }
h5 { font-size: var(--font-size-base); }
h6 { font-size: var(--font-size-sm); }

/* 段落样式 */
p {
    margin-top: 0;
    margin-bottom: var(--spacing-md);
    color: var(--text-primary);
}

/* 列表样式 */
ul, ol {
    padding-left: 2rem;
    margin-top: 0;
    margin-bottom: var(--spacing-md);
    color: var(--text-primary);
}

/* 图片样式 */
img {
    max-width: 100%;
    height: auto;
}

/* 表格样式 */
table {
    caption-side: bottom;
    border-collapse: collapse;
    width: 100%;
}

th, td {
    padding: var(--spacing-sm) var(--spacing-sm);
    text-align: left;
    border-bottom: var(--border-width) solid var(--border-primary);
    color: var(--text-primary);
}

th {
    font-weight: 600;
    color: var(--text-primary);
}

/* 代码样式 */
code, pre {
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

code {
    background-color: transparent;
    padding: 0.125rem 0.25rem;
    border-radius: var(--border-radius-sm);
}

pre {
    display: block;
    margin-top: 0;
    margin-bottom: var(--spacing-md);
    overflow: auto;
    background-color: transparent;
    padding: var(--spacing-md);
    border-radius: var(--border-radius);
}

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

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-primary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-secondary);
}

/* 焦点样式 */
:focus {
    outline: 0;
    box-shadow: var(--shadow-purple);
}

/* 禁用状态 */
:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

/* 选择文本样式 */
::selection {
    background-color: rgba(118, 75, 162, 0.3);
}

/* 打印样式 */
@media print {
    *,
    *::before,
    *::after {
        text-shadow: none !important;
        box-shadow: none !important;
    }
    
    a:not(.btn) {
        text-decoration: underline;
    }
    
    img {
        page-break-inside: avoid;
    }
    
    p,
    h2,
    h3 {
        orphans: 3;
        widows: 3;
    }
    
    h2,
    h3 {
        page-break-after: avoid;
    }
}

/* 响应式工具类 */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* 清除浮动 */
.clearfix::after {
    display: block;
    clear: both;
    content: "";
}

/* 文本截断 */
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 用户选择 */
.user-select-all { user-select: all !important; }
.user-select-auto { user-select: auto !important; }
.user-select-none { user-select: none !important; }

/* 指针事件 */
.pe-none { pointer-events: none !important; }
.pe-auto { pointer-events: auto !important; }