/* 主样式文件 - 导入所有组件样式 */

/* 基础样式 */
@import url('./components/base.css');

/* 组件样式 */
@import url('./components/button.css');
@import url('./components/table.css');
@import url('./components/toast.css');
@import url('./components/navigation.css');

/* 主题样式 */
@import url('./themes/theme.css');

/* 全局样式重置和优化 */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    line-height: 1.6;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    /* 确保html充分利用屏幕宽度 */
    width: 100%;
    overflow-x: hidden;
}

body {
    margin: 0;
    font-family: var(--theme-font-family);
    font-size: var(--theme-font-size-base);
    font-weight: 400;
    line-height: 1.6;
    color: var(--theme-text-primary);
    background-color: var(--theme-bg-secondary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    /* 确保页面充分利用屏幕宽度 */
    overflow-x: hidden;
    min-width: 100vw;
}

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

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

a:focus {
    outline: 2px solid var(--theme-border-focus);
    outline-offset: 2px;
}

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

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

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

/* 列表样式 */
ul, ol {
    margin: 0 0 var(--theme-spacing-md) 0;
    padding-left: var(--theme-spacing-lg);
}

li {
    margin-bottom: var(--theme-spacing-xs);
    color: var(--theme-text-secondary);
}

/* 表单元素样式 */
input, textarea, select {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    box-shadow: 0 0 0 3px var(--theme-primary-light);
}

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

/* 代码样式 */
code {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875em;
    background-color: var(--theme-bg-tertiary);
    padding: 0.125rem 0.25rem;
    border-radius: var(--theme-radius-sm);
    color: var(--theme-text-primary);
}

pre {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    background-color: var(--theme-bg-tertiary);
    padding: var(--theme-spacing-md);
    border-radius: var(--theme-radius-md);
    overflow-x: auto;
    margin: 0 0 var(--theme-spacing-md) 0;
}

pre code {
    background-color: transparent;
    padding: 0;
    border-radius: 0;
}

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

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

::-webkit-scrollbar-track {
    background: var(--theme-bg-tertiary);
    border-radius: var(--theme-radius-sm);
}

::-webkit-scrollbar-thumb {
    background: var(--theme-border-hover);
    border-radius: var(--theme-radius-sm);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--theme-text-tertiary);
}

/* 选择文本样式 */
::selection {
    background-color: var(--theme-primary-light);
    color: var(--theme-primary-dark);
}

::-moz-selection {
    background-color: var(--theme-primary-light);
    color: var(--theme-primary-dark);
}

/* 焦点样式 */
:focus {
    outline: 2px solid var(--theme-border-focus);
    outline-offset: 2px;
}

:focus:not(:focus-visible) {
    outline: none;
}

/* 禁用状态 */
:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* 加载状态 */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--theme-border);
    border-top-color: var(--theme-primary);
    border-radius: 50%;
    animation: loading-spin 1s linear infinite;
}

@keyframes loading-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 工具类 */
.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;
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.break-words {
    word-wrap: break-word;
    word-break: break-word;
}

.break-all {
    word-break: break-all;
}

.select-none {
    user-select: none;
}

.select-text {
    user-select: text;
}

.select-all {
    user-select: all;
}

.cursor-pointer {
    cursor: pointer;
}

.cursor-not-allowed {
    cursor: not-allowed;
}

.pointer-events-none {
    pointer-events: none;
}

.pointer-events-auto {
    pointer-events: auto;
}

/* 响应式工具类 */
@media (max-width: 640px) {
    .sm\:hidden { display: none; }
    .sm\:block { display: block; }
    .sm\:flex { display: flex; }
    .sm\:grid { display: grid; }
}

@media (min-width: 641px) and (max-width: 768px) {
    .md\:hidden { display: none; }
    .md\:block { display: block; }
    .md\:flex { display: flex; }
    .md\:grid { display: grid; }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .lg\:hidden { display: none; }
    .lg\:block { display: block; }
    .lg\:flex { display: flex; }
    .lg\:grid { display: grid; }
}

@media (min-width: 1025px) {
    .xl\:hidden { display: none; }
    .xl\:block { display: block; }
    .xl\:flex { display: flex; }
    .xl\:grid { display: grid; }
}

/* 打印样式 */
@media print {
    * {
        background: transparent !important;
        color: black !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }
    
    a, a:visited {
        text-decoration: underline;
    }
    
    a[href]:after {
        content: " (" attr(href) ")";
    }
    
    abbr[title]:after {
        content: " (" attr(title) ")";
    }
    
    .no-print {
        display: none !important;
    }
    
    .print-only {
        display: block !important;
    }
}
