/* =====================================================
   ADGPT BLOG - AHREFS-STYLE DESIGN
   ===================================================== */

/* CSS Variables for consistent styling */
:root {
  --blog-primary: #5046e5;
  --blog-primary-hover: #4338ca;
  --blog-text-primary: #1a1a2e;
  --blog-text-secondary: #6b7280;
  --blog-text-muted: #9ca3af;
  --blog-border: #e5e7eb;
  --blog-bg-light: #f9fafb;
  --blog-bg-header: linear-gradient(180deg, #000d49 4%, #121248 97%, #171747 100%);
  --blog-link-color: #2563eb;
  --blog-font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --blog-max-width: 1200px;
  --blog-content-width: 680px;
  --blog-sidebar-width: 240px;
}

/* =====================================================
   HEADER BANNER - Like Ahrefs
   ===================================================== */
.blog-header-banner {
  background: var(--blog-bg-header);
  padding: 60px 24px 50px;
  text-align: center;
}

.blog-header-container {
  max-width: var(--blog-max-width);
  margin: 0 auto;
}

/* Category Tags */
.blog-category-tags {
  margin-bottom: 20px;
}

.category-tag {
  display: inline-block;
  color: #60a5fa;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s ease;
}

.category-tag:hover {
  color: #93c5fd;
  text-decoration: underline;
}

.category-tag + .category-tag::before {
  content: ", ";
  color: #60a5fa;
}

/* Main Title */
.blog-main-title {
  color: #ffffff;
  font-size: 42px;
  font-weight: 700;
  line-height: 1.2;
  margin: 0 auto 24px;
  max-width: 900px;
  font-family: var(--blog-font-sans);
}

/* Meta Info */
.blog-meta-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: #d1d5db;
}

.blog-author-link {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
}

.by-text {
  color: #9ca3af;
}

.author-name {
  color: #ffffff;
  text-decoration: none;
  font-weight: 500;
}

.author-name:hover {
  text-decoration: underline;
  color: #ffffff;
}

.blog-date-read {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: #9ca3af;
}

.separator-dot::before {
  content: "•";
}

/* =====================================================
   MAIN CONTENT LAYOUT - 3 Column Grid (Like Ahrefs)
   Left: TOC, Center: Content, Right: Author
   ===================================================== */
.blog-content-wrapper {
  max-width: 1400px;
  margin: 0 auto;
  padding: 50px 24px;
}

.blog-layout-grid {
  display: grid;
  grid-template-columns: var(--blog-sidebar-width) 1fr var(--blog-sidebar-width);
  gap: 40px;
  align-items: start;
}

/* Reorder grid items to match Ahrefs layout */
.blog-left-sidebar {
  order: 3; /* Move to right side */
}

.blog-toc-sidebar {
  order: 1; /* Move to left side */
  display: block !important; /* Show left TOC */
}

.blog-main-content {
  order: 2; /* Keep in center */
}

.blog-right-sidebar {
  display: none; /* Hide right sidebar since we're using left TOC */
}

/* =====================================================
   LEFT SIDEBAR - Now contains TOC (Ahrefs style)
   ===================================================== */
.blog-toc-sidebar {
  position: sticky;
  top: 100px;
}

/* =====================================================
   RIGHT SIDEBAR - Now contains Author & Newsletter
   ===================================================== */
.blog-left-sidebar {
  position: sticky;
  top: 100px;
}

/* Author Card */
.author-sidebar-card {
  background: #fff;
  border: 1px solid var(--blog-border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
  text-align: center;
}

.author-avatar {
  margin-bottom: 16px;
}

.author-img {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
}

.author-sidebar-name {
  display: block;
  color: var(--blog-text-primary);
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  margin-bottom: 12px;
}

.author-sidebar-name:hover {
  color: var(--blog-primary);
}

.author-sidebar-bio {
  color: var(--blog-text-secondary);
  font-size: 13px;
  line-height: 1.6;
  margin: 0 0 16px;
}

.author-social-links {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.social-link {
  color: var(--blog-text-secondary);
  transition: color 0.2s ease;
}

.social-link:hover {
  color: var(--blog-primary);
}

/* Newsletter Card */
.newsletter-sidebar-card {
  background: var(--blog-bg-light);
  border: 1px solid var(--blog-border);
  border-radius: 12px;
  padding: 24px;
}

.newsletter-title {
  color: var(--blog-text-primary);
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 16px;
}

.newsletter-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.newsletter-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--blog-border);
  border-radius: 8px;
  font-size: 14px;
  transition: border-color 0.2s ease;
}

.newsletter-input:focus {
  outline: none;
  border-color: var(--blog-primary);
}

.newsletter-btn {
  width: 100%;
  padding: 12px 16px;
  background: var(--blog-primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

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

/* =====================================================
   TABLE OF CONTENTS - Left Side (Ahrefs Style)
   ===================================================== */
.blog-toc-sidebar .toc-nav {
  background: transparent;
  border: none;
  padding: 0;
}

/* =====================================================
   MAIN CONTENT AREA
   ===================================================== */
.blog-main-content {
  max-width: var(--blog-content-width);
  margin: 0 auto;
}

/* Lead Text */
.blog-lead-text {
  color: var(--blog-text-primary);
  font-size: 18px;
  line-height: 1.7;
  font-weight: 500;
  margin-bottom: 32px;
  padding: 20px;
  background: var(--blog-bg-light);
  border-left: 4px solid var(--blog-primary);
  border-radius: 0 8px 8px 0;
}

/* Featured Image */
.blog-featured-image {
  margin: 0 0 40px;
}

.blog-featured-image img {
  width: 100%;
  height: auto;
  border-radius: 12px;
}

.blog-video-embed {
  margin: 0 0 40px;
  border-radius: 12px;
  overflow: hidden;
}

.blog-video-embed iframe {
  aspect-ratio: 16/9;
  border: none;
}

/* Article Content Typography */
.article-content {
  color: var(--blog-text-primary);
  font-size: 17px;
  line-height: 1.8;
}

.article-content p {
  margin: 0 0 24px;
}

.article-content h2 {
  font-size: 28px;
  font-weight: 700;
  margin: 48px 0 20px;
  padding-top: 24px;
  color: var(--blog-text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.article-content h2:first-child {
  margin-top: 0;
  padding-top: 0;
}

.heading-anchor-link {
  opacity: 0;
  color: var(--blog-text-muted);
  transition: opacity 0.2s ease;
  cursor: pointer;
}

.article-content h2:hover .heading-anchor-link {
  opacity: 1;
}

.article-content h3 {
  font-size: 22px;
  font-weight: 600;
  margin: 36px 0 16px;
  color: var(--blog-text-primary);
}

.article-content h4 {
  font-size: 18px;
  font-weight: 600;
  margin: 28px 0 12px;
  color: var(--blog-text-primary);
}

.article-content a {
  color: var(--blog-link-color);
  text-decoration: none;
}

.article-content a:hover {
  text-decoration: underline;
}

.article-content ul,
.article-content ol {
  margin: 0 0 24px;
  padding-left: 24px;
}

.article-content li {
  margin-bottom: 8px;
}

.article-content blockquote {
  margin: 32px 0;
  padding: 24px 28px;
  background: var(--blog-bg-light);
  border-left: 4px solid var(--blog-primary);
  border-radius: 0 12px 12px 0;
  font-style: italic;
  color: var(--blog-text-secondary);
}

.article-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 24px 0;
}

.article-content figure {
  margin: 32px 0;
}

.article-content figcaption {
  text-align: center;
  font-size: 14px;
  color: var(--blog-text-muted);
  margin-top: 12px;
}

.article-content code {
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 15px;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
}

.article-content pre {
  background: #1e293b;
  color: #e2e8f0;
  padding: 20px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 24px 0;
}

.article-content pre code {
  background: transparent;
  padding: 0;
  color: inherit;
}

/* =====================================================
   FAQ SECTION
   ===================================================== */
.faq-section {
  margin: 48px 0;
  padding: 32px;
  background: var(--blog-bg-light);
  border-radius: 16px;
}

.faq-title {
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 24px;
  color: var(--blog-text-primary);
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.faq-item {
  background: #fff;
  border: 1px solid var(--blog-border);
  border-radius: 10px;
  overflow: hidden;
}

.faq-question {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 20px;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  color: var(--blog-text-primary);
  transition: background 0.2s ease;
}

.faq-question:hover {
  background: var(--blog-bg-light);
}

.faq-q-label {
  color: var(--blog-primary);
  font-weight: 700;
}

.faq-q-text {
  flex: 1;
}

.faq-chevron {
  color: var(--blog-text-muted);
  transition: transform 0.2s ease;
}

.faq-question[aria-expanded="true"] .faq-chevron {
  transform: rotate(180deg);
}

.faq-answer-content {
  padding: 0 20px 20px;
  color: var(--blog-text-secondary);
  font-size: 15px;
  line-height: 1.7;
}

.faq-a-label {
  color: var(--blog-primary);
  font-weight: 600;
  margin-right: 4px;
}

/* =====================================================
   AI EXPLORE & SHARE SECTIONS
   ===================================================== */
.ai-explore-section {
  margin: 40px 0;
  padding: 24px;
  background: #f0f9ff;
  border-radius: 12px;
  border: 1px solid #bae6fd;
}

.ai-explore-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--blog-text-primary);
  margin: 0 0 16px;
}

.ai-buttons-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.ai-btn {
  display: inline-flex;
  align-items: center;
  padding: 10px 16px;
  color: #fff;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ai-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  color: #fff;
}

.ai-btn.chatgpt { background: #10a37f; }
.ai-btn.perplexity { background: #6f42c1; }
.ai-btn.claude { background: #dc8620; }
.ai-btn.googleai { background: #4285f4; }
.ai-btn.grok { background: #1da1f2; }

/* Share Section */
.share-section {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 40px 0;
  padding: 20px 0;
  border-top: 1px solid var(--blog-border);
  border-bottom: 1px solid var(--blog-border);
}

.share-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--blog-text-primary);
}

.share-buttons {
  display: flex;
  gap: 8px;
}

.share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--blog-border);
  border-radius: 8px;
  color: var(--blog-text-secondary);
  transition: all 0.2s ease;
}

.share-btn:hover {
  border-color: var(--blog-primary);
  color: var(--blog-primary);
  background: rgba(80, 70, 229, 0.05);
}

/* =====================================================
   ARTICLE AUTHOR FOOTER
   ===================================================== */
.article-author-footer {
  display: flex;
  gap: 20px;
  margin-top: 48px;
  padding: 32px;
  background: var(--blog-bg-light);
  border-radius: 16px;
}

.author-footer-avatar {
  flex-shrink: 0;
}

.author-footer-img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
}

.author-footer-info {
  flex: 1;
}

.author-footer-header {
  margin-bottom: 12px;
}

.article-by-text {
  display: block;
  font-size: 13px;
  color: var(--blog-text-muted);
  margin-bottom: 4px;
}

.author-footer-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--blog-text-primary);
  text-decoration: none;
}

.author-footer-name:hover {
  color: var(--blog-primary);
}

.author-footer-bio {
  color: var(--blog-text-secondary);
  font-size: 15px;
  line-height: 1.6;
  margin: 0 0 16px;
}

.author-footer-social {
  display: flex;
  gap: 12px;
}

.author-social-link {
  color: var(--blog-text-secondary);
  transition: color 0.2s ease;
}

.author-social-link:hover {
  color: var(--blog-primary);
}

/* =====================================================
   RIGHT SIDEBAR - Author Info (Ahrefs Style)
   ===================================================== */
/* Author card styles already defined above */

.toc-nav-right {
  display: none; /* Hidden since we show TOC on left */
}

.toc-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--blog-text-primary);
  margin: 0 0 16px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc-item {
  margin-bottom: 8px;
}

.toc-link {
  display: block;
  color: var(--blog-text-secondary);
  font-size: 14px;
  line-height: 1.5;
  text-decoration: none;
  padding: 6px 0;
  border-left: 2px solid transparent;
  padding-left: 12px;
  margin-left: -12px;
  transition: all 0.2s ease;
}

.toc-link:hover {
  color: var(--blog-text-primary);
}

.toc-link.active {
  color: var(--blog-primary);
  border-left-color: var(--blog-primary);
  font-weight: 500;
}

/* Sidebar CTA */
.sidebar-cta {
  border-radius: 12px;
  overflow: hidden;
}

.sidebar-cta-link {
  display: block;
}

.sidebar-cta-img {
  width: 100%;
  height: auto;
  border-radius: 12px;
}

/* =====================================================
   MOBILE TOC
   ===================================================== */
.mobile-toc-wrapper {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: #fff;
  border-top: 1px solid var(--blog-border);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
}

.mobile-toc-nav {
  padding: 0;
}

.mobile-toc-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  background: var(--blog-primary);
  color: #fff;
  border: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.mobile-toc-toggle svg {
  transition: transform 0.2s ease;
}

.mobile-toc-toggle[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.mobile-toc-list {
  list-style: none;
  margin: 0;
  padding: 16px 20px;
  max-height: 50vh;
  overflow-y: auto;
}

.mobile-toc-item {
  margin-bottom: 8px;
}

.mobile-toc-link {
  display: block;
  padding: 10px 0;
  color: var(--blog-text-secondary);
  font-size: 14px;
  text-decoration: none;
  border-bottom: 1px solid var(--blog-border);
}

.mobile-toc-link:hover {
  color: var(--blog-primary);
}

/* =====================================================
   KEEP LEARNING / RELATED POSTS
   ===================================================== */
.keep-learning-section {
  background: var(--blog-bg-light);
  padding: 60px 24px;
  margin-top: 60px;
}

.keep-learning-container {
  max-width: var(--blog-max-width);
  margin: 0 auto;
}

.keep-learning-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--blog-text-primary);
  margin: 0 0 32px;
}

.related-posts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.related-post-card {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--blog-border);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.related-post-card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  transform: translateY(-4px);
}

.related-post-link {
  display: block;
  text-decoration: none;
}

.related-post-image {
  aspect-ratio: 16/9;
  overflow: hidden;
  background: linear-gradient(90deg, #7f54cd63, #9567de70, #537dea57, #3c92f945);
}

.related-post-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.related-post-content {
  padding: 20px;
}

.related-post-category {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  color: var(--blog-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.related-post-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--blog-text-primary);
  margin: 0 0 8px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.related-post-excerpt {
  font-size: 14px;
  color: var(--blog-text-secondary);
  line-height: 1.6;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* =====================================================
   RESPONSIVE DESIGN
   ===================================================== */

/* Large screens */
@media (max-width: 1400px) {
  .blog-layout-grid {
    grid-template-columns: 200px 1fr 200px;
    gap: 30px;
  }
}

/* Medium screens - hide left sidebar */
@media (max-width: 1200px) {
  .blog-layout-grid {
    grid-template-columns: 1fr 240px;
  }
  
  .blog-left-sidebar {
    display: none;
  }
  
  .blog-main-content {
    max-width: 100%;
  }
}

/* Tablets */
@media (max-width: 992px) {
  .blog-layout-grid {
    grid-template-columns: 1fr;
  }
  
  .blog-right-sidebar {
    display: none;
  }
  
  .mobile-toc-wrapper {
    display: block;
  }
  
  .blog-main-title {
    font-size: 32px;
  }
  
  .related-posts-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .article-author-footer {
    flex-direction: column;
    text-align: center;
  }
  
  .author-footer-social {
    justify-content: center;
  }
}

/* Mobile */
@media (max-width: 640px) {
  .blog-header-banner {
    padding: 40px 16px 32px;
  }
  
  .blog-main-title {
    font-size: 26px;
  }
  
  .blog-content-wrapper {
    padding: 32px 16px;
  }
  
  .article-content {
    font-size: 16px;
  }
  
  .article-content h2 {
    font-size: 22px;
  }
  
  .article-content h3 {
    font-size: 18px;
  }
  
  .related-posts-grid {
    grid-template-columns: 1fr;
  }
  
  .ai-buttons-row {
    flex-direction: column;
  }
  
  .ai-btn {
    justify-content: center;
  }
  
  .share-section {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .keep-learning-section {
    padding: 40px 16px;
  }
  
  .keep-learning-title {
    font-size: 24px;
  }
}

/* =====================================================
   UTILITY CLASSES
   ===================================================== */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* =====================================================
   BLOG LIST PAGE STYLES (Keep existing)
   ===================================================== */
.hero-section {
  height: 50vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #fff;
  background: linear-gradient(180deg, rgba(0, 0, 0, 1) 4%, rgba(18, 18, 72, 1) 97%, #171747 118%);
}

.hero-content {
  max-width: 800px;
  padding: 20px;
}

.blogs-container {
  max-width: 1200px;
  margin: 0 auto;
  width: 80%;
}

.blog-item-image-wrapper {
  max-height: 180px;
  min-height: 180px;
  width: 100%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(90deg, #7f54cd63, #9567de70, #537dea57, #3c92f945);
  border-radius: 8px;
}

.blog-item-image-wrapper img {
  border-radius: 8px;
}

.blog-item-content {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
  -webkit-line-clamp: 2;
  max-height: 3em;
  font-size: 13px;
  text-overflow: ellipsis;
  margin-bottom: 0.25rem;
}

.blog-item-title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
  -webkit-line-clamp: 2;
  max-height: 3em;
  min-height: 3em;
  text-overflow: ellipsis;
  margin-bottom: 0.25rem;
}

.blog-item-content p {
  font-size: 13px;
}

/* Override old styles that might conflict */
.blog-detail-page .blog-header {
  display: none;
}

.blog-detail-page .blog-content-container {
  max-width: none;
  margin: 0;
  padding: 0;
}

.blog-detail-page .blog-main-content-wrapper {
  display: none;
}

.blog-detail-page .table-of-content-wrapper {
  display: none;
}

.blog-detail-page .table-of-content-wrapper-mobile {
  display: none;
}

.blog-detail-page .related-blogs-list {
  display: none;
}
