function switchToLogin() {
    document.getElementById('auth-title').innerText = '登录至CCS';
    document.getElementById('login-form').style.display = 'block';
    document.getElementById('register-form').style.display = 'none';
}

function switchToRegister() {
    document.getElementById('auth-title').innerText = '注册至CCS';
    document.getElementById('login-form').style.display = 'none';
    document.getElementById('register-form').style.display = 'block';
}

function validateRegistration() {
    const agreement = document.getElementById('agreement').checked;
    if (!agreement) {
        alert('请先同意用户协议和隐私政策');
        return false;
    }
    return true;
}

function showTerms(event) {
    event.preventDefault();
    document.getElementById('terms-modal').style.display = 'block';
}

function showPrivacy(event) {
    event.preventDefault();
    document.getElementById('privacy-modal').style.display = 'block';
}

function closeModal() {
    document.getElementById('terms-modal').style.display = 'none';
    document.getElementById('privacy-modal').style.display = 'none';
}

// 默认显示登录表单
window.onload = switchToLogin;