/* 页面布局：确保页面高度撑满视口 */
html {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    /* 移除固定高度，使用 min-height 让内容决定实际高度 */
    height: auto;
}

body > div {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 100vh;
    /* 移除固定高度，使用 min-height */
    height: auto;
}

/* 保留原有的form-group样式，但为含有flex的form-group提供优先级 */
.form-group {
    margin-bottom: 15px; /* 下边距 */
}

/* 强制重写标签样式，确保长标签能够完整显示 */
#foreignerReg .form-group,
#userReg .form-group,
#dwUserReg .form-group {
    display: flex !important;
    align-items: flex-start !important; /* 顶部对齐，适应多行文本 */
    margin-bottom: 15px !important;
    min-height: 40px !important; /* 设置最小高度 */
}

#foreignerReg .layui-form-label,
#userReg .layui-form-label,
#dwUserReg .layui-form-label {
    min-width: 120px !important; /* 最小宽度 */
    max-width: 280px !important; /* 最大宽度 */
    width: auto !important; /* 自适应宽度 */
    flex-shrink: 0 !important; /* 不压缩 */
    text-align: right !important;
    padding-right: 12px !important;
    line-height: 1.4 !important;
    word-wrap: break-word !important;
    white-space: normal !important; /* 允许文本换行 */
    overflow: visible !important; /* 确保文本不被截断 */
    display: inline-block !important;
    vertical-align: top !important;
    padding-top: 8px !important; /* 与输入框对齐 */
}

/* 调整输入框容器 */
#foreignerReg .layui-input-block,
#userReg .layui-input-block,
#dwUserReg .layui-input-block {
    flex: 1 !important; /* 占据剩余空间 */
    margin-left: 0 !important; /* 移除固定左边距 */
    min-width: 0 !important; /* 允许收缩 */
}

/* 特别长的标签 */
#foreignerReg .layui-form-label.long-label {
    font-size: 12px !important;
    max-width: 300px !important; /* 增加最大宽度 */
    line-height: 1.3 !important; /* 稍微减小行高 */
}

.layui-form-required:before { /* 给红色的必填项打红色星号（文字后）如果打前面用before*/
    content: ' *';
    color: red;
}

.tip {
    font-size: 12px; /* 提示文字大小 */
    color: #999; /* 提示文字颜色 */
}

.register-container {
    max-width: 1400px; /* 最大宽度 */
    margin: 100px auto 20px; /* 居中 */
    padding: 20px; /* 内边距 */
    background-color: #f9f9f9; /* 背景颜色 */
    border-radius: 8px; /* 圆角 */
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); /* 阴影效果 */
    flex: 1; /* 让容器占据剩余空间 */
}

/* 确保页脚正确显示在底部 */
.common-footer {
    margin-top: auto; /* 页脚自动推到底部 */
}

.register-title {
    text-align: center; /* 标题居中 */
    font-size: 18px; /* 标题字体大小 */
    margin-bottom: 20px; /* 下边距 */
    color: var(--primary-color);
}

.layui-form-label {
    width: 200px; /* 增加标签宽度从120px到200px */
    text-align: right; /* 标签右对齐 */
    color: #555; /* 标签颜色 */
    padding-right: 12px; /* 增加右边距 */
    line-height: 1.4; /* 设置行高以支持多行文本 */
    word-wrap: break-word; /* 允许长单词换行 */
}

.layui-input {
    border: 1px solid #ccc; /* 边框 */
    border-radius: 4px; /* 圆角 */
    transition: border-color 0.3s; /* 边框颜色变化效果 */
}

.layui-input:focus {
    border-color: #007bff; /* 聚焦时的边框颜色 */
    outline: none; /* 去掉默认的轮廓 */
}

.layui-btn {
    border-radius: 4px; /* 按钮圆角 */
    transition: background-color 0.3s; /* 背景颜色变化效果 */
}

.layui-btn-normal {
    background-color: #007bff; /* 主按钮颜色 */
    color: white; /* 字体颜色 */
}

.layui-btn-normal:hover {
    background-color: #0056b3; /* 悬停时的颜色 */
}

.layui-btn-primary {
    background-color: #6c757d; /* 次按钮颜色 */
    color: white; /* 字体颜色 */
}

.layui-btn-primary:hover {
    background-color: #5a6268; /* 悬停时的颜色 */
}

.registration-header {
    display: flex;
    justify-content: space-between; /* 使用 space-between 使标题居中，按钮靠右 */
    align-items: center;
    margin-bottom: 20px;
}

.registration-title {
    font-weight: bold;
    color: #007bff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
    flex-grow: 1; /* 使标题占据可用空间以居中 */
    text-align: center; /* 标题文本居中 */
}

.toggle-button {
    font-size: 16px;
    border-radius: 25px;
    background: #f0f0f0; /* 更柔和的背景色 */
    color: #333; /* 更深的文字颜色 */
    border: 1px solid #ccc; /* 添加边框 */
    padding: 8px 16px; /* 调整内边距 */
    box-shadow: none; /* 移除阴影效果 */
    transition: background 0.3s, color 0.3s; /* 添加颜色变化的过渡效果 */
}

.toggle-button:hover {
    background: #e0e0e0; /* 悬停时的背景色变化 */
    color: #007bff; /* 悬停时的文字颜色变化 */
}

/* 添加注册选项卡样式 */
.register-toggle-buttons {
    display: flex;
    margin-top: 15px;
    justify-content: center;
}

.toggle-button {
    padding: 8px 15px;
    margin: 0 5px;
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
    color: #666;
}

.toggle-button:hover {
    background-color: #e6e6e6;
    color: #333;
}

.toggle-button-active {
    background-color: #1E9FFF;
    color: white;
    border-color: #1E9FFF;
}

/* 移动设备适配 */
@media (max-width: 768px) {
    #foreignerReg .form-group,
    #userReg .form-group,
    #dwUserReg .form-group {
        flex-direction: column !important; /* 垂直排列 */
        align-items: stretch !important;
    }
    
    #foreignerReg .layui-form-label,
    #userReg .layui-form-label,
    #dwUserReg .layui-form-label {
        width: 100% !important;
        max-width: none !important;
        text-align: left !important;
        margin-bottom: 5px !important;
        padding-right: 0 !important;
        padding-top: 0 !important;
    }
    
    #foreignerReg .layui-input-block,
    #userReg .layui-input-block,
    #dwUserReg .layui-input-block {
        width: 100% !important;
    }
}

/* 为长标签优化的样式 */
.layui-form-label.long-label {
    width: 220px; /* 为特别长的标签提供更多宽度 */
    font-size: 13px; /* 稍微减小字体大小 */
}

/* 确保输入框对齐 */
.layui-input-block {
    margin-left: 212px; /* 与标签宽度对应 */
}

@media (max-width: 1024px) and (min-width: 769px) {
    .layui-form-label {
        width: 180px; /* 中等屏幕上稍微减小宽度 */
        font-size: 13px; /* 稍微减小字体 */
    }
    
    .layui-input-block {
        margin-left: 192px; /* 调整输入框位置 */
    }
}

/* 密码强度指示器 - 三格形式 */
.password-strength {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 1px; /* 与输入框边距保持一致 */
}

.strength-meter {
    flex: 1;
    height: 8px;
    display: flex;
    gap: 2px;
    border-radius: 4px;
    overflow: hidden;
}

.strength-bar {
    flex: 1;
    height: 100%;
    background: #e0e0e0;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.strength-bar.weak {
    background: #e74c3c;
}

.strength-bar.medium {
    background: #f39c12;
}

.strength-bar.strong {
    background: #27ae60;
}

.strength-text {
    font-size: 12px;
    color: #666;
    font-weight: 500;
    white-space: nowrap;
    min-width: 60px; /* 确保文字有足够空间 */
}

/* 确保密码输入框下方有足够的空间给密码强度指示器 */
.form-group .layui-input[type="password"] + .password-strength {
    margin-bottom: 4px;
}

/* 上传组件样式优化 - 修复提示框高度问题 */
.layui-upload-list {
    margin-top: 8px;
    min-height: auto !important; /* 移除最小高度限制 */
}

.layui-upload-list .tip {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    color: #999;
}

.layui-upload-list .layui-upload-img {
    display: block;
    max-width: 100%;
    max-width: 300px;
    max-height: 180px;
    height: auto;
    object-fit: contain;
    border: 1px solid #e6e6e6;
    border-radius: 2px;
    margin-top: 6px;
}

.layui-upload-list p {
    margin: 6px 0 0 0 !important; /* 移除默认的上下边距 */
    padding: 0 !important;
    min-height: 0 !important;
    line-height: 1.4;
    font-size: 12px;
}

/* 当p标签为空时，不占用空间 */
.layui-upload-list p:empty {
    display: none;
    margin: 0 !important;
    padding: 0 !important;
    height: 0 !important;
    min-height: 0 !important;
}

/* 确保上传组件在form-group中不会过度拉伸 */
#dwUserReg .layui-upload,
#userReg .layui-upload,
#foreignerReg .layui-upload {
    display: flex;
    flex-direction: column;
}

#dwUserReg .layui-upload-list,
#userReg .layui-upload-list,
#foreignerReg .layui-upload-list {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

/* 修复 layer.msg 弹窗高度异常问题 - 防止继承父元素高度 */
/* 确保弹窗不受 body 高度影响 */
body .layui-layer-msg {
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    /* 确保弹窗使用固定定位，不受父元素影响 */
    position: fixed !important;
}

body .layui-layer-msg .layui-layer-content {
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
}