/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #6366f1;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --hover-color: #f1f5f9;
    --navbar-bg: #ffffff;
}

.dark-mode {
    --primary-color: #818cf8;
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --hover-color: #334155;
    --navbar-bg: #1e293b;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
}

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

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

/* 导航栏 */
.navbar {
    background: var(--navbar-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background-color 0.3s;
}

.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--primary-color);
}

.nav-logo i {
    font-size: 1.3rem;
}

.nav-center {
    flex: 1;
    max-width: 400px;
    margin: 0 30px;
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--hover-color);
    border-radius: 20px;
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    transition: all 0.3s;
}

.search-box:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.search-box i {
    color: var(--text-secondary);
    margin-right: 10px;
}

.search-box input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    color: var(--text-primary);
    font-size: 0.95rem;
}

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

.search-clear {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: all 0.2s;
}

.search-clear:hover {
    background: var(--border-color);
}

.nav-right {
    display: flex;
    gap: 10px;
}

.admin-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--primary-color);
    border: none;
    border-radius: 20px;
    color: white;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.admin-btn:hover {
    background: #4f46e5;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.admin-btn i {
    font-size: 1rem;
}

.mode-toggle,
.back-to-top {
    background: var(--hover-color);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    color: var(--text-secondary);
}

.mode-toggle:hover,
.back-to-top:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* 头部样式 */
.header {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
    color: white;
    padding: 50px 0;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    position: relative;
    z-index: 1;
}

.logo img {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    background: white;
    padding: 4px;
}

.logo h1 {
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.subtitle {
    margin-top: 12px;
    font-size: 1.15rem;
    opacity: 0.95;
    font-weight: 400;
    position: relative;
    z-index: 1;
}

/* 分类标签 */
.category-tabs {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 24px;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

.category-tabs .tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 25px;
    color: white;
    font-size: 0.95rem;
    transition: all 0.3s;
    backdrop-filter: blur(10px);
}

.category-tabs .tab:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.category-tabs .tab.active {
    background: white;
    color: #6366f1;
    font-weight: 600;
}

/* 主内容区 */
.main {
    padding: 40px 0;
}

/* 分类样式 */
.category {
    margin-bottom: 50px;
}

.category-header {
    display: flex;
    align-items: center;
}

.category-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-color);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.category-icon {
    color: var(--primary-color);
}

.tool-count {
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--text-secondary);
    background: var(--hover-color);
    padding: 4px 10px;
    border-radius: 10px;
    margin-left: auto;
}

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

/* 工具卡片 */
.tool-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.tool-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, var(--primary-color) 0%, transparent 100%);
    transform: scaleY(0);
    transition: transform 0.3s;
}

.tool-card:hover::before {
    transform: scaleY(1);
}

.tool-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
}

.tool-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 10px;
    overflow: hidden;
    background: var(--hover-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--primary-color);
}

.tool-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tool-info {
    flex: 1;
    min-width: 0;
}

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

.tool-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tool-arrow {
    flex-shrink: 0;
    color: var(--text-secondary);
    font-size: 0.85rem;
    opacity: 0;
    transition: opacity 0.3s;
}

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

/* 无结果提示 */
.no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.no-results i {
    font-size: 4rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.no-results p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.no-results .suggestion {
    font-size: 0.9rem;
    color: var(--text-secondary);
    opacity: 0.8;
}

/* 页脚 */
.footer {
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    padding: 40px 0;
    margin-top: 40px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

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

.footer-section p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 8px;
}

.footer-section ul li a {
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: color 0.3s;
}

.footer-section ul li a:hover {
    color: var(--primary-color);
}

.footer-bottom {
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .navbar .container {
        flex-wrap: wrap;
        gap: 10px;
    }

    .nav-center {
        order: 3;
        width: 100%;
        margin: 0;
    }

    .header {
        padding: 30px 0;
    }

    .logo h1 {
        font-size: 1.5rem;
    }

    .category-tabs {
        gap: 8px;
    }

    .category-tabs .tab {
        padding: 8px 14px;
        font-size: 0.85rem;
    }

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

    .category-title {
        font-size: 1.25rem;
    }

    .back-to-top {
        bottom: 20px;
        right: 20px;
    }
}