/* PIGRAV_Release_Version/common/login_modal/login_modal.css */
.modal-overlay {
    position: fixed; /* 固定定位，覆盖整个视口 */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7); /* 半透明黑色背景 */
    display: flex; /* 使用 flex 布局实现居中 */
    justify-content: center; /* 水平居中 */
    align-items: center; /* 垂直居中 */
    z-index: 10000; /* 确保在最顶层 */
    opacity: 1;
    visibility: visible;
    transform: scale(1);
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
                visibility 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    transform: scale(0.95);
    pointer-events: none; /* 隐藏时不可交互 */
}

.modal-content {
    background-color: #2d3748; /* 深灰色背景 */
    color: #e2e8f0; /* 浅灰色文字 */
    padding: 30px 40px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    position: relative;
    width: 90%;
    max-width: 400px; /* 最大宽度 */
    text-align: center;
    box-sizing: border-box; /* 确保正确计算尺寸 */
}

.close-modal-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    color: #a0aec0; /* 中灰色 */
    cursor: pointer;
    line-height: 1;
}

.close-modal-btn:hover {
    color: #e2e8f0; /* 悬停时变亮 */
}

.modal-content h2 {
    margin-top: 0;
    margin-bottom: 25px;
    color: #ffffff;
    font-weight: 600;
}

.modal-body {
    text-align: left;
}

.form-group {
    margin-bottom: 15px;
    position: relative; /* 用于验证码按钮定位 */
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
    color: #a0aec0;
    white-space: nowrap; /* 新增：强制标签文本不换行 */
}

.form-group input[type="tel"],
.form-group input[type="password"],
.form-group input[type="text"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #4a5568; /* 边框颜色 */
    border-radius: 4px;
    background-color: #1a202c; /* 输入框背景色 */
    color: #e2e8f0; /* 输入文字颜色 */
    font-size: 16px;
    box-sizing: border-box; /* 确保 padding 不会撑大宽度 */
}

.form-group input:focus {
    outline: none;
    border-color: #4299e1; /* 聚焦时边框变蓝 */
    box-shadow: 0 0 0 2px rgba(66, 153, 225, 0.5);
}

/* 新增：输入框错误高亮样式 */
.form-group input.input-error {
    border-color: #f56565; /* 红色边框 */
    box-shadow: 0 0 0 2px rgba(245, 101, 101, 0.5); /* 红色阴影 */
}

/* 新增：标签和提示的包装器 */
.label-wrapper {
    display: flex; /* 使用 flex 布局 */
    align-items: baseline; /* 基线对齐，让标签和提示文字底部对齐 */
    gap: 10px; /* 标签和提示之间的间距 */
    margin-bottom: 5px; /* 保持与下方输入框的间距 */
}

.label-wrapper label {
    margin-bottom: 0; /* 移除 label 自身的下边距 */
    white-space: nowrap;
    flex-shrink: 0; /* 防止标签被压缩 */
}

/* 调整密码提示样式 */
.password-hint {
    font-size: 12px; 
    color: #a0aec0; 
    white-space: nowrap; 
    /* flex-shrink: 0; */ /* 可能不再需要 */
}

/* 修改：记住我 和 忘记密码 行的样式 */
.form-options {
    display: flex; 
    flex-direction: column; /* 垂直排列 */
    align-items: flex-end; /* 右对齐 */
    gap: 5px; /* 上下元素间距 */
    margin-top: 10px; 
    margin-bottom: 20px; 
}

/* 调整忘记密码按钮的上内边距 */
.form-options .link-btn {
    padding-top: 0; /* 移除之前的上边距 */
}

.remember-me-group {
    display: flex; /* 让复选框和标签对齐 */
    align-items: center;
}

.remember-me-group input[type="checkbox"] {
    margin-right: 5px; /* 复选框和标签之间的间距 */
    /* 可以根据需要调整复选框大小或样式 */
}

.remember-me-group label {
    margin-bottom: 0; /* 移除 form-group 带来的默认下边距 */
    font-size: 14px; /* 调整字体大小 */
    color: #a0aec0; /* 调整颜色 */
    cursor: pointer; /* 鼠标悬停时显示指针 */
    white-space: nowrap; /* 防止标签换行 */
}

/* 修正：确保 login-only 和 register-only 的隐藏规则 */
.form-options .login-only.hidden, 
.form-group.register-only.hidden,
.password-hint.register-only.hidden,
/* 新增：确保 forgot-password-only 在非忘记密码模式下隐藏 */
.form-actions .forgot-password-only.hidden { 
    display: none;
}

.form-actions {
    margin-top: 25px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.primary-btn {
    background-color: #4299e1; /* 主按钮蓝色 */
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    width: 100%;
    transition: background-color 0.2s ease;
}

.primary-btn:hover {
    background-color: #2b6cb0; /* 悬停时深蓝色 */
}

.primary-btn:disabled {
    background-color: #a0aec0; /* 禁用时灰色 */
    cursor: not-allowed;
}

.secondary-btn {
    background-color: #4a5568; /* 次按钮灰色 */
    color: #e2e8f0;
    border: 1px solid #718096;
}
.secondary-btn:hover {
    background-color: #718096;
}

.link-btn {
    background: none;
    border: none;
    color: #63b3ed; /* 链接按钮蓝色 */
    cursor: pointer;
    padding: 10px 0 0; /* 增加上边距 */
    font-size: 14px;
    text-decoration: underline;
}

.link-btn:hover {
    color: #90cdf4; /* 悬停时浅蓝色 */
}

/* 新增：为内部包裹 div 应用 Flex 布局 */
.verification-code-input-wrapper {
    display: flex; /* 使用 Flex 布局 */
    align-items: center; /* 垂直居中对齐 */
    gap: 5px; /* 在输入框和按钮之间添加一点间距 */
}

/* 修改：选择器指向内部包裹 div 中的输入框 */
.verification-code-input-wrapper input[type="text"] {
    flex-grow: 1; /* 输入框占据可用空间 */
    width: auto; 
}

/* 修改：选择器指向内部包裹 div 中的按钮 */
#get-code-btn { /* ID 选择器保持不变，但其父级是新的 wrapper */
    /* ... 按钮的其他样式保持不变 (flex-shrink, padding, height 等) ... */
    flex-shrink: 0; 
    padding: 6px 10px;
    font-size: 12px;
    height: 38px; 
    line-height: normal;
}

.form-group.register-only.hidden,
.form-group.login-only.hidden {
    display: none;
}

.modal-message {
    color: #f56565; /* 红色错误消息 */
    font-size: 14px;
    margin-top: -10px;
    margin-bottom: 15px;
    min-height: 1.2em; /* 占据空间防止跳动 */
    text-align: center;
}
.modal-message.success {
    color: #48bb78; /* 绿色成功消息 */
}

/* 新增：模态框抖动动画 */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.modal-shake .modal-content { /* 应用到 modal-content 实现抖动 */
    animation: shake 0.5s ease-in-out;
}

/* === 移动端响应式适配 === */
@media (max-width: 768px) {
    .modal-content {
        width: 85% !important; /* 更小的移动端宽度占比 */
        max-width: 300px !important; /* 更小的最大宽度 */
        padding: 18px 14px !important; /* 减小内边距 */
        margin: 10px !important; /* 减小外边距 */
        box-sizing: border-box !important; /* 确保正确计算尺寸 */
    }

    .modal-content h2 {
        font-size: 20px; /* 减小标题字体 */
        margin-bottom: 20px;
    }

    .form-group input[type="tel"],
    .form-group input[type="password"],
    .form-group input[type="text"] {
        padding: 12px; /* 增大输入框内边距，适合触摸 */
        font-size: 16px; /* 防止iOS缩放 */
    }

    .primary-btn {
        padding: 14px; /* 增大按钮尺寸 */
        font-size: 16px; /* 增大字体 */
    }

    .form-group {
        margin-bottom: 18px; /* 增大表单项间距 */
    }

    .verification-code-input-wrapper {
        gap: 8px; /* 增大验证码输入框和按钮间距 */
    }

    #get-code-btn {
        padding: 8px 12px;
        height: 42px; /* 与输入框高度匹配 */
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .modal-content {
        width: 90% !important; /* 小屏幕增加宽度占比 */
        max-width: 280px !important; /* 小屏幕更小的最大宽度 */
        padding: 16px 12px !important; /* 进一步减小内边距 */
        margin: 8px !important; /* 减小外边距 */
    }

    .modal-content h2 {
        font-size: 18px; /* 进一步减小标题字体 */
        margin-bottom: 15px;
    }

    .form-actions {
        margin-top: 20px;
    }
}

/* 超小屏幕适配（iPhone SE等） */
@media (max-width: 375px) {
    .modal-content {
        width: 92% !important; /* 更大的宽度占比，适合小屏幕 */
        max-width: 260px !important; /* 非常小的最大宽度 */
        padding: 14px 10px !important; /* 最小内边距 */
        margin: 5px auto !important; /* 最小外边距，确保居中 */
    }

    .modal-content h2 {
        font-size: 16px; /* 更小的标题字体 */
        margin-bottom: 12px;
    }

    .form-group {
        margin-bottom: 15px; /* 减小表单项间距 */
    }

    .form-group input[type="tel"],
    .form-group input[type="password"],
    .form-group input[type="text"] {
        padding: 10px; /* 减小输入框内边距 */
        font-size: 16px; /* 保持16px防止缩放 */
    }

    .primary-btn {
        padding: 12px; /* 减小按钮内边距 */
        font-size: 15px;
    }
}

/* === 强制移动端适配 - 最高优先级 === */
@media screen and (max-width: 768px) {
    .modal-overlay .modal-content {
        width: 85% !important;
        max-width: 300px !important;
        min-width: auto !important;
        padding: 18px 14px !important;
        margin: 10px auto !important;
        box-sizing: border-box !important;
    }
}

@media screen and (max-width: 480px) {
    .modal-overlay .modal-content {
        width: 90% !important;
        max-width: 280px !important;
        padding: 16px 12px !important;
        margin: 8px auto !important;
    }
}

@media screen and (max-width: 375px) {
    .modal-overlay .modal-content {
        width: 92% !important;
        max-width: 260px !important;
        padding: 14px 10px !important;
        margin: 5px auto !important;
    }
} 