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

/* 全局变量 - 小程序风格配色 */
:root {
    --primary-color: #FF6B00; /* 爱马仕橙色 */
    --primary-dark: #E55E00;
    --primary-light: #FF8A33;
    --secondary-color: #333;
    --text-color: #333;
    --text-light: #666;
    --text-lighter: #999;
    --background-color: #f8f8f8;
    --white: #fff;
    --gray: #f5f5f5;
    --gray-dark: #e8e8e8;
    --border-color: #eee;
    --success-color: #07c160;
    --error-color: #ff4d4f;
    --shadow: 0 1px 8px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 3px 15px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

/* 基础设置 - 移动优先，响应式缩放 */
html {
    /* 使用视窗宽度的百分比作为基础字体大小，实现等比缩放 */
    font-size: calc(100vw / 1920 * 14); /* 1920px设计稿下14px - 小程序风格更小字体 */
    box-sizing: border-box;
    /* 确保在移动端缩放时字体大小不会变得太小 */
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

/* 使用媒体查询限制最小和最大字体大小 */
@media (max-width: 1440px) {
    html {
        font-size: 13px;
    }
}

@media (max-width: 768px) {
    html {
        font-size: 11px;
    }
}

@media (min-width: 2560px) {
    html {
        font-size: 18px;
    }
}

*, *::before, *::after {
    box-sizing: inherit;
}

/* 确保图片和视频等资源能自适应容器大小 */
img, video, iframe {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

/* 确保表单元素能正确显示 */
input, textarea, select, button {
    box-sizing: border-box;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
}

/* 确保表格能正确显示 */
table {
    width: 100%;
    border-collapse: collapse;
}

/* 基础样式 - 小程序风格 */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.5;
    color: var(--text-color);
    background-color: var(--background-color);
    overflow-x: hidden;
    font-size: 0.9rem;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 核心：移动优先设计，自适应容器宽度 */
.container {
    width: 100%;
    margin: 0 auto;
    padding: 0 15px;
    max-width: 100%;
}

/* 确保所有页面容器都使用自适应宽度 */
.login-container,
.login-box,
.admin-container,
.admin-content {
    width: 100%;
    margin: 0 auto;
    padding: 0 15px;
}

/* 按钮基础样式 - 小程序风格 */
.btn {
    display: inline-block;
    padding: 0.6rem 1.5rem;
    border: none;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    box-shadow: var(--shadow);
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--white);
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--white);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), #CC5400);
    color: var(--white);
}

.btn-block {
    display: block;
    width: 100%;
}

/* 章节标题样式 - 小程序风格 */
.section-title {
    font-size: 1.8rem;
    text-align: center;
    margin-bottom: 0.8rem;
    color: var(--secondary-color);
    position: relative;
    font-weight: 600;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -0.4rem;
    left: 50%;
    transform: translateX(-50%);
    width: 3.5rem;
    height: 2px;
    background-color: var(--primary-color);
    border-radius: 1px;
}

.section-subtitle {
    font-size: 1rem;
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--text-light);
    font-weight: 500;
}

.section-description {
    font-size: 0.9rem;
    text-align: center;
    margin-bottom: 2.5rem;
    color: var(--text-light);
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

/* 内容区域章节标题 */
.section-title {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 1rem;
    color: var(--secondary-color);
    position: relative;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -0.625rem;
    left: 50%;
    transform: translateX(-50%);
    width: 5rem;
    height: 0.1875rem;
    background-color: var(--primary-color);
    border-radius: 0.125rem;
}

.section-subtitle {
    font-size: 1.2rem;
    text-align: center;
    margin-bottom: 2rem;
    color: var(--text-light);
}

.section-description {
    font-size: 1.1rem;
    text-align: center;
    margin-bottom: 4rem;
    color: var(--text-light);
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

/* 动画效果 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease forwards;
}

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

::-webkit-scrollbar-track {
    background: var(--gray);
}

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

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* 表单验证样式 */
.form-input:invalid {
    border-color: var(--error-color);
}

.form-input:valid {
    border-color: var(--success-color);
}

/* 错误信息样式 */
.error-message {
    color: var(--error-color);
    font-size: 0.8rem;
    margin-top: 0.5rem;
    margin-left: 1rem;
    margin-bottom: 20px;
    height: 1rem;
}

.form-input.error {
    border-color: var(--error-color);
}

.form-input.error:focus {
    border-color: var(--error-color);
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.1);
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--gray);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 模态窗口样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--white);
    border-radius: 10px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    animation: slideInUp 0.3s ease;
}

.modal-header {
    padding: 1.5rem;
    background-color: var(--primary-color);
    color: var(--white);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.2rem;
}

.close-modal {
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
}

.close-modal:hover {
    transform: scale(1.1);
}

.modal-body {
    padding: 1.5rem;
    max-height: 50vh;
    overflow-y: auto;
}

.modal-body pre {
    background-color: var(--background-color);
    padding: 1rem;
    border-radius: 5px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    line-height: 1.4;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    border: 1px solid var(--border-color);
}

.modal-footer {
    padding: 1rem 1.5rem;
    background-color: var(--background-color);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    border-top: 1px solid var(--border-color);
}

/* 模态窗口动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
