/* ============================================================
   AI工具导航 - 样式表
   ============================================================ */

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

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #eef2ff;
  --text-main: #1f2937;
  --text-sub: #6b7280;
  --text-light: #9ca3af;
  --bg-page: #f5f7fa;
  --bg-card: #ffffff;
  --border: #e5e7eb;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.12);
  --radius: 12px;
  --sidebar-w: 220px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.6;
  font-size: 14px;
}

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

/* ============================================================
   顶部导航栏
   ============================================================ */
.header {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  padding: 14px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(99, 102, 241, 0.2);
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 32px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  white-space: nowrap;
}

.logo-icon { font-size: 24px; }

.search-box {
  flex: 1;
  max-width: 560px;
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: 24px;
  padding: 0 6px 0 18px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.search-icon { font-size: 16px; opacity: 0.6; }

.search-box input {
  flex: 1;
  border: none;
  outline: none;
  padding: 10px 12px;
  font-size: 14px;
  background: transparent;
}

.search-box button {
  border: none;
  background: var(--primary);
  color: #fff;
  padding: 8px 22px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s;
}

.search-box button:hover { background: var(--primary-dark); }

/* ============================================================
   主体布局
   ============================================================ */
.layout {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

/* 侧边栏 */
.sidebar {
  position: sticky;
  top: 80px;
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow-sm);
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 8px;
  color: var(--text-sub);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  cursor: pointer;
}

.sidebar-item:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.sidebar-item.active {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.sidebar-icon { font-size: 18px; }

/* 内容区 */
.content {
  flex: 1;
  min-width: 0;
}

/* 板块标题 */
.section-header {
  margin-bottom: 16px;
}

.section-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-icon { font-size: 26px; }

.section-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
}

.tool-count {
  font-size: 13px;
  color: var(--text-light);
  background: #f3f4f6;
  padding: 3px 10px;
  border-radius: 12px;
}

/* 子分类标签栏 */
.subtags-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.subtag {
  padding: 6px 14px;
  border-radius: 16px;
  font-size: 13px;
  color: var(--text-sub);
  background: #f3f4f6;
  cursor: pointer;
  transition: all 0.2s;
}

.subtag:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.subtag.active {
  background: var(--primary);
  color: #fff;
}

/* ============================================================
   工具卡片
   ============================================================ */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.tool-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.25s;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tool-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

.tool-card-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.tool-icon {
  font-size: 36px;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-light);
  border-radius: 12px;
  flex-shrink: 0;
}

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

.tool-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tool-tag {
  font-size: 11px;
  padding: 2px 8px;
  background: #f3f4f6;
  color: var(--text-sub);
  border-radius: 10px;
}

.tool-tag.cat-tag {
  background: var(--primary-light);
  color: var(--primary);
}

.tool-desc {
  font-size: 13px;
  color: var(--text-sub);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.tool-card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

.tool-link-hint {
  font-size: 12px;
  color: var(--text-light);
}

.tool-arrow {
  color: var(--primary);
  font-weight: 600;
  transition: transform 0.2s;
}

.tool-card:hover .tool-arrow {
  transform: translateX(4px);
}

/* ============================================================
   空状态
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 80px 20px;
}

.empty-icon {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.6;
}

.empty-text {
  font-size: 18px;
  color: var(--text-sub);
  margin-bottom: 6px;
}

.empty-hint {
  font-size: 14px;
  color: var(--text-light);
}

/* ============================================================
   页脚
   ============================================================ */
.footer {
  background: #1f2937;
  color: #9ca3af;
  text-align: center;
  padding: 28px 20px;
  margin-top: 40px;
}

.footer-inner p {
  font-size: 14px;
  margin-bottom: 6px;
}

.footer-hint {
  font-size: 12px;
  color: #6b7280;
}

/* ============================================================
   返回顶部
   ============================================================ */
.back-to-top {
  position: fixed;
  right: 30px;
  bottom: 30px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
  z-index: 50;
}

.back-to-top.show {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
}

/* ============================================================
   弹窗
   ============================================================ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.show { display: flex; }

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
}

.modal-content {
  position: relative;
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 480px;
  padding: 28px;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.25s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.modal-icon {
  font-size: 44px;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-light);
  border-radius: 14px;
}

.modal-title {
  flex: 1;
  font-size: 22px;
  font-weight: 700;
}

.modal-close {
  font-size: 28px;
  color: var(--text-light);
  cursor: pointer;
  border: none;
  background: none;
  line-height: 1;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  transition: all 0.2s;
}

.modal-close:hover {
  background: #f3f4f6;
  color: var(--text-main);
}

.modal-desc {
  font-size: 15px;
  color: var(--text-sub);
  line-height: 1.7;
  margin-bottom: 16px;
}

.modal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 22px;
}

.modal-tags .tool-tag {
  font-size: 12px;
  padding: 4px 12px;
}

.modal-actions {
  display: flex;
}

.btn-primary {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 13px 24px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: #fff;
  border-radius: 10px;
  font-weight: 600;
  font-size: 15px;
  transition: all 0.25s;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.35);
}

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 1024px) {
  .sidebar {
    position: static;
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }
  .sidebar-item {
    width: auto;
  }
  .layout {
    flex-direction: column;
  }
}

@media (max-width: 768px) {
  .header-inner {
    flex-direction: column;
    gap: 12px;
    padding: 0 16px;
  }
  .search-box {
    width: 100%;
    max-width: none;
  }
  .layout {
    padding: 16px;
    gap: 16px;
  }
  .tools-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
  }
}

@media (max-width: 480px) {
  .tools-grid {
    grid-template-columns: 1fr;
  }
  .section-title {
    font-size: 19px;
  }
}
