/* ========================================
   AI工具集 — ai-bot.cn Style Navigation
   ======================================== */

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

:root {
    /* Palette */
    --brand:        #4D6BFE;
    --brand-dark:   #3B5BDB;
    --brand-light:  #EEF2FF;
    --brand-50:     #F5F7FF;

    --bg:           #F5F6F8;
    --bg-sidebar:   #FAFAFB;
    --surface:      #FFFFFF;

    --ink-900: #1a1a1a;
    --ink-800: #262626;
    --ink-700: #333333;
    --ink-600: #4D4D4D;
    --ink-500: #666666;
    --ink-400: #888888;
    --ink-300: #AAAAAA;
    --ink-200: #CCCCCC;
    --ink-100: #E5E5E5;

    --line:       #EAEAEA;
    --line-light: #F0F0F0;
    --line-dim:   #F5F5F5;

    --text:           var(--ink-800);
    --text-secondary: var(--ink-500);
    --text-muted:     var(--ink-400);

    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
            "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;

    --sidebar-w: 220px;
    --topbar-h: 52px;

    --radius:    8px;
    --radius-sm: 6px;
    --radius-xs: 4px;

    --shadow-card:    0 1px 3px rgba(0,0,0,.04), 0 1px 2px rgba(0,0,0,.02);
    --shadow-hover:   0 4px 12px rgba(0,0,0,.08);
    --shadow-pop:     0 8px 30px rgba(0,0,0,.12);
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

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

a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
img { max-width: 100%; display: block; }

::selection { background: var(--brand-light); color: var(--brand); }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--ink-200); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-300); }

/* ========================================
   SIDEBAR (now full-height, with brand at top)
   ======================================== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-w);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--line);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 6px 0 20px;
    z-index: 900;
}

/* Sidebar scrollbar — slim & subtle */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--ink-100); border-radius: 2px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: var(--ink-200); }

.sidebar__group { margin-bottom: 2px; }

/* Brand block (top of sidebar) */
.sidebar__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 14px 14px;
    margin: 0 0 4px;
    border-bottom: 1px solid var(--line);
    cursor: pointer;
    transition: background .15s;
}
.sidebar__brand:hover { background: var(--brand-50); }

.sidebar__brand-mark {
    width: 32px; height: 32px;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--brand) 0%, #8b5cf6 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(77,107,254,.25);
}

.sidebar__brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
    min-width: 0;
}
.sidebar__brand-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--ink-900);
    letter-spacing: -.01em;
}
.sidebar__brand-title em {
    font-style: normal;
    color: var(--brand);
}
.sidebar__brand-sub {
    font-size: 10.5px;
    color: var(--ink-300);
    font-weight: 600;
    letter-spacing: .08em;
    margin-top: 1px;
}

.sidebar__label {
    font-size: 10px;
    font-weight: 700;
    color: var(--ink-300);
    padding: 14px 16px 4px;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.sidebar__link {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 12px;
    margin: 1px 8px;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: .02em;
    color: var(--ink-700);
    border-radius: var(--radius-sm);
    transition: all .15s ease;
    position: relative;
    cursor: pointer;
    user-select: none;
}
.sidebar__link:hover {
    color: var(--brand);
    background: var(--brand-50);
}
.sidebar__link.active {
    color: var(--brand);
    background: var(--brand-light);
    font-weight: 600;
}

/* Active left-bar indicator */
.sidebar__link.active::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 16px;
    background: var(--brand);
    border-radius: 0 2px 2px 0;
}

.sidebar__icon {
    width: 15px; height: 15px;
    flex-shrink: 0;
    opacity: .45;
    transition: all .15s;
}
.sidebar__link:hover .sidebar__icon { opacity: .7; }
.sidebar__link.active .sidebar__icon { opacity: 1; color: var(--brand); }

.sidebar__arrow {
    margin-left: auto;
    width: 10px; height: 10px;
    opacity: .3;
    transition: all .25s ease;
    flex-shrink: 0;
}
.sidebar__link:hover .sidebar__arrow { opacity: .5; }
.sidebar__link.expanded .sidebar__arrow {
    transform: rotate(180deg);
    opacity: .6;
}

.sidebar__sub {
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s ease;
}
.sidebar__sub.open { max-height: 500px; }

.sidebar__sub-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px 6px 34px;
    margin: 1px 8px;
    font-size: 13.5px;
    font-weight: 500;
    letter-spacing: .01em;
    color: var(--ink-500);
    border-radius: var(--radius-xs);
    transition: all .15s;
    cursor: pointer;
    position: relative;
}
.sidebar__sub-link::before {
    content: '';
    width: 4px; height: 4px;
    border-radius: 50%;
    background: var(--ink-200);
    flex-shrink: 0;
    transition: all .15s;
}
.sidebar__sub-link:hover {
    color: var(--brand);
    background: var(--brand-50);
}
.sidebar__sub-link:hover::before { background: var(--brand); transform: scale(1.3); }
.sidebar__sub-link.active {
    color: var(--brand);
    font-weight: 600;
}
.sidebar__sub-link.active::before { background: var(--brand); transform: scale(1.3); }

/* ========================================
   MAIN
   ======================================== */
.main {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
}

/* ========================================
   TOPBAR (horizontal nav above sidebar)
   ======================================== */
.topbar {
    position: relative;
    height: var(--topbar-h);
    background: transparent;
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    z-index: 10;
}
.topbar__menu {
    display: none;
    width: 36px; height: 36px;
    align-items: center;
    justify-content: center;
    color: var(--ink-700);
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}
.topbar__menu:hover { background: var(--brand-50); }
.topbar__nav {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
}
.topbar__link {
    padding: 6px 14px;
    font-size: 14px;
    font-weight: 500;
    color: var(--ink-700);
    border-radius: var(--radius-sm);
    transition: all .15s;
}
.topbar__link:hover { background: var(--brand-50); color: var(--brand); }
.topbar__link.active { color: var(--brand); background: var(--brand-light); font-weight: 600; }

/* ========================================
   HERO (full-width, sticks to sidebar)
   ======================================== */
.hero {
    position: relative;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 24px 28px;
    /* 混色填充（蓝紫粉），渐变消失至屏幕中部 */
    background:
        radial-gradient(ellipse 60% 50% at 20% 30%, rgba(180, 200, 255, .65) 0%, transparent 70%),
        radial-gradient(ellipse 60% 50% at 80% 30%, rgba(220, 190, 255, .55) 0%, transparent 70%),
        radial-gradient(ellipse 80% 40% at 50% 60%, rgba(255, 210, 235, .30) 0%, transparent 80%),
        linear-gradient(180deg, rgba(220, 225, 250, .30) 0%, transparent 90%);
    border-bottom: 1px solid var(--line);
    text-align: center;
    overflow: hidden;
}

/* 渐变柔和延伸至下方 section */
.hero::after {
    content: '';
    position: absolute;
    left: 0; right: 0;
    top: 100%;
    height: 80px;
    background: linear-gradient(180deg, rgba(220, 225, 250, .25) 0%, transparent 100%);
    pointer-events: none;
    z-index: 1;
}

/* small AI-BOT.CN pill */
.hero__pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    color: var(--brand);
    background: rgba(255,255,255,.85);
    border: 1px solid rgba(77,107,254,.18);
    padding: 5px 12px;
    border-radius: 999px;
    margin-bottom: 14px;
    letter-spacing: .04em;
    backdrop-filter: blur(6px);
}
.hero__pill-dot {
    width: 6px; height: 6px;
    background: var(--brand);
    border-radius: 50%;
    box-shadow: 0 0 0 3px rgba(77,107,254,.18);
}

/* big title with logo mark */
.hero__title-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 22px;
}
.hero__logo-mark {
    color: var(--brand);
    display: flex;
    align-items: center;
    filter: drop-shadow(0 4px 10px rgba(77,107,254,.30));
}
.hero__title {
    font-size: 46px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: .1em;
    color: var(--ink-900);
    margin: 0;
    display: inline-flex;
    align-items: baseline;
    gap: .14em;
}
/* "AI" 渐变两字，撑开视觉宽度 */
.hero__title-ai {
    font-style: normal;
    background: linear-gradient(115deg, var(--brand) 15%, #06b6d4 95%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    letter-spacing: .06em;
}
/* "圈"字被手绘蓝圈圈住 —— 呼应品牌名 */
.hero__title-quan {
    position: relative;
    padding: 0 .06em;
}
.hero__title-circle {
    position: absolute;
    left: 50%; top: 50%;
    width: 1.75em; height: 1.75em;
    transform: translate(-50%, -54%) rotate(-6deg);
    color: var(--brand);
    opacity: .85;
    pointer-events: none;
}
.hero__title em {
    font-style: normal;
    background: linear-gradient(90deg, var(--brand) 0%, #8b5cf6 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* 5 tabs (常用/搜索/社区/图片/生活) */
.hero__tabs {
    display: inline-flex;
    align-items: center;
    gap: 26px;
    margin-bottom: 16px;
    position: relative;
}

/* tab 下划线指示器（切换时滑动过渡） */
.hero__tab-indicator {
    position: absolute;
    bottom: -6px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--ink-900);
    border-radius: 2px;
    transition: left .25s cubic-bezier(.4,0,.2,1), width .25s cubic-bezier(.4,0,.2,1);
    z-index: 2;
}
.hero__tab {
    font-size: 14.5px;
    font-weight: 500;
    color: var(--ink-500);
    cursor: pointer;
    padding: 4px 2px;
    position: relative;
    transition: color .15s;
    text-decoration: none;
}
.hero__tab:hover { color: var(--ink-800); }
.hero__tab.active {
    color: var(--ink-900);
    font-weight: 700;
}
/* active 下划线改用 .hero__tab-indicator 滑动 */

/* search bar */
.hero__search {
    position: relative;
    width: 800px;
    max-width: 100%;
    margin: 0 auto;
    display: flex;
    align-items: center;
    background: #e8e9ed;
    border-radius: 999px;
    padding: 4px 4px 4px 20px;
    transition: all .2s;
}
.hero__search:focus-within {
    background: #fff;
    box-shadow: 0 0 0 3px rgba(77,107,254,.12), 0 4px 12px rgba(15,18,28,.04);
}
.hero__search-input {
    flex: 1;
    height: 38px;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text);
    font-size: 14px;
    font-family: var(--font);
    padding: 0;
}
.hero__search-input::placeholder { color: var(--ink-300); }
.hero__search-btn {
    width: 38px; height: 38px;
    border: none;
    background: transparent;
    border-radius: 50%;
    color: var(--ink-400);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: color .15s;
}
.hero__search-btn:hover { color: var(--brand); }

/* engine chips below search */
.hero__engines {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 12px;
}
.hero__engine {
    height: 26px;
    padding: 0 12px;
    background: transparent;
    border: none;
    color: var(--ink-400);
    font-size: 12.5px;
    font-weight: 500;
    border-radius: 999px;
    cursor: pointer;
    transition: all .15s ease;
    font-family: var(--font);
}
.hero__engine:hover { color: var(--ink-800); }
.hero__engine.active {
    color: var(--brand);
    background: rgba(77,107,254,.08);
    font-weight: 600;
}

.hero__stats {
    display: flex;
    gap: 32px;
    margin-top: 20px;
}
.hero__stat { display: flex; flex-direction: column; }
.hero__stat-num {
    font-size: 22px;
    font-weight: 700;
    color: var(--ink-900);
    line-height: 1;
}
.hero__stat-num em { color: var(--brand); font-style: normal; }
.hero__stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ========================================
   SECTIONS
   ======================================== */
.section {
    padding: 24px 20px;
    border-bottom: 1px solid var(--line-light);
    scroll-margin-top: 16px;
}

/* 第一个 section 紧贴 hero、背景透明让 hero 渐变穿透至其中部 */
.section:first-of-type {
    padding-top: 12px;
    background: transparent;
    position: relative;
    z-index: 2;
}

.section__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    gap: 16px;
}

.section__title-group {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

/* (section__num removed — clean titles) */

.section__title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -.01em;
    color: var(--ink-900);
    position: relative;
    padding-left: 10px;
}
.section__title::before {
    content: '';
    position: absolute;
    left: 0; top: 50%;
    transform: translateY(-50%);
    width: 3px; height: 16px;
    background: var(--brand);
    border-radius: 2px;
}

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

/* ========================================
   SUB-TABS
   ======================================== */
.sub-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.sub-tab {
    padding: 5px 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--ink-500);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 20px;
    transition: all .15s;
    cursor: pointer;
    white-space: nowrap;
}
.sub-tab:hover {
    color: var(--brand);
    border-color: var(--brand);
}
.sub-tab.active {
    color: #fff;
    background: var(--brand);
    border-color: var(--brand);
    font-weight: 600;
}

/* ========================================
   TOOL GRID & CARDS
   ======================================== */
.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 10px;
}

.tool-card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    transition: all .2s ease;
    overflow: hidden;
    cursor: pointer;
}

.tool-card:hover {
    border-color: var(--brand);
    box-shadow: var(--shadow-hover);
}

/* (removed __top / __footer / __arrow — new flat layout) */

.tool-card__icon {
    position: relative;
    width: 40px; height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
    transition: transform .2s ease;
    overflow: hidden;
}
/* favicon 图片：绝对定位盖住文字，加载失败 remove 后文字露出 */
.tool-card__icon-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: inherit;
    padding: 4px;
    box-sizing: border-box;
    background: rgba(255,255,255,.92);
    z-index: 1;
}
.tool-card__icon-text {
    position: relative;
    z-index: 0;
}
.tool-card:hover .tool-card__icon { transform: scale(1.05); }

.tool-card__body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.tool-card__name {
    font-size: 14px;
    font-weight: 600;
    color: var(--ink-900);
    letter-spacing: -.005em;
    line-height: 1.4;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tool-card__desc {
    font-size: 12px;
    color: var(--ink-400);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* flat layout — no footer */

.tool-card__tag {
    font-size: 10px;
    font-weight: 500;
    color: var(--ink-400);
    padding: 1px 6px;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: var(--line-dim);
}

/* flat layout — no arrow */

/* Badge */
.tool-card__badge {
    position: absolute;
    top: 0; right: 0;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
    padding: 2px 8px;
    border-radius: 0 var(--radius) 0 var(--radius-sm);
    z-index: 2;
}
.tool-card__badge.hot { background: #FF4D4F; color: white; }
.tool-card__badge.new { background: #52C41A; color: white; }

/* ========================================
   BACK-TO-TOP
   ======================================== */
.back-to-top {
    position: fixed;
    bottom: 24px; right: 24px;
    width: 40px; height: 40px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--brand);
    opacity: 0;
    transform: translateY(8px);
    transition: all .25s;
    z-index: 800;
    cursor: pointer;
    box-shadow: var(--shadow-hover);
}
.back-to-top.visible { opacity: 1; transform: translateY(0); }
.back-to-top:hover {
    background: var(--brand);
    color: #fff;
    border-color: var(--brand);
}

/* ========================================
   FOOTER
   ======================================== */
.footer {
    padding: 24px;
    border-top: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    background: var(--surface);
}
.footer__text { font-size: 12px; color: var(--text-muted); }
.footer__text em { color: var(--brand); font-style: normal; font-weight: 600; }
.footer__text kbd {
    display: inline-block;
    padding: 1px 5px;
    font-size: 10px;
    font-family: monospace;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 3px;
    color: var(--ink-500);
}

/* ========================================
   ANIMATIONS
   ======================================== */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.tool-card { animation: fadeUp .25s ease both; }
.tool-card:nth-child(1) { animation-delay: 0ms; }
.tool-card:nth-child(2) { animation-delay: 20ms; }
.tool-card:nth-child(3) { animation-delay: 40ms; }
.tool-card:nth-child(4) { animation-delay: 60ms; }
.tool-card:nth-child(5) { animation-delay: 80ms; }
.tool-card:nth-child(6) { animation-delay: 100ms; }
.tool-card:nth-child(7) { animation-delay: 120ms; }
.tool-card:nth-child(8) { animation-delay: 140ms; }

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 1024px) {
    :root { --sidebar-w: 180px; }
    .hero { padding: 28px 20px 50px; }
    .hero__title { font-size: 34px; }
    .section { padding: 20px 24px; }
}

@media (max-width: 768px) {
    :root { --sidebar-w: 0px; }
    .sidebar {
        transform: translateX(-100%);
        transition: transform .3s;
        width: 240px;
        z-index: 950;
        background: var(--surface);
    }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
    .topbar__menu { display: flex; }
    .topbar__nav { display: none; }
    .hero { padding: 24px 16px 40px; }
    .hero__title { font-size: 28px; }
    .hero__tabs { gap: 16px; }
    .hero__tab { font-size: 13.5px; }
    .hero__search { max-width: 100%; }
    .section { padding: 20px 16px; }
    .section__header { flex-direction: column; align-items: flex-start; }
    .tool-grid { grid-template-columns: 1fr; gap: 8px; }
    .footer { padding: 20px 16px; flex-direction: column; text-align: center; }
    .mobile-menu-btn { display: flex; }
}
