/* ========================================
   Firebase 认证系统样式（模块化分组整理）
   ======================================== */

/* ========== 1. 顶部登录按钮 ========== */
#top-login-btn {
    position: fixed;
    /* 固定定位，滚动时保持在视口指定位置 */
    top: 18px;
    /* 距离视口顶部18px */
    right: 32px;
    /* 距离视口右侧32px */
    z-index: 10000;
    /* 设置堆叠顺序为10000，确保显示在其他元素上方 */
}

.top-login-btn-beauty {
    display: flex;
    /* 使用弹性盒布局模型 */
    align-items: center;
    /* 垂直居中对齐子元素 */
    justify-content: center;
    /* 水平居中对齐子元素 */
    background: linear-gradient(90deg, #3385ff 0%, #4f9cff 100%);
    /* 90度蓝色渐变背景，从#3385ff到#4f9cff */
    color: #fff;
    /* 字体颜色为白色 */
    font-size: 16px;
    /* 字体大小16px */
    font-weight: 600;
    /* 字体粗细600（半粗体） */
    border: none;
    /* 无边框 */
    border-radius: 24px;
    /* 边框圆角24px，使按钮呈椭圆形 */
    box-shadow: 0 4px 16px 0 rgba(51, 133, 255, 0.13);
    /* 添加阴影效果，水平偏移0，垂直偏移4px，模糊半径16px，蓝色透明度0.13 */
    padding: 0 22px;
    /* 左右内边距22px，上下内边距0 */
    height: 44px;
    /* 固定高度44px */
    min-width: 90px;
    /* 最小宽度90px */
    cursor: pointer;
    /* 鼠标悬停时显示指针形状，表示可点击 */
    position: fixed;
    /* 固定定位，滚动时保持在视口指定位置 */
    top: 18px;
    /* 距离视口顶部18px */
    right: 32px;
    /* 距离视口右侧32px */
    z-index: 10000;
    /* 堆叠顺序10000，确保显示在其他元素上方 */
    transition: all 0.18s cubic-bezier(.4, 0, .2, 1);
    /* 所有属性变化时应用0.18秒过渡效果，使用自定义缓动函数 */
    letter-spacing: 1px;
    /* 字符间距1px */
    outline: none;
    /* 移除元素获得焦点时的默认轮廓线 */
    user-select: none;
    /* 禁止用户选择文本 */
}

.top-login-btn-beauty svg {
    display: inline-block;
    vertical-align: middle;
    margin-right: 7px;
}

.top-login-btn-beauty:hover,
.top-login-btn-beauty:focus {
    background: linear-gradient(90deg, #2968d4 0%, #3385ff 100%);
    /* 鼠标悬停/获取焦点时背景为90度深蓝色渐变，从#2968d4到#3385ff */
    box-shadow: 0 8px 24px 0 rgba(51, 133, 255, 0.18);
    /* 悬停/获取焦点时阴影增强，垂直偏移8px，模糊半径24px，蓝色透明度0.18 */
    color: #fff;
    /* 保持字体颜色为白色 */
    transform: translateY(-2px) scale(1.04);
    /* 悬停/获取焦点时向上移动2px并轻微放大1.04倍，增强交互感 */
}

.top-login-btn-beauty:active {
    transform: scale(0.97);
    box-shadow: 0 2px 8px 0 rgba(51, 133, 255, 0.10);
}

/* ========== 2. 用户头像/下拉菜单 ========== */
#user-avatar-btn {
    position: fixed;
    top: 18px;
    right: 32px;
    z-index: 10000;
    display: none;
}

.user-avatar-container {
    display: flex;
    /* 使用弹性盒布局模型，使子元素灵活排列 */
    align-items: center;
    /* 垂直居中对齐子元素 */
    gap: 8px;
    /* 子元素之间的间距为8px */
    /* background: #fff; */
    /* border: 1px solid #e0e7ef; */
    border-radius: 20px;
    /* 边框圆角20px，使容器呈圆角矩形 */
    padding: 4px 12px;
    /* 内边距上下4px、左右12px */
    cursor: pointer;
    /* 鼠标悬停时显示指针形状，表示可点击 */
    transition: all 0.3s ease;
    /* 所有属性变化时应用0.3秒过渡效果，使用ease缓动函数 */
    /* box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); */
}

.user-avatar-container:hover .user-avatar {
    /* box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); */
    /* transform: translateY(-1px); */
    border: 2px solid #e0e7ef;
}

.user-avatar {
    width: 32px;
    /* 设置头像宽度为32px */
    height: 32px;
    /* 设置头像高度为32px */
    border-radius: 50%;
    /* 边框圆角50%，使头像呈圆形 */
    object-fit: cover;
    /* 图片保持比例并覆盖整个容器，可能会裁剪部分内容 */
    transition: all 0.3s ease;
    /* 所有属性变化时应用0.3秒过渡效果，使用ease缓动函数 */
    border: 2px solid #ffffff00;
    /* 2px宽的透明边框（十六进制透明色） */
}

.user-info {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    color: #333;
}

.user-name {
    font-size: 14px;
    /* 设置字体大小为14px */
    font-weight: 500;
    /* 设置字体粗细为500（中等） */
    color: #333;
    /* 设置字体颜色为深灰色（#333） */
    margin-left: 8px;
    /* 左侧外边距8px，与头像保持间距 */
    white-space: nowrap;
    /* 禁止文本换行 */
    overflow: hidden;
    /* 隐藏溢出内容 */
    text-overflow: ellipsis;
    /* 溢出文本显示省略号（...） */
    max-width: 120px;
    /* 最大宽度120px，超出部分显示省略号 */
}

.dropdown-arrow {
    width: 12px;
    height: 12px;
    transition: transform 0.3s ease;
}

.user-avatar-container:hover .dropdown-arrow {
    transform: rotate(180deg);
}

/* 用户下拉菜单 */
.user-dropdown-menu {
    position: absolute;
    /* 绝对定位，相对于父容器定位 */
    top: 100%;
    /* 距离父容器顶部100%，即显示在父容器下方 */
    right: 0;
    /* 距离父容器右侧0px，右对齐显示 */
    background: #fff;
    /* 背景色为白色 */
    border-radius: 12px;
    /* 边框圆角12px，使下拉菜单呈圆角矩形 */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    /* 添加阴影，水平偏移0，垂直偏移4px，模糊半径20px，黑色透明度0.12 */
    width: 220px;
    /* 设置下拉菜单宽度为220px */
    padding: 12px 0;
    /* 上下内边距12px，左右内边距0 */
    margin-top: 8px;
    /* 上外边距8px，与头像保持间距 */
    z-index: 1000;
    /* 设置堆叠顺序为1000，确保显示在其他元素上方 */
    display: none;
    /* 默认隐藏下拉菜单 */
}

.user-dropdown-menu.active {
    display: block;
    /* 激活状态下显示下拉菜单（块级元素） */
}

/* 用户下拉菜单基础样式 */
.user-dropdown {
    position: absolute;
    /* 绝对定位，相对于父容器定位 */
    top: 100%;
    /* 距离父容器顶部100%，即显示在父容器下方 */
    right: 0;
    /* 距离父容器右侧0px，右对齐显示 */
    background: #fff;
    /* 背景色为白色 */
    border-radius: 12px;
    /* 边框圆角12px，使下拉菜单呈圆角矩形 */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    /* 添加阴影 */
    width: 220px;
    /* 设置下拉菜单宽度为220px */
    padding: 12px 0;
    /* 上下内边距12px，左右内边距0 */
    margin-top: 8px;
    /* 上外边距8px，与头像保持间距 */
    z-index: 1000;
    /* 设置堆叠顺序为1000，确保显示在其他元素上方 */
    opacity: 0;
    /* 默认透明 */
    visibility: hidden;
    /* 默认隐藏 */
    transform: translateY(-10px);
    /* 默认向上偏移10px */
    transition: all 0.3s ease;
    /* 添加过渡动画 */
}

.user-dropdown.show {
    opacity: 1;
    /* 显示时完全不透明 */
    visibility: visible;
    /* 显示时可见 */
    transform: translateY(0);
    /* 显示时回到原位置 */
}

.dropdown-item {
    display: flex;
    /* 使用弹性盒布局模型 */
    align-items: center;
    /* 垂直居中对齐子元素 */
    gap: 8px;
    /* 子元素之间的间距为8px */
    padding: 12px 16px;
    /* 上下内边距12px，左右内边距16px */
    color: #333;
    /* 字体颜色为深灰色（#333） */
    text-decoration: none;
    /* 移除文本下划线 */
    transition: background-color 0.2s ease;
    /* 背景色变化时应用0.2秒过渡效果，使用ease缓动函数 */
    border-bottom: 1px solid #f0f0f0;
    /* 底部边框为1px实线浅灰色（#f0f0f0） */
}

.dropdown-item:last-child {
    border-bottom: none;
    /* 最后一个菜单项移除底部边框 */
}

.dropdown-item:hover {
    background-color: #f8f9fa;
    /* 鼠标悬停时背景色变为浅灰色（#f8f9fa） */
}

.dropdown-item i {
    width: 16px;
    text-align: center;
}

/* ========== 3. 登录弹窗整体 ========== */
#login-modal {
    display: none;
    /* 默认隐藏登录弹窗 */
    position: fixed;
    /* 固定定位，覆盖整个视口 */
    left: 0;
    /* 距离视口左侧0px */
    top: 0;
    /* 距离视口顶部0px */
    width: 100vw;
    /* 宽度占满整个视口 */
    height: 100vh;
    /* 高度占满整个视口 */
    background: rgba(0, 0, 0, 0.3);
    /* 半透明黑色背景（透明度0.3） */
    z-index: 9999;
    /* 设置堆叠顺序为9999，确保弹窗显示在最上层 */
    align-items: center;
    /* 垂直居中对齐子元素 */
    justify-content: center;
    /* 水平居中对齐子元素 */
    backdrop-filter: blur(4px);
    /* 背景模糊效果，值为4px */
}

.login-modal-content {
    background: #fff;
    /* 背景色为白色 */
    padding: 32px 36px;
    /* 内边距上下32px、左右36px */
    border-radius: 12px;
    /* 边框圆角12px */
    min-width: 320px;
    /* 最小宽度320px */
    max-width: 400px;
    /* 最大宽度400px */
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.1);
    /* 阴影效果：垂直偏移2px，模糊16px，黑色透明度0.1 */
    display: flex;
    /* 使用弹性盒布局 */
    flex-direction: column;
    /* 子元素垂直排列 */
    align-items: center;
    /* 子元素水平居中对齐 */
    animation: modalSlideIn 0.3s ease;
    /* 应用滑入动画，持续0.3秒 */
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }

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

.login-modal-title {
    margin-bottom: 18px;
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

.login-modal-subtitle {
    margin-bottom: 24px;
    color: #666;
    font-size: 14px;
}

.close-btn {
    position: absolute;
    /* 绝对定位，相对于模态框定位 */
    top: 16px;
    /* 距离模态框顶部16px */
    right: 16px;
    /* 距离模态框右侧16px */
    font-size: 24px;
    /* 字体大小24px，使关闭图标更大更易点击 */
    cursor: pointer;
    /* 鼠标悬停时显示指针形状，表示可点击 */
    color: #666;
    /* 图标颜色为中灰色（#666） */
    transition: color 0.2s ease;
    /* 颜色变化时应用0.2秒过渡效果，使用ease缓动函数 */
}

.close-btn:hover {
    color: #333;
    /* 鼠标悬停时颜色变为深灰色（#333），增强交互反馈 */
}

/* ========== 4. 登录/注册表单与输入框 ========== */
.login-form {
    width: 100%;
    /* 表单宽度占满父容器 */
    margin-top: 24px;
    /* 上外边距24px，与上方元素保持间距 */
}

.form-group {
    margin-bottom: 16px;
    /* 表单组底部外边距16px，用于分隔不同表单元素 */
    width: 100%;
    /* 宽度占满父容器，确保表单组元素全宽显示 */
}

.form-label {
    display: block;
    /* 块级元素显示，独占一行 */
    margin-bottom: 8px;
    /* 底部外边距8px，与输入框保持间距 */
    font-weight: 500;
    /* 字体粗细500（中等） */
    color: #333;
    /* 字体颜色深灰色（#333） */
    font-size: 14px;
}

.form-input-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
}

.form-input-wrapper .form-input {
    padding-right: 40px;
    /* 预留小眼睛按钮空间 */
}

.toggle-password-visibility {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    outline: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    color: #bbb;
    transition: color 0.2s;
    z-index: 2;
}

.toggle-password-visibility:hover {
    color: #3385ff;
}

.eye-icon {
    display: block;
    width: 20px;
    height: 20px;
    pointer-events: none;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e7ef;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.form-input:focus {
    outline: none;
    border-color: #3385ff;
    box-shadow: 0 0 0 3px rgba(51, 133, 255, 0.1);
}

.form-input.error {
    border-color: #ff4757;
}

.form-error {
    color: #ff4757;
    font-size: 12px;
    margin-top: 4px;
    display: none;
}

/* 记住密码复选框 */
.remember-group {
    margin-bottom: 8px;
    margin-top: -8px;
}

.remember-group label {
    display: flex;
    align-items: center;
    font-size: 14px;
    color: #666;
    cursor: pointer;
    user-select: none;
}

.remember-group input[type="checkbox"] {
    appearance: none;
    width: 16px;
    height: 16px;
    border: 2px solid #b3c6e0;
    border-radius: 5px;
    margin-right: 7px;
    background: #fff;
    outline: none;
    transition: border-color 0.2s, background 0.2s;
    position: relative;
    display: inline-block;
    vertical-align: middle;
}

.remember-group input[type="checkbox"]:checked {
    background: #3385ff;
    border-color: #3385ff;
}

.remember-group input[type="checkbox"]:checked::after {
    content: '';
    display: block;
    position: absolute;
    left: 50%;
    top: 50%;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: translate(-50%, -50%) rotate(45deg);
    box-sizing: border-box;
    pointer-events: none;
}

/* ========== 6. 通用按钮 ========== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
}

.btn-secondary {
    background: #f1f3f4;
    color: #333;
}

.btn-secondary:hover {
    background: #e8eaed;
}

.btn-primary {
    background: #3385ff;
    float: right;
    color: #fff;
}

.btn-primary:hover {
    background: #2968d4;
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* ========== 7. 注册/切换链接 ========== */
.register-link {
    margin-top: 16px;
    text-align: center;
    font-size: 14px;
    color: #666;
}

.register-link a {
    color: #3385ff;
    text-decoration: none;
    font-weight: 500;
}

.register-link a:hover {
    text-decoration: underline;
}

/* ========== 8. 加载状态 ========== */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ========== 9. 响应式 ========== */
@media (max-width: 768px) {

    #top-login-btn,
    #user-avatar-btn {
        top: 12px;
        right: 16px;
    }

    .login-modal-content {
        margin: 16px;
        padding: 24px 20px;
        min-width: auto;
        width: calc(100% - 32px);
    }

    .user-avatar-container {
        padding: 3px 8px;
    }

    .user-name {
        display: none;
    }

    .dropdown-arrow {
        display: none;
    }

    .top-login-btn-beauty {
        top: 12px;
        right: 12px;
        font-size: 15px;
        height: 38px;
        min-width: 70px;
        padding: 0 14px;
    }

    .top-login-btn-beauty svg {
        margin-right: 5px;
        width: 18px;
        height: 18px;
    }
}

/* Semi Design 风格按钮 */
.semi-btn {
    display: inline-block;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    background: #fff;
    color: #1a1a1a;
    padding: 8px 0;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 8px;
}

.semi-btn-block {
    width: 100%;
}

.semi-btn-outline {
    border: 1px solid #3385ff;
    color: #3385ff;
    background: #fff;
}

.semi-btn-outline:hover {
    background: #eaf3ff;
    border-color: #1a73e8;
    color: #1a73e8;
}

.semi-btn-primary {
    background: #3385ff;
    color: #fff;
    border: 1px solid #3385ff;
}

.semi-btn-primary:hover {
    background: #1a73e8;
    border-color: #1a73e8;
}

.semi-btn-secondary {
    background: #f5f6fa;
    color: #1a1a1a;
    border: 1px solid #d1d5db;
}

.semi-btn-secondary:hover {
    background: #e5e9f2;
}

/* Semi Design 风格弹窗 */
.semi-modal {
    position: fixed;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.semi-modal-content {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    width: 340px;
    max-width: 90vw;
    padding: 24px 24px 16px 24px;
    position: relative;
}

.semi-modal-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 18px;
    color: #222;
}

.semi-modal-body {
    margin-bottom: 16px;
}

.semi-form-group {
    margin-bottom: 14px;
}

.semi-form-label {
    display: block;
    font-size: 14px;
    color: #666;
    margin-bottom: 4px;
}

.semi-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
}

.semi-input:focus {
    border-color: #3385ff;
}

.semi-form-error {
    color: #e54848;
    font-size: 13px;
    margin-top: 2px;
    min-height: 18px;
}

.semi-modal-footer {
    display: flex;
    justify-content: space-between;
}

.semi-modal-footer .semi-btn {
    width: 48%;
}