/**
 * 用户中心样式 - 彩色渐变 Hero 区域(完全复制作者页面设计)
 *
 * @package    Hui
 * @subpackage Assets
 * @since      1.2.0
 */

/* ============================================================================
   页面背景色统一
   ============================================================================ */

/* 确保用户中心页面背景色一致 */
.hui-user-center {
    background: transparent;
}

.xun-user-center {
    background: transparent;
}

/* ============================================================================
   Hero 区域 - 全宽显示
   ============================================================================ */

/* Hero 外层容器 */
.hui-user-hero {
    width: 100%;
    margin-top: 0; /* 去掉顶部间距,避免露出白色背景 */
    margin-bottom: 1.5rem;
    padding-top: 1.5rem; /* 用 padding 代替 margin,保持间距但不露出背景 */
    background: var(--color-bg-layout, #f5f5f5); /* 使用页面背景色 */
}

/* 透明Header模式 */
.hui-user-hero--transparent {
    margin-top: 0;
    padding-top: 80px;
}

/* Hero 包装器 */
.hui-user-hero-wrapper {
    max-width: var(--xun-container-width, 1200px);
    margin: 0 auto;
    padding: 0 1rem;
    background: transparent; /* 确保包装器背景透明 */
}

/* Hero 内容容器 */
.hui-user-hero-content {
    position: relative;
    background: var(--color-bg-container);
    border-radius: var(--xun-radius-lg, 12px);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    margin: 0; /* 去掉可能的外边距 */
}

/* 封面图背景 */
.hui-user-hero-bg {
    position: relative;
    width: 100%;
    height: 200px;
    background-color: var(--color-fill-quaternary);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: scroll; /* 固定背景,不随滚动移动 */
}

/* 更换封面按钮 - 右上角 */
.hui-user-cover-edit-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 10;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-full, 9999px);
    font-size: 0.875rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.95);
    cursor: pointer;
    transition: all 0.2s var(--ease-smooth, ease);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.hui-user-cover-edit-btn:hover {
    background: rgba(0, 0, 0, 0.65);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

.hui-user-cover-edit-btn:active {
    transform: translateY(0);
}

.hui-user-cover-edit-btn svg {
    flex-shrink: 0;
}

/* 深色模式适配 */
@media (prefers-color-scheme: dark) {
    :root:not(.light) .hui-user-cover-edit-btn {
        background: rgba(0, 0, 0, 0.6);
        border-color: rgba(255, 255, 255, 0.2);
    }
    
    :root:not(.light) .hui-user-cover-edit-btn:hover {
        background: rgba(0, 0, 0, 0.75);
        border-color: rgba(255, 255, 255, 0.3);
    }
}

.dark .hui-user-cover-edit-btn {
    background: rgba(0, 0, 0, 0.6);
    border-color: rgba(255, 255, 255, 0.2);
}

.dark .hui-user-cover-edit-btn:hover {
    background: rgba(0, 0, 0, 0.75);
    border-color: rgba(255, 255, 255, 0.3);
}

/* ============================================================================
   用户信息卡片 - 白色背景区域
   ============================================================================ */

/* 用户信息卡片 */
.hui-user-card {
    position: relative;
    padding: 1.5rem;
    background: var(--color-bg-container);
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
}

/* 毛玻璃过渡效果 */
.hui-user-card::before {
    content: '';
    position: absolute;
    top: -60px;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(to bottom, 
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.4) 50%,
        rgba(255, 255, 255, 0.8) 100%
    );
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    pointer-events: none;
    z-index: 1;
}

/* 左侧内容区域 */
.hui-user-card-left {
    position: relative;
    z-index: 2;
    flex: 1;
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
}

/* 头像 */
.hui-user-avatar {
    position: relative;
    z-index: 2;
    flex-shrink: 0;
    width: 80px;
    height: 80px;
}

.hui-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-full, 9999px);
    border: 3px solid var(--color-bg-container);
    box-shadow: var(--shadow-sm);
    background: var(--color-bg-container);
}

/* 头像编辑按钮 */
.hui-user-avatar .xun-avatar-edit-btn {
    position: absolute;
    bottom: 0;
    right: 0;
    z-index: 3;
}

/* 用户信息 */
.hui-user-info {
    position: relative;
    z-index: 2;
    flex: 1;
    min-width: 0;
}

.hui-user-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-text);
    margin: 0 0 0.5rem 0;
    line-height: 1.2;
}

.hui-user-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
}

.hui-user-badges {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.hui-user-uid-badge,
.hui-user-vip-badge,
.hui-user-level-badge,
.hui-user-points-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.125rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 500;
    border-radius: var(--radius-sm, 6px);
    line-height: 1.4;
}

.hui-user-uid-badge {
    color: var(--color-text-tertiary);
    background: var(--color-fill-quaternary);
}

.hui-user-vip-badge {
    color: #fff;
    background: linear-gradient(135deg, #ffd700 0%, #ffb800 100%);
}

.hui-user-level-badge.xun-level-badge--text {
    color: var(--level-color, var(--color-text-tertiary));
    background: var(--level-bg-color, var(--color-fill-quaternary));
}

.hui-user-level-badge.xun-level-badge--icon {
    background: transparent;
    border: none;
    padding: 0;
}

.hui-user-level-badge.xun-level-badge--icon .xun-level-icon {
    object-fit: contain;
    width: auto;
    height: 18px;
    max-height: 20px;
    display: block;
}

.hui-user-points-badge {
    color: var(--color-text-tertiary);
    background: var(--color-fill-quaternary);
}

/* 右侧操作按钮 */
.hui-user-card-right {
    position: relative;
    z-index: 2;
    flex-shrink: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: flex-start;
    justify-content: center;
    width: auto;
}

/* 签到按钮 - 已签到状态样式 */
.hui-user-card-right .xun-checkin-btn.is-checked,
.hui-user-card-right .xun-checkin-btn[disabled] {
    color: var(--color-text-secondary) !important;
    background: var(--color-fill-quaternary) !important;
    border: 1px solid var(--color-border-secondary) !important;
}

/* 个人主页按钮 - 独占一行 */
.hui-author-page-btn {
    width: auto;
    flex-basis: 60%;
    background: var(--color-fill-quaternary) !important;
    border: 1px solid var(--color-border-secondary) !important;
}

.hui-author-page-btn:hover {
    background: var(--color-fill-tertiary) !important;
    border-color: var(--color-border) !important;
}

/* ============================================================================
   深色模式适配
   ============================================================================ */

@media (prefers-color-scheme: dark) {
    :root:not(.light) .hui-user-card::before {
        background: linear-gradient(to bottom, 
            rgba(15, 23, 42, 0) 0%,
            rgba(15, 23, 42, 0.4) 50%,
            rgba(15, 23, 42, 0.8) 100%
        );
    }
}

.dark .hui-user-card::before {
    background: linear-gradient(to bottom, 
        rgba(15, 23, 42, 0) 0%,
        rgba(15, 23, 42, 0.4) 50%,
        rgba(15, 23, 42, 0.8) 100%
    );
}

/* ============================================================================
   响应式设计
   ============================================================================ */

@media (max-width: 768px) {
    /* 移动端去掉容器 padding */
    .hui-user-hero-wrapper {
        padding: 0;
    }
    
    /* 移动端去掉圆角 */
    .hui-user-hero-content {
        border-radius: 0;
    }
    
    /* 移动端渐变背景高度 */
    .hui-user-hero-bg {
        height: 150px;
    }
    
    /* 移动端更换封面按钮 */
    .hui-user-cover-edit-btn {
        top: 0.75rem;
        right: 0.75rem;
        padding: 0.375rem 0.75rem;
        font-size: 0.8125rem;
    }
    
    .hui-user-cover-edit-btn svg {
        width: 14px;
        height: 14px;
    }
    
    /* 移动端卡片布局 */
    .hui-user-card {
        padding: 1rem;
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    /* 移动端毛玻璃过渡 */
    .hui-user-card::before {
        top: -40px;
        height: 40px;
    }
    
    /* 移动端左侧内容 */
    .hui-user-card-left {
        width: 100%;
        flex-direction: column;
        align-items: center;
    }
    
    /* 移动端头像 */
    .hui-user-avatar {
        width: 64px;
        height: 64px;
    }
    
    /* 移动端用户信息 */
    .hui-user-info {
        width: 100%;
        text-align: center;
    }
    
    .hui-user-name {
        font-size: 1.125rem;
    }
    
    .hui-user-meta {
        justify-content: center;
        font-size: 0.75rem;
    }
    
    .hui-user-badges {
        justify-content: center;
    }
    
    /* 移动端右侧按钮 */
    .hui-user-card-right {
        width: 100%;
        flex-direction: row;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .hui-user-card-right .btn {
        flex: 1;
        min-width: 100px;
    }
}

/* ============================================================================
   用户标签样式
   ============================================================================ */

/* 用户标签容器 */
.hui-user-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

/* 单个标签 */
.hui-user-tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    background-color: var(--color-fill-quaternary, #f5f5f5);
    color: var(--color-text-secondary, #666);
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.4;
    height: 24px; /* 固定高度，与编辑按钮一致 */
    transition: all 0.2s ease;
}

.hui-user-tag:hover {
    background-color: var(--color-fill-tertiary, #e8e8e8);
}

/* 空状态提示 */
.hui-user-tags-empty {
    display: inline-flex;
    align-items: center;
    padding: 4px 0;
    color: var(--color-text-tertiary, #999);
    font-size: 13px;
    line-height: 1.4;
    height: 24px; /* 固定高度，与编辑按钮一致 */
}

/* 深色模式 */
@media (prefers-color-scheme: dark) {
    :root:not(.light) .hui-user-tag {
        background-color: var(--color-fill-quaternary, rgba(255, 255, 255, 0.08));
        color: var(--color-text-secondary, rgba(255, 255, 255, 0.65));
    }
    
    :root:not(.light) .hui-user-tag:hover {
        background-color: var(--color-fill-tertiary, rgba(255, 255, 255, 0.12));
    }
}

.dark .hui-user-tag {
    background-color: var(--color-fill-quaternary, rgba(255, 255, 255, 0.08));
    color: var(--color-text-secondary, rgba(255, 255, 255, 0.65));
}

.dark .hui-user-tag:hover {
    background-color: var(--color-fill-tertiary, rgba(255, 255, 255, 0.12));
}

/* 标签包装器 */
.hui-user-tags-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

/* 标签显示容器（个人资料页面） */
.hui-user-tags-display {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 32px;
    align-items: center;
}

.hui-user-tags-empty {
    color: var(--color-text-tertiary);
    font-size: 0.875rem;
}

/* 编辑按钮 */
.hui-user-tags-edit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0; /* 防止按钮被压缩 */
    width: 24px;
    height: 24px;
    padding: 0;
    background: var(--color-fill-quaternary);
    border: none;
    border-radius: var(--radius-sm, 4px);
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.hui-user-tags-edit-btn:hover {
    background: var(--color-fill-tertiary);
    color: var(--color-text);
}


/* ============================================================================
   标签编辑模态框 - 对接父主题模态框样式
   ============================================================================ */

/* 模态框容器 */
.hui-tags-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}

/* 显示状态 */
.hui-tags-modal.is-active {
    display: flex !important;
}

/* 遮罩层 */
.hui-tags-modal__overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
}

/* 内容容器 */
.hui-tags-modal__content {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 500px;
    margin: 0 1rem;
    background: var(--color-bg-container);
    border-radius: var(--radius-lg, 12px);
    box-shadow: var(--shadow-modal, 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04));
    animation: modalSlideIn 0.2s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 头部 */
.hui-tags-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--color-border);
}

.hui-tags-modal__title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--color-text);
}

.hui-tags-modal__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm, 4px);
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.hui-tags-modal__close:hover {
    background: var(--color-fill-quaternary);
    color: var(--color-text);
}

/* 主体 */
.hui-tags-modal__body {
    padding: 1.5rem;
}

/* 底部 */
.hui-tags-modal__footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--color-border);
}

/* 内联标签编辑器 */
.hui-tags-editor-inline {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.hui-tags-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.hui-tag-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.hui-tag-input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    background: var(--color-fill-quaternary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm, 6px);
    font-size: 0.875rem;
    color: var(--color-text);
    transition: all 0.2s ease;
}

.hui-tag-input:focus {
    outline: none;
    border-color: var(--color-primary);
    background: var(--color-bg-container);
}

.hui-tag-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: var(--color-fill-quaternary);
    border: none;
    border-radius: var(--radius-sm, 4px);
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.hui-tag-remove:hover {
    background: var(--color-error-bg);
    color: var(--color-error);
}

.hui-tag-add-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--color-fill-quaternary);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-sm, 6px);
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.hui-tag-add-btn:hover:not(:disabled) {
    background: var(--color-fill-tertiary);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.hui-tag-add-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.hui-tags-hint {
    margin: 0;
    font-size: 0.8125rem;
    color: var(--color-text-tertiary);
}

/* 按钮加载状态 */
.hui-tags-modal__btn--save .hui-tags-btn__spinner {
    display: none;
}

.hui-tags-modal__btn--save.is-loading .hui-tags-btn__text {
    display: none;
}

.hui-tags-modal__btn--save.is-loading .hui-tags-btn__spinner {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

/* 响应式 */
@media (max-width: 640px) {
    .hui-tags-modal__content {
        max-width: calc(100% - 2rem);
    }
    
    .hui-tags-modal__header,
    .hui-tags-modal__body,
    .hui-tags-modal__footer {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}
