/**
 * frontend.css
 * 前台首页样式
 */

/* 固定头部 */
.fixed-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: #ffffff;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

/* 隐藏移动端菜单滚动条 */
/* 隐藏移动端菜单滚动条和通用隐藏滚动条工具类 */
#mobile-menu::-webkit-scrollbar,
.no-scrollbar::-webkit-scrollbar {
    display: none;
}

#mobile-menu,
.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* 滚动容器边缘渐变遮罩 */
.mask-linear {
    -webkit-mask-image: linear-gradient(to right, transparent, black 12px, black calc(100% - 12px), transparent);
    mask-image: linear-gradient(to right, transparent, black 12px, black calc(100% - 12px), transparent);
}

/* 移除浏览器默认的 search input 清除按钮 */
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-results-button,
input[type="search"]::-webkit-search-results-decoration {
    -webkit-appearance: none;
}

/* GPU 加速动画 */
@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translate3d(0, 20px, 0);
    }

    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

.animate-fade-in-up {
    animation: fade-in-up 0.4s ease-out forwards;
    opacity: 0;
    will-change: transform, opacity;
}

.animation-delay-200 {
    animation-delay: 0.1s;
}

.animation-delay-400 {
    animation-delay: 0.2s;
}

.animation-delay-600 {
    animation-delay: 0.3s;
}

/* 自定义边框工具类 */
.border-l-3 {
    border-left-width: 3px;
}

/* 资源卡片动画 - 仅前8张卡片有动画 */
.resource-card {
    will-change: transform, opacity;
    transform: translateZ(0);
    backface-visibility: hidden;
    min-height: 24rem;
    /* 统一卡片高度 (约384px) - 适配 GitHub 按钮 */
}

/* 移动端减少卡片高度 */
@media (max-width: 768px) {
    .resource-card {
        min-height: 18rem;
        /* 移动端减少约 96px */
    }

    .resource-card .card-title {
        min-height: 2rem !important;
        /* 减少标题区高度 */
    }

    .resource-card .card-desc {
        min-height: 3rem !important;
        /* 减少描述区高度 */
        -webkit-line-clamp: 3 !important;
        /* 移动端显示3行 */
        line-clamp: 3 !important;
    }
}

.resource-card:nth-child(1) {
    animation: fade-in-up 0.3s ease-out 0.05s forwards;
    opacity: 0;
}

.resource-card:nth-child(2) {
    animation: fade-in-up 0.3s ease-out 0.1s forwards;
    opacity: 0;
}

.resource-card:nth-child(3) {
    animation: fade-in-up 0.3s ease-out 0.15s forwards;
    opacity: 0;
}

.resource-card:nth-child(4) {
    animation: fade-in-up 0.3s ease-out 0.2s forwards;
    opacity: 0;
}

.resource-card:nth-child(5) {
    animation: fade-in-up 0.3s ease-out 0.25s forwards;
    opacity: 0;
}

.resource-card:nth-child(6) {
    animation: fade-in-up 0.3s ease-out 0.3s forwards;
    opacity: 0;
}

.resource-card:nth-child(7) {
    animation: fade-in-up 0.3s ease-out 0.35s forwards;
    opacity: 0;
}

.resource-card:nth-child(8) {
    animation: fade-in-up 0.3s ease-out 0.4s forwards;
    opacity: 0;
}

.resource-card:nth-child(n+9) {
    opacity: 1;
}

/* =====================================================
   卡片样式主题 - 可在后台设置中切换
   ===================================================== */

/* 样式1: 卡片阴影 (shadow) - 悬浮效果更强 */
.card-style-shadow .resource-card {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-style-shadow .resource-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 10px 10px -5px rgba(0, 0, 0, 0.08);
}

/* 样式2: 渐变边框 (gradient) - 彩色渐变边框 */
.card-style-gradient .resource-card {
    position: relative;
    background: white;
    border: none;
    transition: all 0.3s ease;
}

.card-style-gradient .resource-card::before {
    content: '';
    position: absolute;
    inset: 0;
    padding: 2px;
    border-radius: inherit;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f43f5e 100%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

.card-style-gradient .resource-card:hover::before {
    opacity: 1;
}

.card-style-gradient .resource-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px -5px rgba(102, 126, 234, 0.3);
}

/* 样式3: 宽列表 (wide) - 更大的卡片 */
.card-style-wide .resource-grid {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)) !important;
    gap: 1.5rem !important;
}

.card-style-wide .resource-card {
    padding: 1.5rem !important;
    border-radius: 1rem !important;
    transition: all 0.3s ease;
}

.card-style-wide .resource-card:hover {
    transform: scale(1.02);
    box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.15);
}

.card-style-wide .resource-card .text-lg {
    font-size: 1.25rem !important;
}

.card-style-wide .resource-card .w-10 {
    width: 3.5rem !important;
    height: 3.5rem !important;
}

/* Dark mode 支持 */
.dark .card-style-shadow .resource-card {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
}

.dark .card-style-shadow .resource-card:hover {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 10px 10px -5px rgba(0, 0, 0, 0.25);
}

.dark .card-style-gradient .resource-card::before {
    background: linear-gradient(135deg, #818cf8 0%, #a78bfa 50%, #fb7185 100%);
}

.dark .card-style-gradient .resource-card:hover {
    box-shadow: 0 10px 20px -5px rgba(129, 140, 248, 0.3);
}

/* =====================================================
   卡片标签样式 - 根据主题变化位置和外观
   ===================================================== */

/* Shadow 主题 → 霓虹发光风格 - 标签右上角 */
.card-style-shadow .card-tag {
    top: 0 !important;
    left: auto !important;
    right: 0 !important;
    border-radius: 0 0.75rem 0 0.75rem !important;
}

.card-style-shadow .card-tag span {
    background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%) !important;
    border: 1px solid rgba(139, 92, 246, 0.6) !important;
    box-shadow:
        0 0 8px rgba(139, 92, 246, 0.6),
        0 0 16px rgba(139, 92, 246, 0.4),
        0 0 24px rgba(139, 92, 246, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
    animation: neon-pulse 2s ease-in-out infinite;
}

@keyframes neon-pulse {

    0%,
    100% {
        box-shadow:
            0 0 8px rgba(139, 92, 246, 0.6),
            0 0 16px rgba(139, 92, 246, 0.4),
            0 0 24px rgba(139, 92, 246, 0.2),
            inset 0 1px 0 rgba(255, 255, 255, 0.1);
    }

    50% {
        box-shadow:
            0 0 12px rgba(236, 72, 153, 0.7),
            0 0 24px rgba(236, 72, 153, 0.5),
            0 0 36px rgba(236, 72, 153, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.15);
    }
}

/* Gradient 主题 - 标签左上角，渐变背景 */
.card-style-gradient .card-tag span {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f43f5e 100%) !important;
    border-radius: 0 0 0.75rem 0 !important;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.35);
}

/* Wide 主题 → 毛玻璃 Glassmorphism 风格 - 标签左上角胶囊 */
.card-style-wide .card-tag {
    top: 0 !important;
    bottom: auto !important;
    left: 0 !important;
    right: auto !important;
    width: auto !important;
    justify-content: flex-start !important;
    padding: 0 !important;
}

.card-style-wide .card-tag span {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.45) 0%, rgba(255, 255, 255, 0.15) 100%) !important;
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.6) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.4) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.4) !important;
    border-top: none !important;
    border-left: none !important;
    border-radius: 0 0 0.85rem 0 !important;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.1);
    color: #0f172a !important;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
    font-weight: 700 !important;
    padding: 0.35rem 0.85rem !important;
    letter-spacing: 0.02em;
}

/* 深色模式下的增强毛玻璃 */
.dark .card-style-wide .card-tag span {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.05) 100%) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-top: none !important;
    border-left: none !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    color: #e2e8f0 !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Apple 主题 - 苹果极简风格，动态渐变胶囊标签 */
.card-style-apple .resource-card {
    position: relative;
    border: none;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);

    /* 默认渐变 (彩虹) - Fallback */
    --apple-gradient: linear-gradient(90deg, #ff6b9d, #c44dff, #00c6ff, #72f088, #ff6b9d);
}

/* 颜色变体定义 */
.card-style-apple .resource-card.apple-color-gray {
    --apple-gradient: linear-gradient(90deg, #64748b, #94a3b8, #cbd5e1, #64748b);
}

.card-style-apple .resource-card.apple-color-blue {
    --apple-gradient: linear-gradient(90deg, #1d4ed8, #3b82f6, #60a5fa, #1d4ed8);
}

/* Deep System Blue */
.card-style-apple .resource-card.apple-color-purple {
    --apple-gradient: linear-gradient(90deg, #7c3aed, #a855f7, #d946ef, #7c3aed);
}

.card-style-apple .resource-card.apple-color-cyan {
    --apple-gradient: linear-gradient(90deg, #0891b2, #22d3ee, #34d399, #0891b2);
}

/* Network Cyan-Teal */
.card-style-apple .resource-card.apple-color-indigo {
    --apple-gradient: linear-gradient(90deg, #4f46e5, #6366f1, #8b5cf6, #4f46e5);
}

.card-style-apple .resource-card.apple-color-green {
    --apple-gradient: linear-gradient(90deg, #059669, #10b981, #34d399, #059669);
}

.card-style-apple .resource-card.apple-color-pink {
    --apple-gradient: linear-gradient(90deg, #db2777, #ec4899, #fb7185, #db2777);
}

.card-style-apple .resource-card.apple-color-orange {
    --apple-gradient: linear-gradient(90deg, #ea580c, #f97316, #fbbf24, #ea580c);
}

.card-style-apple .resource-card.apple-color-amber {
    --apple-gradient: linear-gradient(90deg, #d97706, #f59e0b, #fbbf24, #d97706);
}

.card-style-apple .resource-card.apple-color-emerald {
    --apple-gradient: linear-gradient(90deg, #059669, #34d399, #10b981, #059669);
}

.card-style-apple .resource-card.apple-color-red {
    --apple-gradient: linear-gradient(90deg, #dc2626, #ef4444, #f43f5e, #dc2626);
}

/* 动态渐变发光边框 */
.card-style-apple .resource-card::before {
    content: '';
    position: absolute;
    inset: 0;
    padding: 2px;
    border-radius: inherit;
    background: var(--apple-gradient);
    background-size: 300% 100%;
    animation: apple-border-glow 4s ease infinite;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

@keyframes apple-border-glow {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

.card-style-apple .resource-card:hover::before {
    opacity: 1;
}

.card-style-apple .resource-card:hover {
    transform: translateY(-6px) scale(1.01);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.05);
}

.card-style-apple .card-tag span {
    background: var(--apple-gradient) !important;
    background-size: 400% 100% !important;
    animation: apple-gradient-flow 6s ease infinite;
    border-radius: 9999px !important;
    padding: 0.35rem 0.75rem !important;
    font-weight: 600 !important;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    box-shadow: 0 2px 12px rgba(196, 77, 255, 0.35);
    border: none !important;
}

@keyframes apple-gradient-flow {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* =====================================================
   详情页按钮样式 - 下载按钮和 GitHub 按钮
   ===================================================== */

/* Default 主题 - 保持原有样式，无额外覆盖 */
.theme-default .btn-download {
    transition: all 0.3s ease;
}

/* Shadow 主题 → 霓虹发光按钮 */
.theme-shadow .btn-download {
    background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%) !important;
    border: 1px solid rgba(139, 92, 246, 0.5) !important;
    box-shadow:
        0 0 10px rgba(139, 92, 246, 0.5),
        0 0 20px rgba(139, 92, 246, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

.theme-shadow .btn-download:hover {
    transform: translateY(-3px);
    box-shadow:
        0 0 15px rgba(236, 72, 153, 0.6),
        0 0 30px rgba(236, 72, 153, 0.4),
        0 0 45px rgba(236, 72, 153, 0.2);
    border-color: rgba(236, 72, 153, 0.6) !important;
}

.theme-shadow .btn-github {
    border: 1px solid rgba(139, 92, 246, 0.4) !important;
    background: transparent !important;
    transition: all 0.3s ease;
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.2);
}

.theme-shadow .btn-github:hover {
    background: rgba(139, 92, 246, 0.15) !important;
    box-shadow: 0 0 16px rgba(139, 92, 246, 0.4);
    border-color: rgba(139, 92, 246, 0.6) !important;
}

/* Gradient 主题 - 紫粉渐变，悬浮发光 */
.theme-gradient .btn-download {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f43f5e 100%) !important;
    background-size: 200% 200% !important;
    border: none !important;
    animation: gradient-shift 3s ease infinite;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
}

@keyframes gradient-shift {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

.theme-gradient .btn-download:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.6);
}

.theme-gradient .btn-github {
    position: relative;
    border: 2px solid transparent !important;
    background: linear-gradient(white, white) padding-box,
        linear-gradient(135deg, #667eea, #764ba2, #f43f5e) border-box !important;
    transition: all 0.3s ease;
}

.theme-gradient .btn-github:hover {
    transform: rotate(3deg) scale(1.05);
}

.theme-gradient .btn-github i {
    transition: transform 0.3s ease;
}

.theme-gradient .btn-github:hover i {
    transform: rotate(360deg);
}

/* Wide 主题 → 毛玻璃按钮 */
.theme-wide .btn-download {
    border-radius: 1rem !important;
    padding: 1rem 2rem !important;
    font-size: 1.1rem !important;
    background: rgba(99, 102, 241, 0.85) !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
    transition: all 0.3s ease;
}

.theme-wide .btn-download:hover {
    transform: scale(1.05);
    background: rgba(99, 102, 241, 0.95) !important;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.45);
}

.theme-wide .btn-github {
    border-radius: 1rem !important;
    padding: 1rem 1.5rem !important;
    background: rgba(255, 255, 255, 0.15) !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.25) !important;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.theme-wide .btn-github:hover {
    transform: scale(1.08);
    background: rgba(255, 255, 255, 0.25) !important;
}

.theme-wide .btn-github i {
    font-size: 1.3rem !important;
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.theme-wide .btn-github:hover i {
    transform: translateY(-3px);
}

/* Apple 主题 - 按钮美化 */
.card-style-apple .btn-card-main {
    border-radius: 9999px !important;
    /* Pill shape */
    background: linear-gradient(180deg, #0071e3 0%, #147ce5 100%) !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
    border: 1px solid rgba(0, 0, 0, 0.05) !important;
    font-size: 0.95em !important;
    letter-spacing: 0.02em;
}

.card-style-apple .btn-card-main:hover {
    background: linear-gradient(180deg, #147ce5 0%, #288cf7 100%) !important;
    box-shadow: 0 4px 12px rgba(0, 113, 227, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
    transform: translateY(-1px);
}

.card-style-apple .btn-card-main:active {
    transform: scale(0.98) translateY(0);
}

.card-style-apple .btn-card-secondary {
    border-radius: 9999px !important;
    /* Circle shape */
    width: 2.8rem !important;
    padding: 0 !important;
    background: rgba(0, 0, 0, 0.04) !important;
}

.card-style-apple .btn-card-secondary:hover {
    background: rgba(0, 0, 0, 0.08) !important;
}

.dark .card-style-apple .btn-card-secondary {
    background: rgba(255, 255, 255, 0.1) !important;
}

.dark .card-style-apple .btn-card-secondary:hover {
    background: rgba(255, 255, 255, 0.2) !important;
}

/* 详情按钮图标替换：隐藏原 info图标，显示右箭头 */
.card-style-apple .btn-card-secondary i {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.card-style-apple .btn-card-secondary i::before {
    content: "\f054" !important;
    /* fa-chevron-right */
    font-size: 0.9em;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.card-style-apple .btn-card-secondary:hover i::before {
    opacity: 0.9;
}

/* =====================================================
   深色模式支持
   ===================================================== */

/* 霓虹深色模式（保持相同效果，本身就是深色风格）*/
.dark .card-style-shadow .card-tag span {
    border-color: rgba(168, 85, 247, 0.7) !important;
}

/* 渐变深色模式 */
.dark .card-style-gradient .card-tag span {
    background: linear-gradient(135deg, #818cf8 0%, #a78bfa 50%, #fb7185 100%) !important;
}

.dark .theme-gradient .btn-github {
    background: linear-gradient(#1f2937, #1f2937) padding-box,
        linear-gradient(135deg, #818cf8, #a78bfa, #fb7185) border-box !important;
}

/* 毛玻璃深色模式 */
.dark .card-style-wide .card-tag span {
    background: rgba(30, 41, 59, 0.6) !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
    color: #e2e8f0 !important;
    text-shadow: none;
}

.dark .theme-wide .btn-github {
    background: rgba(30, 41, 59, 0.4) !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
}

/* Apple 深色模式 */
.dark .card-style-apple .resource-card {
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

.dark .card-style-apple .resource-card:hover {
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

.dark .theme-apple .btn-github {
    background: linear-gradient(#1f2937, #1f2937) padding-box,
        linear-gradient(90deg, #ff6b9d, #c44dff, #00c6ff, #ff6b9d) border-box !important;
}