/* 登录/注册模态窗口 - 独立系统 */

/* 遮罩层 */
.auth-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.2s;
}

.auth-modal-overlay.show {
    display: flex;
    opacity: 1;
}

/* 模态窗口内容 */
.auth-modal {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 16px 20px;
    width: 90%;
    max-width: 320px;
    transform: scale(0.95);
    transition: transform 0.2s;
    will-change: transform;
}

.auth-modal-overlay.show .auth-modal {
    transform: scale(1);
}

/* 防止动画期间模态窗口变化 */
.auth-modal-overlay.show.auth-submitting .auth-modal {
    transform: scale(1) !important;
}

/* Tab 切换栏 */
.auth-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid #e8eaed;
    margin-bottom: 14px;
}

.auth-tab {
    flex: 1;
    padding: 8px 0;
    background: transparent;
    border: none;
    font-size: 14px;
    font-weight: 500;
    color: #70757a;
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
}

.auth-tab:hover {
    color: #202124;
}

.auth-tab.active {
    color: #1a73e8;
}

.auth-tab::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background: #1a73e8;
    transition: width 0.2s;
}

.auth-tab.active::after {
    width: 60%;
}

/* 表单容器 */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* 输入组 */
.auth-input-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.auth-input-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #70757a;
    font-weight: 400;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
}

.auth-input-label .material-icons {
    font-size: 14px;
    color: #5f6368;
}

/* 输入框容器 */
.auth-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.auth-input {
    width: 100%;
    height: 38px;
    padding: 0 12px;
    border: 1px solid #e8eaed;
    border-radius: 8px;
    font-size: 14px;
    color: #202124;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
}

.auth-input:focus {
    outline: none;
    border-color: #1a73e8;
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.1);
}

.auth-input::placeholder {
    color: #9aa0a6;
}

/* 验证码行 */
.auth-code-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.auth-code-row .auth-input-group {
    flex: 1;
}

.auth-send-code-btn {
    height: 38px;
    padding: 0 12px;
    background: #1a73e8;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
}

.auth-send-code-btn:hover:not(:disabled) {
    background: #1765cc;
}

.auth-send-code-btn:disabled {
    background: #9aa0a6;
    cursor: not-allowed;
}



/* 密码区域 - 苹果风格居中布局 */
.auth-password-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}

/* 密码标签 - 居中 */
.auth-password-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.auth-password-header .auth-input-label {
    justify-content: center;
}

/* 密码圆点显示 - 居中 */
.auth-password-dots {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.auth-password-dots .dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1.5px solid #d0d0d0;
    background: transparent;
    transition: all 0.15s;
}

.auth-password-dots .dot.filled {
    background: #1a73e8;
    border-color: #1a73e8;
}

/* 数字键盘 - 苹果风格 */
.auth-numpad {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-top: 12px;
    justify-items: center;
    width: 100%;
}

.numpad-btn {
    width: 56px;
    height: 56px;
    background: rgba(26, 115, 232, 0.08);
    border: none;
    border-radius: 50%;
    font-size: 24px;
    font-weight: 300;
    color: #1a73e8;
    cursor: pointer;
    transition: all 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.numpad-btn:hover:not(:disabled) {
    background: rgba(26, 115, 232, 0.15);
}

.numpad-btn:active:not(:disabled) {
    background: #1a73e8;
    color: white;
    transform: scale(0.95);
}

.numpad-btn.numpad-empty {
    background: transparent;
    cursor: default;
}

.numpad-btn.numpad-delete {
    background: rgba(26, 115, 232, 0.08);
}

.numpad-btn.numpad-delete:hover {
    background: rgba(26, 115, 232, 0.15);
}

.numpad-btn.numpad-delete:active {
    background: #1a73e8;
}

.numpad-btn.numpad-delete .material-icons {
    font-size: 22px;
    color: #1a73e8;
    transition: color 0.1s;
}

.numpad-btn.numpad-delete:active .material-icons {
    color: white;
}

/* 注册表单额外字段 */
.auth-register-fields {
    display: none;
    flex-direction: column;
    gap: 12px;
}

.auth-modal[data-mode="register"] .auth-register-fields {
    display: flex;
}

/* 登录模式下的占位区域（已禁用） */
.auth-login-spacer {
    display: none;
}

/* 提交按钮 */
.auth-submit-btn {
    width: 100%;
    height: 42px;
    margin-top: 8px;
    background: #1a73e8;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    outline: none;
    box-shadow: none;
}

.auth-submit-btn:focus {
    outline: none;
    box-shadow: none;
}

.auth-submit-btn:hover:not(:disabled):not(.loading) {
    background: #1765cc;
}

.auth-submit-btn:disabled {
    cursor: not-allowed;
}

/* 按钮文字 */
.auth-btn-text {
    display: inline-block;
}

/* 按钮加载状态 - 只禁用，完全不改变外观 */
.auth-submit-btn.loading {
    pointer-events: none;
}

/* ========== 全局状态指示器（独立于模态窗口） ========== */
.auth-global-status {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
}

.auth-global-status.show {
    opacity: 1;
}

/* 加载旋转圆环 */
.auth-global-spinner {
    width: 64px;
    height: 64px;
    border: 4px solid rgba(200, 200, 200, 0.3);
    border-top-color: #1a73e8;
    border-radius: 50%;
    animation: auth-spin 0.8s linear infinite;
}

@keyframes auth-spin {
    to { transform: rotate(360deg); }
}

/* 结果图标 */
.auth-global-icon {
    width: 64px;
    height: 64px;
}

.auth-global-icon svg {
    width: 100%;
    height: 100%;
}

/* 成功：绿色圆环 + 绿色勾 */
.auth-global-icon.success svg circle {
    stroke: #34a853;
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    animation: auth-circle-draw 0.4s ease-out forwards;
}

.auth-global-icon.success svg path {
    stroke: #34a853;
    stroke-dasharray: 50;
    stroke-dashoffset: 50;
    animation: auth-check-draw 0.3s ease-out 0.25s forwards;
}

/* 失败：红色圆环 + 红色叉 */
.auth-global-icon.error svg circle {
    stroke: #ea4335;
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    animation: auth-circle-draw 0.4s ease-out forwards;
}

.auth-global-icon.error svg path {
    stroke: #ea4335;
    stroke-dasharray: 50;
    stroke-dashoffset: 50;
    animation: auth-check-draw 0.3s ease-out 0.25s forwards;
}

@keyframes auth-circle-draw {
    to { stroke-dashoffset: 0; }
}

@keyframes auth-check-draw {
    to { stroke-dashoffset: 0; }
}

/* 登录按钮状态变化 - 已登录：蓝色背景 */
.login-btn.logged-in {
    background: #1a73e8;
    border-color: #1a73e8;
    color: white;
}

.login-btn.logged-in:hover {
    background: #1765cc;
    border-color: #1765cc;
}

/* 响应式 */
@media (max-width: 480px) {
    .auth-modal {
        width: 95%;
        padding: 14px 16px;
    }

    .numpad-btn {
        width: 50px;
        height: 50px;
        font-size: 22px;
    }
}
