/* 重置样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: url('./bg.webp') no-repeat center center;
    background-size: cover;
    background-attachment: fixed;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #333;
    line-height: 1.6;
    position: relative;
}

/* 背景遮罩层，提供更好的对比度 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    z-index: -1;
}

/* toast层图标大小 */
.pxmu-success-icon {
    width: 22px !important;
}

.container {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

/* 页面容器 */
#registerPage,
#changePasswordPage,
#changeSafePasswordPage {
    background: rgba(255, 255, 255, 0.9) !important;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 20px;
    padding: 32px 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15), 0 8px 16px rgba(0, 0, 0, 0.1);
    width: 100%;
    transition: all 0.3s ease;
    color: #333 !important;
}

.hidden {
    display: none !important;
}

/* 头部样式 */
.header {
    text-align: center;
    margin-bottom: 32px;
}

.header h1 {
    font-size: 24px;
    font-weight: 600;
    color: #333 !important;
    margin-top: 16px;
}

/* 表单样式 */
form {
    width: 100%;
}

/* Safari 自动填充修复输入框 - 完全隐藏 */
.safari-fix-input {
    position: absolute;
    left: -9999px;
    top: -9999px;
    width: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    opacity: 0 !important;
    pointer-events: none;
    visibility: hidden;
}

/* 表单项统一容器 */
.form-item {
    margin-bottom: 16px;
}

/* 输入框样式 */
input[type="tel"]:not(.safari-fix-input),
input[type="text"]:not(.safari-fix-input),
input[type="password"]:not(.safari-fix-input) {
    width: 100%;
    height: 48px;
    background: rgba(255, 255, 255, 0.85) !important;
    border: 1px solid rgba(200, 200, 200, 0.6) !important;
    border-radius: 12px;
    padding: 0 16px;
    font-size: 16px;
    color: #333 !important;
    margin-bottom: 0;
    transition: all 0.3s ease;
    outline: none;
    letter-spacing: 1px;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

input[type="tel"]:not(.safari-fix-input):focus,
input[type="text"]:not(.safari-fix-input):focus,
input[type="password"]:not(.safari-fix-input):focus {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(73, 191, 125, 0.6);
    box-shadow: 0 0 0 3px rgba(73, 191, 125, 0.1);
}

input::placeholder {
    color: #999;
    font-size: 14px;
}

/* 密码输入框容器 */
.password-container {
    position: relative;
}

.password-container input {
    padding-right: 46px;
    margin-bottom: 0;
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    padding: 0;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-password-img {
    width: 22px;
    height: 22px;
    opacity: 0.6;
    transition: opacity 0.3s ease;
    display: block;
}

.toggle-password:hover .toggle-password-img {
    opacity: 1;
}



/* 验证码容器 */
.captcha-container {
    display: flex;
    gap: 12px;
    align-items: center;
}

.captcha-input {
    flex: 0 1 60%;
    margin-bottom: 0 !important;
}

.captcha-img {
    flex: 0 1 38%;
    height: 48px;
    min-width: 80px;
    border-radius: 12px;
    cursor: pointer;
    border: 1px solid rgba(200, 200, 200, 0.6) !important;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.85) !important;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.captcha-img:hover {
    border-color: rgba(73, 191, 125, 0.6);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 按钮样式 */
.button-container {
    margin-top: 24px;
}

button[type="submit"] {
    width: 100%;
    height: 48px;
    min-height: 48px;
    background: linear-gradient(135deg, #49bf7d 0%, #45a049 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 16px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(73, 191, 125, 0.3);
}

button[type="submit"]:hover {
    background: linear-gradient(135deg, #45a049 0%, #3d8b40 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(73, 191, 125, 0.4);
}

button[type="submit"]:active {
    transform: translateY(0);
}

/* 内部按钮容器 */
.button-inner-container {
    display: flex;
    gap: 12px;
}

.change-pwd-btn,
.change-safe-pwd-btn,
.back-button {
    flex: 1;
    height: 44px;
    min-height: 44px;
    background: rgba(255, 255, 255, 0.7) !important;
    color: #555 !important;
    border: 1px solid rgba(200, 200, 200, 0.6) !important;
    border-radius: 12px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.change-pwd-btn:hover,
.change-safe-pwd-btn:hover,
.back-button:hover {
    color: #49bf7d;
    border-color: rgba(73, 191, 125, 0.6);
    background: rgba(73, 191, 125, 0.1);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(73, 191, 125, 0.2);
}

/* 响应式设计 */
@media (max-width: 480px) {
    body {
        padding: 16px;
        background-attachment: scroll; /* 移动端使用scroll避免性能问题 */
    }
    
    #registerPage,
    #changePasswordPage,
    #changeSafePasswordPage {
        padding: 24px 20px;
        border-radius: 16px;
        background: rgba(255, 255, 255, 0.92);
    }
    
    .header h1 {
        font-size: 20px;
    }
    
    input[type="tel"]:not(.safari-fix-input),
    input[type="text"]:not(.safari-fix-input),
    input[type="password"]:not(.safari-fix-input) {
        height: 44px;
        font-size: 15px;
        padding: 0 14px;
    }
    
    button[type="submit"] {
        height: 44px;
        min-height: 44px;
        font-size: 15px;
    }
    
    .captcha-input {
        flex: 0 1 58%;
    }
    
    .captcha-img {
        flex: 0 1 40%;
        height: 44px;
        min-width: 70px;
    }
    
    .agreement-container {
        font-size: 13px;
        margin: 12px 0 20px 0;
    }
    
    .agreement-container input[type="checkbox"] {
        width: 14px;
        height: 14px;
    }
    
    .button-inner-container {
        flex-direction: column;
        gap: 8px;
    }
    
    .change-pwd-btn,
    .change-safe-pwd-btn,
    .back-button {
        width: 100%;
        height: 44px;
        min-height: 44px;
        font-size: 13px;
        flex: none;
    }
}

@media (max-width: 360px) {
    body {
        padding: 12px;
    }
    
    #registerPage,
    #changePasswordPage,
    #changeSafePasswordPage {
        padding: 20px 16px;
    }
    
    .header {
        margin-bottom: 24px;
    }
    
    .header h1 {
        font-size: 18px;
    }
    
    .form-item {
        margin-bottom: 12px;
    }
    
    input[type="tel"]:not(.safari-fix-input),
    input[type="text"]:not(.safari-fix-input),
    input[type="password"]:not(.safari-fix-input) {
        height: 42px;
        font-size: 14px;
    }
    
    button[type="submit"] {
        height: 44px;
        min-height: 44px;
        font-size: 14px;
    }
    

    
    .captcha-input {
        flex: 0 1 55%;
    }
    
    .captcha-img {
        flex: 0 1 43%;
        height: 42px;
        min-width: 65px;
    }
    
    .change-pwd-btn,
    .change-safe-pwd-btn,
    .back-button {
        height: 44px;
        min-height: 44px;
        font-size: 12px;
    }
}

/* 触摸友好样式 */
@media (hover: none) and (pointer: coarse) {
    button, .captcha-img {
        min-height: 44px;
        min-width: 44px;
    }
    
    .change-pwd-btn,
    .change-safe-pwd-btn,
    .back-button {
        min-height: 44px;
        height: 44px;
    }
    
    .toggle-password {
        padding: 0;
        width: 22px;
        height: 22px;
    }
    
    .toggle-password-img {
        width: 22px;
        height: 22px;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#registerPage:not(.hidden),
#changePasswordPage:not(.hidden),
#changeSafePasswordPage:not(.hidden) {
    animation: fadeIn 0.4s ease-out;
}

/* 加载动画 */
.loading {
    opacity: 0.7;
    pointer-events: none;
}

.loading button[type="submit"] {
    background: #ccc;
    cursor: not-allowed;
}

/* 错误状态 */
.error {
    border-color: #f44336 !important;
    background: #ffebee !important;
}

.error::placeholder {
    color: #f44336;
}

/* 成功状态 */
.success {
    border-color: #49bf7d !important;
    background: #e8f5e8 !important;
}

/* 提示信息 */
.message {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
    text-align: center;
}

.message.success {
    background: #e8f5e8;
    color: #2e7d32;
    border: 1px solid #49bf7d;
}

.message.error {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #f44336;
}

.message.info {
    background: #e3f2fd;
    color: #1565c0;
    border: 1px solid #2196f3;
}

/* 移动端横屏适配 */
@media screen and (max-height: 500px) and (orientation: landscape) {
    body {
        padding: 10px;
        background-attachment: scroll;
        align-items: flex-start;
        padding-top: 20px;
    }
    
    #registerPage,
    #changePasswordPage,
    #changeSafePasswordPage {
        padding: 20px 16px;
        border-radius: 12px;
        background: rgba(255, 255, 255, 0.95);
        max-height: calc(100vh - 40px);
        overflow-y: auto;
        margin-top: 20px;
    }
    
    .header {
        margin-bottom: 20px;
    }
    
    .header h1 {
        font-size: 18px;
    }
    
    .form-item {
        margin-bottom: 12px;
    }
    
    input[type="tel"]:not(.safari-fix-input),
    input[type="text"]:not(.safari-fix-input),
    input[type="password"]:not(.safari-fix-input) {
        height: 40px;
        font-size: 14px;
    }
    
    button[type="submit"] {
        height: 40px;
        min-height: 40px;
        font-size: 14px;
    }
    
    .captcha-img {
        height: 40px;
    }
    
    .change-pwd-btn,
    .change-safe-pwd-btn,
    .back-button {
        height: 36px;
        min-height: 36px;
        font-size: 12px;
    }
}

/* 移动端竖屏优化 */
@media screen and (max-width: 480px) and (orientation: portrait) {
    body {
        background-attachment: scroll;
    }
    
    .container {
        max-width: 360px;
    }
    
    #registerPage,
    #changePasswordPage,
    #changeSafePasswordPage {
        background: rgba(255, 255, 255, 0.93);
        margin: 10px 0;
    }
}

/* 大屏幕优化 */
@media screen and (min-width: 1200px) {
    body {
        background-attachment: fixed;
        background-size: cover;
    }
    
    .container {
        max-width: 450px;
    }
    
    #registerPage,
    #changePasswordPage,
    #changeSafePasswordPage {
        padding: 40px 32px;
        background: rgba(255, 255, 255, 0.9);
    }
}

/* 暗色主题适配 - 暂时禁用自动检测 */
@media (prefers-color-scheme: dark) and (max-width: 0px) {
    body {
        background: url('./bg.webp') no-repeat center center;
        background-size: cover;
        background-attachment: fixed;
    }
    
    /* 暗色主题的遮罩层 */
    body::before {
        background: rgba(0, 0, 0, 0.4);
    }
    
    #registerPage,
    #changePasswordPage,
    #changeSafePasswordPage {
        background: rgba(26, 32, 44, 0.9);
        color: #e2e8f0;
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 0 8px 16px rgba(0, 0, 0, 0.2);
        backdrop-filter: blur(15px);
        -webkit-backdrop-filter: blur(15px);
        border: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .header h1 {
        color: #e2e8f0;
    }
    
    input[type="tel"]:not(.safari-fix-input),
    input[type="text"]:not(.safari-fix-input),
    input[type="password"]:not(.safari-fix-input) {
        background: #2d3748;
        color: #e2e8f0;
        border: 1px solid #4a5568;
    }
    
    input[type="tel"]:not(.safari-fix-input):focus,
    input[type="text"]:not(.safari-fix-input):focus,
    input[type="password"]:not(.safari-fix-input):focus {
        background: #4a5568;
        border-color: #49bf7d;
    }
    
    input::placeholder {
        color: #a0aec0;
    }
    
    .captcha-img {
        border-color: #4a5568;
    }
    
    .agreement-container {
        color: #a0aec0;
    }
    
    .change-pwd-btn,
    .change-safe-pwd-btn,
    .back-button {
        color: #a0aec0;
        border-color: #4a5568;
    }
    
    .change-pwd-btn:hover,
    .change-safe-pwd-btn:hover,
    .back-button:hover {
        color: #49bf7d;
        border-color: #49bf7d;
        background: rgba(76, 175, 80, 0.1);
    }
}