/* ===== Auth Modal (Popup Overlay) ===== */
.auth-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
}
.auth-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.5);
    backdrop-filter: blur(2px);
}
.auth-modal-container {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}
.auth-modal-container .auth-card {
    position: relative;
    margin: auto;
    animation: auth-fade-in .25s ease-out;
}
.auth-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: none;
    background: var(--c-bg);
    color: var(--c-text-muted);
    cursor: pointer;
    transition: all .15s;
    z-index: 2;
}
.auth-modal-close:hover {
    background: #f3f4f6;
    color: var(--c-text);
}
.auth-modal-close:active {
    transform: scale(.95);
}

/* ===== Auth Pages (Login / Register / Activate) ===== */
.auth-wrap {
    min-height: calc(100vh - var(--header-h) - 80px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 16px;
}
.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--c-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 20px 32px 20px;
    animation: auth-fade-in .25s ease-out;
}
@keyframes auth-fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.auth-header {
    text-align: center;
    margin-bottom: 12px;
}
.auth-title {
    font-size: var(--text-base);
    font-weight: 700;
    color: var(--c-text);
    margin: 0;
}
.auth-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--c-primary-light);
    color: var(--c-primary);
    margin-bottom: 14px;
}
.auth-icon-success {
    background: var(--c-secondary-light);
    color: var(--c-secondary);
}
.auth-icon-error {
    background: #fef2f2;
    color: var(--c-danger);
}

.auth-tabs {
    display: flex;
    border-bottom: 1px solid var(--c-border);
    margin-bottom: 16px;
}
.auth-tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 8px;
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--c-text-muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: color .15s, border-color .15s;
    margin-bottom: -1px;
    white-space: nowrap;
}
.auth-tab-btn:hover {
    color: var(--c-text-secondary);
}
.auth-tab-btn.active {
    color: var(--c-primary);
    border-bottom-color: var(--c-primary);
}
.auth-tab-btn svg {
    flex-shrink: 0;
}
.auth-tab-panel {
    display: none;
}
.auth-tab-panel.active {
    display: block;
}

.auth-wechat-wrap {
    text-align: center;
    padding: 20px 0 8px;
}
.auth-wechat-qr-placeholder {
    margin: 0 auto 20px;
    width: 120px;
    height: 120px;
    background: var(--c-bg);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}
.auth-btn-wechat {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: auto;
    min-width: 220px;
    padding: 12px 28px;
    font-size: var(--text-base);
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all .2s;
    text-decoration: none;
    background: #07C160;
    color: #fff;
    border: none;
    margin: 0 auto;
}
.auth-btn-wechat:hover {
    background: #06AD56;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(7,193,96,.35);
}
.auth-wechat-hint {
    font-size: var(--text-xs);
    color: var(--c-text-muted);
    margin: 12px 0 0;
}

.auth-alert {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    line-height: 1.6;
    margin-bottom: 16px;
}
.auth-alert svg {
    flex-shrink: 0;
    margin-top: 3px;
}
.auth-alert p { margin: 0; }
.auth-alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}
.auth-alert-error svg { color: var(--c-danger); }
.auth-alert-success {
    background: var(--c-secondary-light);
    border: 1px solid #a7f3d0;
    color: #065f46;
}
.auth-alert-success svg { color: var(--c-secondary); }
.auth-alert-info {
    background: var(--c-primary-light);
    border: 1px solid #bfdbfe;
    color: #1e40af;
}

.auth-form { margin-bottom: 0; }
.auth-field {
    margin-bottom: 12px;
}
.auth-field:last-of-type {
    margin-bottom: 14px;
}
.auth-field label {
    display: none;
}
.auth-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.auth-input-icon {
    position: absolute;
    left: 12px;
    color: var(--c-text-muted);
    pointer-events: none;
    transition: color .2s;
    z-index: 1;
}
.auth-input-wrap input {
    width: 100%;
    padding: 10px 40px 10px 40px;
    font-size: var(--text-base);
    color: var(--c-text);
    background: var(--c-bg);
    border: 1.5px solid var(--c-border);
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color .2s, box-shadow .2s, background .2s;
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
}
.auth-input-wrap input::placeholder {
    color: var(--c-text-muted);
    font-size: var(--text-sm);
}
.auth-input-wrap input:focus {
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
    background: var(--c-surface);
}
.auth-input-wrap:focus-within .auth-input-icon {
    color: var(--c-primary);
}
.auth-input-wrap input:-webkit-autofill,
.auth-input-wrap input:-webkit-autofill:hover,
.auth-input-wrap input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px var(--c-bg) inset;
    -webkit-text-fill-color: var(--c-text);
    transition: background-color 5000s ease-in-out 0s;
}
.auth-pw-toggle {
    position: absolute;
    right: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 4px;
    color: var(--c-text-muted);
    transition: color .15s,background .15s;
    z-index: 1;
    background: none;
    border: none;
    cursor: pointer;
}
.auth-pw-toggle:hover {
    color: var(--c-text-secondary);
    background: rgba(0,0,0,.04);
}
.auth-pw-toggle:active {
    color: var(--c-primary);
}

.auth-btn {
    display: block;
    width: 100%;
    padding: 9px 24px;
    font-size: var(--text-base);
    font-weight: 600;
    text-align: center;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all .2s;
    text-decoration: none;
    letter-spacing: .08em;
}
.auth-btn-primary {
    background: var(--c-primary);
    color: #fff;
    border: none;
}
.auth-btn-primary:hover {
    background: var(--c-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(37,99,235,.3);
}
.auth-btn-primary:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}
.auth-btn-primary:focus-visible {
    outline: 2px solid var(--c-primary);
    outline-offset: 2px;
}

.auth-mode-toggle {
    text-align: center;
    padding: 10px 0 0;
    font-size: var(--text-sm);
    color: var(--c-text-muted);
}
.auth-mode-toggle a {
    color: var(--c-primary);
    font-weight: 500;
}
.auth-mode-toggle a:hover {
    text-decoration: underline;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 12px 0;
    color: var(--c-text-muted);
    font-size: var(--text-xs);
}
.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--c-border);
}

.auth-third-party {
    text-align: center;
    margin-bottom: 8px;
}
.auth-third-party-label {
    display: block;
    font-size: var(--text-xs);
    color: var(--c-text-muted);
    margin-bottom: 12px;
}
.auth-third-party-btns {
    display: flex;
    justify-content: center;
    gap: 16px;
}
.auth-third-party-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--c-surface);
    border: 1.5px solid var(--c-border);
    color: var(--c-text-secondary);
    text-decoration: none;
    transition: all .2s;
}
.auth-third-party-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.auth-third-party-btn[title*="GitHub"]:hover {
    border-color: #24292f;
    color: #24292f;
    background: #f6f8fa;
}
.auth-third-party-btn[title*="Gitee"]:hover {
    border-color: #c71d23;
    color: #c71d23;
    background: #fef2f2;
}

.auth-agreement {
    text-align: center;
    font-size: var(--text-xs);
    color: var(--c-text-muted);
    line-height: 1.6;
}
.auth-agreement a {
    color: var(--c-text-muted);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.auth-agreement a:hover {
    color: var(--c-primary);
}

@media (max-width: 480px) {
    .auth-card { padding: 28px 20px 24px; }
    .auth-btn-wechat { min-width: 0; width: 100%; }
    .auth-third-party-btns { gap: 12px; }
}
