/*
Theme Name: 抖掌柜资讯
Theme URI: https://news.douzhanggui.com
Author: dzg
Author URI: https://news.douzhanggui.com
Description: 电商资讯与经验干货分享主题
Version: 1.0.0
Requires PHP: 7.4
*/

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #f04142;
  --primary-dark: #d63031;
  --text: #222;
  --text-secondary: #666;
  --text-light: #999;
  --bg: #f5f5f5;
  --card-bg: #fff;
  --border: #e8e8e8;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06);
  --max-width: 1000px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--text); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--primary); }

img { max-width: 100%; height: auto; display: block; }

/* Header */
.site-header {
  background: #fff;
  border-bottom: 2px solid var(--primary);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 16px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.site-logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.site-logo .logo-icon {
  width: auto;
  min-width: 56px;
  height: 28px;
  padding: 0 8px;
  background: var(--primary);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  overflow-x: auto;
}

.main-nav a {
  padding: 6px 14px;
  font-size: 15px;
  color: var(--text);
  border-radius: 4px;
  white-space: nowrap;
  transition: all 0.2s;
}

.main-nav a:hover {
  background: #fef0f0;
  color: var(--primary);
}

.main-nav a.active {
  color: var(--primary);
  font-weight: 600;
}

.nav-dropdown {
  position: relative;
}

.nav-dropdown-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.nav-dropdown-toggle svg {
  transition: transform 0.2s;
}

.nav-dropdown:hover .nav-dropdown-toggle svg {
  transform: rotate(180deg);
}

.nav-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  min-width: 160px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: all 0.2s;
  z-index: 200;
  padding: 6px;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-dropdown-menu a {
  display: block;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 14px;
}

.nav-dropdown-menu a:hover {
  background: #fef0f0;
}

.search-box {
  position: relative;
  flex-shrink: 0;
}

.search-box input {
  width: 180px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 17px;
  padding: 0 14px 0 36px;
  font-size: 13px;
  background: #f5f5f5;
  outline: none;
  transition: all 0.2s;
}

.search-box input:focus {
  border-color: var(--primary);
  background: #fff;
  width: 220px;
}

.search-box .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-light);
}

/* Layout */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 20px 16px;
}

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

.article-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s;
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.article-card:hover {
  box-shadow: 0 2px 12px rgba(0,0,0,0.1);
}

.article-card.has-thumb .article-body {
  flex: 1;
  min-width: 0;
}

.article-card .article-thumb {
  flex-shrink: 0;
  width: 160px;
  height: 100px;
  border-radius: 6px;
  overflow: hidden;
  background: #f0f0f0;
}

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

.article-card .article-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100px;
}

.article-card .article-title {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.5;
  margin-bottom: 8px;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-card:hover .article-title {
  color: var(--primary);
}

.article-card .article-excerpt {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 8px;
}

.article-card .article-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-light);
}

.article-card .article-meta .meta-cat {
  color: var(--primary);
}

.article-card .article-meta .meta-dot::before {
  content: "·";
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 30px 0;
}

.pagination a, .pagination span {
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 14px;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text);
  transition: all 0.2s;
}

.pagination a:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.pagination .current {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Single Post */
.single-post {
  background: #fff;
  border-radius: var(--radius);
  padding: 32px 40px;
  box-shadow: var(--shadow);
}

.single-post .post-header {
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 20px;
}

.single-post .post-title {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 12px;
  color: #1a1a1a;
}

.single-post .post-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text-light);
}

.single-post .post-meta .meta-cat {
  color: var(--primary);
  font-weight: 500;
}

.single-post .post-content {
  font-size: 16px;
  line-height: 1.8;
  color: #333;
}

.single-post .post-content p {
  margin-bottom: 16px;
}

.single-post .post-content h2,
.single-post .post-content h3 {
  margin: 28px 0 14px;
  font-weight: 600;
  color: #1a1a1a;
}

.single-post .post-content h2 { font-size: 22px; }
.single-post .post-content h3 { font-size: 19px; }

.single-post .post-content img {
  border-radius: 6px;
  margin: 16px auto;
}

.single-post .post-content a {
  color: var(--primary);
}

.single-post .post-content blockquote {
  border-left: 4px solid var(--primary);
  padding: 8px 16px;
  margin: 16px 0;
  background: #fafafa;
  color: var(--text-secondary);
  border-radius: 0 6px 6px 0;
}

.single-post .post-content ul,
.single-post .post-content ol {
  padding-left: 24px;
  margin-bottom: 16px;
}

.single-post .post-content li {
  margin-bottom: 6px;
}

.single-post .post-content pre {
  background: #f5f5f5;
  border-radius: 6px;
  padding: 14px;
  overflow-x: auto;
  margin: 16px 0;
  font-size: 14px;
}

.single-post .post-content code {
  background: #f0f0f0;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 14px;
}

.single-post .post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
}

.single-post .post-content th,
.single-post .post-content td {
  border: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
}

.single-post .post-tags {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.single-post .post-tags a {
  padding: 4px 12px;
  background: #f5f5f5;
  border-radius: 4px;
  font-size: 13px;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.single-post .post-tags a:hover {
  background: #fef0f0;
  color: var(--primary);
}

/* Post nav */
.post-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
  gap: 16px;
}

.post-nav a {
  background: #fff;
  border-radius: var(--radius);
  padding: 14px 20px;
  box-shadow: var(--shadow);
  font-size: 14px;
  color: var(--text-secondary);
  flex: 1;
  transition: all 0.2s;
}

.post-nav a:hover {
  color: var(--primary);
}

.post-nav .nav-next {
  text-align: right;
}

/* Footer */
.site-footer {
  background: #fff;
  border-top: 1px solid var(--border);
  padding: 24px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-light);
  margin-top: 30px;
}

.site-footer a {
  color: var(--text-light);
}

.site-footer .footer-links {
  margin-bottom: 8px;
  display: flex;
  justify-content: center;
  gap: 16px;
}

/* Breadcrumb */
.breadcrumb {
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 16px;
  padding: 0 4px;
}

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

.breadcrumb .sep {
  margin: 0 6px;
}

/* Category header */
.category-header {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.category-header h1 {
  font-size: 22px;
  color: var(--text);
  margin-bottom: 4px;
}

.category-header .cat-desc {
  font-size: 13px;
  color: var(--text-light);
}

/* 404 */
.error-404 {
  text-align: center;
  padding: 80px 20px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.error-404 h1 {
  font-size: 72px;
  color: var(--primary);
  margin-bottom: 16px;
}

.error-404 p {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.error-404 a {
  display: inline-block;
  padding: 10px 28px;
  background: var(--primary);
  color: #fff;
  border-radius: 6px;
  font-size: 14px;
  transition: background 0.2s;
}

.error-404 a:hover {
  background: var(--primary-dark);
}

/* Search results */
.search-info {
  background: #fff;
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  font-size: 14px;
  color: var(--text-secondary);
}

.search-info strong {
  color: var(--primary);
}

/* Responsive */
@media (max-width: 768px) {
  .header-inner {
    height: 48px;
    gap: 12px;
    padding: 0 12px;
  }

  .site-logo {
    font-size: 17px;
  }

  .site-logo .logo-icon {
    width: 24px;
    height: 24px;
    font-size: 12px;
  }

  .main-nav {
    gap: 2px;
  }

  .main-nav a {
    padding: 4px 10px;
    font-size: 14px;
  }

  .search-box {
    display: none;
  }

  .container {
    padding: 12px;
  }

  .article-card {
    padding: 12px 14px;
    flex-direction: column;
    gap: 10px;
  }

  .article-card .article-thumb {
    width: 100%;
    height: 160px;
  }

  .article-card .article-title {
    font-size: 16px;
  }

  .single-post {
    padding: 20px 16px;
  }

  .single-post .post-title {
    font-size: 20px;
  }

  .single-post .post-content {
    font-size: 15px;
  }

  .post-nav {
    flex-direction: column;
  }

  .post-nav .nav-next {
    text-align: left;
  }
}

/* No-image article card variant */
.article-card.no-thumb .article-body {
  min-height: auto;
}
