/* ===== CSS Variables ===== */
:root {
  --primary: #6c63ff;
  --primary-light: #8b85ff;
  --primary-dark: #5549e8;
  --accent: #ff6b6b;
  --bg: #f5f6fa;
  --bg-white: #ffffff;
  --sidebar-bg: #ffffff;
  --sidebar-width: 200px;
  --header-height: 56px;
  --text: #1a1a2e;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --border: #e5e7eb;
  --border-light: #f3f4f6;
  --shadow: 0 1px 3px rgba(0,0,0,.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,.1);
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', 'Segoe UI', sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
img { max-width: 100%; display: block; }

/* ===== Header ===== */
.header {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--header-height);
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  box-shadow: var(--shadow);
}
.header-inner {
  display: flex; align-items: center;
  height: 100%; padding: 0 16px;
  gap: 16px;
}
.header-left { display: flex; align-items: center; gap: 10px; }
.sidebar-toggle {
  display: flex; flex-direction: column; justify-content: center; gap: 5px;
  width: 32px; height: 32px; border: none; background: none; cursor: pointer; padding: 6px;
}
.sidebar-toggle span { display: block; height: 2px; background: var(--text-secondary); border-radius: 2px; transition: .2s; }
.logo { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 17px; color: var(--primary); }
.logo-icon { font-size: 20px; }
.header-nav { display: flex; gap: 4px; flex: 1; }
.nav-link {
  padding: 6px 12px; border-radius: var(--radius-sm);
  font-size: 14px; color: var(--text-secondary);
  transition: background .15s, color .15s;
}
.nav-link:hover { background: var(--bg); color: var(--primary); }

/* ===== 顶部导航下拉菜单 ===== */
.nav-dropdown {
  position: relative;
}
.nav-dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}
.dropdown-arrow {
  font-size: 10px;
  transition: transform .2s;
  opacity: 0.6;
}
.nav-dropdown:hover .dropdown-arrow {
  transform: rotate(180deg);
}
.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  min-width: 120px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.1);
  padding: 4px 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity .15s ease, transform .15s ease, visibility .15s;
  z-index: 1000;
}
.nav-dropdown:hover .nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}
.nav-dropdown-item {
  display: block;
  padding: 8px 16px;
  font-size: 14px;
  color: #444;
  text-align: center;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.nav-dropdown-item:hover {
  background: var(--bg);
  color: var(--primary);
}

.header-right { margin-left: auto; }
.admin-link {
  font-size: 13px; color: var(--text-muted); padding: 4px 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.admin-link:hover { border-color: var(--primary); color: var(--primary); }

/* ===== Layout Body ===== */
.layout-body {
  display: flex;
  padding-top: var(--header-height);
  min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
  width: var(--sidebar-width);
  min-height: calc(100vh - var(--header-height));
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  position: sticky; top: var(--header-height);
  overflow-y: auto; overflow-x: hidden;
  flex-shrink: 0;
  height: calc(100vh - var(--header-height));
  transition: width .25s ease;
}
.sidebar-inner { padding: 12px 0; }
.cat-list {}
.cat-item {}
.cat-link {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 16px; font-size: 13.5px; color: var(--text-secondary);
  border-radius: 0;
  transition: background .12s, color .12s;
  cursor: pointer;
  white-space: nowrap; overflow: hidden;
}
.cat-link:hover { background: var(--bg); color: var(--primary); }
.cat-link.active { background: #ece9ff; color: var(--primary); font-weight: 600; }
.cat-icon { font-size: 15px; min-width: 20px; text-align: center; }
.cat-name { overflow: hidden; text-overflow: ellipsis; }

/* ===== Main Content ===== */
.main-content {
  flex: 1;
  padding: 24px 28px;
  min-width: 0;
  max-width: calc(100vw - var(--sidebar-width));
}

/* ===== Hero Search ===== */
.hero {
  text-align: center;
  padding: 36px 20px 28px;
  background: linear-gradient(135deg, #f0eeff 0%, #fff5f5 50%, #f0f9ff 100%);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
}
.hero-sub { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; letter-spacing: .5px; }
.hero-title {
  font-size: 32px; font-weight: 800; color: var(--primary);
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin-bottom: 16px;
}
.hero-icon { font-size: 28px; }
.search-tabs { display: flex; justify-content: center; gap: 4px; margin-bottom: 14px; }
.tab-btn {
  padding: 5px 18px; border-radius: 20px; font-size: 14px;
  border: none; background: transparent; cursor: pointer; color: var(--text-secondary);
  transition: .15s;
}
.tab-btn.active { background: var(--primary); color: #fff; }
.search-box {
  display: flex; align-items: center; max-width: 560px; margin: 0 auto;
  background: var(--bg-white); border-radius: 28px;
  box-shadow: 0 2px 16px rgba(108,99,255,.12);
  border: 2px solid transparent;
  transition: border .2s;
  position: relative;
}
.search-box:focus-within { border-color: var(--primary); }
.search-input {
  flex: 1; border: none; outline: none; padding: 13px 20px;
  font-size: 15px; background: transparent; border-radius: 28px;
}
.search-btn {
  width: 44px; height: 44px; border-radius: 50%; margin-right: 4px;
  background: var(--primary); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; color: #fff;
  flex-shrink: 0; transition: background .15s;
}
.search-btn:hover { background: var(--primary-dark); }
.search-engines { margin-top: 12px; font-size: 13px; color: var(--text-muted); display: flex; justify-content: center; gap: 16px; }
.engine-link { color: var(--text-secondary); }
.engine-link:hover { color: var(--primary); }

/* ===== Search Dropdown ===== */
.search-results-dropdown {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 200;
  background: var(--bg-white); border-radius: var(--radius);
  box-shadow: var(--shadow-md); margin-top: 8px; max-height: 400px; overflow-y: auto;
  display: none;
}
.search-results-dropdown.show { display: block; }
.search-result-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; cursor: pointer;
  transition: background .12s;
}
.search-result-item:hover { background: var(--bg); }
.search-box { position: relative; }

/* ===== Section ===== */
.tools-section, .news-section, .friend-links-section, .banner-section {
  margin-bottom: 28px;
}
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.section-title {
  font-size: 17px; font-weight: 700; color: var(--text);
  display: flex; align-items: center; gap: 6px;
}
.section-icon { font-size: 18px; }
.more-link { font-size: 13px; color: var(--primary); }
.more-link:hover { text-decoration: underline; }

/* ===== Tools Grid ===== */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.tools-grid-large {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.tool-card {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--bg-white); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow);
  transition: box-shadow .2s, transform .2s;
  border: 1px solid transparent; position: relative;
  cursor: pointer;
}
.tool-card:hover {
  box-shadow: var(--shadow-md); transform: translateY(-2px);
  border-color: var(--primary);
}
.tool-card-large { padding: 16px; }
.tool-logo { flex-shrink: 0; }
.tool-emoji { font-size: 28px; display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; }
.tool-emoji-lg { font-size: 36px; width: 52px; height: 52px; }
.tool-logo img { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; }
.tool-info { flex: 1; min-width: 0; }
.tool-name { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.tool-desc { font-size: 12px; color: var(--text-secondary); line-height: 1.5; word-break: break-all; }
.tool-tags { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.tool-category { font-size: 11px; color: var(--primary); margin-top: 4px; }

/* ===== Badges ===== */
.badge {
  position: absolute; top: 8px; right: 8px;
  font-size: 11px; padding: 2px 6px; border-radius: 4px; font-weight: 600;
}
.badge.hot { background: #fff0f0; color: #ef4444; }
.badge.new { background: #f0fff4; color: #10b981; }

/* ===== Banner Section ===== */
.banner-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.banner-item { border-radius: var(--radius); overflow: hidden; }
.ad-section { margin-bottom: 20px; }
.ad-placeholder { border-radius: var(--radius); }

/* ===== News Grid ===== */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.news-card {
  background: var(--bg-white); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow);
  transition: box-shadow .2s, transform .2s;
  display: flex; flex-direction: column;
}
.news-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.news-cover img { width: 100%; height: 140px; object-fit: cover; }
.news-info { padding: 12px; flex: 1; }
.news-category { font-size: 11px; color: var(--primary); font-weight: 600; margin-bottom: 4px; }
.news-title { font-size: 14px; font-weight: 600; line-height: 1.5; margin-bottom: 6px; }
.news-meta { font-size: 12px; color: var(--text-muted); display: flex; gap: 10px; }

/* ===== Friend Links ===== */
.friend-links { display: flex; flex-wrap: wrap; gap: 10px; }
.friend-link {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 14px; background: var(--bg-white);
  border-radius: 20px; font-size: 13px; box-shadow: var(--shadow);
  border: 1px solid var(--border); transition: .15s;
}
.friend-link:hover { border-color: var(--primary); color: var(--primary); }
.friend-logo { width: 16px; height: 16px; border-radius: 3px; }

/* ===== Page Header ===== */
.page-header { margin-bottom: 24px; }
.breadcrumb { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; display: flex; align-items: center; gap: 4px; }
.breadcrumb a:hover { color: var(--primary); }
.page-title { font-size: 22px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.page-title .count { font-size: 14px; font-weight: 400; color: var(--text-muted); }
.page-desc { font-size: 14px; color: var(--text-secondary); margin-top: 6px; }

/* ===== Pagination ===== */
.pagination { display: flex; justify-content: center; gap: 6px; margin-top: 28px; }
.page-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 8px;
  font-size: 14px; background: var(--bg-white); border: 1px solid var(--border);
  color: var(--text-secondary); transition: .15s;
  padding: 0 12px; width: auto; min-width: 36px;
}
.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ===== News List ===== */
.news-list { display: flex; flex-direction: column; gap: 14px; }
.news-list-item {
  display: flex; gap: 16px; background: var(--bg-white);
  border-radius: var(--radius); padding: 16px;
  box-shadow: var(--shadow); transition: .2s;
}
.news-list-item:hover { box-shadow: var(--shadow-md); }
.news-list-cover img { width: 120px; height: 80px; object-fit: cover; border-radius: 6px; }
.news-list-info { flex: 1; }
.news-meta-row { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.news-cat-tag { font-size: 11px; background: #ece9ff; color: var(--primary); padding: 2px 8px; border-radius: 4px; font-weight: 600; }
.news-date, .news-author { font-size: 12px; color: var(--text-muted); }
.news-list-title { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.news-list-summary { font-size: 13px; color: var(--text-secondary); line-height: 1.6; }

/* ===== News Detail ===== */
.news-detail-layout { display: grid; grid-template-columns: 1fr 280px; gap: 24px; }
.news-detail { background: var(--bg-white); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }
.news-detail-header { margin-bottom: 20px; }
.news-detail-title { font-size: 24px; font-weight: 700; line-height: 1.4; margin: 10px 0; }
.news-detail-meta { font-size: 13px; color: var(--text-muted); display: flex; gap: 16px; }
.news-detail-cover img { width: 100%; max-height: 400px; object-fit: cover; border-radius: var(--radius); margin-bottom: 20px; }
.rich-content { font-size: 15px; line-height: 1.8; color: var(--text); }
.rich-content h2 { font-size: 20px; font-weight: 700; margin: 20px 0 10px; }
.rich-content h3 { font-size: 17px; font-weight: 600; margin: 16px 0 8px; }
.rich-content p { margin-bottom: 14px; }
.rich-content img { max-width: 100%; border-radius: 8px; margin: 12px 0; }
.rich-content a { color: var(--primary); text-decoration: underline; }
.rich-content ul, .rich-content ol { padding-left: 20px; margin-bottom: 14px; }
.news-sidebar .related-news { background: var(--bg-white); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.related-news h3 { font-size: 15px; font-weight: 700; margin-bottom: 12px; }
.related-item { display: block; padding: 8px 0; border-bottom: 1px solid var(--border-light); }
.related-item:last-child { border-bottom: none; }
.related-title { font-size: 13px; color: var(--text); line-height: 1.4; }
.related-date { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.related-item:hover .related-title { color: var(--primary); }

/* ===== Apply ===== */
.apply-container { display: grid; grid-template-columns: 1fr 280px; gap: 24px; }
.apply-card { background: var(--bg-white); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }
.apply-info { background: var(--bg-white); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); height: fit-content; }
.apply-info h3 { font-size: 15px; font-weight: 700; margin-bottom: 12px; }
.apply-info li { font-size: 13px; color: var(--text-secondary); padding: 5px 0; line-height: 1.5; }

/* ===== Search Page ===== */
.search-hero { max-width: 600px; margin: 0 auto 32px; }
.search-box-large { max-width: 100%; }
.search-results-section {}

/* ===== Form ===== */
.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 6px; }
.form-control {
  width: 100%; padding: 9px 13px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; outline: none;
  transition: border .2s; background: var(--bg-white);
}
.form-control:focus { border-color: var(--primary); }
textarea.form-control { resize: vertical; }
.required { color: var(--accent); }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 9px 20px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500; cursor: pointer;
  border: 1px solid transparent; transition: .15s; gap: 5px;
}
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--bg); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }
.btn-block { width: 100%; }

/* ===== Alert ===== */
.alert {
  padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px;
  font-size: 14px;
}
.alert-success { background: #f0fff4; color: #065f46; border: 1px solid #bbf7d0; }
.alert-error { background: #fff5f5; color: #991b1b; border: 1px solid #fecaca; }

/* ===== Footer ===== */
.footer { background: var(--bg-white); border-top: 1px solid var(--border); padding: 24px 28px; margin-top: auto; }
.footer-inner { max-width: 1400px; margin: 0 auto; }
.footer-links { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.footer-links a { font-size: 12px; color: var(--text-muted); padding: 2px 6px; }
.footer-links a:hover { color: var(--primary); }
.footer-text { font-size: 13px; color: var(--text-muted); }
.icp { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ===== Empty State ===== */
.empty-state { text-align: center; padding: 48px 0; color: var(--text-muted); font-size: 14px; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  :root { --sidebar-width: 0px; }
  .sidebar { transform: translateX(-200px); position: fixed; z-index: 90; width: 200px; }
  .sidebar.open { transform: translateX(0); }
  .main-content { padding: 16px; max-width: 100vw; }
  .tools-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .hero-title { font-size: 24px; }
  .apply-container, .news-detail-layout { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .header-nav { display: none; }
}
@media (max-width: 480px) {
  .tools-grid { grid-template-columns: 1fr 1fr; }
  .news-grid { grid-template-columns: 1fr; }
}
