/* ===================================================
   ToolsHub - Main Stylesheet
   =================================================== */

:root {
  --bg: #f7f8fb;
  --surface: #ffffff;
  --surface-alt: #f0f2f7;
  --text: #1a1d27;
  --text-muted: #5b6172;
  --border: #e3e6ed;
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-light: #eef0ff;
  --accent: #06b6d4;
  --success: #16a34a;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(20, 20, 40, 0.06);
  --shadow-lg: 0 8px 30px rgba(20, 20, 40, 0.10);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

[data-theme="dark"] {
  --bg: #11131a;
  --surface: #181b25;
  --surface-alt: #1f2330;
  --text: #eef0f5;
  --text-muted: #9aa0b4;
  --border: #2a2f3d;
  --primary: #6366f1;
  --primary-dark: #818cf8;
  --primary-light: #232846;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background .2s ease, color .2s ease;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
.container { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

/* ---------- Announcement bar ---------- */
.announcement-bar {
  background: var(--primary);
  color: #fff;
  text-align: center;
  padding: 10px 40px;
  font-size: 14px;
  position: relative;
}
.announcement-close {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: #fff; font-size: 18px; cursor: pointer;
}

/* ---------- Header ---------- */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50; }
.header-inner { display: flex; align-items: center; gap: 20px; padding: 14px 20px; }
.logo-text { font-size: 22px; font-weight: 800; color: var(--primary); }
.header-search { flex: 1; max-width: 420px; display: flex; }
.header-search input {
  flex: 1; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius) 0 0 var(--radius);
  background: var(--surface-alt); color: var(--text); font-size: 14px;
}
.header-search button {
  border: 1px solid var(--border); border-left: none; background: var(--surface-alt);
  border-radius: 0 var(--radius) var(--radius) 0; padding: 0 14px; cursor: pointer;
}
.main-nav { display: flex; gap: 22px; margin-left: auto; }
.main-nav a { color: var(--text); font-weight: 600; font-size: 14px; }
.theme-toggle, .mobile-menu-toggle {
  background: var(--surface-alt); border: 1px solid var(--border); border-radius: 8px;
  width: 38px; height: 38px; cursor: pointer; font-size: 16px;
}
.mobile-menu-toggle { display: none; }
.mobile-nav { display: none; flex-direction: column; padding: 10px 20px; background: var(--surface); border-top: 1px solid var(--border); }
.mobile-nav a { padding: 10px 0; color: var(--text); font-weight: 600; border-bottom: 1px solid var(--border); }

@media (max-width: 860px) {
  .main-nav { display: none; }
  .mobile-menu-toggle { display: block; }
  .header-search { order: 3; flex-basis: 100%; max-width: none; margin-top: 10px; }
  .header-inner { flex-wrap: wrap; }
  .mobile-nav.open { display: flex; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block; padding: 11px 22px; border-radius: var(--radius); font-weight: 600;
  border: none; cursor: pointer; font-size: 14px; transition: transform .15s ease, box-shadow .15s ease;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); text-decoration: none; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }

/* ---------- Hero ---------- */
.hero { padding: 60px 0 40px; text-align: center; }
.hero h1 { font-size: 38px; font-weight: 800; margin-bottom: 12px; }
.hero p { color: var(--text-muted); font-size: 17px; max-width: 600px; margin: 0 auto 28px; }

/* ---------- Section ---------- */
.section { padding: 40px 0; }
.section-header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 22px; }
.section-header h2 { font-size: 24px; font-weight: 700; margin: 0; }
.section-header a { font-size: 14px; font-weight: 600; }

/* ---------- Tool / Post Grid ---------- */
.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); transition: transform .15s ease, box-shadow .15s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.tool-card .tool-icon { font-size: 30px; margin-bottom: 12px; }
.tool-card h3 { margin: 0 0 6px; font-size: 16px; }
.tool-card p { margin: 0; font-size: 13px; color: var(--text-muted); }
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 20px; background: var(--primary-light); color: var(--primary); margin-left: 6px; }

.post-card img { border-radius: var(--radius) var(--radius) 0 0; height: 160px; object-fit: cover; }
.post-card { padding: 0; overflow: hidden; }
.post-card .post-body { padding: 16px; }
.post-card h3 { font-size: 16px; margin: 0 0 8px; }
.post-card .post-meta { font-size: 12px; color: var(--text-muted); }

/* ---------- Category chips ---------- */
.category-chips { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 26px; }
.category-chips a {
  padding: 8px 16px; border-radius: 20px; background: var(--surface-alt); border: 1px solid var(--border);
  color: var(--text); font-size: 13px; font-weight: 600;
}
.category-chips a.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- Breadcrumbs ---------- */
.breadcrumbs { font-size: 13px; color: var(--text-muted); margin: 18px 0; }
.breadcrumbs ol { list-style: none; display: flex; gap: 6px; padding: 0; margin: 0; flex-wrap: wrap; }
.breadcrumbs li:not(:last-child)::after { content: '/'; margin-left: 6px; color: var(--text-muted); }

/* ---------- Tool detail page ---------- */
.tool-detail { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 30px; box-shadow: var(--shadow); }
.tool-detail h1 { margin-top: 0; }
.tool-app { background: var(--surface-alt); border-radius: var(--radius); padding: 24px; margin: 20px 0; }
.tool-app label { display: block; font-weight: 600; font-size: 13px; margin: 12px 0 6px; }
.tool-app input, .tool-app select, .tool-app textarea {
  width: 100%; padding: 11px 14px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 14px;
}
.tool-result {
  margin-top: 18px; padding: 18px; border-radius: 8px; background: var(--primary-light); color: var(--text);
  font-weight: 600; display: none;
}
.tool-result.show { display: block; }
.related-tools { margin-top: 30px; }

/* ---------- Forms ---------- */
.form-page { max-width: 640px; margin: 30px auto; }
.form-group { margin-bottom: 18px; }
.form-group label { font-weight: 600; font-size: 14px; display: block; margin-bottom: 6px; }
.form-group input, .form-group textarea, .form-group select {
  width: 100%; padding: 12px 14px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 14px;
}

/* ---------- Footer ---------- */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); margin-top: 50px; }
.footer-inner { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; padding: 40px 20px; }
.footer-col h4 { margin-top: 0; }
.footer-col a { display: block; color: var(--text-muted); margin-bottom: 8px; font-size: 14px; }
.newsletter-col form { display: flex; gap: 8px; margin-top: 8px; }
.newsletter-col input { flex: 1; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-alt); color: var(--text); }
.footer-bottom { text-align: center; padding: 16px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-muted); }
@media (max-width: 760px) { .footer-inner { grid-template-columns: repeat(2, 1fr); } }

/* ---------- Ads ---------- */
.ad-slot { text-align: center; margin: 16px 0; overflow: hidden; }
.ad-sticky { position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; background: var(--surface); border-top: 1px solid var(--border); }

/* ---------- 404 ---------- */
.error-page { text-align: center; padding: 80px 0; }
.error-page h1 { font-size: 90px; margin: 0; color: var(--primary); }

/* ---------- Pagination ---------- */
.pagination { display: flex; gap: 8px; justify-content: center; margin: 30px 0; }
.pagination a, .pagination span {
  padding: 8px 14px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; color: var(--text);
}
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }
