/* =========================================
   EventOS Blog Stylesheet
   Extends the main EventOS dark theme
   ========================================= */

/* --- Reading Progress Bar --- */
.reading-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: var(--gradient-primary);
  z-index: 9999;
  width: 0%;
  transition: width 0.1s linear;
}

/* --- Breadcrumbs --- */
.breadcrumbs {
  padding: 100px 20px 0;
  max-width: 1200px;
  margin: 0 auto;
  font-size: 0.875rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.breadcrumbs a {
  color: var(--text-secondary);
}

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

.breadcrumbs .separator {
  color: var(--border-highlight);
}

.breadcrumbs .current {
  color: var(--text-primary);
  font-weight: 500;
}

/* --- Blog Hub / Listing Page --- */
.blog-hero {
  padding: 120px 20px 40px;
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
}

.blog-hero h1 {
  font-size: 3rem;
  margin-bottom: 16px;
}

.blog-hero p {
  font-size: 1.125rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

/* Category Filter Tabs */
.category-tabs {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 0 20px;
  margin-bottom: 48px;
}

.category-tab {
  padding: 8px 20px;
  border-radius: 99px;
  border: 1px solid var(--border-color);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.category-tab:hover,
.category-tab.active {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--text-primary);
}

/* Blog Post Cards Grid */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px 80px;
}

.blog-card {
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  overflow: hidden;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}

.blog-card:hover {
  transform: translateY(-6px);
  border-color: var(--border-highlight);
  box-shadow: var(--shadow);
}

.blog-card-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.blog-card-body {
  padding: 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.blog-card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.blog-card-meta .dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--text-secondary);
}

.blog-card h3 {
  font-size: 1.2rem;
  margin-bottom: 10px;
  line-height: 1.4;
  color: var(--text-primary);
}

.blog-card h3 a {
  color: inherit;
}

.blog-card h3 a:hover {
  color: var(--primary);
}

.blog-card-excerpt {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 16px;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.read-more-link {
  color: var(--primary);
  font-weight: 600;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 4px;
}

.read-more-link:hover {
  gap: 8px;
}

/* Category Badge */
.category-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--primary-light);
  color: #C7D2FE;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.category-badge.photography { background: rgba(34, 211, 238, 0.15); color: #67E8F9; border-color: rgba(34, 211, 238, 0.3); }
.category-badge.invoicing { background: rgba(52, 211, 153, 0.15); color: #6EE7B7; border-color: rgba(52, 211, 153, 0.3); }
.category-badge.marketing { background: rgba(251, 191, 36, 0.15); color: #FCD34D; border-color: rgba(251, 191, 36, 0.3); }
.category-badge.planning { background: rgba(244, 114, 182, 0.15); color: #F9A8D4; border-color: rgba(244, 114, 182, 0.3); }

/* --- Individual Blog Post --- */
.article-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 20px 80px;
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 48px;
  align-items: start;
}

/* Article Header */
.article-header {
  padding: 120px 20px 0;
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
}

.article-header .category-badge {
  margin-bottom: 16px;
}

.article-header h1 {
  font-size: 2.75rem;
  line-height: 1.2;
  margin-bottom: 20px;
  letter-spacing: -0.02em;
}

.article-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.article-meta .meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.article-meta .meta-item i {
  width: 16px;
  height: 16px;
}

.article-featured-image {
  max-width: 900px;
  margin: 0 auto 40px;
  padding: 0 20px;
}

.article-featured-image img {
  width: 100%;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow);
}

/* Article Body Typography */
.article-body {
  min-width: 0;
}

.article-content {
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--text-secondary);
}

.article-content h2 {
  font-size: 1.8rem;
  color: var(--text-primary);
  margin-top: 48px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.article-content h3 {
  font-size: 1.35rem;
  color: var(--text-primary);
  margin-top: 36px;
  margin-bottom: 12px;
}

.article-content h4 {
  font-size: 1.15rem;
  color: var(--text-primary);
  margin-top: 28px;
  margin-bottom: 10px;
}

.article-content p {
  margin-bottom: 20px;
}

.article-content a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.article-content a:hover {
  color: var(--secondary);
}

.article-content a.btn {
  text-decoration: none;
  color: #ffffff; /* Or inherit if style.css handles it, but forcing white for btn-primary is safe */
}

.article-content a.btn:hover {
  color: #ffffff;
}

.article-content strong {
  color: var(--text-primary);
  font-weight: 600;
}

.article-content ul,
.article-content ol {
  margin: 16px 0 24px 24px;
  list-style: disc;
}

.article-content ol {
  list-style: decimal;
}

.article-content li {
  margin-bottom: 10px;
  padding-left: 4px;
}

.article-content blockquote {
  margin: 24px 0;
  padding: 20px 24px;
  border-left: 4px solid var(--primary);
  background: var(--surface);
  border-radius: 0 12px 12px 0;
  font-style: italic;
  color: var(--text-primary);
}

.article-content pre {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  overflow-x: auto;
  margin: 24px 0;
  font-family: 'Fira Code', 'Courier New', monospace;
  font-size: 0.9rem;
  line-height: 1.6;
}

.article-content code {
  background: rgba(99, 102, 241, 0.15);
  color: #C7D2FE;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.9em;
  font-family: 'Fira Code', 'Courier New', monospace;
}

.article-content pre code {
  background: none;
  padding: 0;
  color: var(--text-primary);
}

.article-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
}

.article-content th,
.article-content td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.article-content th {
  background: var(--surface);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.9rem;
}

.article-content td {
  font-size: 0.9rem;
}

.article-content img {
  max-width: 100%;
  border-radius: 12px;
  margin: 24px 0;
  border: 1px solid var(--border-color);
}

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

.article-content figcaption {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 8px;
  font-style: italic;
}

/* --- Table of Contents Sidebar --- */
.toc-sidebar {
  position: sticky;
  top: 100px;
}

.toc-card {
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 24px;
}

.toc-card h4 {
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.toc-list li {
  margin-bottom: 8px;
}

.toc-list a {
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.5;
  display: block;
  padding: 4px 12px;
  border-left: 2px solid transparent;
  border-radius: 0 6px 6px 0;
  transition: var(--transition);
}

.toc-list a:hover,
.toc-list a.active {
  color: var(--primary);
  border-left-color: var(--primary);
  background: var(--primary-light);
}

.toc-list .toc-h3 {
  padding-left: 24px;
  font-size: 0.825rem;
}

/* Sidebar CTA Card */
.sidebar-cta {
  margin-top: 24px;
  background: var(--gradient-primary);
  border-radius: 20px;
  padding: 24px;
  text-align: center;
}

.sidebar-cta h4 {
  color: white;
  font-size: 1rem;
  margin-bottom: 8px;
}

.sidebar-cta p {
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.85rem;
  margin-bottom: 16px;
}

.sidebar-cta .btn {
  width: 100%;
  background: white;
  color: var(--primary);
  font-size: 0.9rem;
  padding: 10px 20px;
}

.sidebar-cta .btn:hover {
  background: #f0f0f0;
  transform: translateY(-2px);
}

/* --- In-Article CTA Banner --- */
.article-cta-banner {
  margin: 40px 0;
  padding: 32px;
  background: var(--surface);
  border: 1px solid var(--primary);
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 24px;
  box-shadow: 0 0 30px rgba(99, 102, 241, 0.15);
}

.article-cta-banner .cta-icon {
  width: 56px;
  height: 56px;
  min-width: 56px;
  background: var(--primary-light);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
}

.article-cta-banner .cta-text h4 {
  color: var(--text-primary);
  font-size: 1.1rem;
  margin-bottom: 4px;
}

.article-cta-banner .cta-text p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 0;
}

.article-cta-banner .btn {
  white-space: nowrap;
  margin-left: auto;
}

/* --- End-of-Article CTA --- */
.end-cta {
  margin-top: 48px;
  padding: 48px;
  background: var(--gradient-primary);
  border-radius: 24px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.end-cta::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 60%;
  height: 200%;
  background: rgba(255, 255, 255, 0.08);
  transform: rotate(30deg);
}

.end-cta h3 {
  font-size: 1.75rem;
  color: white;
  margin-bottom: 12px;
  position: relative;
  z-index: 2;
}

.end-cta p {
  color: rgba(255, 255, 255, 0.85);
  font-size: 1rem;
  margin-bottom: 24px;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
  position: relative;
  z-index: 2;
}

.end-cta-buttons {
  display: flex;
  gap: 16px;
  justify-content: center;
  position: relative;
  z-index: 2;
}

.end-cta .btn-white {
  background: white;
  color: var(--primary);
}

.end-cta .btn-white:hover {
  background: #f0f0f0;
  transform: translateY(-2px);
}

.end-cta .btn-outline-white {
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: white;
  background: rgba(255, 255, 255, 0.1);
}

.end-cta .btn-outline-white:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

/* --- FAQ Section inside Article --- */
.article-faq {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--border-color);
}

.article-faq h2 {
  border: none;
  text-align: center;
  margin-bottom: 24px;
}

/* --- Responsive Design --- */
@media (max-width: 1024px) {
  .article-container {
    grid-template-columns: 1fr;
  }

  .toc-sidebar {
    position: relative;
    top: 0;
    order: -1;
  }

  .toc-card {
    margin-bottom: 24px;
  }

  .blog-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .blog-hero h1 {
    font-size: 2rem;
  }

  .blog-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .article-header h1 {
    font-size: 2rem;
  }

  .article-meta {
    flex-direction: column;
    gap: 8px;
  }

  .article-content h2 {
    font-size: 1.5rem;
  }

  .article-cta-banner {
    flex-direction: column;
    text-align: center;
  }

  .article-cta-banner .btn {
    margin-left: 0;
    width: 100%;
  }

  .end-cta {
    padding: 32px 20px;
  }

  .end-cta-buttons {
    flex-direction: column;
    align-items: center;
  }

  .end-cta-buttons .btn {
    width: 100%;
    max-width: 280px;
  }
}

@media (max-width: 480px) {
  .blog-hero h1 {
    font-size: 1.75rem;
  }

  .article-header {
    padding-top: 100px;
  }

  .article-header h1 {
    font-size: 1.65rem;
  }
}
