/* AI学院 - 公共样式 */
:root {
  --primary: #1a73e8;
  --primary-dark: #1557b0;
  --primary-light: #e8f0fe;
  --accent: #ff6b00;
  --accent-hover: #e55f00;
  --text: #333333;
  --text-secondary: #666666;
  --text-muted: #999999;
  --border: #e8e8e8;
  --bg: #ffffff;
  --bg-section: #f5f7fa;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  --shadow-hover: 0 4px 20px rgba(26, 115, 232, 0.15);
  --radius: 8px;
  --radius-lg: 12px;
  --container: 1200px;
  --header-height: 70px;
  --transition: all 0.3s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-width: 1200px;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--primary-dark);
}

img {
  max-width: 100%;
  vertical-align: middle;
}

ul, ol {
  list-style: none;
}

.container {
  width: var(--container);
  max-width: 100%;
  margin: 0 auto;
  padding: 0 20px;
}

/* ========== Header ========== */
.site-header {
  background: var(--bg);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.header-top {
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  height: var(--header-height);
  gap: 30px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.logo-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--primary), #4a9af5);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 20px;
  font-weight: bold;
}

.logo-text h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.2;
}

.logo-text span {
  font-size: 12px;
  color: var(--text-muted);
}

.main-nav {
  display: flex;
  gap: 4px;
  flex: 1;
}

.main-nav a {
  padding: 8px 14px;
  color: var(--text);
  font-size: 15px;
  border-radius: 6px;
  white-space: nowrap;
}

.main-nav a:hover,
.main-nav a.active {
  color: var(--primary);
  background: var(--primary-light);
}

.header-search {
  display: flex;
  align-items: center;
  background: var(--bg-section);
  border-radius: 20px;
  padding: 0 4px 0 16px;
  width: 220px;
  flex-shrink: 0;
}

.header-search input {
  border: none;
  background: transparent;
  outline: none;
  flex: 1;
  font-size: 13px;
  height: 36px;
}

.header-search button {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
}

.header-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
  align-items: center;
}

.header-user {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-section);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 3px 4px 3px 3px;
  transition: var(--transition);
}

.header-user:hover,
.header-user.open {
  border-color: var(--primary-light);
  box-shadow: 0 2px 8px rgba(26, 115, 232, 0.12);
}

.header-user-main {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border-radius: 20px;
  color: var(--text);
  text-decoration: none;
  transition: var(--transition);
}

.header-user-main:hover {
  color: var(--primary);
  background: rgba(26, 115, 232, 0.06);
}

.header-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, #4285f4 100%);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.header-user-name {
  max-width: 100px;
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-user-toggle {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 50%;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.header-user-toggle:hover,
.header-user.open .header-user-toggle {
  background: var(--primary-light);
  color: var(--primary);
}

.header-user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 168px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  padding: 6px 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: var(--transition);
  z-index: 1100;
}

.header-user.open .header-user-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.header-user-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 14px;
  color: var(--text);
  text-decoration: none;
  transition: var(--transition);
}

.header-user-item:hover {
  background: var(--bg-section);
  color: var(--primary);
}

.header-user-item .item-icon {
  width: 18px;
  text-align: center;
  font-size: 14px;
  opacity: 0.85;
}

.header-user-item.logout:hover {
  color: #c62828;
  background: #ffebee;
}

.header-user-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 20px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  gap: 6px;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-dark);
  color: #fff;
}

.btn-accent {
  background: var(--accent);
  color: #fff;
}

.btn-accent:hover {
  background: var(--accent-hover);
  color: #fff;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--primary);
  color: var(--primary);
}

.btn-outline:hover {
  background: var(--primary-light);
}

.btn-sm {
  padding: 5px 12px;
  font-size: 13px;
}

/* ========== Footer ========== */
.site-footer {
  background: #2c3e50;
  color: #bdc3c7;
  margin-top: 60px;
}

.footer-main {
  padding: 50px 0 30px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
}

.footer-brand .logo-text h1 {
  color: #fff;
}

.footer-brand p {
  margin-top: 12px;
  font-size: 13px;
  line-height: 1.8;
}

.footer-col h4 {
  color: #fff;
  font-size: 16px;
  margin-bottom: 16px;
}

.footer-col a {
  display: block;
  color: #bdc3c7;
  font-size: 13px;
  padding: 4px 0;
}

.footer-col a:hover {
  color: #fff;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  padding: 20px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-links a {
  color: #95a5a6;
  font-size: 13px;
}

.footer-links a:hover {
  color: #fff;
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 20px 0;
  text-align: center;
  font-size: 13px;
}

/* ========== Breadcrumb ========== */
.breadcrumb {
  padding: 16px 0;
  font-size: 13px;
  color: var(--text-muted);
}

.breadcrumb a {
  color: var(--text-secondary);
}

.breadcrumb span {
  margin: 0 8px;
}

/* ========== Page Layout ========== */
.page-header {
  background: linear-gradient(135deg, var(--primary) 0%, #4a9af5 100%);
  color: #fff;
  padding: 40px 0;
  margin-bottom: 30px;
}

.page-header h2 {
  font-size: 28px;
  margin-bottom: 8px;
}

.page-header p {
  font-size: 15px;
  opacity: 0.9;
}

.page-body {
  padding-bottom: 40px;
}

.layout-with-sidebar {
  display: flex;
  gap: 24px;
}

.sidebar {
  width: 240px;
  flex-shrink: 0;
}

.sidebar-box {
  background: var(--bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 20px;
}

.sidebar-title {
  padding: 14px 16px;
  background: var(--primary);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
}

.sidebar-list a {
  display: block;
  padding: 12px 16px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.sidebar-list a:hover,
.sidebar-list a.active {
  color: var(--primary);
  background: var(--primary-light);
}

.sidebar-list a .count {
  float: right;
  color: var(--text-muted);
  font-size: 12px;
}

.main-content {
  flex: 1;
  min-width: 0;
}

/* ========== Cards ========== */
.card {
  background: var(--bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.card-grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.card-grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

/* ========== Tags ========== */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
}

.tag-free {
  background: #e8f5e9;
  color: #2e7d32;
}

.tag-paid {
  background: #fff3e0;
  color: #e65100;
}

.tag-hot {
  background: #fce4ec;
  color: #c62828;
}

.tag-top {
  background: var(--accent);
  color: #fff;
}

.tag-essence {
  background: #fff8e1;
  color: #f57f17;
}

.tag-level-1 { background: #e8f5e9; color: #2e7d32; }
.tag-level-2 { background: #e3f2fd; color: #1565c0; }
.tag-level-3 { background: #fce4ec; color: #c62828; }

.tag-open { background: #e8f5e9; color: #2e7d32; }
.tag-closed { background: #f5f5f5; color: #757575; }

/* ========== Section ========== */
.section {
  margin-bottom: 40px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.section-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  position: relative;
  padding-left: 14px;
}

.section-title::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 22px;
  background: var(--primary);
  border-radius: 2px;
}

.section-more {
  font-size: 14px;
  color: var(--text-muted);
}

.section-more:hover {
  color: var(--primary);
}

/* ========== Tabs ========== */
.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.tab-item {
  padding: 8px 20px;
  border-radius: 20px;
  background: var(--bg-section);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 14px;
  border: none;
  transition: var(--transition);
}

.tab-item:hover,
.tab-item.active {
  background: var(--primary);
  color: #fff;
}

/* ========== Pagination ========== */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 30px;
}

.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
}

.pagination a:hover,
.pagination span.current {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ========== Filter Bar ========== */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.filter-bar label {
  color: var(--text-secondary);
  font-size: 14px;
}

.filter-options {
  display: flex;
  gap: 8px;
}

.filter-options a {
  padding: 4px 12px;
  border-radius: 4px;
  color: var(--text-secondary);
  font-size: 13px;
}

.filter-options a:hover,
.filter-options a.active {
  background: var(--primary-light);
  color: var(--primary);
}

/* ========== Detail Page ========== */
.article-detail {
  background: var(--bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 40px;
}

.article-detail h1 {
  font-size: 28px;
  line-height: 1.4;
  margin-bottom: 16px;
}

.article-meta {
  display: flex;
  gap: 20px;
  color: var(--text-muted);
  font-size: 13px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.article-content {
  font-size: 15px;
  line-height: 1.9;
}

.article-content h2 {
  font-size: 20px;
  margin: 24px 0 12px;
  color: var(--text);
}

.article-content h3 {
  font-size: 17px;
  margin: 20px 0 10px;
}

.article-content p {
  margin-bottom: 16px;
}

.article-content pre {
  background: #282c34;
  color: #abb2bf;
  padding: 16px;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 16px 0;
  font-size: 13px;
  line-height: 1.5;
}

.article-content code {
  background: var(--bg-section);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
}

.article-content ul {
  list-style: disc;
  padding-left: 24px;
  margin-bottom: 16px;
}

.article-content li {
  margin-bottom: 6px;
}

/* ========== Utility ========== */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }
