/* ============================================
   首页登录/注册弹窗样式（与首页青绿暗色风格一致）
   --------------------------------------------
   结构 / ID 复用社群登录注册弹窗（preview/Preview.html），
   功能由 main/js/tomwebapp-auth-handler.js + js/preview-auth.js 提供。
   本文件只负责视觉，不改动社群页样式。
   ============================================ */

#auth-modal-overlay {
    --auth-accent: var(--accent, #0FB89B);
    --auth-accent-soft: var(--accent-soft, rgba(15, 184, 155, 0.14));
    --auth-accent-border: var(--accent-border, rgba(15, 184, 155, 0.38));
    --auth-bg: var(--bg-card-solid, #141d27);
    --auth-bg-deep: var(--bg, #080d12);
    --auth-text: var(--text-1, #eef2f5);
    --auth-text-2: var(--text-2, #a3b0bb);
    --auth-text-3: var(--text-3, #6b7883);
    --auth-border: var(--border-strong, rgba(255, 255, 255, 0.16));
}

#auth-modal-overlay.auth-modal-overlay {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    background: rgba(3, 8, 12, 0.78);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    /* 必须高于 tom-responsive.css 的移动悬浮导航（--tom-r-z + 4） */
    z-index: 2147483600;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.25s ease;
}

#auth-modal-overlay.auth-modal-overlay:not(.hidden) {
    opacity: 1;
}

#auth-modal-overlay.hidden,
#auth-modal-overlay .auth-view.hidden {
    display: none !important;
}

#auth-modal-overlay .auth-modal-content {
    position: relative;
    width: min(100%, 470px);
    max-height: 88vh;
    overflow-y: auto;
    padding: 28px 24px 24px;
    background: var(--auth-bg);
    border: 1px solid var(--auth-accent-border);
    border-radius: var(--radius-md, 16px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(15, 184, 155, 0.08);
    animation: homeAuthFadeIn 0.28s ease-out;
    scrollbar-width: thin;
}

@keyframes homeAuthFadeIn {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to { opacity: 1; transform: none; }
}

#auth-modal-overlay .auth-modal-close {
    position: absolute;
    top: 12px;
    right: 14px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--auth-border);
    border-radius: 50%;
    background: transparent;
    color: var(--auth-text-2);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

#auth-modal-overlay .auth-modal-close:hover {
    color: var(--auth-accent);
    border-color: var(--auth-accent-border);
    background: var(--auth-accent-soft);
}

#auth-modal-overlay .auth-title {
    margin: 0 0 18px;
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    color: var(--auth-text);
    letter-spacing: 0.02em;
}

#auth-modal-overlay .auth-title::after {
    content: "";
    display: block;
    width: 44px;
    height: 2px;
    margin: 10px auto 0;
    border-radius: 2px;
    background: var(--auth-accent);
    box-shadow: 0 0 12px rgba(15, 184, 155, 0.45);
}

#auth-modal-overlay .auth-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#auth-modal-overlay .auth-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

#auth-modal-overlay .auth-form-row {
    display: flex;
    gap: 10px;
}

#auth-modal-overlay .auth-form-row .auth-form-group {
    flex: 1 1 0;
}

#auth-modal-overlay .auth-input {
    width: 100%;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid var(--auth-border);
    border-radius: 10px;
    background: var(--auth-bg-deep);
    color: var(--auth-text);
    -webkit-text-fill-color: var(--auth-text);
    caret-color: var(--auth-text);
    color-scheme: dark;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#auth-modal-overlay .auth-input::placeholder {
    color: var(--auth-text-3);
}

#auth-modal-overlay .auth-input:focus {
    outline: none;
    border-color: var(--auth-accent);
    box-shadow: 0 0 0 3px var(--auth-accent-soft);
}

#auth-modal-overlay input.auth-input:-webkit-autofill,
#auth-modal-overlay input.auth-input:-webkit-autofill:hover,
#auth-modal-overlay input.auth-input:-webkit-autofill:focus,
#auth-modal-overlay input.auth-input:-webkit-autofill:active,
#auth-modal-overlay input.auth-input:autofill,
#auth-modal-overlay input.auth-input:-moz-autofill {
    -webkit-box-shadow: 0 0 0 1000px var(--auth-bg-deep) inset;
    box-shadow: 0 0 0 1000px var(--auth-bg-deep) inset;
    background-color: var(--auth-bg-deep);
    -webkit-text-fill-color: var(--auth-text);
    caret-color: var(--auth-text);
    transition: background-color 5000s ease-in-out 0s;
}

#auth-modal-overlay .auth-password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

#auth-modal-overlay .auth-password-wrapper .auth-input {
    padding-right: 48px;
}

#auth-modal-overlay .auth-password-toggle-btn {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--auth-text-3);
    cursor: pointer;
}

#auth-modal-overlay .auth-password-toggle-btn:hover {
    color: var(--auth-accent);
    background: var(--auth-accent-soft);
}

#auth-modal-overlay .auth-captcha-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

#auth-modal-overlay .auth-captcha-input { flex: 1 1 auto; }

#auth-modal-overlay .auth-captcha-img {
    flex: 0 0 auto;
    width: 120px;
    height: 40px;
    border: 1px solid var(--auth-accent-border);
    border-radius: 8px;
    background: var(--auth-bg-deep);
    object-fit: fill;
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

#auth-modal-overlay .auth-captcha-img:hover {
    border-color: var(--auth-accent);
    transform: scale(1.02);
}

#auth-modal-overlay .auth-submit-btn {
    width: 100%;
    margin-top: 4px;
    padding: 11px 16px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: linear-gradient(92deg, var(--accent, #0FB89B), #14C7A9);
    color: #06110e;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 8px 22px rgba(15, 184, 155, 0.22);
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

#auth-modal-overlay .auth-submit-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.06);
    box-shadow: 0 12px 28px rgba(15, 184, 155, 0.3);
}

#auth-modal-overlay .auth-submit-btn:disabled {
    opacity: 0.65;
    cursor: wait;
    transform: none;
}

#auth-modal-overlay .auth-switch {
    margin-top: 2px;
    text-align: center;
    font-size: 13px;
    color: var(--auth-text-2);
}

#auth-modal-overlay .auth-switch-link {
    margin-left: 6px;
    color: var(--auth-accent);
    font-weight: 600;
    text-decoration: none;
}

#auth-modal-overlay .auth-switch-link:hover {
    text-decoration: underline;
}

#auth-modal-overlay .auth-register-hint {
    padding: 10px 12px;
    border: 1px solid var(--auth-accent-border);
    border-radius: 10px;
    background: var(--auth-accent-soft);
    color: var(--auth-text-2);
    font-size: 12px;
    line-height: 1.6;
    text-align: center;
}

#auth-modal-overlay .auth-register-hint span {
    color: var(--auth-accent);
}

#auth-modal-overlay .auth-error-message {
    color: #ff7a7a;
    font-size: 12px;
    line-height: 1.5;
    text-align: center;
    word-break: break-word;
}

#auth-modal-overlay .auth-form-group label {
    color: var(--auth-text);
    font-size: 13px;
    font-weight: 600;
}

#auth-modal-overlay .auth-divider {
    display: flex;
    align-items: center;
    margin: 6px 0;
    color: var(--auth-text-3);
    font-size: 12px;
}

#auth-modal-overlay .auth-divider::before,
#auth-modal-overlay .auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--auth-border);
}

#auth-modal-overlay .auth-divider span {
    padding: 0 12px;
}

#auth-modal-overlay .oauth-login-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 4px;
}

#auth-modal-overlay .oauth-login-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 6px;
    border: 1px solid var(--auth-border);
    border-radius: 10px;
    background: transparent;
    color: var(--auth-text-3);
    font-size: 12px;
    cursor: not-allowed;
}

#auth-modal-overlay .tom-auth-login-progress {
    display: none;
    margin-top: 2px;
    padding: 10px 12px;
    border: 1px solid var(--auth-accent-border);
    border-radius: 10px;
    background: var(--auth-accent-soft);
}

#auth-modal-overlay .tom-auth-login-progress.is-running,
#auth-modal-overlay .tom-auth-login-progress.is-error {
    display: block;
}

#auth-modal-overlay .tom-auth-login-progress.is-error {
    border-color: rgba(255, 122, 122, 0.6);
    background: rgba(255, 122, 122, 0.08);
}

#auth-modal-overlay .tom-auth-login-progress-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 12px;
    color: var(--auth-text-2);
}

#auth-modal-overlay .tom-auth-login-progress-text {
    color: var(--auth-text);
    font-weight: 700;
}

#auth-modal-overlay .tom-auth-login-progress-track {
    height: 6px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.28);
}

#auth-modal-overlay .tom-auth-login-progress-bar {
    height: 100%;
    width: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--accent, #0FB89B), #14C7A9);
    transition: width 360ms cubic-bezier(.22, .61, .36, 1);
}

#auth-modal-overlay .tom-auth-login-progress-error {
    margin-top: 8px;
    color: #ffd6d6;
    font-size: 12px;
    line-height: 1.5;
}

@media (max-width: 520px) {
    #auth-modal-overlay.auth-modal-overlay { padding: 12px; }
    #auth-modal-overlay .auth-modal-content { padding: 24px 16px 18px; max-height: 92vh; }
    #auth-modal-overlay .auth-form-row { flex-direction: column; gap: 12px; }
    #auth-modal-overlay .auth-captcha-img { width: 110px; }
}

@media (prefers-reduced-motion: reduce) {
    #auth-modal-overlay .auth-modal-content { animation: none; }
}
