/* ===== BLOG DETAIL PAGE STYLES ===== */

/* Prevent horizontal overflow on the entire page */
body.blog-detail-page {
  overflow-x: hidden;
}

/* Banner */
.blog-detail-banner {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 60%, #0c2340 100%);
  padding: 120px 0 52px; /* top padding accounts for fixed header */
  position: relative;
  overflow: hidden;
}
.blog-detail-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 70% 70% at 50% -10%, rgba(59,130,246,0.22) 0%, transparent 70%);
  pointer-events: none;
}
.blog-detail-banner .container {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  box-sizing: border-box;
}
.banner-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  background: rgba(245,158,11,0.12);
  border: 2px solid rgba(245,158,11,0.4);
  border-radius: 20px;
  margin-bottom: 16px;
  box-shadow: 0 0 32px rgba(245,158,11,0.15);
}
.banner-icon-wrap svg { width: 40px; height: 40px; }
.banner-category-tag {
  display: inline-block;
  background: rgba(245,158,11,0.15);
  color: #fbbf24;
  border: 1px solid rgba(245,158,11,0.35);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  padding: 5px 18px;
  margin-bottom: 16px;
}
.blog-detail-banner h1 {
  font-size: clamp(1.55rem, 3vw, 2.25rem);
  font-weight: 800;
  color: #fff;
  max-width: 820px;
  margin: 0 auto 16px;
  line-height: 1.3;
}
.banner-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  color: #94a3b8;
  font-size: 0.82rem;
  margin-top: 4px;
}
.banner-meta span { display: flex; align-items: center; gap: 5px; }

/* Layout */
.blog-detail-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 40px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 24px 64px;
  box-sizing: border-box;
}

/* Article */
.blog-article {
  min-width: 0;
  overflow: hidden;
}
.article-featured-img {
  width: 100%;
  max-width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: 14px;
  margin-bottom: 28px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
}
.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid #e2e8f0;
}
.meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.83rem;
  color: #64748b;
}
.meta-item svg { color: #f59e0b; }
.article-title {
  font-size: clamp(1.5rem, 2.5vw, 2rem);
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 20px;
  line-height: 1.3;
}
.article-body {
  color: #334155;
  line-height: 1.85;
  font-size: 1rem;
  overflow-wrap: break-word;
  word-wrap: break-word;
}
.article-body h2 {
  font-size: 1.3rem;
  font-weight: 700;
  color: #0f172a;
  margin: 36px 0 14px;
  padding-left: 14px;
  border-left: 4px solid #f59e0b;
}
.article-body h3 { font-size: 1.08rem; font-weight: 700; color: #1e293b; margin: 24px 0 10px; }
.article-body p { margin-bottom: 16px; }
.article-body ul, .article-body ol { padding-left: 22px; margin-bottom: 16px; }
.article-body li { margin-bottom: 8px; }
.article-body strong { color: #0f172a; }

/* Key Point Box */
.key-box {
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
  border: 1px solid #f59e0b;
  border-left: 5px solid #f59e0b;
  border-radius: 10px;
  padding: 18px 20px;
  margin: 24px 0;
  box-sizing: border-box;
}
.key-box-title {
  font-weight: 700;
  color: #92400e;
  font-size: 0.88rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.key-box ul { margin: 0; padding-left: 18px; }
.key-box li { color: #78350f; font-size: 0.93rem; margin-bottom: 6px; }

/* Blue Info Box */
.info-box {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-left: 5px solid #3b82f6;
  border-radius: 10px;
  padding: 18px 20px;
  margin: 24px 0;
  color: #1e40af;
  font-size: 0.93rem;
  box-sizing: border-box;
}
.info-box strong { color: #1d4ed8; }

/* Table wrapper for horizontal scroll on mobile */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 24px 0;
  border-radius: 10px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.07);
}
.table-wrap table {
  margin: 0;
  box-shadow: none;
}

/* Tables */
.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 0.9rem;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,0.07);
}
.article-body thead th {
  background: #1e293b;
  color: #fff;
  padding: 12px 14px;
  text-align: left;
  font-weight: 700;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.article-body tbody tr:nth-child(even) { background: #f8fafc; }
.article-body tbody td { padding: 11px 14px; border-bottom: 1px solid #e2e8f0; color: #334155; }
.article-body tbody tr:hover { background: #fef9ee; }
.badge-green { background: #d1fae5; color: #065f46; padding: 2px 10px; border-radius: 99px; font-size: 0.78rem; font-weight: 600; }
.badge-amber { background: #fef3c7; color: #92400e; padding: 2px 10px; border-radius: 99px; font-size: 0.78rem; font-weight: 600; }
.badge-blue  { background: #dbeafe; color: #1e40af; padding: 2px 10px; border-radius: 99px; font-size: 0.78rem; font-weight: 600; }

/* Formula Box */
.formula-box {
  background: #0f172a;
  color: #f59e0b;
  font-family: 'Courier New', monospace;
  padding: 18px 24px;
  border-radius: 10px;
  margin: 20px 0;
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
  letter-spacing: 0.02em;
  overflow-wrap: break-word;
  word-wrap: break-word;
  box-sizing: border-box;
}

/* FAQ */
.faq-item { border: 1px solid #e2e8f0; border-radius: 10px; margin-bottom: 12px; overflow: hidden; }
.faq-q {
  padding: 16px 18px;
  font-weight: 700;
  font-size: 0.95rem;
  color: #0f172a;
  background: #f8fafc;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.faq-a { padding: 14px 18px; color: #475569; font-size: 0.92rem; line-height: 1.7; border-top: 1px solid #e2e8f0; }

/* Tags */
.article-tags { margin-top: 32px; padding-top: 24px; border-top: 1px solid #e2e8f0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.article-tags span { font-size: 0.8rem; font-weight: 600; color: #64748b; margin-right: 4px; }
.tag-pill { background: #f1f5f9; color: #475569; padding: 5px 13px; border-radius: 99px; font-size: 0.8rem; text-decoration: none; transition: all 0.2s; }
.tag-pill:hover { background: #f59e0b; color: #fff; }

/* ===== SIDEBAR ===== */
.blog-sidebar { display: flex; flex-direction: column; gap: 28px; min-width: 0; }
.sidebar-widget {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 22px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.05);
  box-sizing: border-box;
}
.widget-title {
  font-size: 1rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid #f59e0b;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Search */
.search-form { display: flex; gap: 0; }
.blog-sidebar .search-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #e2e8f0;
  border-right: none;
  border-radius: 8px 0 0 8px;
  font-size: 0.9rem;
  outline: none;
  color: #334155;
  min-width: 0;
}
.blog-sidebar .search-input:focus { border-color: #f59e0b; }
.blog-sidebar .search-btn {
  padding: 10px 16px;
  background: #f59e0b;
  border: none;
  border-radius: 0 8px 8px 0;
  color: #fff;
  cursor: pointer;
  transition: background 0.2s;
}
.blog-sidebar .search-btn:hover { background: #d97706; }

/* Categories */
.cat-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.cat-list li a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: #475569;
  font-size: 0.88rem;
  font-weight: 500;
  transition: all 0.2s;
}
.cat-list li a:hover { background: #fef9ee; color: #f59e0b; }
.cat-count { background: #f1f5f9; color: #64748b; border-radius: 99px; padding: 2px 9px; font-size: 0.75rem; font-weight: 700; }

/* Recent Posts */
.recent-post { display: flex; gap: 12px; padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid #f1f5f9; }
.recent-post:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.recent-post-img { width: 72px; height: 60px; object-fit: cover; border-radius: 8px; flex-shrink: 0; }
.recent-post-info { flex: 1; min-width: 0; }
.recent-post-title { font-size: 0.82rem; font-weight: 700; color: #1e293b; line-height: 1.4; margin-bottom: 4px; text-decoration: none; display: block; overflow-wrap: break-word; }
.recent-post-title:hover { color: #f59e0b; }
.recent-post-date { font-size: 0.74rem; color: #94a3b8; }

/* Tags Widget */
.tags-cloud { display: flex; flex-wrap: wrap; gap: 7px; }
.tags-cloud a { background: #f1f5f9; color: #475569; padding: 5px 12px; border-radius: 99px; font-size: 0.78rem; text-decoration: none; font-weight: 500; transition: all 0.2s; }
.tags-cloud a:hover { background: #f59e0b; color: #fff; }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .blog-detail-layout {
    grid-template-columns: 1fr;
    padding: 24px 16px 48px;
    gap: 28px;
  }
  .blog-sidebar { order: 2; }
  .blog-detail-banner { padding: 100px 0 36px; }
  .blog-detail-banner h1 { font-size: 1.35rem; }
  .banner-meta { gap: 12px; font-size: 0.78rem; }
  .banner-icon-wrap { width: 58px; height: 58px; }
  .banner-icon-wrap svg { width: 30px; height: 30px; }
  .article-featured-img { border-radius: 10px; margin-bottom: 20px; }
  .article-title { font-size: 1.3rem; }
  .article-meta { gap: 10px; }
  .meta-item { font-size: 0.78rem; }
  .article-body h2 { font-size: 1.15rem; margin: 28px 0 12px; }
  .article-body h3 { font-size: 1rem; }
  .article-body { font-size: 0.93rem; }
  .formula-box { font-size: 0.82rem; padding: 14px 14px; word-break: break-word; overflow-wrap: break-word; }
  .key-box, .info-box { padding: 14px 14px; }

  /* Tables — horizontal scroll on mobile */
  .article-body table {
    font-size: 0.78rem;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }
  .article-body thead,
  .article-body tbody,
  .article-body tr { display: table; width: 100%; table-layout: auto; }
  .article-body thead th { padding: 10px 10px; font-size: 0.72rem; white-space: nowrap; }
  .article-body tbody td { padding: 9px 10px; white-space: nowrap; }
}

@media (max-width: 480px) {
  .blog-detail-banner { padding: 90px 0 30px; }
  .blog-detail-banner .container { padding: 0 16px; }
  .blog-detail-banner h1 { font-size: 1.1rem; }
  .banner-meta { flex-direction: column; gap: 5px; font-size: 0.75rem; }
  .banner-category-tag { font-size: 0.65rem; padding: 4px 14px; }
  .banner-icon-wrap { width: 52px; height: 52px; }
  .banner-icon-wrap svg { width: 26px; height: 26px; }
  .blog-detail-layout { padding: 20px 14px 40px; }
  .article-title { font-size: 1.1rem; }
  .article-meta { flex-direction: column; gap: 8px; }
  .meta-item[style*="margin-left:auto"] { margin-left: 0 !important; }
  .recent-post-img { width: 60px; height: 50px; }
  .faq-q { font-size: 0.85rem; padding: 12px 14px; }
  .faq-a { font-size: 0.82rem; padding: 12px 14px; }
  .article-tags { gap: 6px; }
  .tag-pill { font-size: 0.72rem; padding: 4px 10px; }
  .sidebar-widget { padding: 16px; }
  .formula-box { font-size: 0.75rem; padding: 12px 12px; }
}
