/* 登录/注册弹窗样式 */

/* 弹窗容器 - 只针对.container */
.auth-popup {
    position: fixed !important; /* 使用fixed定位 */
    top: 0 !important;
    left: 50% !important; /* 水平居中 */
    transform: translateX(-50%) scale(0.95) !important; /* 水平居中并稍微缩小 */
    width: 100% !important;
    max-width: 516px !important; /* 与.container相同的最大宽度 */
    height: 100vh !important;
    background-color: rgba(0, 0, 0, 0.8) !important;
    z-index: 99999 !important;  /* 最高层级 */
    display: flex !important; /* 保持 flex 布局 */
    justify-content: center !important;
    align-items: flex-start !important; /* 改为顶部对齐，给底部留出空间 */
    padding-top: 10vh !important; /* 顶部留出10%的空间 */
    padding-bottom: 80px !important; /* 底部留出空间给关闭按钮 */
    opacity: 0 !important; /* 初始透明 */
    visibility: hidden !important; /* 初始不可见 */
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s linear 0.3s !important; /* 过渡效果 */
    pointer-events: none !important; /* 初始状态下不响应交互 */
    margin: 0 auto !important; /* 水平居中 */
    overflow-y: auto !important; /* 允许垂直滚动 */
    scrollbar-width: none !important; /* Firefox 隐藏滚动条 */
    -ms-overflow-style: none !important; /* IE 和 Edge 隐藏滚动条 */
    box-sizing: border-box !important; /* 确保padding不会增加总高度 */
}

/* 隐藏 WebKit 浏览器的滚动条 (Chrome, Safari, Opera) */
.auth-popup::-webkit-scrollbar {
    display: none !important;
}

/* 当显示时应用的样式 */
.auth-popup.active {
    opacity: 1 !important; /* 变为不透明 */
    visibility: visible !important; /* 变为可见 */
    transform: translateX(-50%) scale(1) !important; /* 保持水平居中并恢复正常大小 */
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s linear 0s !important; /* 过渡效果 */
    pointer-events: auto !important; /* 可见时响应交互 */
}

/* 弹窗内容 */
.auth-popup-content {
    position: relative;
    width: 90%;
    max-width: 465px;
    background-color: var(--background-color);
    border-radius: 10px;
    overflow-x: hidden; /* 隐藏水平滚动条 */
    overflow-y: auto; /* 允许垂直滚动 */
    scrollbar-width: none; /* Firefox 隐藏滚动条 */
    -ms-overflow-style: none; /* IE 和 Edge 隐藏滚动条 */
}

/* 隐藏 WebKit 浏览器的滚动条 (Chrome, Safari, Opera) */
.auth-popup-content::-webkit-scrollbar {
    display: none;
}

/* 关闭按钮 - 位于内容底部中间 */
.auth-popup-close {
    position: fixed; /* 使用固定定位 */
    left: 50%;
    transform: translateX(-50%); /* 水平居中 */
    display: flex; /* 使用flex布局 */
    align-items: center; /* 垂直居中 */
    justify-content: center; /* 水平居中 */
    cursor: pointer;
    z-index: 999999; /* 确保在最上层 */
    border: none;
    margin-top: 10px; /* 与内容保持一定距离 */
    background-color:transparent;
}

/* 标签栏 */
.auth-tabs {
    display: flex;
}

.auth-tab {
    flex: 1;
    padding: 1rem 0;
    background-color: var(--background-color);
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    -webkit-tap-highlight-color: transparent; /* 禁用移动端点击高亮 */
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
}

.auth-tab.active {
    background-color: var(--background-color);
    color: var(--active-color);
}

.auth-tab.active span {
    color: var(--active-color);
}

.auth-tab-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.2rem;
    height: 1.2rem;
}

.auth-tab-icon svg {
    width: 100%;
    height: 100%;
    fill: var(--text-color);
}

.auth-tab.active .auth-tab-icon svg {
    fill: var(--active-color);
}

.auth-tab {
    color: var(--text-color);
    transition: color 0.3s ease;
}

.auth-tab.active {
    background-color: var(--background-color);
    color: var(--active-color);
}

.auth-tab.active span {
    color: var(--active-color);
}

/* 确保图标和文字都使用相同的颜色 */
.auth-tab svg {
    fill: var(--text-color);
    transition: fill 0.3s ease;
}

.auth-tab.active svg {
    fill: var(--active-color);
}

.auth-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    /* left: 50%; */
    /* transform: translateX(-50%); */
    width: 90%;
    height: 3px;
    background-color: var(--active-color); 
    border-radius: 3px 3px 0 0;
    color: var(--active-color); /* 使用主题变量替换金色 */
}

.auth-tab-text
{
    font-size: 1rem;
}

/* 表单容器 */
.auth-form-container {
    position: relative; /* Needed for absolute positioning of forms */
}

/* 表单部分 - Setup for fade transition */
.auth-form {
    /* display: none; */ /* Replaced by opacity/visibility */
    position: absolute; /* Allow forms to overlap */
    top: 0;
    left: 0;
    width: 100%;
    padding: 20px; /* Add padding here since container padding won't apply directly */
    box-sizing: border-box; /* Ensure padding is included in width */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s linear 0.3s; /* Fade out */
}

.auth-form.active {
    /* display: block; */ /* Replaced by opacity/visibility */
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0s linear 0s; /* Fade in */
    position: relative; /* Override absolute positioning for the active form to define container height */
}

/* 表单标题 */
.auth-form-title {
    font-size: 18px;
    margin-bottom: 5px;
    color: var(--text-color);
    font-weight: bold;
}

.auth-form-subtitle {
    font-size: 12px;
    margin-bottom: 20px;
}

/* 表单组 */
.form-group {
    margin-bottom: 15px;
    position: relative;
}

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

.form-group input {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid var(--secondary-color);
    border-radius: 5px;
    color: var(--text-color);
    background-color: var(--register-darker-bg-color);
    font-size: 14px;
    outline: none !important;
}

/* Placeholder 文本颜色 */
.form-group input::placeholder {
    color: var(--secondary-color); /* 使用主题变量 */
}

/* 密码查看按钮 */
.toggle-password {
    position: absolute;
    right: 10px;
    top: 5px;
    color: var(--secondary-color);
    cursor: pointer;
    font-size: 18px;
}

.toggle-password svg {
    width: 1.4rem;
    height: 1.4rem;
    fill: var(--secondary-color);
}

/* 强度指示器 */
.strength-meter {
    display: flex;
    margin-top: 10px;
}

.strength-meter-bar {
    height: 5px;
    flex: 1;
    margin-right: 5px;
    background-color: var(--secondary-color);
    border-radius: 2px;
}

.strength-meter-bar.active {
    background-color: var(--active-color);
}

/* 国家代码选择器 */
.country-code-selector {
    display: flex;
    align-items: center;
    border: 1px solid var(--secondary-color);
    border-radius: 5px;
    overflow: hidden;
    min-width: 80px; /* 确保有足够的最小宽度 */
}

.country-flag {
    padding: 0 8px;
    display: flex;
    align-items: center;
    flex-shrink: 0; /* 防止国旗被压缩 */
}

.country-flag img {
    width: 24px;
    height: auto;
}

.country-code {
    font-weight: bold;
    color: var(--secondary-color);
    padding-right: 10px;
    white-space: nowrap; /* 防止文本换行 */
    flex-grow: 1; /* 允许文本区域增长 */
    text-align: center; /* 文本居中 */
}

.country-code-selector select {
    background-color: transparent;
    border: none;
    color: #fff;
    padding: 10px 5px;
    width: 100%;
    cursor: pointer;
}

/* 复选框 */
.checkbox-container {
    display: flex;
    align-items: center;
    margin: 20px 0;
}

.checkbox-container input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 10px;
    accent-color: var(--primary-color);
}

.checkbox-container label {
    color:  var(--secondary-color);
    font-size: 14px;
}

.contract-link {
    color: var(--active-color);
    text-decoration: none;
}
/* 添加忘记密码链接样式 */
.forgot-password {
    color: var(--text-color);
    text-decoration: none;
    font-size: 14px;
    float: right;
    margin-top: 5px;
}

/* 添加切换链接样式 */
.auth-switch-link {
    text-align: center;
    margin-top: 20px;
}

.auth-switch-link a {
    color: var(--active-color);
    text-decoration: none;
    font-size: 14px;
}

/* 提交按钮 */
.auth-submit-btn {
    width: 100%;
    padding: 12px 0;
    background-color: var(--active-color); /* 使用主题变量 */
    color: var(--text-color-active); 
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
}

/* 第三方登录支持 */
.auth-support-text {
    text-align: center;
    margin: 20px 0;
    color: #ccc;
    font-size: 14px;
}

/* 隐藏类 */
.hidden {
    display: none !important;
}

/* 手机号输入框样式 */
.mobile-input-container {
    display: flex;
    align-items: stretch; /* 确保子元素高度一致 */
    gap: 10px; /* 使用gap代替margin，更现代的布局方式 */
}

.country-code-selector {
    width: auto; /* 自动宽度，根据内容调整 */
    min-width: 80px; /* 最小宽度确保显示完整 */
    max-width: 100px; /* 最大宽度限制 */
    flex-shrink: 0; /* 防止被压缩 */
}

.mobile-input {
    flex-grow: 1; /* 允许输入框占据剩余空间 */
    min-width: 0; /* 允许输入框在必要时缩小 */
}

/* 验证错误样式 */
.error-message {
    display: none;
    color: #ff4d4f;
    font-size: 12px;
    margin-top: 5px;
    align-items: center;
}

.error-message img {
    width: 14px;
    height: 14px;
    margin-right: 5px;
}

.error-message::before {
    content: '\26A0'; /* Unicode警告符号 */
    display: inline-block;
    margin-right: 5px;
    font-size: 14px;
}

/* 隐藏图片，使用Unicode符号代替 */
.error-message img {
    display: none;
}

.form-group.has-error input {
    border-color: #ff4d4f;
}

.form-group.has-error .error-message {
    display: flex;
}
