/**
 * 社区通用样式 - 用户登录状态显示
 */

/* 内容区最小高度，避免页脚跑中间 */
.main-content {
    min-height: 80vh;
}

/* Header 登录区域 - 默认隐藏，等JS确认登录状态后再显示，避免闪烁 */
.header-auth {
    min-width: 160px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 15px;
    flex-shrink: 0;
    visibility: hidden;
}

/* 用户信息下拉菜单 */
.user-info-dropdown {
    position: relative;
    display: inline-block;
}

.user-avatar-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.user-avatar-wrapper:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

/* Header 用户头像 */
.user-avatar-wrapper .user-avatar,
.header-auth .user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e5e5e5;
}

/* 通用用户头像（字母头像 fallback） */
.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.user-nickname {
    font-size: 14px;
    color: #333;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-info-dropdown .dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 180px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s;
    z-index: 1000;
}

.user-info-dropdown.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-info-dropdown .dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    transition: background-color 0.2s;
}

.user-info-dropdown .dropdown-item:first-child {
    border-radius: 8px 8px 0 0;
}

.user-info-dropdown .dropdown-item:last-child {
    border-radius: 0 0 8px 8px;
}

.user-info-dropdown .dropdown-item:hover {
    background-color: #f5f5f5;
    color: #333;
    text-decoration: none;
}

.user-info-dropdown .dropdown-divider {
    height: 1px;
    background-color: #e5e5e5;
    margin: 4px 0;
}

.logout-item {
    color: #999;
}

.logout-item:hover {
    color: #ff4d4f;
    background-color: #fff1f0;
}

/* 通用搜索栏 - 靠近登录区 */
.header-search {
    max-width: 400px;
    margin-left: auto;
    margin-right: 20px;
}
.header-search form {
    display: flex;
    gap: 0;
}
.header-search input {
    flex: 1;
    min-width: 0;
    padding: 8px 15px;
    border: 1px solid #ddd;
    border-right: none;
    border-radius: 20px 0 0 20px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
}
.header-search input:focus {
    border-color: #a82224;
}
.header-search button {
    padding: 8px 16px;
    background: #a82224;
    color: #fff;
    border: none;
    border-radius: 0 20px 20px 0;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
    white-space: nowrap;
}
.header-search button:hover {
    background: #8b1a1c;
}
@media (max-width: 768px) {
    .header-search {
        max-width: 100%;
        margin: 10px 0;
        order: 3;
    }
    .header-search input {
        min-width: 120px;
    }
}

/* 移动端适配 */
@media (max-width: 768px) {
    .user-nickname {
        max-width: 80px;
    }
    
    .user-info-dropdown .dropdown-menu {
        right: -10px;
        min-width: 160px;
    }
}

/* 每页条数选择器 */
.pagination-pagesize {
    display: flex;
    align-items: center;
    gap: 6px;
}
.pagination-pagesize label {
    color: #666;
    font-size: 14px;
}
.pagesize-select {
    padding: 5px 8px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    font-size: 14px;
    color: #333;
    background: #fff;
    cursor: pointer;
    outline: none;
    transition: border-color 0.3s;
}
.pagesize-select:focus {
    border-color: #a82224;
}
