/* ============================================
   登录/注册弹窗 - TomWebApp 科技风格
   ============================================ */
.auth-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

.auth-modal-overlay.hidden {
    display: none;
}

.auth-modal-content {
    background: var(--bg-panel);
    border: 1px solid var(--accent-color);
    border-radius: 12px;
    padding: 2rem;
    max-width: 600px;
    width: 90%;
    max-height: calc(var(--vh, 1vh) * 90);
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
    transform: none;
    position: relative;
    animation: modalFadeIn 0.3s ease-out;
    pointer-events: auto;
    z-index: 10001;
}

@keyframes modalFadeIn {
    0% {
        transform: scale(0.9) translateY(-20px);
        opacity: 0;
    }

    100% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.auth-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    width: 32px;
    height: 32px;
    font-size: 20px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.auth-modal-close:hover {
    background: var(--accent-color);
    color: #000;
    border-color: var(--accent-color);
    box-shadow: none;
    transform: none;
}

.auth-view {
    display: block;
}

.auth-view.hidden {
    display: none;
}

.auth-title {
    color: var(--accent-color) !important;
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 1.5rem;
    text-shadow: none;
    letter-spacing: 0;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.auth-form-group {
    position: relative;
}

/* 两列布局样式 */
.auth-form-row {
    display: flex;
    gap: 0.75rem;
}

.auth-form-row .auth-form-group {
    flex: 1;
}

/* 注册提示文字 */
.auth-register-hint {
    background: rgba(37, 99, 235, 0.1);
    border: 1px solid rgba(37, 99, 235, 0.3);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.6;
    text-align: center;
}

.auth-password-wrapper {
    position: relative;
}

.auth-password-wrapper .auth-input {
    padding-right: 56px;
}

.auth-input-with-icon {
    display: flex;
    align-items: center;
    gap: 8px;
}

.auth-input-with-icon .auth-input {
    flex: 1 1 auto;
    width: auto !important;
    min-width: 0;
}

.auth-input-with-icon .icon-btn {
    flex: 0 0 auto;
}

.auth-password-toggle-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--border-color);
    background: var(--bg-app);
    box-shadow: none;
    -webkit-appearance: none;
    appearance: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    opacity: 0.85;
    transition: opacity 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: 8px;
}

.auth-password-toggle-btn:hover {
    opacity: 1;
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.auth-password-toggle-btn:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(64, 158, 255, 0.18);
}

/* 眼睛图标SVG样式 */
.auth-eye-icon,
.auth-eye-off-icon {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: all 0.2s ease;
}

/* 默认显示闭眼图标，隐藏睁眼图标 */
.auth-password-toggle-btn .auth-eye-icon {
    display: none;
}

.auth-password-toggle-btn .auth-eye-off-icon {
    display: block;
}

/* 当密码可见时，显示睁眼图标，隐藏闭眼图标 */
.auth-password-toggle-btn.password-visible .auth-eye-icon {
    display: block;
}

.auth-password-toggle-btn.password-visible .auth-eye-off-icon {
    display: none;
}

/* 悬停效果 */
.auth-password-toggle-btn:hover .auth-eye-icon,
.auth-password-toggle-btn:hover .auth-eye-off-icon {
    color: var(--accent-color);
}

.auth-input {
    width: 100% !important;
    display: block;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.25) !important;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
    caret-color: #ffffff !important;
    font-size: 14px;
    transition: all 0.3s ease;
    box-sizing: border-box;
    pointer-events: auto;
    user-select: text;
}

.auth-modal-content .auth-input {
    background: rgba(0, 0, 0, 0.25) !important;
    color: #ffffff !important;
    -webkit-text-fill-color: #777777 !important;
    caret-color: #ffffff !important;
}

.auth-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: none;
    background: rgba(0, 0, 0, 0.4) !important;
}

.auth-modal-content .auth-input:focus {
    background: rgba(0, 0, 0, 0.4) !important;
}

.auth-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

/* 覆盖浏览器自动填充导致的白底/黑字，保持弹窗输入框风格一致 */
#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 rgba(0, 0, 0, 0.25) inset !important;
    box-shadow: 0 0 0 1000px rgba(0, 0, 0, 0.25) inset !important;
    background-color: rgba(0, 0, 0, 0.25) !important;
    background: rgba(0, 0, 0, 0.25) !important;
    -webkit-text-fill-color: #ffffff !important;
    caret-color: #ffffff !important;
    transition: background-color 5000s ease-in-out 0s;
}

#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:focus,
#auth-modal-overlay input.auth-input:-moz-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px rgba(0, 0, 0, 0.4) inset !important;
    box-shadow: 0 0 0 1000px rgba(0, 0, 0, 0.4) inset !important;
    background-color: rgba(0, 0, 0, 0.4) !important;
    background: rgba(0, 0, 0, 0.4) !important;
}

.auth-submit-btn {
    background: #2563eb !important;
    color: #ffffff !important;
    padding: 12px !important;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    margin-top: 0;
    text-transform: none;
    letter-spacing: 0;
    box-shadow: none;
}

.auth-submit-btn:hover {
    background: #1d4ed8 !important;
    color: #ffffff !important;
    transform: none;
    box-shadow: none;
}

.auth-submit-btn:active {
    transform: translateY(0);
}

.auth-switch {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 16px !important;
    color: var(--text-secondary);
    line-height: 1.5 !important;
}

.auth-switch * {
    font-size: 16px !important;
}

.auth-switch span,
.auth-switch a {
    font-size: 16px !important;
    line-height: 1.5 !important;
}

.auth-switch-link {
    color: var(--accent-color) !important;
    text-decoration: none;
    font-weight: 600;
    margin-left: 0.5rem;
    position: relative;
    transition: all 0.3s ease;
    font-size: 14px !important;
    line-height: 1.5 !important;
}

.auth-switch-link:hover {
    text-shadow: none;
}

.auth-captcha-wrapper {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.auth-captcha-input {
    flex: 1;
}

.auth-captcha-img {
    width: 160px;
    height: 50px;
    background: var(--bg-app);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    transition: all 0.3s ease;
    object-fit: cover;
    object-position: center;
}

.auth-captcha-img:hover {
    border-color: var(--accent-color);
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.3);
    transform: scale(1.02);
}

.auth-captcha-wrapper-style {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.auth-input-half {
    width: 60%;
}

.auth-captcha-img-style {
    width: 160px;
    height: 50px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    flex: 0 0 auto;
    object-fit: cover;
    object-position: center;
}

.auth-error-message {
    color: var(--danger-color);
    font-size: 0.85rem;
    margin-top: 0.5rem;
    text-align: center;
    padding: 8px;
    background: rgba(255, 77, 79, 0.1);
    border-radius: 6px;
    border: 1px solid rgba(255, 77, 79, 0.3);
}

.auth-error-message:empty {
    display: none;
    margin-top: 0;
    padding: 0;
    border: 0;
}

/* Turnstile 验证码容器样式 */
.auth-turnstile-wrapper {
    display: none;
    justify-content: center;
    align-items: center;
    min-height: 0;
}

.auth-turnstile-wrapper .cf-turnstile {
    margin: 0 auto;
}


/* ============================================
   设置面板登录提示样式
   ============================================ */
.auth-required-prompt {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-required-prompt .primary-button {
    background: var(--accent-color) !important;
    color: #000 !important;
    border: none;
    box-shadow: 0 4px 15px rgba(0, 229, 255, 0.3);
    transition: all 0.3s ease;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.auth-required-prompt .primary-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(0, 229, 255, 0.5);
    background: var(--accent-hover) !important;
}

/* ============================================
   防止闪烁：默认隐藏需要权限的面板内容
   ============================================ */
#pane-data>.settings-group,
#pane-purchase>.settings-group,
#pane-notice>.settings-group,
#pane-contact>.settings-group,
#pane-device>.settings-group {
    display: none !important;
}

/* 当面板被标记为已授权时，显示内容 */
#pane-data.auth-verified>.settings-group,
#pane-purchase.auth-verified>.settings-group,
#pane-notice.auth-verified>.settings-group,
#pane-contact.auth-verified>.settings-group,
#pane-device.auth-verified>.settings-group {
    display: block !important;
}

/* 默认隐藏登录提示；未授权时才显示 */
.auth-required-prompt {
    display: none !important;
}

#pane-data:not(.auth-verified)>.auth-required-prompt,
#pane-purchase:not(.auth-verified)>.auth-required-prompt,
#pane-notice:not(.auth-verified)>.auth-required-prompt,
#pane-contact:not(.auth-verified)>.auth-required-prompt,
#pane-device:not(.auth-verified)>.auth-required-prompt {
    display: flex !important;
}

.tom-auth-login-progress {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(245, 158, 11, 0.55);
    background: rgba(245, 158, 11, 0.1);
}

.tom-auth-login-progress.is-error {
    border-color: rgba(239, 68, 68, 0.5);
    background: rgba(239, 68, 68, 0.08);
}

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

.tom-auth-login-progress-text {
    color: var(--text-primary);
    font-weight: 600;
}

.tom-auth-login-progress-track {
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    overflow: hidden;
}

.tom-auth-login-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #fde68a, #f59e0b);
    border-radius: 999px;
    transition: width 220ms ease;
}

.tom-auth-login-progress.is-error .tom-auth-login-progress-bar {
    background: linear-gradient(90deg, #f87171, #ef4444);
}

.tom-auth-login-progress-error {
    margin-top: 8px;
    font-size: 12px;
    line-height: 1.5;
    color: #fecaca;
    word-break: break-word;
}
