/**
 * 右侧认证面板 - 登录 / 注册 / 忘记密码
 * 颜色主题与目录面板 (side-nav) 一致：透明磨砂玻璃
 */

/* 目录面板：透明磨砂 + 主题色（黑夜黄 #FFD016 / 白天暗红 #ca0c16） */
[data-theme="light"] {
    --auth-text: #121212;
    --auth-text-secondary: #666;
    --auth-border: rgba(0, 0, 0, 0.12);
    --auth-input-bg: rgba(255, 255, 255, 0.6);
    --auth-overlay: rgba(0, 0, 0, 0.25);
    --auth-accent: #A51111;
    --auth-accent-hover: #a30911;
    --auth-accent-on: #fff;
}

[data-theme="dark"],
:root:not([data-theme="light"]) {
    --auth-text: #E8E5E0;
    --auth-text-secondary: #999;
    --auth-border: rgba(232, 229, 224, 0.25);
    --auth-input-bg: rgba(255, 255, 255, 0.08);
    --auth-overlay: rgba(0, 0, 0, 0.25);
    --auth-accent: #FFD016;
    --auth-accent-hover: #E6C212;
    --auth-accent-on: #2C2C2C;
}

.auth-panel {
    --auth-muted: #8a8a8a;
}

.auth-panel-overlay {
    position: fixed;
    inset: 0;
    background: var(--auth-overlay);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.auth-panel-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.auth-panel {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    width: 400px;
    max-width: 100%;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-left: 1px solid rgba(255, 255, 255, 0.2);
    z-index: 10001;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

[data-theme="dark"] .auth-panel,
:root:not([data-theme="light"]) .auth-panel {
    background: rgba(20, 20, 20, 0.75);
    border-left-color: rgba(255, 255, 255, 0.08);
}

.auth-panel.open {
    transform: translateX(0);
}

.auth-panel-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow-y: auto;
    padding: 24px;
    background: transparent;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.auth-panel-body::-webkit-scrollbar {
    display: none;
}

.auth-mode {
    display: none;
}

.auth-mode.active {
    display: block;
    flex: 0 0 auto;
}

/* 登录子 Tab */
.auth-login-tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--auth-border);
}

.auth-login-tab {
    flex: 1;
    padding: 10px 0;
    font-size: 14px;
    color: var(--auth-text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    text-align: center;
}

.auth-login-tab.active {
    color: var(--auth-accent);
    border-bottom-color: var(--auth-accent);
}

.auth-login-tab:hover {
    color: var(--auth-accent);
}

/* 忘记密码子 Tab */
.auth-forgot-tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--auth-border);
}

.auth-forgot-tab {
    flex: 1;
    padding: 10px 0;
    font-size: 14px;
    color: var(--auth-text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    text-align: center;
}

.auth-forgot-tab.active {
    color: var(--auth-accent);
    border-bottom-color: var(--auth-accent);
}

.auth-forgot-tab:hover {
    color: var(--auth-accent);
}

/* 表单通用 */
.auth-form {
    margin-bottom: 16px;
}

.auth-field {
    margin-bottom: 16px;
}

.auth-field input {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    border: 1px solid var(--auth-border);
    border-radius: 8px;
    font-size: 14px;
    box-sizing: border-box;
    background: var(--auth-input-bg);
    color: var(--auth-text);
}

.auth-field input:focus {
    border-color: var(--auth-accent);
    outline: none;
}

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

.auth-code-field {
    display: flex;
    gap: 10px;
}

.auth-code-field input {
    flex: 1;
}

.auth-get-code {
    flex-shrink: 0;
    height: 44px;
    padding: 0 16px;
    background: var(--auth-accent);
    color: var(--auth-accent-on);
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
}

.auth-get-code:hover:not(:disabled) {
    background: var(--auth-accent);
}

.auth-get-code:disabled {
    background: var(--auth-muted);
    cursor: not-allowed;
}

.auth-remember-forget {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    font-size: 14px;
}

.auth-remember-forget label {
    color: var(--auth-text-secondary);
    cursor: pointer;
}

.auth-link {
    color: var(--auth-accent);
    text-decoration: none;
}

.auth-link:hover {
    text-decoration: underline;
}

.auth-btn {
    width: 100%;
    height: 44px;
    background: var(--auth-accent);
    color: var(--auth-accent-on);
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
}

.auth-btn:disabled {
    background: var(--auth-muted);
    cursor: not-allowed;
}

.auth-switch-text {
    text-align: center;
    font-size: 14px;
    color: var(--auth-text-secondary);
    margin: 0;
}

.auth-mode-switch {
    margin: -8px 0 16px;
    font-size: 12px;
}

.auth-mode-switch a {
    color: var(--auth-accent);
    text-decoration: none;
}

.auth-mode-switch a:hover {
    text-decoration: underline;
}

/* 注册头像选择 */
.auth-avatar-wrap {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 16px;
}

.auth-avatar-preview {
    cursor: pointer;
}

.auth-avatar-preview img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: contain;
    border: 2px solid var(--auth-accent);
    padding: 4px;
    background: var(--auth-input-bg);
}

.auth-avatar-tooltip {
    display: none;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 100%;
    margin-top: 12px;
    z-index: 100;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--auth-border);
    border-radius: 12px;
    padding: 20px;
    min-width: 320px;
}

.auth-avatar-tooltip::before {
    content: '';
    position: absolute;
    left: 50%;
    margin-left: -6px;
    top: -6px;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid var(--auth-border);
}

.auth-avatar-tooltip::after {
    content: '';
    position: absolute;
    left: 50%;
    margin-left: -5px;
    top: -5px;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 5px solid rgba(255, 255, 255, 0.95);
}

.auth-avatar-tooltip.show {
    display: block;
}

.auth-avatar-tooltip-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
}

.auth-avatar-tooltip-item {
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    border: 2px solid transparent;
    transition: border-color 0.2s, transform 0.15s;
}

.auth-avatar-tooltip-item:hover {
    border-color: var(--auth-accent);
    transform: scale(1.08);
}

.auth-avatar-tooltip-item.selected {
    border-color: var(--auth-accent);
}

.auth-avatar-tooltip-item img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: contain;
    border-radius: 50%;
    display: block;
}
