/* 省心工具 - 重设计样式 */

:root {
  --bg: #08080d;
  --bg2: #0f0f18;
  --bg3: #16161f;
  --bg-card: #1a1a26;
  --bg-card-hover: #22222f;
  --border: #2a2a3a;
  --border-hover: #3a3a50;
  --text: #e2e2ed;
  --text2: #9090a8;
  --text3: #5a5a72;
  --accent: #6c63ff;
  --accent2: #8b7fff;
  --accent-light: rgba(108, 99, 255, 0.12);
  --accent-glow: rgba(108, 99, 255, 0.25);
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --radius: 12px;
  --radius-sm: 8px;
  --header-h: 60px;
  --sidebar-w: 220px;
}

[data-theme="light"] {
  --bg: #f0f0f5;
  --bg2: #e8e8f0;
  --bg3: #dedee8;
  --bg-card: #ffffff;
  --bg-card-hover: #f6f6fb;
  --border: #d0d0e0;
  --border-hover: #b8b8cc;
  --text: #1a1a2e;
  --text2: #4a4a6a;
  --text3: #8888a0;
  --accent-light: rgba(108, 99, 255, 0.08);
  --shadow: 0 4px 24px rgba(0,0,0,0.08);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration: none; }

/* ===== Layout ===== */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: 100;
  display: flex;
  flex-direction: column;
}

.sidebar-logo {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-logo .logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.sidebar-logo span {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.sidebar-nav {
  padding: 12px 12px;
  flex: 1;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text2);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 2px;
}

.sidebar-nav-item:hover {
  background: var(--bg3);
  color: var(--text);
}

.sidebar-nav-item.active {
  background: var(--accent-light);
  color: var(--accent);
}

.sidebar-nav-item .icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-nav-item .arrow {
  margin-left: auto;
  font-size: 11px;
  opacity: 0.5;
}

.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 12px;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text3);
}

/* ===== Main Content ===== */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ===== Header ===== */
.header {
  height: var(--header-h);
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
}

.header-search {
  flex: 1;
  max-width: 560px;
  position: relative;
}

.header-search input {
  width: 100%;
  height: 38px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0 16px 0 40px;
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: all 0.2s;
}

.header-search input:focus {
  border-color: var(--accent);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.header-search .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text3);
  font-size: 14px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  background: var(--bg3);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--text2);
  transition: all 0.2s;
}

.icon-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

/* ===== Page Body ===== */
.page-body {
  flex: 1;
  padding: 24px;
}

/* ===== Hero Banner ===== */
.hero-banner {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #1a1a3a 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.hero-banner::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, var(--accent-glow), transparent 70%);
  pointer-events: none;
}

.hero-banner h1 {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #fff, var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  position: relative;
}

.hero-banner p {
  color: var(--text2);
  font-size: 14px;
  position: relative;
}

/* ===== Tabs ===== */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
  width: fit-content;
  margin-bottom: 24px;
}

.tab-btn {
  padding: 8px 20px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text2);
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  background: transparent;
}

.tab-btn:hover {
  color: var(--text);
  background: var(--bg3);
}

.tab-btn.active {
  background: var(--accent);
  color: white;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ===== Section ===== */
.section {
  margin-bottom: 40px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title .icon {
  font-size: 18px;
}

.section-more {
  font-size: 12px;
  color: var(--text3);
  cursor: pointer;
  transition: color 0.2s;
}

.section-more:hover {
  color: var(--accent);
}

/* ===== Tool Card Grid ===== */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: all 0.25s;
  position: relative;
  overflow: hidden;
}

.tool-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow), 0 0 0 1px var(--accent-light);
}

.tool-card .ext-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 10px;
  background: var(--accent-light);
  color: var(--accent);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.tool-card .icon-wrap {
  width: 48px;
  height: 48px;
  background: var(--accent-light);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  font-size: 24px;
  overflow: hidden;
}

.tool-card .icon-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tool-card h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

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

/* ===== Article List ===== */
.article-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.article-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: all 0.2s;
}

.article-card:hover {
  border-color: var(--accent);
  transform: translateX(4px);
}

.article-card .thumb {
  width: 80px;
  height: 60px;
  background: var(--accent-light);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  overflow: hidden;
}

.article-card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.article-card .info {
  flex: 1;
  min-width: 0;
}

.article-card h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.article-card p {
  font-size: 12px;
  color: var(--text2);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-card .meta {
  font-size: 11px;
  color: var(--text3);
  margin-top: 4px;
}

/* ===== Category Cards Row (horizontal scroll) ===== */
.cat-scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.cat-scroll::-webkit-scrollbar {
  height: 4px;
}

.cat-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.cat-scroll::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.cat-card {
  flex-shrink: 0;
  width: 140px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.cat-card:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.cat-card .icon {
  font-size: 28px;
  margin-bottom: 8px;
}

.cat-card h4 {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 2px;
}

.cat-card span {
  font-size: 10px;
  color: var(--text3);
}

/* ===== Info List (like ai-bot.cn news) ===== */
.info-list {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.info-item {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: background 0.15s;
}

.info-item:last-child {
  border-bottom: none;
}

.info-item:hover {
  background: var(--bg-card-hover);
}

.info-item .dot {
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  flex-shrink: 0;
}

.info-item .title {
  flex: 1;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.info-item .tag {
  font-size: 10px;
  background: var(--accent-light);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 4px;
  flex-shrink: 0;
}

.info-item .time {
  font-size: 11px;
  color: var(--text3);
  flex-shrink: 0;
}

/* ===== Tool Detail ===== */
.detail-page {
  padding: 32px 0;
}

.detail-header {
  margin-bottom: 24px;
}

.breadcrumb {
  font-size: 13px;
  color: var(--text3);
  margin-bottom: 16px;
}

.breadcrumb a {
  color: var(--accent);
}

.breadcrumb span {
  margin: 0 8px;
}

.detail-header h1 {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 12px;
}

.detail-header .meta {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: var(--text2);
}

.detail-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
}

.detail-content h2 { font-size: 18px; margin: 24px 0 12px; }
.detail-content h3 { font-size: 15px; margin: 16px 0 8px; }
.detail-content p { margin: 8px 0; line-height: 1.8; }
.detail-content ul, .detail-content ol { padding-left: 24px; margin: 8px 0; }
.detail-content li { margin: 4px 0; }
.detail-content code { background: var(--accent-light); padding: 2px 6px; border-radius: 4px; font-size: 13px; }
.detail-content table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.detail-content th, .detail-content td { border: 1px solid var(--border); padding: 8px 12px; }
.detail-content th { background: var(--accent-light); }

.detail-tool-bar {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}

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

.btn-primary:hover { background: var(--accent2); }

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

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ===== Filter Bar ===== */
.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.filter-btn {
  padding: 7px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  color: var(--text2);
  cursor: pointer;
  transition: all 0.2s;
}

.filter-btn:hover, .filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* ===== Page Header ===== */
.page-header {
  padding: 32px 0 24px;
}

.page-header h1 {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 6px;
}

.page-header p {
  color: var(--text2);
  font-size: 14px;
}

/* ===== Footer ===== */
.footer {
  border-top: 1px solid var(--border);
  padding: 32px 24px;
  text-align: center;
  color: var(--text3);
  font-size: 13px;
  margin-top: auto;
}

/* ===== Loading / Empty ===== */
.loading, .empty {
  text-align: center;
  padding: 80px;
  color: var(--text3);
  font-size: 14px;
}

/* ===== Banner Ads ===== */
.side-banners {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.side-banner {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--text3);
  cursor: pointer;
  transition: all 0.2s;
}

.side-banner:hover {
  border-color: var(--accent);
}

.side-banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  :root { --sidebar-w: 60px; }
  .sidebar-logo span, .sidebar-nav-item .arrow, .sidebar-divider, .sidebar-footer { display: none; }
  .sidebar-nav-item { justify-content: center; padding: 12px; }
  .sidebar-logo { justify-content: center; padding: 0; }
}

@media (max-width: 900px) {
  .sidebar { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .tool-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-banner { padding: 20px; }
  .hero-banner h1 { font-size: 20px; }
  .page-body { padding: 16px; }
  .header { padding: 0 16px; }
  .header-search { max-width: 100%; }
  .tabs { width: 100%; overflow-x: auto; }
  .tab-btn { padding: 7px 14px; font-size: 12px; white-space: nowrap; }
}

/* Mobile nav overlay */
.mobile-nav {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 260px;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  z-index: 200;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
}

.mobile-nav.open {
  transform: translateX(0);
}

.mobile-nav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 199;
  display: none;
}

.mobile-nav-overlay.open {
  display: block;
}

.mobile-nav-header {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.mobile-nav-list {
  flex: 1;
  padding: 12px;
  overflow-y: auto;
}

.mobile-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  color: var(--text2);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 2px;
}

.mobile-nav-item:hover {
  background: var(--bg3);
  color: var(--text);
}

.mobile-nav-item.active {
  background: var(--accent-light);
  color: var(--accent);
}

/* ===== Ext Badge ===== */
.ext-badge-inline {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  color: var(--accent);
  margin-left: 6px;
}
