/* 全局样式重置和基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 防止媒体元素溢出 */
img,
video,
iframe,
embed,
object {
    max-width: 100%;
    height: auto;
}

/* 防止预格式化文本溢出 */
pre,
code {
    max-width: 100%;
    overflow-x: auto;
}

/* 防止长单词溢出 */
p,
h1, h2, h3, h4, h5, h6,
li {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

:root {
    /* 颜色变量 */
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --text-color: #1f2937;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --bg-color: #f9fafb;
    --white: #ffffff;
    
    /* 间距 */
    --spacing-xs: 8px;
    --spacing-sm: 16px;
    --spacing-md: 24px;
    --spacing-lg: 32px;
    --spacing-xl: 48px;
    
    /* 字体 */
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
    --font-mono: "SF Mono", Monaco, Consolas, monospace;
    
    /* 其他 */
    --border-radius: 8px;
    --box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

html {
    overflow-x: hidden;
}

body {
    font-family: var(--font-family);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    max-width: 100vw;
}

.container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 0 var(--spacing-sm);
    overflow-x: hidden;
}

/* 页头样式 */
.site-header {
    background: var(--white);
    box-shadow: var(--box-shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm) 0;
}

.logo a {
    text-decoration: none;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.logo a:hover .logo-icon {
    transform: scale(1.1);
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 4px;
    line-height: 1.2;
}

.logo .slogan {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.2;
}

/* 导航 */
.main-nav .nav-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.main-nav .nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-color);
    transition: var(--transition);
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: var(--spacing-md);
    align-items: center;
}

.nav-menu a {
    text-decoration: none;
    color: var(--text-color);
    font-size: 15px;
    padding: 8px 12px;
    border-radius: 6px;
    transition: var(--transition);
}

.nav-menu a:hover,
.nav-menu a.active {
    color: var(--primary-color);
    background: rgba(37, 99, 235, 0.1);
}

/* 主内容区 */
.main-content {
    min-height: calc(100vh - 200px);
    padding: 0;
}

/* 面包屑 */
.breadcrumb {
    margin-bottom: var(--spacing-md);
    font-size: 14px;
}

.breadcrumb ol {
    display: flex;
    list-style: none;
    flex-wrap: wrap;
    gap: 8px;
}

.breadcrumb li {
    display: flex;
    align-items: center;
}

.breadcrumb li:not(:last-child)::after {
    content: "›";
    margin-left: 8px;
    color: var(--text-secondary);
}

.breadcrumb a {
    color: var(--text-secondary);
    text-decoration: none;
}

.breadcrumb a:hover {
    color: var(--primary-color);
}

.breadcrumb li:last-child span {
    color: var(--text-color);
}

/* 卡片 */
.card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    overflow-x: auto;
    max-width: 100%;
    min-width: 0;
    width: 100%;
}

.card-header {
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-sm);
    border-bottom: 2px solid var(--border-color);
}

.card-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-color);
}

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

/* 网格布局 */
.grid {
    display: grid;
    gap: var(--spacing-md);
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* 表单元素 */
.form-group {
    margin-bottom: var(--spacing-sm);
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-color);
    font-size: 14px;
}

.form-input,
.form-select {
    width: 100%;
    height: 44px;
    padding: 0 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 16px;
    font-family: var(--font-family);
    transition: var(--transition);
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-input::placeholder {
    color: #9ca3af;
}

.form-help {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-secondary);
}

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 500;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    font-family: var(--font-family);
}

.btn-primary {
    background: var(--primary-color);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--white);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-color);
}

.btn-success {
    background: var(--success-color);
    color: var(--white);
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 表格 */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: var(--spacing-sm);
    /* 添加滚动阴影提示 */
    background: 
        linear-gradient(to right, white 30%, rgba(255,255,255,0)),
        linear-gradient(to left, white 30%, rgba(255,255,255,0)),
        linear-gradient(to right, rgba(0,0,0,.1), rgba(255,255,255,0)),
        linear-gradient(to left, rgba(0,0,0,.1), rgba(255,255,255,0));
    background-position: left center, right center, left center, right center;
    background-repeat: no-repeat;
    background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
    background-attachment: local, local, scroll, scroll;
}

.table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px; /* 防止表格过窄 */
    background: var(--white);
}

.table th,
.table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap; /* 防止内容换行 */
}

.table th {
    background: var(--bg-color);
    font-weight: 600;
    color: var(--text-color);
    font-size: 14px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.table td {
    font-size: 14px;
}

.table tbody tr:hover {
    background: var(--bg-color);
}

.table .number {
    font-family: var(--font-mono);
    text-align: right;
}

/* 移动端表格优化 */
@media (max-width: 768px) {
    .table {
        font-size: 12px;
        min-width: 500px;
    }
    
    .table th,
    .table td {
        padding: 8px 4px;
        font-size: 12px;
    }
    
    .table th {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .table {
        font-size: 11px;
        min-width: 450px;
    }
    
    .table th,
    .table td {
        padding: 6px 3px;
        font-size: 11px;
    }
}

/* 提示框 */
.alert {
    padding: var(--spacing-sm);
    border-radius: 6px;
    margin-bottom: var(--spacing-sm);
    font-size: 14px;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* 页脚 */
.site-footer {
    background: var(--white);
    border-top: 1px solid var(--border-color);
    margin-top: var(--spacing-xl);
    padding: var(--spacing-lg) 0 var(--spacing-md);
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

.footer-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
    color: var(--text-color);
}

.footer-section ul {
    list-style: none;
}

.footer-section li {
    margin-bottom: 8px;
}

.footer-section a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: var(--transition);
}

.footer-section a:hover {
    color: var(--primary-color);
}

.footer-section p {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
}

.footer-bottom {
    text-align: center;
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--border-color);
}

.footer-bottom p {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 4px;
}

.footer-bottom .disclaimer {
    font-size: 12px;
    margin-top: var(--spacing-sm);
}

/* 工具类 */
.text-center {
    text-align: center;
}

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

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

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

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

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

.font-mono {
    font-family: var(--font-mono);
}

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

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--spacing-xs); }
.mt-2 { margin-top: var(--spacing-sm); }
.mt-3 { margin-top: var(--spacing-md); }
.mt-4 { margin-top: var(--spacing-lg); }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--spacing-xs); }
.mb-2 { margin-bottom: var(--spacing-sm); }
.mb-3 { margin-bottom: var(--spacing-md); }
.mb-4 { margin-bottom: var(--spacing-lg); }

.hidden {
    display: none;
}

/* 移动端响应式 */
@media (max-width: 768px) {
    /* 导航菜单 */
    .main-nav .nav-toggle {
        display: flex;
    }
    
    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--white);
        flex-direction: column;
        padding: var(--spacing-sm);
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
        z-index: 999;
    }
    
    .nav-menu.active {
        display: flex;
    }
    
    .nav-menu a {
        padding: 12px;
        width: 100%;
    }
    
    /* 网格布局改为单列或两列 */
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* 页脚网格 */
    .footer-content {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* 容器内边距 */
    .container {
        padding: 0 12px;
    }
    
    /* 主内容区 */
    .main-content {
        padding: 0;
    }
    
    /* 卡片内边距 */
    .card {
        padding: var(--spacing-sm);
        margin-bottom: var(--spacing-sm);
    }
}

@media (max-width: 480px) {
    /* 超小屏单列布局 */
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
    }
    
    /* Logo字体 */
    .logo-icon {
        width: 32px;
        height: 32px;
    }
    
    .logo h1 {
        font-size: 20px;
    }
    
    .logo .slogan {
        font-size: 11px;
    }
    
    /* 页面标题 */
    h1 {
        font-size: 24px !important;
    }
    
    /* 按钮 */
    .btn {
        padding: 10px 16px;
        font-size: 14px;
    }
}
