* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* General Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
}

.modal-content {
    position: relative;
    margin: auto;
    padding: 20px;
    border-radius: 10px;
    background-color: rgba(44, 44, 44, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    text-align: center;
    width: 85%;
    max-width: 340px;
    top: 50%;
    transform: translateY(-50%);
}

.close-button {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    background: none;
    border: none;
}

.close-button:hover,
.close-button:focus {
    color: #fff;
    text-decoration: none;
}

/* Custom Alert Specific Styles */
.custom-alert .modal-content {
    padding: 30px 25px;
    border-top: 4px solid #8A2BE2;
}

.custom-alert p {
    margin: 0 0 25px 0;
    font-size: 17px;
    line-height: 1.5;
}

.custom-alert button {
    padding: 12px 45px;
    background: #8A2BE2;
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.custom-alert button:hover {
    background: #7b24c7;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(138, 43, 226, 0.4);
}

/* Captcha Modal Specific Styles */
#captchaImage {
    margin: 15px 0 20px;
    width: 100%;
    height: auto;
    border-radius: 5px;
    background-color: #fff;
}

.captcha-input-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#captchaInput {
    width: 100%;
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    color: white;
    box-sizing: border-box;
}

#captchaInput::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

#submitCaptcha {
    width: 100%;
    padding: 12px;
    background: #8A2BE2;
    border: none;
    border-radius: 5px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
}

#submitCaptcha:hover {
    background: #7b24c7;
}

/* Body and Layout */
body, html {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #fff;
    -ms-overflow-style: none;
    scrollbar-width: none;
    overflow-x: hidden;
    background-image: url('../images/u_bg_8.png');
    background-size: 150% 150%;
    background-position: center;
    background-attachment: fixed;
    animation: background-pan 20s linear infinite alternate;
}

body::-webkit-scrollbar {
    display: none;
}

@keyframes background-pan {
    from { background-position: 0% center; }
    to { background-position: 100% center; }
}

.container {
    max-width: 400px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 25px;
    box-sizing: border-box;
    position: relative;
}

.page-header {
    width: 100%;
    padding-top: 12vh;
    position: relative;
}

.main-content {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.page-footer {
    margin-top: 50px;
    padding-bottom: 20px;
    font-size: 12px;
    color: #aaa;
    text-align: center;
}

/* Logo */
.logo {
    text-align: center;
    margin-bottom: 30px;
}

.logo img {
    max-width: 120px;
    margin-bottom: 20px;
    animation: bounce 2.5s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

/* Language Selector */
.language-selector {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    color: white;
    padding: 5px;
    display: flex;
    align-items: center;
}

.language-selector .fa-globe {
    margin-right: 8px;
}

.language-selector select {
    background: transparent;
    border: none;
    color: #fff;
    outline: none;
    cursor: pointer;
}

.language-selector select option {
    background: #1e193c;
    border: none;
}

/* Form Styles */
.register-form {
    width: 100%;
    max-width: 380px;
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.input-group {
    position: relative;
    display: flex;
    align-items: center;
    margin-top: 10px;
}

.input-group .icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: rgba(255, 255, 255, 0.6);
}

.input-group input {
    width: 100%;
    padding: 15px 15px 15px 50px;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 30px;
    color: #fff;
    font-size: 16px;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.input-group input:focus {
    border-color: #8A2BE2;
    box-shadow: 0 0 10px rgba(138, 43, 226, 0.5);
}

.toggle-password {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.6);
    font-size: 18px;
}

.toggle-password:hover {
    color: #fff;
}

.input-group.with-button input {
    padding-right: 110px;
}

.btn-get-code {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    padding: 8px 20px;
    background-color: #8A2BE2;
    border: none;
    border-radius: 20px;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-get-code:hover {
    background-color: #9370DB;
}

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

/* 输入组加载状态样式 */
.input-group.loading {
    position: relative;
    pointer-events: none;
}

.input-group.loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(138, 43, 226, 0.1);
    border-radius: 30px;
    z-index: 1;
}

.input-group.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 50px;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border: 4px solid rgba(138, 43, 226, 0.3);
    border-top: 4px solid #8A2BE2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 2;
}

.input-group.loading input {
    background-color: rgba(255, 255, 255, 0.02);
    border-color: rgba(138, 43, 226, 0.3);
    color: rgba(255, 255, 255, 0.7);
}

.input-group.loading .btn-get-code {
    opacity: 0.5;
    background-color: #666;
    cursor: not-allowed;
}

@keyframes spin {
    0% { transform: translateY(-50%) rotate(0deg); }
    100% { transform: translateY(-50%) rotate(360deg); }
}

/* 响应式调整 */
@media (max-width: 480px) {
    .btn-get-code {
        padding: 6px 16px;
        min-width: 70px;
    }
    .input-group.loading::after {
        width: 16px;
        height: 16px;
        right: 32px;
        border-width: 4.5px;
    }
}

.note {
    font-size: 12px;
    color: #ccc;
    text-align: left;
    padding-left: 20px;
    margin-top: -15px;
    margin-bottom: -10px;
}

.agreement {
    font-size: 13px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.agreement label {
    cursor: pointer;
}

.agreement a {
    color: #c390f8;
    text-decoration: none;
}

.btn-register {
    background: linear-gradient(45deg, #8A2BE2, #9370DB);
    color: #fff;
    border: none;
    border-radius: 30px;
    padding: 18px;
    font-size: 18px;
    cursor: pointer;
    width: 100%;
    margin-top: 20px;
    font-weight: bold;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-register:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(138, 43, 226, 0.4);
}

/* Preloader */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #0c0a1f;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.75s ease, visibility 0.75s ease;
}

#preloader.hidden {
    opacity: 0;
    visibility: hidden;
}

.spinner {
    border: 8px solid rgba(255, 255, 255, 0.2);
    border-left-color: #9b59b6;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
}

/* Responsive */
@media (max-width: 480px) {
    .logo img {
        width: 100px;
    }
    .register-form {
        gap: 15px;
        max-width: 100%;
    }
    .input-group input {
        font-size: 14px;
    }
    .btn-get-code {
        padding: 8px 15px;
        font-size: 12px;
    }
    .btn-register {
        padding: 15px;
        font-size: 16px;
    }
    .page-footer {
        font-size: 10px;
    }
}

/* RTL Support */
[dir="rtl"] .input-group .icon {
    left: auto;
    right: 20px;
}
[dir="rtl"] .toggle-password {
    right: auto;
    left: 20px;
}
[dir="rtl"] .input-group input {
    padding-left: 50px;
    padding-right: 50px;
}
[dir="rtl"] .input-group.with-button input {
    padding-right: 110px;
    padding-left: 15px;
}
[dir="rtl"] .btn-get-code {
    right: auto;
    left: 8px;
}
[dir="rtl"] .language-selector {
    right: auto;
    left: 20px;
}
[dir="rtl"] .language-selector .fa-globe {
    margin-right: 0;
    margin-left: 8px;
}
[dir="rtl"] .note {
    text-align: right;
    padding-left: 0;
    padding-right: 20px;
}

/* 已有账号下载链接样式 */
.existing-account-section {
    text-align: center;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid rgba(138, 43, 226, 0.2);
}

.download-app-link {
    color: #8A2BE2;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-block;
    padding: 8px 16px;
    border-radius: 6px;
    border: 1px solid transparent;
}

.download-app-link:hover {
    color: #7b24c7;
    background-color: rgba(138, 43, 226, 0.1);
    border-color: rgba(138, 43, 226, 0.3);
    text-decoration: none;
    transform: translateY(-1px);
}

.download-app-link:active {
    transform: translateY(0);
}

/* 响应式设计 */
@media (max-width: 480px) {
    .existing-account-section {
        margin-top: 15px;
        padding-top: 12px;
    }
    
    .download-app-link {
        font-size: 13px;
        padding: 6px 12px;
    }
}