/**
 * 首页样式
 * 包含分类下拉菜单、轮播样式等
 */

/* ==================== 分类下拉菜单样式 ==================== */

/* 分类下拉菜单暗黑风格 */
#mobile-category-dropdown {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(20, 20, 25, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8),
                0 0 0 1px rgba(255, 255, 255, 0.05) inset;
}

#mobile-category-dropdown.active {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
}

/* 分类按钮动画 */
#mobile-category-toggle svg {
    transition: transform 0.3s ease;
}

#mobile-category-toggle svg.rotate-180 {
    transform: rotate(180deg);
}

/* 分类项样式 */
.category-filter {
    position: relative;
    transition: all 0.3s ease;
    color: rgba(255, 255, 255, 0.7);
}

.category-filter:hover {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.9);
}

.category-filter.active {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-weight: 500;
}

.category-filter.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: linear-gradient(to bottom, #818cf8, #c084fc);
    border-radius: 0 2px 2px 0;
    box-shadow: 0 0 10px rgba(129, 140, 248, 0.5);
}

/* 防止文字选中 */
#mobile-category-dropdown,
#mobile-category-toggle {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* ==================== 精选轮播样式 ==================== */

/* 确保精选轮播的文本始终左对齐 */
.featured-swiper h2,
.featured-swiper p {
    text-align: left !important;
}

/* 确保标签不居中 */
.featured-swiper .flex {
    justify-content: flex-start !important;
}

/* ==================== 加载状态样式 ==================== */

/* 加载动画 */
.loading-container {
    text-align: center;
    padding: 3rem 1rem;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 1rem;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.875rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 错误提示 */
.error-container {
    text-align: center;
    padding: 3rem 1rem;
    color: rgba(255, 255, 255, 0.5);
}

.error-container p {
    font-size: 0.875rem;
}

/* ==================== 移动端优化 ==================== */

/* 优化移动端触摸反馈 */
@media (hover: none) {
    .category-filter:active {
        background: rgba(255, 255, 255, 0.15);
    }
    
    #mobile-category-toggle:active {
        opacity: 0.8;
    }
}

/* ==================== 响应式设计 ==================== */

/* 平板设备 */
@media (max-width: 1024px) {
    .category-filter {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
}

/* 手机设备 */
@media (max-width: 768px) {
    #mobile-category-dropdown {
        right: 1rem;
        left: 1rem;
        margin-top: 0.5rem;
        min-width: auto;
    }
    
    .category-filter {
        padding: 0.5rem 0.75rem;
        font-size: 0.8125rem;
    }
}

/* ==================== 暗黑模式优化 ==================== */

@media (prefers-color-scheme: dark) {
    #mobile-category-dropdown {
        background: rgba(15, 15, 20, 0.98);
        border-color: rgba(255, 255, 255, 0.08);
    }
    
    .category-filter:hover {
        background: rgba(255, 255, 255, 0.06);
    }
    
    .category-filter.active {
        background: rgba(255, 255, 255, 0.1);
    }
}

/* ==================== 动画效果 ==================== */

/* 淡入动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* 下拉菜单展开动画 */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#mobile-category-dropdown[style*="block"] {
    animation: slideDown 0.2s ease-out;
}

/* ==================== 加载更多按钮样式 ==================== */

#load-more {
    transition: all 0.3s ease;
}

#load-more:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

#load-more:active {
    transform: translateY(0);
}

#load-more:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* 错误状态 */
#load-more.text-red-400 {
    color: #f87171 !important;
    border-color: rgba(248, 113, 113, 0.3);
}

/* 确保父容器有相对定位 */
.lg\:hidden.px-4.py-3.border-b.border-white\/5 {
    position: relative !important;
}

/* 下拉菜单样式 */
#mobile-category-dropdown {
    position: absolute !important;
    background: rgba(20, 20, 25, 0.95) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 8px !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8) !important;
    color: white !important;
}

/* 分类项样式 */
.category-filter {
    color: rgba(255, 255, 255, 0.8) !important;
    transition: all 0.3s ease !important;
}

.category-filter:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    color: white !important;
}

.category-filter.active {
    background: rgba(255, 255, 255, 0.15) !important;
    color: white !important;
    position: relative;
}

.category-filter.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: #818cf8;
    border-radius: 0 2px 2px 0;
}