/* ═══════════════════════════════════════
   电智工坊工具箱 - 样式表
   深蓝工程风暗色主题
   ═══════════════════════════════════════ */

/* --- CSS 变量 --- */
:root {
    --bg-primary: #0A1F44;
    --bg-secondary: #0D2852;
    --bg-card: #112E58;
    --bg-card-hover: #163A6A;
    --bg-elevated: #1A4480;
    --text-primary: #FFFFFF;
    --text-secondary: #AABBCC;
    --text-muted: #6B8299;
    --accent: #00D2B3;
    --accent-light: #80E8D8;
    --accent-dark: #009980;
    --warning: #FFB300;
    --danger: #FF4D4D;
    --success: #4CFF7A;
    --border: #1A3A6A;
    --shadow: rgba(0, 0, 0, 0.3);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', 'PingFang SC', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
}

/* --- 重置 --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--accent-light);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* --- 导航栏 --- */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(10, 31, 68, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(26, 58, 106, 0.5);
    transition: background var(--transition);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.logo-icon {
    font-size: 24px;
}

.logo-text {
    color: var(--accent);
}

.nav-links {
    display: flex;
    gap: 32px;
}

.nav-link {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    padding: 8px 0;
    position: relative;
    transition: color var(--transition);
}

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

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent);
    border-radius: 1px;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 1px;
    transition: var(--transition);
}

/* --- Hero 区 --- */
.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 120px 24px 80px;
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.grid-overlay {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(0, 210, 179, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 210, 179, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
}

.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: float 8s ease-in-out infinite;
}

.orb-1 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, var(--accent), transparent 70%);
    top: 20%;
    left: 10%;
}

.orb-2 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, #0066FF, transparent 70%);
    bottom: 20%;
    right: 10%;
    animation-delay: -4s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -30px) scale(1.05); }
    66% { transform: translate(-20px, 20px) scale(0.95); }
}

.hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 800px;
}

.hero-title {
    font-size: clamp(36px, 7vw, 72px);
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 20px;
    letter-spacing: -1px;
}

.title-line {
    display: block;
}

.title-line.accent {
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: clamp(14px, 2.5vw, 18px);
    color: var(--text-secondary);
    margin-bottom: 40px;
    font-weight: 400;
}

/* --- 搜索框 --- */
.search-box {
    position: relative;
    max-width: 560px;
    margin: 0 auto 48px;
}

.search-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--text-muted);
    pointer-events: none;
}

.search-box input {
    width: 100%;
    padding: 16px 20px 16px 52px;
    font-size: 16px;
    font-family: var(--font-sans);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    color: var(--text-primary);
    outline: none;
    transition: var(--transition);
}

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

.search-box input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 210, 179, 0.15);
}

/* --- Hero 统计 --- */
.hero-stats {
    display: flex;
    justify-content: center;
    gap: 48px;
    flex-wrap: wrap;
}

.stat {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 28px;
    font-weight: 700;
    color: var(--accent);
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
}

/* --- 分类导航 --- */
.category-nav {
    padding: 24px 0;
    position: sticky;
    top: 64px;
    z-index: 100;
    background: rgba(10, 31, 68, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(26, 58, 106, 0.3);
}

.category-pills {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.category-pills::-webkit-scrollbar {
    display: none;
}

.category-pill {
    flex-shrink: 0;
    padding: 8px 20px;
    font-size: 13px;
    font-weight: 500;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    font-family: var(--font-sans);
}

.category-pill:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.category-pill.active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg-primary);
}

/* --- 工具区 --- */
.tools-section {
    padding: 60px 0;
}

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

.section-title {
    font-size: 24px;
    font-weight: 700;
}

.section-desc {
    color: var(--text-secondary);
    font-size: 14px;
}

.view-all {
    font-size: 14px;
    color: var(--accent);
}

/* --- 工具网格 --- */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.tool-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    transition: var(--transition);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.tool-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--accent-light));
    opacity: 0;
    transition: opacity var(--transition);
}

.tool-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 210, 179, 0.1);
}

.tool-card:hover::before {
    opacity: 1;
}

.tool-icon {
    font-size: 32px;
    margin-bottom: 12px;
    display: block;
}

.tool-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.tool-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 16px;
}

.tool-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
}

.tool-category {
    padding: 3px 10px;
    background: rgba(0, 210, 179, 0.1);
    color: var(--accent);
    border-radius: var(--radius-sm);
    font-weight: 500;
}

.tool-badge {
    padding: 3px 10px;
    background: rgba(255, 179, 0, 0.1);
    color: var(--warning);
    border-radius: var(--radius-sm);
    font-weight: 500;
}

.tool-badge.free {
    background: rgba(76, 255, 122, 0.1);
    color: var(--success);
}

/* --- 加载/无结果 --- */
.loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.no-results .hint {
    font-size: 13px;
    margin-top: 8px;
}

/* --- 博客区 --- */
.blog-section {
    padding: 60px 0;
    border-top: 1px solid var(--border);
}

.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
}

.blog-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    transition: var(--transition);
}

.blog-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.blog-card-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.blog-card-excerpt {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.blog-card-date {
    font-size: 12px;
    color: var(--text-muted);
}

.blog-placeholder {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.blog-placeholder .hint {
    font-size: 13px;
    margin-top: 8px;
}

/* --- 关于区 --- */
.about-section {
    padding: 60px 0;
    border-top: 1px solid var(--border);
}

.about-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px;
}

.about-card h2 {
    font-size: 24px;
    margin-bottom: 20px;
}

.about-card > p {
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.8;
}

.about-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
    margin-top: 32px;
}

.feature {
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.feature-icon {
    font-size: 28px;
    margin-bottom: 12px;
    display: block;
}

.feature h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
}

.feature p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

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

.footer-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 24px;
    margin-bottom: 24px;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--text-primary);
}

.footer-links {
    display: flex;
    gap: 24px;
}

.footer-links a {
    color: var(--text-secondary);
    font-size: 14px;
}

.footer-links a:hover {
    color: var(--accent);
}

.footer-qr {
    text-align: right;
    color: var(--text-secondary);
    font-size: 14px;
}

.footer-qr .sub {
    font-size: 12px;
    color: var(--text-muted);
}

.footer-bottom {
    text-align: center;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-muted);
}

/* --- 响应式 --- */
@media (max-width: 768px) {
    .nav-links {
        display: none;
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        background: rgba(10, 31, 68, 0.98);
        flex-direction: column;
        padding: 16px 24px;
        gap: 16px;
        border-bottom: 1px solid var(--border);
    }

    .nav-links.open {
        display: flex;
    }

    .nav-toggle {
        display: flex;
    }

    .hero {
        min-height: auto;
        padding: 100px 20px 60px;
    }

    .hero-stats {
        gap: 24px;
    }

    .tools-grid {
        grid-template-columns: 1fr;
    }

    .blog-grid {
        grid-template-columns: 1fr;
    }

    .footer-content {
        flex-direction: column;
        text-align: center;
    }

    .footer-qr {
        text-align: center;
    }

    .about-card {
        padding: 24px;
    }

    .about-features {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .about-features {
        grid-template-columns: 1fr;
    }
}
