/**
 * Inspire 主题头像选择器样式文件
 * 
 * 文件功能：
 * - 为评论者头像选择功能提供完整样式支持
 * - 定义头像选择器的交互界面样式
 * - 包含头像预览和选择按钮样式
 * - 支持响应式头像选择器布局
 * - 提供头像切换动画效果
 * 
 * 主要组件：
 * - 头像选择器容器样式
 * - 头像预览区域样式
 * - 头像选项网格布局
 * - 选择按钮和确认界面
 * - 头像切换过渡动画
 * 
 * 使用场景：
 * - 用户评论时选择头像
 * - 个人资料页面头像设置
 * - 管理员为用户设置头像
 * 
 * @package Inspire
 * @version 1.0.0
 * @author Inspire Theme
 */

/* 头像选择器容器 */
.avatar-selector {
    margin: 10px 0;
    padding: 15px;
    background: #f9f9f9;
    border: 1px solid #e1e1e1;
    border-radius: 8px !important; /* 确保四个角都是圆角 */
    transition: all 0.3s ease;
    box-sizing: border-box; /* 确保padding不影响布局 */
}

/* 确保在author-info容器内的头像选择器也有正确的圆角 */
.author-info .avatar-selector {
    border-radius: 8px !important;
    border-top-left-radius: 8px !important;
    border-top-right-radius: 8px !important;
    border-bottom-left-radius: 8px !important;
    border-bottom-right-radius: 8px !important;
}

.avatar-selector:hover {
    border-color: #c3c4c7;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* 头像选择器标签 */
.avatar-selector-label {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
    display: block;
}

/* 头像网格容器 */
.avatar-selector-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    gap: 8px;
    max-width: 100%;
    margin-top: 10px;
}

/* 头像选项 */
.avatar-option {
    width: 50px;
    height: 50px;
    border: 2px solid #ddd;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    overflow: hidden;
    position: relative;
    aspect-ratio: 1 / 1; /* 确保保持正圆形 */
    flex-shrink: 0; /* 防止在flex容器中被压缩 */
}

.avatar-option:hover {
    border-color: #0073aa;
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0,115,170,0.2);
}

.avatar-option.selected {
    border-color: #0073aa;
    border-width: 3px;
    background: #f0f8ff;
    box-shadow: 0 0 0 2px rgba(0,115,170,0.1);
}

.avatar-option.selected::after {
    content: '✓';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 16px;
    height: 16px;
    background: #0073aa;
    color: white;
    border-radius: 50%;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* 头像选项中的图片 */
.avatar-option img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block; /* 确保图片正确显示 */
    max-width: none; /* 覆盖主题可能的限制 */
    max-height: none; /* 覆盖主题可能的限制 */
}

/* 加载状态 */
.avatar-selector-grid .loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 20px;
    color: #666;
    font-style: italic;
}

/* 头像加载失败时的样式 */
.avatar-option:empty::before,
.avatar-option:has(img[style*="display: none"])::before {
    content: "头像";
    font-size: 12px;
    color: #999;
    text-align: center;
    line-height: 1;
}

/* 确保头像选项有最小内容 */
.avatar-option {
    min-width: 50px;
    min-height: 50px;
    font-size: 12px;
    color: #999;
    text-align: center;
    line-height: 50px;
}

/* 评论头像预览区域 */
#comment-avatar-preview {
    transition: all 0.3s ease;
}

#comment-avatar-preview img {
    border-radius: 50%;
    border: 2px solid #ddd;
    transition: all 0.3s ease;
}

#comment-avatar-preview img:hover {
    border-color: #0073aa;
    transform: scale(1.05);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .avatar-selector-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 6px;
    }
    
    .avatar-option {
        width: 40px;
        height: 40px;
    }
    
    .avatar-selector {
        padding: 10px;
        margin: 8px 0;
    }
}

@media (max-width: 480px) {
    .avatar-selector-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 4px;
    }
    
    .avatar-option {
        width: 35px;
        height: 35px;
    }
}

/* 动画效果 */
@keyframes avatarSelect {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1.05);
    }
}

.avatar-option.selected {
    animation: avatarSelect 0.3s ease;
}

/* 无障碍支持 */
.avatar-option:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    .avatar-selector {
        background: #2c2c2c;
        border-color: #444;
        color: #fff;
    }
    
    .avatar-selector-label {
        color: #fff;
    }
    
    .avatar-option {
        border-color: #555;
        background: #333;
    }
    
    .avatar-option:hover {
        border-color: #0096dd;
    }
    
    .avatar-option.selected {
        border-color: #0096dd;
        background: #1a3a4a;
    }
}