/* 全局禁止文字选择（除输入框外） */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* 允许输入框内的文字选择 */
input, textarea {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

html {
    font-size: 16px;
}

body {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #f3f6fb;
    overflow-x: hidden;
    padding: 20px;
}

/* 压暗的酸性风格渐变背景 */
.background-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    background:
        radial-gradient(circle at 15% 20%, rgba(59, 130, 246, 0.12) 0%, transparent 35%),
        radial-gradient(circle at 85% 30%, rgba(14, 165, 233, 0.10) 0%, transparent 40%),
        linear-gradient(135deg, #f5f9ff 0%, #e9f2ff 45%, #ffffff 100%);
}

/* 萤火虫粒子容器 */
.fireflies-container {
    display: none;
}

/* 萤火虫粒子 */
.firefly {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    pointer-events: none;
    filter: blur(0.5px);
    animation: firefly-float 10s ease-in-out infinite;
    box-shadow: 0 0 8px 1px currentColor;
}

/* 萤火虫动画 - 连续不断 */
@keyframes firefly-float {
    0%, 100% {
        opacity: 0.2;
        transform: translate(0, 0);
    }
    15% {
        opacity: 0.8;
    }
    35% {
        opacity: 1;
    }
    55% {
        opacity: 0.8;
    }
    75% {
        opacity: 0.4;
    }
    90% {
        opacity: 0.2;
    }
}

/* Logo名称 - 优雅的衬线字体 */
.logo-name {
    position: fixed;
    left: 50%;
    top: 40px;
    transform: translateX(-50%);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 0;
    line-height: 0;
    font-weight: 700;
    letter-spacing: 0;
    z-index: 5;
    text-align: center;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    pointer-events: none;
    transition: opacity 0.2s ease;
    opacity: 0;
    visibility: hidden;
    white-space: nowrap;
    max-width: 95vw;
}

.logo-name.hidden {
    opacity: 0;
    visibility: hidden;
}

.logo-name .logo-icon {
    width: 260px;
    height: auto;
    max-width: min(78vw, 420px);
    object-fit: contain;
}

/* 容器 */
.container {
    width: 100%;
    max-width: 420px;
    z-index: 10;
    position: relative;
}

/* 增强的毛玻璃登录/注册表单容器 */
.form-container {
    width: 100%;
    padding: 36px 40px 30px;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e5eaf3;
    box-shadow:
        0 16px 40px rgba(15, 23, 42, 0.08),
        0 2px 8px rgba(15, 23, 42, 0.04);
    position: relative;
    overflow: hidden;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 玻璃质感增强效果 */
.form-container::before {
    content: none;
}

/* 玻璃光泽效果 */
.form-container::after {
    content: none;
}

@keyframes glass-shine {
    0% { transform: translateX(-100%); }
    20%, 100% { transform: translateX(100%); }
}

/* 表单头部 */
.form-header {
    text-align: center;
    margin-bottom: 30px;
}

.form-header h1 {
    color: #1f2a44;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.form-header p {
    color: #5b6b8b;
    font-size: 13px;
    letter-spacing: 0.3px;
}

/* 表单 */
.form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    margin-bottom: 6px;
    position: relative;
}

.form-group label {
    display: block;
    color: #334155;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.input-wrapper {
    position: relative;
}

.input-wrapper i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 18px;
    z-index: 1;
}

/* 密码可见性切换按钮 */
.password-toggle {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    z-index: 2;
    width: 40px;
    height: 40px;
    display: none;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    outline: none;
    padding: 0;
    margin: 0;
    /* 移除移动端点击高亮效果 */
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    touch-action: manipulation;
}

.password-toggle.show {
    display: flex;
}

.password-toggle i {
    color: #94a3b8;
    font-size: 22px;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    position: static;
    transform: none;
    /* 移除移动端点击高亮效果 */
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    pointer-events: none;
}

.password-toggle:hover i {
    color: #475569;
}

/* 移除所有焦点和激活状态的视觉反馈 */
.password-toggle:focus {
    outline: none !important;
    box-shadow: none !important;
}

.password-toggle:active {
    outline: none !important;
    box-shadow: none !important;
    background: transparent !important;
}

/* 输入框 */
.input-wrapper input {
    width: 100%;
    padding: 16px 56px 16px 48px;
    background: #f7f9fc;
    border: 1px solid #dbe3ef;
    border-radius: 12px;
    color: #1f2a44;
    font-size: 16px;
    transition: all 0.3s ease;
    outline: none;
    user-select: text;
    -webkit-user-select: text;
}

.input-wrapper input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
    background: #ffffff;
}

.input-wrapper input::placeholder {
    color: #9aa6b2;
}

.input-wrapper input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 自动填充检测动画 - 用于JavaScript检测 */
@keyframes onAutoFillStart {
    from { background: transparent; }
    to { background: transparent; }
}

.input-wrapper input:-webkit-autofill {
    animation-name: onAutoFillStart;
    animation-duration: 0.001s;
}

/* 记住登录状态 */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    font-size: 14px;
}

.remember-me {
    display: flex;
    align-items: center;
    color: #475569;
}

.remember-me input {
    margin-right: 8px;
    accent-color: #2563eb;
    cursor: pointer;
}

.remember-me label {
    cursor: pointer;
    user-select: none;
}

/* 用户协议复选框 */
.agreement-group {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    font-size: 14px;
    color: #475569;
}

.agreement-checkbox {
    width: 16px;
    height: 16px;
    accent-color: #2563eb;
    cursor: pointer;
    flex-shrink: 0;
}

.agreement-label {
    cursor: pointer;
    user-select: none;
}

.terms-link {
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
}

.terms-link:hover {
    text-decoration: underline;
    color: #1D4ED8;
}

/* 用户协议弹窗 */
.terms-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.terms-modal-panel {
    background: #FFFFFF;
    border-radius: 16px;
    width: 100%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.terms-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e5eaf3;
}

.terms-modal-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: #1f2a44;
    margin: 0;
}

.terms-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #5b6b8b;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.terms-modal-close:hover {
    color: #1f2a44;
}

.terms-modal-body {
    padding: 24px;
    overflow-y: auto;
    font-size: 13px;
    line-height: 1.7;
    color: #000000;
    font-family: 'Microsoft YaHei', 'PingFang SC', -apple-system, sans-serif;
    letter-spacing: 0.02em;
}

.terms-modal-body h2 {
    font-family: 'Microsoft YaHei', 'PingFang SC', -apple-system, sans-serif;
    font-weight: 700;
    font-size: 15px;
    color: #000000;
    margin: 20px 0 10px;
}

.terms-modal-body strong {
    font-weight: 700;
    color: #000000;
}

.terms-modal-body p {
    margin: 0 0 8px;
    color: #000000;
}

.terms-modal-body .num-eng {
    font-family: 'Times New Roman', serif;
}

/* 按钮 */
.btn {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 6px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    /* 移除移动端点击高亮效果 */
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    touch-action: manipulation;
    outline: none;
}

.btn-login,
.btn-register {
    background: linear-gradient(90deg, #2563eb, #1d4ed8);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.25);
}

.btn-login:hover:not(:disabled),
.btn-register:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 12px 25px rgba(37, 99, 235, 0.35);
}

.btn-login:active:not(:disabled),
.btn-register:active:not(:disabled) {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* 移除所有焦点和激活状态的视觉反馈 */
.btn:focus {
    outline: none !important;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.25) !important;
}

.btn-login:focus,
.btn-register:focus {
    outline: none !important;
}

.btn-login:active:not(:disabled),
.btn-register:active:not(:disabled) {
    outline: none !important;
}

.btn-text {
    display: inline-block;
}

.btn-loader {
    position: absolute;
    display: none;
}

.btn.loading .btn-text {
    visibility: hidden;
}

.btn.loading .btn-loader {
    display: inline-block;
}

/* 表单底部 */
.form-footer {
    text-align: center;
    margin-top: 22px;
    color: #64748b;
    font-size: 14px;
}

.form-footer p {
    margin: 0;
}

.toggle-link {
    color: #2563eb;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
    cursor: pointer;
}

.toggle-link:hover {
    color: #1d4ed8;
}

/* 表单错误提示 */
.form-error {
    margin-top: 12px;
    padding: 12px 16px;
    background-color: rgba(239, 68, 68, 0.08);
    border-left: 4px solid #ef4444;
    border-radius: 6px;
    color: #b91c1c;
    font-size: 14px;
    line-height: 1.5;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Toast提示框 */
.toast-notification {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(150px);
    background: linear-gradient(135deg, #34a853 0%, #2d8e47 100%);
    color: white;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(52, 168, 83, 0.3);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 500;
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
    max-width: calc(100% - 40px);
    line-height: 1.5;
}

.toast-notification.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.toast-notification i {
    font-size: 20px;
    animation: checkmark 0.6s ease;
    flex-shrink: 0;
}

@keyframes checkmark {
    0% {
        transform: scale(0) rotate(-45deg);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1) rotate(0);
    }
}

.toast-notification.error {
    background: linear-gradient(135deg, #ea4335 0%, #d33f2d 100%);
    box-shadow: 0 4px 16px rgba(234, 67, 53, 0.3);
}

/* 响应式设计 - 移动端 */
@media (max-width: 768px) {
    .container {
        padding: 32px 12px 28px;
        max-width: 94%;
    }
    
    .form-header h1 {
        font-size: 32px;
    }
    
    .logo-name {
        font-size: 3.8rem;
        letter-spacing: 3px;
    }
    
    .password-toggle {
        right: 14px;
        width: 36px;
        height: 36px;
    }
    
    .password-toggle i {
        font-size: 20px;
    }
    
    .input-wrapper input {
        padding: 14px 52px 14px 44px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 20px 6px 16px;
        max-width: 98%;
    }
    
    .logo-name {
        font-size: 3rem;
        letter-spacing: 2px;
    }
    
    .form-container {
        padding: 28px 24px 24px;
    }
    
    .form-header h1 {
        font-size: 28px;
    }
    
    .password-toggle {
        right: 12px;
        width: 32px;
        height: 32px;
    }
    
    .password-toggle i {
        font-size: 18px;
    }
    
    .input-wrapper input {
        padding: 12px 48px 12px 42px;
    }
    
    .toast-notification {
        bottom: 20px;
        left: 20px;
        right: 20px;
        transform: translateY(150px);
        max-width: none;
    }
    
    .toast-notification.show {
        transform: translateY(0);
    }
}

/* 小屏幕额外优化 */
@media (max-width: 375px) {
    .container {
        max-width: 99%;
        padding: 16px 4px 12px;
    }
    
    .logo-name {
        font-size: 2.6rem;
        letter-spacing: 1.5px;
    }
    
    .form-container {
        padding: 24px 20px 20px;
    }
}

/* 横屏优化 */
@media (orientation: landscape) {
    .form-header h1 {
        font-size: 20px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

@media (min-width: 769px) and (orientation: landscape) {
    .logo-name {
        font-size: 4.2rem;
    }
    
    .form-header h1 {
        font-size: 28px;
        white-space: normal;
        overflow: visible;
    }
}

/* 超大屏幕优化 */
@media (min-width: 1200px) {
    .container {
        max-width: 450px;
    }
}
