/* ============================================================
   AIBean.top — single-page layout with left sidebar (external CSS)
   Light + dark via [data-theme] on <html>. No inline styles.
   ============================================================ */

:root {
  --bg: #f6f7fb; --surface: #ffffff; --surface-2: #eef1f8;
  --text: #0f172a; --text-muted: #5b6478; --border: #e5e8f0;
  --brand: #4f46e5; --brand-2: #7c3aed; --accent: #06b6d4;
  --success: #10b981; --warn: #f59e0b;
  --shadow-sm: 0 2px 8px rgba(15,23,42,.06); --shadow: 0 12px 32px rgba(15,23,42,.08);
  --shadow-lg: 0 24px 60px rgba(49,46,129,.18); --ring: rgba(79,70,229,.35);
  --gradient: linear-gradient(135deg, var(--brand), var(--brand-2));
  --sidebar-w: 264px; --topbar-h: 58px;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0b1020; --surface: #141b30; --surface-2: #1d2743;
  --text: #e9edf7; --text-muted: #9aa6c2; --border: #26314f;
  --brand: #8b8cff; --brand-2: #b18cff; --accent: #22d3ee;
  --shadow-sm: 0 2px 8px rgba(0,0,0,.35); --shadow: 0 14px 36px rgba(0,0,0,.45);
  --shadow-lg: 0 26px 64px rgba(0,0,0,.55); --ring: rgba(139,140,255,.45);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-size: 16px; line-height: 1.65;
  font-family: -apple-system, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  transition: background .25s ease, color .25s ease; -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
h1,h2,h3,p { margin: 0; }
button { font-family: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; border-radius: 8px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 12px; top: -48px; z-index: 200; background: var(--brand); color: #fff; padding: 10px 16px; border-radius: 10px; transition: top .2s; }
.skip-link:focus { top: 12px; }

/* ---------- Layout (centered block: sidebar + content) ---------- */
.layout { display: flex; align-items: flex-start; max-width: 1680px; margin: 0 auto; }
.content { flex: 1 1 auto; min-width: 0; }
main { display: block; max-width: 1680px; margin: 0; padding: 0 40px 40px; }

/* ---------- Sidebar (sticky: follows scroll, pins to top) ---------- */
.sidebar {
  position: sticky; top: 0; flex: 0 0 var(--sidebar-w); width: var(--sidebar-w); height: 100dvh; z-index: 60;
  background: var(--surface); border-right: 1px solid var(--border);
  padding: 18px 14px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto;
}
.sidebar__brand { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px; }
.sidebar__close { display: none; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem; letter-spacing: -.01em; }
.brand__mark { width: 34px; height: 34px; border-radius: 10px; background: var(--gradient); display: grid; place-items: center; color: #fff; box-shadow: var(--shadow-sm); }
.brand__mark svg { width: 20px; height: 20px; }
.brand__name span { background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }

.search { position: relative; display: flex; align-items: center; }
.search svg { position: absolute; left: 13px; width: 18px; height: 18px; color: var(--text-muted); pointer-events: none; }
.search input { width: 100%; height: 42px; padding: 0 14px 0 40px; border-radius: 11px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-size: .95rem; transition: border-color .15s, box-shadow .15s, background .15s; }
.search input::placeholder { color: var(--text-muted); }
.search input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--ring); background: var(--surface); }

.sidenav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidenav__label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted); padding: 14px 10px 6px; }
.sidenav__link {
  display: flex; align-items: center; gap: 11px; padding: 10px 11px; border-radius: 10px;
  color: var(--text-muted); font-weight: 600; font-size: .93rem; position: relative;
  transition: color .15s, background .15s;
}
.sidenav__link svg { width: 18px; height: 18px; flex: none; }
.sidenav__link span { flex: 1; }
.sidenav__link:hover { color: var(--text); background: var(--surface-2); }
.sidenav__link.is-active { color: #fff; background: var(--gradient); }

.sidebar__foot { display: flex; flex-direction: column; gap: 10px; padding-top: 12px; border-top: 1px solid var(--border); }

.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 11px; transition: transform .15s, background .15s, border-color .15s; }
.icon-btn:hover { transform: translateY(-1px); background: var(--surface-2); border-color: var(--brand); }
.icon-btn svg { width: 20px; height: 20px; }
.theme-toggle .moon { display: none; }
[data-theme="dark"] .theme-toggle .sun { display: none; }
[data-theme="dark"] .theme-toggle .moon { display: block; }

.sidebar-backdrop { display: none; }

/* ---------- Topbar (mobile only) ---------- */
.topbar { display: none; position: sticky; top: 0; z-index: 50; height: var(--topbar-h); align-items: center; gap: 12px; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar .brand { flex: 1; }

/* ---------- Hero ---------- */
.hero { position: relative; text-align: center; padding: 64px 0 30px; overflow: hidden; }
.hero__glow { position: absolute; inset: -30% 0 auto 0; height: 120%; z-index: -1; background: radial-gradient(55% 55% at 50% 0%, rgba(79,70,229,.24), transparent 70%), radial-gradient(40% 40% at 80% 20%, rgba(6,182,212,.18), transparent 70%); }
[data-theme="dark"] .hero__glow { background: radial-gradient(55% 55% at 50% 0%, rgba(139,140,255,.28), transparent 70%), radial-gradient(40% 40% at 80% 20%, rgba(34,211,238,.18), transparent 70%); }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: .8rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--brand); background: var(--surface); border: 1px solid var(--border); padding: 6px 14px; border-radius: 999px; box-shadow: var(--shadow-sm); }
.eyebrow svg { width: 15px; height: 15px; }
.hero h1 { font-size: clamp(1.9rem, 4.4vw, 3rem); font-weight: 850; letter-spacing: -.02em; line-height: 1.1; margin: 20px 0 12px; }
.hero h1 .grad { background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { max-width: 640px; margin: 0 auto; color: var(--text-muted); font-size: 1.05rem; }
.hero__stats { display: flex; gap: 28px; justify-content: center; margin-top: 18px; color: var(--text-muted); font-size: .92rem; }
.hero__stats b { color: var(--text); font-weight: 800; }

/* ---------- Sections ---------- */
.section { padding: 40px 0; scroll-margin-top: 24px; }
.section__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.section__title-wrap { display: flex; align-items: center; gap: 14px; }
.section__icon { width: 44px; height: 44px; border-radius: 13px; background: var(--gradient); color: #fff; display: grid; place-items: center; flex: none; box-shadow: var(--shadow-sm); }
.section__icon svg { width: 23px; height: 23px; }
.section__icon--star { background: linear-gradient(135deg, #f59e0b, #f43f5e); }
.section__title { font-size: 1.55rem; font-weight: 800; letter-spacing: -.01em; }
.section__sub { color: var(--text-muted); margin-top: 3px; font-size: .95rem; }

/* ---------- Tool grid / cards ---------- */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.card { position: relative; display: flex; flex-direction: column; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 18px; box-shadow: var(--shadow-sm); transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--brand) 40%, var(--border)); }
.card.is-hidden { display: none; }
.card__top { display: flex; align-items: center; gap: 12px; }
.card__logo { width: 44px; height: 44px; border-radius: 12px; flex: none; overflow: hidden; display: grid; place-items: center; font-weight: 800; color: #fff; font-size: 1.1rem; background: var(--gradient); }
.card__title { font-size: 1.03rem; font-weight: 700; line-height: 1.3; }
.card__cat { font-size: .78rem; color: var(--text-muted); }
.card__desc { color: var(--text-muted); font-size: .9rem; flex: 1; }
.card__tags { display: flex; flex-wrap: wrap; gap: 7px; }
.tag { font-size: .74rem; font-weight: 600; color: var(--text-muted); background: var(--surface-2); padding: 3px 10px; border-radius: 8px; }
.card__foot { display: flex; align-items: center; justify-content: space-between; margin-top: 2px; }
.price { font-size: .76rem; font-weight: 700; padding: 4px 11px; border-radius: 999px; }
.price--free { color: var(--success); background: color-mix(in srgb, var(--success) 15%, transparent); }
.price--trial { color: var(--accent); background: color-mix(in srgb, var(--accent) 15%, transparent); }
.price--freemium { color: var(--brand); background: color-mix(in srgb, var(--brand) 14%, transparent); }
.price--paid { color: var(--warn); background: color-mix(in srgb, var(--warn) 16%, transparent); }
.card__cta { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--brand); font-size: .9rem; }
.card__cta svg { width: 15px; height: 15px; transition: transform .15s; }
.card:hover .card__cta svg { transform: translateX(3px); }

/* ---------- Empty state ---------- */
.no-result { text-align: center; color: var(--text-muted); padding: 40px 0; display: none; }
.no-result.show { display: block; }
.section.is-hidden, .hero.is-hidden { display: none; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); }
.footer-bottom { max-width: 1680px; margin: 0 auto; padding: 22px 40px; display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; text-align: center; color: var(--text-muted); font-size: .85rem; }
.footer-bottom a { color: var(--brand); }

/* ---------- Buttons / misc (used by 404 & small pages) ---------- */
.center-actions { margin-top: 22px; display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; padding: 11px 20px; border-radius: 12px; border: 1px solid transparent; transition: transform .15s, box-shadow .15s, background .15s; }
.btn--primary { background: var(--gradient); color: #fff; box-shadow: var(--shadow-sm); }
.btn--primary:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.btn--ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn--ghost:hover { border-color: var(--brand); }

/* ---------- Responsive ---------- */
@media (max-width: 520px)  { .tool-grid { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .topbar { display: flex; }
  .content { margin-left: 0; }
  main { padding: 0 18px 32px; }
  .footer-bottom { padding: 18px; }
  .sidebar { position: fixed; top: 0; left: 0; transform: translateX(-100%); transition: transform .25s ease; width: 288px; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .sidebar__close { display: grid; }
  .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(2,6,23,.5); opacity: 0; visibility: hidden; transition: opacity .2s; z-index: 55; }
  .sidebar-backdrop.show { opacity: 1; visibility: visible; }
  .section { scroll-margin-top: calc(var(--topbar-h) + 12px); }
  .hero { padding: 36px 0 20px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
