/* 通用REM布局CSS文件 */

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

/* 设置根字体大小，根据屏幕宽度动态计算 */
html {
    font-size: 16px;
}

/* 针对不同屏幕宽度设置不同的根字体大小 */
@media screen and (max-width: 320px) {
    html {
        font-size: 14px;
    }
}

@media screen and (min-width: 321px) and (max-width: 375px) {
    html {
        font-size: 15px;
    }
}

@media screen and (min-width: 376px) and (max-width: 414px) {
    html {
        font-size: 16px;
    }
}

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

/* 移动端基础样式 */
body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
    -webkit-tap-highlight-color: transparent; /* 移除点击高亮效果 */
    overflow-x: hidden; /* 禁止横向滚动 */
}

/* 通用容器样式 */
.container {
    max-width: 640px;
    margin: 0 auto;
    padding: 0 0.9375rem; /* 15px */
    width: 100%;
}

/* 通用按钮样式 */
.btn {
    display: inline-block;
    padding: 0.9375rem 1.25rem; /* 15px 20px */
    border: none;
    border-radius: 0.25rem; /* 4px */
    font-size: 1rem; /* 16px */
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 2.75rem; /* 44px */
    min-width: 2.75rem; /* 44px */
    line-height: normal;
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-primary:active {
    background-color: #2471a3;
    transform: translateY(1px);
}

.btn-success {
    background-color: #27ae60;
    color: white;
}

.btn-success:hover {
    background-color: #229954;
}

.btn-success:active {
    background-color: #1e8449;
    transform: translateY(1px);
}

.btn:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
    opacity: 0.7;
}

/* 通用输入框样式 */
input[type="text"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 0.9375rem; /* 15px */
    border: 1px solid #ddd;
    border-radius: 0.25rem; /* 4px */
    font-size: 1rem; /* 16px */
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    transition: all 0.3s ease;
    min-height: 2.75rem; /* 44px */
    line-height: 1.4;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.1);
}

textarea {
    resize: vertical;
    min-height: 9.375rem; /* 150px */
}

/* 通用标题样式 */
h1, h2, h3, h4, h5, h6 {
    color: #2c3e50;
    font-weight: 600;
    margin-bottom: 0.9375rem; /* 15px */
}

h1 {
    font-size: 1.75rem; /* 28px */
}

h2 {
    font-size: 1.5rem; /* 24px */
}

h3 {
    font-size: 1.25rem; /* 20px */
}

/* 通用表单样式 */
.form-group {
    margin-bottom: 1.25rem; /* 20px */
}

label {
    display: block;
    margin-bottom: 0.3125rem; /* 5px */
    font-weight: 600;
    color: #555;
    font-size: 0.875rem; /* 14px */
}

/* 通用错误信息样式 */
.error-message {
    color: #e74c3c;
    font-size: 0.875rem; /* 14px */
    margin-top: 0.3125rem; /* 5px */
}

/* 通用成功信息样式 */
.success-message {
    color: #27ae60;
    font-size: 0.875rem; /* 14px */
    margin-top: 0.3125rem; /* 5px */
}

/* 固定顶部导航栏 */
.fixed-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    padding: 0.625rem 0; /* 10px */
}

/* 固定底部按钮栏 */
.fixed-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: white;
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
    padding: 0.625rem 0.9375rem; /* 10px 15px */
    z-index: 1000;
}

/* 内容区域，避免被固定导航栏和底部栏遮挡 */
.content-wrapper {
    margin-top: 3.75rem; /* 60px，根据固定导航栏高度调整 */
    margin-bottom: 5rem; /* 80px，根据固定底部栏高度调整 */
}

/* 居中垂直布局 */
.vertical-center {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 1.25rem; /* 20px */
}

/* 禁用用户选择 */
.no-select {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}
