/* ========================================
   现代化导航页面样式
   支持响应式设计和深色/浅色模式
======================================== */

/* CSS 变量定义 */
:root {
    /* 浅色主题 */
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-hover: #f1f5f9;
    
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    
    --accent-primary: #3b82f6;
    --accent-secondary: #8b5cf6;
    --accent-gradient: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* 深色主题 */
[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #1e293b;
    --bg-hover: #334155;
    
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    
    --border-color: #334155;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.4);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.4), 0 4px 6px -4px rgb(0 0 0 / 0.4);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.5), 0 8px 10px -6px rgb(0 0 0 / 0.5);
}

/* 重置样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ========================================
   背景动画
======================================== */
.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.gradient-sphere {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
    animation: float 20s infinite ease-in-out;
}

.sphere-1 {
    width: 600px;
    height: 600px;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    top: -200px;
    right: -100px;
    animation-delay: 0s;
}

.sphere-2 {
    width: 400px;
    height: 400px;
    background: linear-gradient(135deg, #ec4899 0%, #8b5cf6 100%);
    bottom: -100px;
    left: -100px;
    animation-delay: -7s;
}

.sphere-3 {
    width: 300px;
    height: 300px;
    background: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
    top: 50%;
    left: 50%;
    animation-delay: -14s;
}

@keyframes float {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    25% {
        transform: translate(50px, -50px) scale(1.1);
    }
    50% {
        transform: translate(0, -100px) scale(1);
    }
    75% {
        transform: translate(-50px, -50px) scale(0.9);
    }
}

/* ========================================
   头部导航
======================================== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 72px;
    background: rgba(var(--bg-secondary), 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    z-index: 1000;
    transition: var(--transition-normal);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo i {
    font-size: 1.75rem;
    -webkit-text-fill-color: initial;
    color: var(--accent-primary);
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-link {
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition-fast);
    position: relative;
}

.nav-link:hover,
.nav-link.active {
    color: var(--accent-primary);
    background: var(--bg-hover);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.theme-toggle {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: var(--transition-fast);
}

.theme-toggle:hover {
    background: var(--bg-hover);
    color: var(--accent-primary);
    transform: rotate(15deg);
}

.admin-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--accent-gradient);
    color: white;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--transition-fast);
    box-shadow: 0 4px 14px 0 rgba(59, 130, 246, 0.39);
}

.admin-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px 0 rgba(59, 130, 246, 0.5);
}

.mobile-menu-btn {
    display: none;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 1.2rem;
    transition: var(--transition-fast);
}

.mobile-menu-btn:hover {
    background: var(--bg-hover);
}

/* ========================================
   移动端菜单
======================================== */
.mobile-menu {
    display: none;
    position: fixed;
    top: 72px;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 16px;
    flex-direction: column;
    gap: 8px;
    z-index: 999;
    transform: translateY(-100%);
    opacity: 0;
    transition: var(--transition-normal);
}

.mobile-menu.active {
    transform: translateY(0);
    opacity: 1;
}

.mobile-nav-link {
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 12px;
}

.mobile-nav-link:hover {
    background: var(--bg-hover);
    color: var(--accent-primary);
}

.admin-mobile-link {
    background: var(--accent-gradient);
    color: white !important;
    margin-top: 8px;
}

/* ========================================
   主要内容区域
======================================== */
.main-content {
    padding-top: 72px;
    max-width: 1400px;
    margin: 0 auto;
    padding-left: 32px;
    padding-right: 32px;
    padding-bottom: 80px;
}

/* ========================================
   Hero 搜索区域
======================================== */
.hero-section {
    padding: 80px 0 60px;
    text-align: center;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 16px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 40px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.search-box {
    position: relative;
    max-width: 640px;
    margin: 0 auto 32px;
}

.search-icon {
    position: absolute;
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.2rem;
}

.search-input {
    width: 100%;
    padding: 20px 24px 20px 60px;
    font-size: 1.1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-xl);
    background: var(--bg-card);
    color: var(--text-primary);
    transition: var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    padding: 12px 24px;
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
}

.search-btn:hover {
    transform: translateY(-50%) scale(1.02);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.quick-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

.tag {
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 100px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
}

.tag:hover {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

/* ========================================
   分类区域
======================================== */
.categories-section {
    margin-bottom: 60px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-primary);
}

.section-title i {
    color: var(--accent-primary);
}

.view-all {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--accent-primary);
    font-weight: 500;
    font-size: 0.95rem;
    transition: var(--transition-fast);
}

.view-all:hover {
    gap: 12px;
}

/* ========================================
   卡片网格
======================================== */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.nav-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    transition: var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.nav-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent-gradient);
    transform: scaleX(0);
    transition: var(--transition-normal);
}

.nav-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-primary);
}

.nav-card:hover::before {
    transform: scaleX(1);
}

.card-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
    transition: var(--transition-fast);
}

.nav-card:hover .card-icon {
    transform: scale(1.1);
}

/* 品牌色彩 */
.card-icon.github { background: #24292e; color: white; }
.card-icon.vercel { background: #000000; color: white; }
.card-icon.figma { background: #f24e1e; color: white; }
.card-icon.codepen { background: #1e1f26; color: white; }
.card-icon.stackoverflow { background: #f48024; color: white; }
.card-icon.caniuse { background: #c75000; color: white; }
.card-icon.mdn { background: #83d0f2; color: #1b1b1b; }
.card-icon.freecodecamp { background: #0a0a23; color: white; }
.card-icon.csstricks { background: #ff7b00; color: white; }
.card-icon.javascript { background: #f7df1e; color: #323330; }
.card-icon.aws { background: #ff9900; color: white; }
.card-icon.cloudflare { background: #f48120; color: white; }
.card-icon.supabase { background: #3ecf8e; color: white; }
.card-icon.railway { background: #0b0d0e; color: white; }

.card-content {
    flex: 1;
    min-width: 0;
}

.card-content h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.card-content p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-arrow {
    color: var(--text-muted);
    opacity: 0;
    transform: translateX(-10px);
    transition: var(--transition-fast);
}

.nav-card:hover .card-arrow {
    opacity: 1;
    transform: translateX(0);
    color: var(--accent-primary);
}

/* ========================================
   页脚
======================================== */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 60px 32px 24px;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 60px;
    margin-bottom: 40px;
}

.footer-brand .logo {
    margin-bottom: 16px;
}

.footer-brand p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.social-links {
    display: flex;
    gap: 12px;
}

.social-link {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: var(--bg-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 1.2rem;
    transition: var(--transition-fast);
}

.social-link:hover {
    background: var(--accent-primary);
    color: white;
    transform: translateY(-3px);
}

.footer-links {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
}

.footer-column h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.footer-column a {
    display: block;
    padding: 8px 0;
    color: var(--text-secondary);
    transition: var(--transition-fast);
}

.footer-column a:hover {
    color: var(--accent-primary);
    padding-left: 4px;
}

.footer-bottom {
    max-width: 1400px;
    margin: 0 auto;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ========================================
   响应式设计
======================================== */
@media (max-width: 1024px) {
    .hero-title {
        font-size: 2.75rem;
    }
    
    .cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 40px;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 0 20px;
    }
    
    .nav-menu {
        display: none;
    }
    
    .admin-btn span {
        display: none;
    }
    
    .mobile-menu-btn {
        display: flex;
    }
    
    .mobile-menu {
        display: flex;
    }
    
    .main-content {
        padding-left: 20px;
        padding-right: 20px;
    }
    
    .hero-section {
        padding: 60px 0 40px;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .search-box {
        margin-bottom: 24px;
    }
    
    .search-input {
        padding: 16px 16px 16px 52px;
        font-size: 1rem;
    }
    
    .search-btn {
        display: none;
    }
    
    .cards-grid {
        grid-template-columns: 1fr;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .footer {
        padding: 40px 20px 20px;
    }
    
    .footer-links {
        grid-template-columns: repeat(2, 1fr);
        gap: 30px;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 1.75rem;
    }
    
    .footer-links {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    
    .quick-tags {
        gap: 8px;
    }
    
    .tag {
        padding: 6px 12px;
        font-size: 0.85rem;
    }
}

/* ========================================
   动画效果
======================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.nav-card {
    animation: fadeInUp 0.5s ease forwards;
}

.nav-card:nth-child(1) { animation-delay: 0.05s; }
.nav-card:nth-child(2) { animation-delay: 0.1s; }
.nav-card:nth-child(3) { animation-delay: 0.15s; }
.nav-card:nth-child(4) { animation-delay: 0.2s; }
.nav-card:nth-child(5) { animation-delay: 0.25s; }
.nav-card:nth-child(6) { animation-delay: 0.3s; }

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* 选中文字样式 */
::selection {
    background: var(--accent-primary);
    color: white;
}
