/**
 * 移动端底部Tab样式
 *
 * @package    Xun Child
 * @since      1.0.0
 */

/* ============================================================================
   仅在移动端显示
   ============================================================================ */
.xun-mobile-tab,
.xun-mobile-tab-publish,
.xun-mobile-tab-placeholder {
    display: none;
}

@media (max-width: 768px) {
    .xun-mobile-tab,
    .xun-mobile-tab-placeholder {
        display: block;
    }
}

/* ============================================================================
   底部Tab导航栏
   ============================================================================ */
.xun-mobile-tab {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: var(--mobile-tab-bg, #ffffff);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.xun-mobile-tab__inner {
    display: flex;
    align-items: center;
    justify-content: space-around;
    height: 56px;
    max-width: 100%;
    margin: 0 auto;
}

/* ============================================================================
   Tab项目
   ============================================================================ */
.xun-mobile-tab__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    height: 100%;
    text-decoration: none;
    color: var(--mobile-tab-icon, #666666);
    transition: color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.xun-mobile-tab__item:hover,
.xun-mobile-tab__item:focus {
    text-decoration: none;
    color: var(--mobile-tab-icon, #666666);
}

.xun-mobile-tab__item.is-active {
    color: var(--mobile-tab-active, #6366f1);
}

.xun-mobile-tab__icon {
    font-size: 20px;
    line-height: 1;
    margin-bottom: 4px;
}

.xun-mobile-tab__label {
    font-size: 10px;
    line-height: 1;
    white-space: nowrap;
}

/* ============================================================================
   中心按钮（发布按钮）
   ============================================================================ */
.xun-mobile-tab__item--center {
    position: relative;
    flex: none;
    width: 60px;
}

.xun-mobile-tab__center-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--mobile-tab-active, #6366f1), #8b5cf6);
    border-radius: 50%;
    color: #ffffff;
    font-size: 22px;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
    transform: translateY(-10px);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.xun-mobile-tab__item--center:active .xun-mobile-tab__center-btn {
    transform: translateY(-8px) scale(0.95);
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.3);
}

/* ============================================================================
   底部占位
   ============================================================================ */
.xun-mobile-tab-placeholder {
    height: 56px;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

/* ============================================================================
   发布弹窗
   ============================================================================ */
@media (max-width: 768px) {
    .xun-mobile-tab-publish {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 10000;
    }

    .xun-mobile-tab-publish.is-open {
        display: block;
    }
}

.xun-mobile-tab-publish__overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.xun-mobile-tab-publish.is-open .xun-mobile-tab-publish__overlay {
    opacity: 1;
}

.xun-mobile-tab-publish__content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--mobile-tab-bg, #ffffff);
    border-radius: 16px 16px 0 0;
    padding-bottom: env(safe-area-inset-bottom, 0);
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.xun-mobile-tab-publish.is-open .xun-mobile-tab-publish__content {
    transform: translateY(0);
}

.xun-mobile-tab-publish__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.xun-mobile-tab-publish__title {
    font-size: 16px;
    font-weight: 600;
    color: var(--mobile-tab-icon, #333333);
}

.xun-mobile-tab-publish__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 50%;
    color: var(--mobile-tab-icon, #666666);
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.xun-mobile-tab-publish__close:hover {
    background: rgba(0, 0, 0, 0.1);
}

.xun-mobile-tab-publish__options {
    display: flex;
    padding: 20px;
    gap: 16px;
}

.xun-mobile-tab-publish__option {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    padding: 20px 16px;
    background: rgba(99, 102, 241, 0.05);
    border-radius: 12px;
    text-decoration: none;
    color: var(--mobile-tab-icon, #333333);
    transition: background 0.2s ease, transform 0.2s ease;
}

.xun-mobile-tab-publish__option:hover {
    text-decoration: none;
    color: var(--mobile-tab-icon, #333333);
    background: rgba(99, 102, 241, 0.1);
}

.xun-mobile-tab-publish__option:active {
    transform: scale(0.98);
}

.xun-mobile-tab-publish__option-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--mobile-tab-active, #6366f1), #8b5cf6);
    border-radius: 12px;
    color: #ffffff;
    font-size: 20px;
    margin-bottom: 10px;
}

.xun-mobile-tab-publish__option-text {
    font-size: 14px;
    font-weight: 500;
}

/* ============================================================================
   夜间模式适配
   ============================================================================ */
[data-theme="dark"] .xun-mobile-tab,
.dark-mode .xun-mobile-tab,
html.dark .xun-mobile-tab {
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .xun-mobile-tab-publish__header,
.dark-mode .xun-mobile-tab-publish__header,
html.dark .xun-mobile-tab-publish__header {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .xun-mobile-tab-publish__close,
.dark-mode .xun-mobile-tab-publish__close,
html.dark .xun-mobile-tab-publish__close {
    background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .xun-mobile-tab-publish__close:hover,
.dark-mode .xun-mobile-tab-publish__close:hover,
html.dark .xun-mobile-tab-publish__close:hover {
    background: rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .xun-mobile-tab-publish__option,
.dark-mode .xun-mobile-tab-publish__option,
html.dark .xun-mobile-tab-publish__option {
    background: rgba(99, 102, 241, 0.1);
}

[data-theme="dark"] .xun-mobile-tab-publish__option:hover,
.dark-mode .xun-mobile-tab-publish__option:hover,
html.dark .xun-mobile-tab-publish__option:hover {
    background: rgba(99, 102, 241, 0.15);
}

/* ============================================================================
   动画效果
   ============================================================================ */
@keyframes mobileTabPulse {
    0%, 100% {
        box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
    }
    50% {
        box-shadow: 0 4px 20px rgba(99, 102, 241, 0.6);
    }
}

.xun-mobile-tab__center-btn {
    animation: mobileTabPulse 2s ease-in-out infinite;
}

/* ============================================================================
 * 九宫格美化样式
 *
 * 为首页九宫格文章卡片创建外层容器
 * 顶部显示Mac圆点和更新时间，底部显示统计信息
 *
 * @package    Xun Child
 * @since      1.0.0
 * ============================================================================ */

/* 外层容器 */
.xun-grid-beautify-enabled .xun-posts-cards .xun-grid-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--color-bg-container);
    border: 1px solid var(--color-border-secondary);
    border-radius: var(--xun-radius-lg, 12px);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    transition: all 0.3s ease;
}

/* 渐变边框效果 */
.xun-grid-beautify-enabled .xun-posts-cards .xun-grid-wrapper::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: calc(var(--xun-radius-lg, 12px) + 4px);
    padding: 3px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.7) 0%, rgba(139, 92, 246, 0.5) 25%, rgba(236, 72, 153, 0.4) 50%, rgba(59, 130, 246, 0.5) 75%, rgba(99, 102, 241, 0.7) 100%);
    -webkit-mask: 
        linear-gradient(#fff 0 0) content-box, 
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 0;
}

/* 悬停时显示边框 */
.xun-grid-beautify-enabled .xun-posts-cards .xun-grid-wrapper:hover::before {
    opacity: 1;
}

/* 悬停效果 */
.xun-grid-beautify-enabled .xun-posts-cards .xun-grid-wrapper:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 28px -8px rgba(99, 102, 241, 0.2), 0 8px 16px -8px rgba(99, 102, 241, 0.1);
    border-color: transparent;
}

/* 顶部栏容器 */
.xun-grid-beautify-enabled .xun-posts-cards .xun-grid-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--color-fill-quaternary);
    border-bottom: 1px solid var(--color-border-secondary);
}

/* Mac圆点容器 */
.xun-grid-beautify-enabled .xun-posts-cards .xun-grid-mac-dots {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* 单个圆点 */
.xun-grid-beautify-enabled .xun-posts-cards .xun-grid-mac-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    box-shadow: inset 0 -1px 2px rgba(0, 0, 0, 0.1);
}

/* 红色圆点 */
.xun-grid-beautify-enabled .xun-posts-cards .xun-grid-mac-dot-red {
    background: #ff5f57;
}

/* 黄色圆点 */
.xun-grid-beautify-enabled .xun-posts-cards .xun-grid-mac-dot-yellow {
    background: #febc2e;
}

/* 绿色圆点 */
.xun-grid-beautify-enabled .xun-posts-cards .xun-grid-mac-dot-green {
    background: #28c840;
}

/* 更新时间 */
.xun-grid-beautify-enabled .xun-posts-cards .xun-grid-update-time {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--color-text-tertiary);
}

.xun-grid-beautify-enabled .xun-posts-cards .xun-grid-update-time svg {
    width: 14px;
    height: 14px;
    opacity: 0.7;
}

/* 卡片容器 */
.xun-grid-beautify-enabled .xun-posts-cards .xun-grid-card-container {
    position: relative;
    flex: 1;
}

/* 内部卡片重置样式 */
.xun-grid-beautify-enabled .xun-posts-cards .xun-grid-wrapper .xun-post-card {
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
    margin: 0 !important;
}

/* 卡片链接 */
.xun-grid-beautify-enabled .xun-posts-cards .xun-grid-wrapper .xun-post-card-link {
    border-radius: 0;
}

/* 缩略图悬停缩放 */
.xun-grid-beautify-enabled .xun-posts-cards .xun-grid-wrapper .xun-post-thumb img {
    transition: transform 0.4s ease;
}

.xun-grid-beautify-enabled .xun-posts-cards .xun-grid-wrapper:hover .xun-post-thumb img {
    transform: scale(1.05);
}

/* 隐藏原有的缩略图统计信息 */
.xun-grid-beautify-enabled .xun-posts-cards .xun-grid-wrapper .xun-post-thumb-stats {
    display: none !important;
}

/* 底部栏容器 */
.xun-grid-beautify-enabled .xun-posts-cards .xun-grid-footer {
    padding: 10px 14px;
    background: var(--color-fill-quaternary);
    border-top: 1px solid var(--color-border-secondary);
}

/* 统计信息容器 */
.xun-grid-beautify-enabled .xun-posts-cards .xun-grid-stats {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 16px;
}

/* 单个统计项 */
.xun-grid-beautify-enabled .xun-posts-cards .xun-grid-stat-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--color-text-tertiary);
    transition: color 0.2s ease;
}

.xun-grid-beautify-enabled .xun-posts-cards .xun-grid-wrapper:hover .xun-grid-stat-item {
    color: var(--color-text-secondary);
}

/* 统计项图标 */
.xun-grid-beautify-enabled .xun-posts-cards .xun-grid-stat-item svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* 评论图标颜色 */
.xun-grid-beautify-enabled .xun-posts-cards .xun-grid-stat-comments svg {
    color: #3b82f6;
}

/* 阅读图标颜色 */
.xun-grid-beautify-enabled .xun-posts-cards .xun-grid-stat-views svg {
    color: #10b981;
}

/* 点赞图标颜色 */
.xun-grid-beautify-enabled .xun-posts-cards .xun-grid-stat-likes svg {
    color: #ec4899;
}

/* 内容区域背景适配 */
.xun-grid-beautify-enabled .xun-posts-cards .xun-grid-wrapper .xun-post-content {
    background: var(--color-bg-container);
}

/* 九宫格响应式适配 */
@media (max-width: 768px) {
    .xun-grid-beautify-enabled .xun-posts-cards .xun-grid-header {
        padding: 8px 10px;
    }
    
    .xun-grid-beautify-enabled .xun-posts-cards .xun-grid-mac-dot {
        width: 10px;
        height: 10px;
    }
    
    .xun-grid-beautify-enabled .xun-posts-cards .xun-grid-mac-dots {
        gap: 5px;
    }
    
    .xun-grid-beautify-enabled .xun-posts-cards .xun-grid-update-time {
        font-size: 11px;
    }
    
    .xun-grid-beautify-enabled .xun-posts-cards .xun-grid-update-time svg {
        width: 12px;
        height: 12px;
    }
    
    .xun-grid-beautify-enabled .xun-posts-cards .xun-grid-footer {
        padding: 8px 10px;
    }
    
    .xun-grid-beautify-enabled .xun-posts-cards .xun-grid-stats {
        gap: 12px;
    }
    
    .xun-grid-beautify-enabled .xun-posts-cards .xun-grid-stat-item {
        font-size: 11px;
        gap: 3px;
    }
    
    .xun-grid-beautify-enabled .xun-posts-cards .xun-grid-stat-item svg {
        width: 12px;
        height: 12px;
    }
    
    .xun-grid-beautify-enabled .xun-posts-cards .xun-grid-wrapper:hover {
        transform: none;
    }
    
    .xun-grid-beautify-enabled .xun-posts-cards .xun-grid-wrapper:hover .xun-post-thumb img {
        transform: none;
    }
    
    .xun-grid-beautify-enabled .xun-posts-cards .xun-grid-wrapper {
        border-radius: var(--xun-radius, 8px);
    }
    
    .xun-grid-beautify-enabled .xun-posts-cards .xun-grid-wrapper::before {
        border-radius: calc(var(--xun-radius, 8px) + 4px);
    }
}

/* 九宫格深色模式适配 - 自动跟随系统 */
@media (prefers-color-scheme: dark) {
    :root:not(.light) .xun-grid-beautify-enabled .xun-posts-cards .xun-grid-wrapper {
        background: var(--color-bg-container);
        border-color: var(--color-border);
    }
    
    :root:not(.light) .xun-grid-beautify-enabled .xun-posts-cards .xun-grid-header,
    :root:not(.light) .xun-grid-beautify-enabled .xun-posts-cards .xun-grid-footer {
        background: var(--color-fill-secondary);
        border-color: var(--color-border);
    }
    
    :root:not(.light) .xun-grid-beautify-enabled .xun-posts-cards .xun-grid-wrapper .xun-post-content {
        background: var(--color-bg-container);
    }
    
    :root:not(.light) .xun-grid-beautify-enabled .xun-posts-cards .xun-grid-wrapper::before {
        background: linear-gradient(135deg, rgba(129, 140, 248, 0.6) 0%, rgba(167, 139, 250, 0.5) 25%, rgba(244, 114, 182, 0.4) 50%, rgba(96, 165, 250, 0.5) 75%, rgba(129, 140, 248, 0.6) 100%);
    }
    
    :root:not(.light) .xun-grid-beautify-enabled .xun-posts-cards .xun-grid-wrapper:hover {
        box-shadow: 0 12px 28px -8px rgba(129, 140, 248, 0.25), 0 8px 16px -8px rgba(129, 140, 248, 0.15);
    }
}

/* 九宫格深色模式适配 - 手动 .dark 类 */
.dark .xun-grid-beautify-enabled .xun-posts-cards .xun-grid-wrapper {
    background: var(--color-bg-container);
    border-color: var(--color-border);
}

.dark .xun-grid-beautify-enabled .xun-posts-cards .xun-grid-header,
.dark .xun-grid-beautify-enabled .xun-posts-cards .xun-grid-footer {
    background: var(--color-fill-secondary);
    border-color: var(--color-border);
}

.dark .xun-grid-beautify-enabled .xun-posts-cards .xun-grid-wrapper .xun-post-content {
    background: var(--color-bg-container);
}

.dark .xun-grid-beautify-enabled .xun-posts-cards .xun-grid-wrapper::before {
    background: linear-gradient(135deg, rgba(129, 140, 248, 0.6) 0%, rgba(167, 139, 250, 0.5) 25%, rgba(244, 114, 182, 0.4) 50%, rgba(96, 165, 250, 0.5) 75%, rgba(129, 140, 248, 0.6) 100%);
}

.dark .xun-grid-beautify-enabled .xun-posts-cards .xun-grid-wrapper:hover {
    box-shadow: 0 12px 28px -8px rgba(129, 140, 248, 0.25), 0 8px 16px -8px rgba(129, 140, 248, 0.15);
}

/* ============================================================================
 * 日夜主题切换遮罩动画
 *
 * 主题切换时显示全屏遮罩动画，带有图标和加载点效果
 *
 * @package    Xun Child
 * @since      1.0.0
 * ============================================================================ */

/* 遮罩容器 */
.xun-theme-switch-mask {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--mask-bg-color);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    pointer-events: none;
}

/* 激活状态 */
.xun-theme-switch-mask.is-active {
    opacity: 1;
    visibility: visible;
}

/* 遮罩内容容器 */
.xun-theme-switch-mask__content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

/* 主题图标 */
.xun-theme-switch-mask__icon {
    font-size: 64px;
    color: var(--mask-icon-color);
    animation: themeIconPulse 1.5s ease-in-out infinite;
}

/* 加载点容器 */
.xun-theme-switch-mask__dots {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 单个加载点 */
.xun-theme-switch-mask__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--mask-icon-color);
    animation: dotBounce 1.4s ease-in-out infinite;
}

.xun-theme-switch-mask__dot:nth-child(1) {
    animation-delay: 0s;
}

.xun-theme-switch-mask__dot:nth-child(2) {
    animation-delay: 0.2s;
}

.xun-theme-switch-mask__dot:nth-child(3) {
    animation-delay: 0.4s;
}

.xun-theme-switch-mask__dot:nth-child(4) {
    animation-delay: 0.6s;
}

.xun-theme-switch-mask__dot:nth-child(5) {
    animation-delay: 0.8s;
}

.xun-theme-switch-mask__dot:nth-child(6) {
    animation-delay: 1s;
}

.xun-theme-switch-mask__dot:nth-child(7) {
    animation-delay: 1.2s;
}

/* 底部文字 */
.xun-theme-switch-mask__text {
    position: absolute;
    bottom: 40px;
    right: 40px;
    font-size: 14px;
    color: var(--mask-text-color);
    opacity: 0.6;
    font-weight: 500;
    letter-spacing: 1px;
}

/* 日间模式颜色变量 */
.xun-theme-switch-mask[data-mode="light"] {
    --mask-bg-color: #f5f5f5;
    --mask-icon-color: #666666;
    --mask-text-color: #999999;
}

/* 夜间模式颜色变量 */
.xun-theme-switch-mask[data-mode="dark"] {
    --mask-bg-color: #2c3e50;
    --mask-icon-color: #ffffff;
    --mask-text-color: #a0a0a0;
}

/* 图标脉动动画 */
@keyframes themeIconPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

/* 加载点跳动动画 */
@keyframes dotBounce {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* 响应式适配 */
@media (max-width: 768px) {
    .xun-theme-switch-mask__icon {
        font-size: 48px;
    }
    
    .xun-theme-switch-mask__dot {
        width: 6px;
        height: 6px;
        gap: 6px;
    }
    
    .xun-theme-switch-mask__text {
        bottom: 30px;
        right: 30px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .xun-theme-switch-mask__icon {
        font-size: 40px;
    }
    
    .xun-theme-switch-mask__dot {
        width: 5px;
        height: 5px;
    }
    
    .xun-theme-switch-mask__text {
        bottom: 20px;
        right: 20px;
        font-size: 11px;
    }
}
