/* 主页特定样式 */

/* 页面跳转动画遮罩 */
#pageTransitionOverlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease-out;
    backdrop-filter: blur(4px);
}

#pageTransitionOverlay.show {
    opacity: 1;
}

#pageTransitionOverlay .transition-content {
    background: white;
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

#pageTransitionOverlay .transition-spinner {
    position: relative;
    width: 64px;
    height: 64px;
}

#pageTransitionOverlay .transition-ring-bg {
    width: 64px;
    height: 64px;
    border: 4px solid #e0f2fe;
    border-radius: 50%;
}

#pageTransitionOverlay .transition-ring-spin {
    position: absolute;
    top: 0;
    left: 0;
    width: 64px;
    height: 64px;
    border: 4px solid transparent;
    border-top-color: #0ea5e9;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

#pageTransitionOverlay .transition-ring-inner {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 48px;
    height: 48px;
    border: 4px solid transparent;
    border-bottom-color: #67e8f9;
    border-radius: 50%;
    animation: spin-reverse 1s linear infinite;
}

#pageTransitionOverlay .transition-title {
    color: #0284c7;
    font-weight: 500;
    font-size: 1.125rem;
    max-width: 250px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#pageTransitionOverlay .transition-sub {
    color: #6b7280;
    font-size: 0.875rem;
}

/* 反向旋转动画 */
@keyframes spin-reverse {
    from {
        transform: rotate(360deg);
    }
    to {
        transform: rotate(0deg);
    }
}

.animate-spin-reverse {
    animation: spin-reverse 1s linear infinite;
}

/* 加载动画 */
@keyframes spin-reverse {
    from {
        transform: rotate(360deg);
    }
    to {
        transform: rotate(0deg);
    }
}

@keyframes pulse-scale {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
}

.animate-spin-reverse {
    animation: spin-reverse 1.2s linear infinite;
}

.animate-pulse-scale {
    animation: pulse-scale 2s ease-in-out infinite;
}

/* 历史记录和设置按钮定位样式 */
.top-corner-button {
    position: fixed;
    z-index: 10;
    background: #222;
    border: 1px solid #333;
    border-radius: 0.5rem;
    padding: 0.375rem 0.75rem;
    transition: all 0.2s ease;
}

.top-corner-button:hover {
    background: #333;
    border-color: white;
}

/* 搜索区域样式 */
.search-box {
    height: 3.5rem;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
    border-radius: 0.5rem;
    overflow: hidden;
    display: flex;
    align-items: stretch;
}

.search-button {
    width: 5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    color: black;
    font-weight: 500;
    transition: background-color 0.2s;
}

.search-button:hover {
    background: #f0f0f0;
}

.search-input {
    flex: 1;
    background: #111;
    border-top: 1px solid #333;
    border-bottom: 1px solid #333;
    color: white;
    padding: 0 1.5rem;
    font-size: 1rem;
    outline: none;
    transition: background-color 0.2s;
}

.search-input:focus {
    background: #191919;
}

/* 最近搜索记录样式 */
.recent-search-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    margin: 0.25rem;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 0.5rem;
    color: #e5e7eb;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.recent-search-tag:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.4);
}

/* 豆瓣区域样式 */
.douban-container {
    margin: 2rem auto;
    max-width: 1280px;
    padding: 0 0.5rem;
}

.douban-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.douban-toggle {
    display: flex;
    align-items: center;
    background: #222;
    border-radius: 9999px;
    padding: 0.25rem;
}

.douban-toggle-button {
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
    border-radius: 9999px;
}

.douban-toggle-button.active {
    background: #db2777;
    color: white;
}

.douban-toggle-button:not(.active) {
    color: #9ca3af;
}

.douban-toggle-button:not(.active):hover {
    color: white;
}

.douban-refresh-button {
    font-size: 0.875rem;
    padding: 0.25rem 0.75rem;
    background: #db2777;
    color: white;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.douban-refresh-button:hover {
    background: #be185d;
}

.douban-tags-container {
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.douban-tags {
    display: flex;
    gap: 0.5rem;
    min-width: max-content;
}

.douban-tag {
    padding: 0.25rem 0.75rem;
    background: rgba(219, 39, 119, 0.1);
    border: 1px solid rgba(219, 39, 119, 0.2);
    border-radius: 0.5rem;
    color: #f9a8d4;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.douban-tag:hover {
    background: rgba(219, 39, 119, 0.2);
    border-color: rgba(219, 39, 119, 0.4);
}

.douban-tag.active {
    background: #db2777;
    border-color: #db2777;
    color: white;
}

/* 搜索结果样式 */
.search-results-container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 0.5rem;
}

.search-result-stats {
    text-align: right;
    font-size: 0.875rem;
    color: #9ca3af;
    margin-bottom: 1rem;
}

/* 响应式网格布局 */
.search-results-grid {
    display: grid;
    gap: 1rem;
}

@media (max-width: 640px) {
    .search-results-grid {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 641px) and (max-width: 768px) {
    .search-results-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .search-results-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1025px) {
    .search-results-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* 视频卡片样式 */
.video-card {
    position: relative;
    background: linear-gradient(145deg, #ffffff, #f8fafc);
    border-radius: 1rem;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(186, 230, 253, 0.5);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.video-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 40px rgba(14, 165, 233, 0.15), 0 8px 16px rgba(0, 0, 0, 0.08);
    border-color: rgba(56, 189, 248, 0.6);
}

.video-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #0ea5e9, #06b6d4, #0ea5e9);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.video-card:hover::before {
    opacity: 1;
}

.video-card .poster-container {
    position: relative;
    aspect-ratio: 2/3;
    overflow: hidden;
    background: linear-gradient(135deg, #e0f2fe, #cffafe);
}

.video-card .poster-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.video-card:hover .poster-container img {
    transform: scale(1.1);
}

.video-card .poster-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: #7dd3fc;
    background: linear-gradient(135deg, #e0f2fe, #cffafe);
}

.video-card .badge-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 2.5rem 0.75rem 0.5rem;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
}

.video-card .badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.9), rgba(6, 182, 212, 0.9));
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 0.375rem;
    backdrop-filter: blur(4px);
}

.video-card .card-info {
    padding: 0.75rem;
    background: linear-gradient(180deg, #ffffff, #f0f9ff);
}

.video-card .card-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1e293b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: color 0.2s ease;
}

.video-card:hover .card-title {
    color: #0284c7;
}

/* 播放图标覆盖层 */
.video-card .play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.video-card:hover .play-overlay {
    opacity: 1;
}

.video-card .play-icon {
    width: 3.5rem;
    height: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transform: scale(0.8);
    transition: transform 0.3s ease;
}

.video-card:hover .play-icon {
    transform: scale(1);
}

.video-card .play-icon svg {
    width: 1.5rem;
    height: 1.5rem;
    color: #0ea5e9;
    margin-left: 3px;
}

/* 分类筛选按钮样式 */
.filter-btn {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    border-radius: 0.75rem;
    background: linear-gradient(135deg, #ffffff, #f0f9ff);
    color: #0369a1;
    border: 1px solid #e0f2fe;
    transition: all 0.2s ease;
    cursor: pointer;
    white-space: nowrap;
    font-weight: 500;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.filter-btn:hover {
    background: linear-gradient(135deg, #e0f2fe, #cffafe);
    border-color: #38bdf8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.15);
}

.filter-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.filter-btn.active {
    background: linear-gradient(135deg, #0ea5e9, #06b6d4);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.35);
    font-weight: 600;
}

/* 搜索输入框聚焦效果 */
#searchInput:focus::placeholder {
    opacity: 0.5;
}

/* 内联加载指示器样式 */
#recentLoadingMore > div {
    animation: fade-in 0.3s ease-out;
}

@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 视频卡片入场动画 */
.video-card {
    animation: card-fade-in 0.4s ease-out backwards;
}

@keyframes card-fade-in {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 为每个卡片添加延迟动画 */
.video-card:nth-child(1) { animation-delay: 0.02s; }
.video-card:nth-child(2) { animation-delay: 0.04s; }
.video-card:nth-child(3) { animation-delay: 0.06s; }
.video-card:nth-child(4) { animation-delay: 0.08s; }
.video-card:nth-child(5) { animation-delay: 0.10s; }
.video-card:nth-child(6) { animation-delay: 0.12s; }
.video-card:nth-child(7) { animation-delay: 0.14s; }
.video-card:nth-child(8) { animation-delay: 0.16s; }

/* 页面区域标题美化 */
#recentUpdatesArea h2,
#resultsArea h2 {
    letter-spacing: 0.025em;
}

/* 分类侧边栏滚动条美化 */
#categoryFilters::-webkit-scrollbar {
    width: 4px;
}

#categoryFilters::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 2px;
}

#categoryFilters::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 2px;
}

#categoryFilters::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}
