/* ===== 全局重置与品牌色板 ===== */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #8b5cf6;
    --accent: #06b6d4;
    --bg-light: #f8fafc;
    --bg-card: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
    --radius: 12px;
    --radius-lg: 16px;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

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

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

a:hover {
    color: var(--primary-dark);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ===== 字体层级 ===== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
}

h1 { font-size: clamp(32px, 5vw, 48px); }
h2 { font-size: clamp(24px, 4vw, 36px); }
h3 { font-size: 22px; }
h4 { font-size: 18px; }

p {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* ===== 导航栏 ===== */
#navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

#navbar.scrolled {
    box-shadow: var(--shadow-md);
}

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

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    width: 36px;
    height: 36px;
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 24px;
}

.nav-links a {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
    padding: 8px 0;
    position: relative;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: var(--transition);
}

.nav-links a:hover::after,
.nav-links a.active::after {
    width: 100%;
}

.nav-links a.active {
    color: var(--primary);
}

.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
    gap: 5px;
    padding: 5px;
}

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

/* ===== Hero 区域 ===== */
#hero {
    padding: 120px 20px 80px;
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 50%, #cffafe 100%);
    text-align: center;
    min-height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-container {
    max-width: 800px;
    margin: 0 auto;
}

.hero-logo {
    height: 60px;
    margin: 0 auto 24px;
}

.hero-slogan {
    font-size: clamp(28px, 6vw, 48px);
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 16px;
}

.hero-description {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 32px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

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

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

#searchInput {
    width: 100%;
    padding: 16px 16px 16px 48px;
    border: 2px solid var(--border-color);
    border-radius: 50px;
    font-size: 16px;
    outline: none;
    transition: var(--transition);
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
}

#searchInput:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

.category-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.category-tag {
    padding: 8px 20px;
    border-radius: 50px;
    border: 1.5px solid var(--border-color);
    background: var(--bg-card);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
}

.category-tag:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #eef2ff;
}

.category-tag.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ===== 工具列表区域 ===== */
#tools {
    padding: 80px 20px;
}

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

.section-title {
    text-align: center;
    margin-bottom: 48px;
    position: relative;
}

.section-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    margin: 12px auto 0;
    border-radius: 2px;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

.tool-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    position: relative;
    display: flex;
    flex-direction: column;
}

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

.tool-card.pinned {
    border-color: var(--secondary);
    background: linear-gradient(135deg, #faf5ff, #fdf4ff);
}

.tool-card.pinned::before {
    content: '\f08d';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 12px;
    right: 12px;
    color: var(--secondary);
    font-size: 14px;
}

.tool-card .tool-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    margin-bottom: 16px;
}

.tool-card h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
}

.tool-card p {
    font-size: 14px;
    color: var(--text-secondary);
    flex-grow: 1;
    margin-bottom: 16px;
}

.tool-card .tool-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tool-card .tool-category {
    display: inline-block;
    padding: 4px 12px;
    background: #eef2ff;
    color: var(--primary);
    border-radius: 50px;
    font-size: 12px;
    font-weight: 500;
}

.tool-card .tool-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    background: var(--primary);
    color: white;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
}

.tool-card .tool-link:hover {
    background: var(--primary-dark);
    color: white;
    transform: scale(1.02);
}

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

.no-result i {
    font-size: 48px;
    margin-bottom: 16px;
}

/* ===== 页脚 ===== */
footer {
    background: var(--text-primary);
    color: #cbd5e1;
    padding: 60px 20px 20px;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 40px;
}

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

.footer-desc {
    font-size: 14px;
    color: #94a3b8;
    line-height: 1.8;
}

.footer-links h4,
.footer-social h4 {
    color: white;
    margin-bottom: 16px;
    font-size: 16px;
}

.footer-links a {
    display: block;
    color: #94a3b8;
    margin-bottom: 8px;
    font-size: 14px;
}

.footer-links a:hover {
    color: white;
}

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

.social-icons a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    color: #94a3b8;
    font-size: 18px;
    transition: var(--transition);
}

.social-icons a:hover {
    background: var(--primary);
    color: white;
}

.footer-bottom {
    text-align: center;
    padding-top: 32px;
    margin-top: 32px;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 14px;
    color: #64748b;
}

.footer-bottom a {
    color: #94a3b8;
}

.footer-bottom a:hover {
    color: white;
}

/* ===== 后台管理样式 ===== */
.admin-login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #eef2ff, #e0e7ff);
    padding: 20px;
}

.admin-login-card {
    background: white;
    padding: 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.admin-login-card h2 {
    margin-bottom: 24px;
}

.login-error {
    color: #dc2626;
    font-size: 14px;
    margin-top: 12px;
}

.admin-panel {
    min-height: 100vh;
    background: var(--bg-light);
}

.admin-nav {
    background: white;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.admin-nav .nav-container {
    height: 56px;
}

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

.admin-main {
    padding: 40px 20px;
}

.admin-container {
    max-width: 900px;
    margin: 0 auto;
}

.admin-container h1 {
    margin-bottom: 24px;
}

.admin-tools-list {
    margin-top: 24px;
}

.admin-tool-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    margin-bottom: 12px;
    transition: var(--transition);
}

.admin-tool-item:hover {
    box-shadow: var(--shadow-md);
}

.admin-tool-item.pinned {
    border-left: 4px solid var(--secondary);
}

.tool-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.tool-name {
    font-weight: 600;
    font-size: 16px;
}

.tool-category {
    font-size: 13px;
    color: var(--text-muted);
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 4px;
}

.tool-pinned-badge {
    font-size: 13px;
    color: var(--secondary);
}

.tool-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

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

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
}

/* ===== 弹窗样式 ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: white;
    padding: 32px;
    border-radius: var(--radius-lg);
    max-width: 500px;
    width: 100%;
    position: relative;
    box-shadow: var(--shadow-lg);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 20px;
    font-size: 28px;
    font-weight: 300;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-content h2 {
    margin-bottom: 24px;
}

/* ===== 表单样式 ===== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 15px;
    outline: none;
    transition: var(--transition);
    background: var(--bg-card);
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-group textarea {
    resize: vertical;
}

/* ===== 按钮样式 ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #f1f5f9;
}

.btn-danger {
    background: #fef2f2;
    border: 1.5px solid #fecaca;
    color: #dc2626;
}

.btn-danger:hover {
    background: #dc2626;
    color: white;
    border-color: #dc2626;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.btn-full {
    width: 100%;
}

/* ===== 成功提示 ===== */
.alert-success {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #059669;
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 3000;
    animation: slideIn 0.3s ease;
    font-weight: 500;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ===== 响应式设计 ===== */
@media (max-width: 768px) {
    .hamburger {
        display: flex;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 64px;
        left: 0;
        width: 100%;
        background: white;
        flex-direction: column;
        padding: 20px;
        box-shadow: var(--shadow-md);
        border-bottom: 1px solid var(--border-color);
    }

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

    .nav-links a {
        padding: 12px 0;
        width: 100%;
        text-align: center;
    }

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

    .footer-container {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .footer-logo {
        margin: 0 auto 16px;
    }

    .social-icons {
        justify-content: center;
    }

    .admin-tool-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .tool-actions {
        width: 100%;
        justify-content: flex-start;
    }
}

@media (max-width: 480px) {
    #hero {
        padding: 100px 16px 60px;
    }

    .hero-logo {
        height: 48px;
    }

    .search-box {
        max-width: 100%;
    }

    .modal-content {
        padding: 24px;
    }
}