/* ============================================================
   BLOG MODULE - CSS STYLING
   ============================================================ */

/* Blog uses the main design system variables from modern-frontend.css */
/* Fallback values for standalone use */
:root {
    --primary-color: var(--color-primary, #007BFF);
    --primary-dark: var(--color-primary-dark, #0056b3);
    --text-dark: var(--color-gray-900, #0f172a);
    --text-light: var(--color-gray-500, #64748b);
    --bg-light: var(--color-gray-50, #f8fafc);
    --border-color: var(--color-gray-200, #e2e8f0);
    --shadow-sm: var(--shadow-sm, 0 1px 2px 0 rgba(0, 0, 0, 0.05));
    --shadow-md: var(--shadow-md, 0 4px 6px -1px rgba(0, 0, 0, 0.1));
}

/* Main Container */
.blog-main {
    min-height: 100vh;
    background: #ffffff;
}

/* Blog Header */
.blog-header {
    background: linear-gradient(135deg, var(--color-primary, #007BFF) 0%, var(--color-primary-dark, #0056b3) 100%);
    color: white;
    padding: 60px 20px;
    text-align: center;
}

.blog-header-content h1 {
    font-size: 3rem;
    font-weight: 700;
    margin: 0 0 10px 0;
    letter-spacing: -0.5px;
}

.blog-header-content p {
    font-size: 1.1rem;
    margin: 0 0 40px 0;
    opacity: 0.9;
}

.blog-search {
    display: flex;
    max-width: 500px;
    margin: 0 auto;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
    transition: all 0.2s ease;
}

.blog-search:hover {
    border-color: var(--color-primary, #007BFF);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(23, 162, 184, 0.1);
}

.blog-search-input {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 0;
    font-size: 1rem;
}

.blog-search-btn {
    padding: 12px 25px;
    background: linear-gradient(135deg, var(--color-primary, #007BFF) 0%, var(--color-primary-dark, #0056b3) 100%);
    color: white;
    border: none;
    border-radius: 0 6px 6px 0;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
}

.blog-search-btn:hover {
    background: linear-gradient(135deg, var(--color-primary-dark, #0056b3) 0%, var(--color-primary-dark, #0056b3) 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(23, 162, 184, 0.2);
}

/* Blog Container */
.blog-container {
    max-width: 87%;
    margin: 0 auto;
    padding: 40px 20px;
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 40px;
}

@media (max-width: 768px) {
    .blog-container {
        grid-template-columns: 1fr;
        gap: 30px;
        padding: 20px 15px;
    }
}

/* Blog Posts Grid */
.blog-content {
    grid-column: 1;
}

.blog-posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

@media (max-width: 768px) {
    .blog-posts-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* Blog Card */
.blog-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: none;
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.blog-card:hover {
    border-color: var(--color-primary, #007BFF);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(23, 162, 184, 0.1);
}

.blog-card-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: var(--bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
}

.blog-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.blog-card:hover .blog-card-image img {
    transform: scale(1.02);
}

.blog-card-image.placeholder {
    font-size: 2rem;
    color: var(--border-color);
}

.blog-card-content {
    padding: 25px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.blog-category-tag {
    display: inline-block;
    background: var(--color-primary, #007BFF);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 12px;
    text-decoration: none;
    width: fit-content;
    transition: all 0.2s ease;
}

.blog-category-tag:hover {
    background: var(--color-primary-dark, #0056b3);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(23, 162, 184, 0.2);
}

.blog-card-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0 0 15px 0;
    line-height: 1.4;
    color: var(--text-dark);
}

.blog-card-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.3s;
}

.blog-card-title a:hover {
    color: var(--color-primary, #007BFF);
}

.blog-card-excerpt {
    color: var(--text-light);
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 0 0 15px 0;
    flex: 1;
}

.blog-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.blog-card-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.blog-card-meta i {
    color: var(--color-primary, #007BFF);
}

/* No Posts Message */
.blog-no-posts {
    text-align: center;
    padding: 60px 20px;
    background: var(--bg-light);
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.blog-no-posts i {
    font-size: 3rem;
    color: var(--border-color);
    margin-bottom: 20px;
}

.blog-no-posts p {
    font-size: 1.1rem;
    color: var(--text-light);
    margin-bottom: 20px;
}

/* Pagination */
.pagination-container {
    display: flex;
    justify-content: center;
    margin-top: 40px;
    padding-top: 40px;
    border-top: 1px solid var(--border-color);
}

.pagination {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}

.pagination-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 8px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    text-decoration: none;
    color: var(--text-dark);
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.pagination-number:hover {
    border-color: var(--color-primary, #007BFF);
    color: var(--color-primary, #007BFF);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(23, 162, 184, 0.1);
}

.pagination-number.active {
    background: linear-gradient(135deg, var(--color-primary, #007BFF) 0%, var(--color-primary-dark, #0056b3) 100%);
    color: white;
    border-color: var(--color-primary, #007BFF);
}

.pagination-dots {
    color: var(--text-light);
}

/* Blog Sidebar */
.blog-sidebar {
    grid-column: 2;
}

@media (max-width: 768px) {
    .blog-sidebar {
        grid-column: 1;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 30px;
    }
}

/* Sidebar Widgets */
.sidebar-widget {
    background: white;
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 30px;
    border: 1px solid #e2e8f0;
    box-shadow: none;
    transition: all 0.2s ease;
}

@media (max-width: 768px) {
    .sidebar-widget {
        margin-bottom: 0;
    }
}

.sidebar-widget:hover {
    border-color: var(--color-primary, #007BFF);
    box-shadow: 0 4px 12px rgba(23, 162, 184, 0.05);
}

.widget-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 20px 0;
    color: var(--text-dark);
    padding-bottom: 15px;
    border-bottom: 2px solid var(--color-primary, #007BFF);
}

/* Category List */
.category-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.category-list li {
    margin-bottom: 12px;
}

.category-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-dark);
    text-decoration: none;
    padding: 8px 0;
    transition: all 0.3s;
    border-left: 3px solid transparent;
    padding-left: 12px;
}

.category-link:hover {
    color: var(--color-primary, #007BFF);
    border-left-color: var(--color-primary, #007BFF);
}

.post-count {
    background: var(--color-primary, #007BFF);
    color: white;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Recent Posts List */
.recent-posts-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.recent-posts-list li {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.recent-posts-list li:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.recent-post-link {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    color: var(--text-dark);
    text-decoration: none;
    transition: color 0.3s;
    font-weight: 500;
}

.recent-post-link:hover {
    color: var(--color-primary, #007BFF);
}

.recent-date {
    color: var(--text-light);
    font-size: 0.85rem;
    white-space: nowrap;
    font-weight: 400;
}

/* Tags Cloud */
.tags-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tag-cloud-item {
    display: inline-block;
    padding: 6px 12px;
    background: white;
    color: var(--color-primary, #007BFF);
    border: 1px solid var(--color-primary, #007BFF);
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.2s ease;
    font-weight: 500;
}

.tag-cloud-item:hover {
    background: linear-gradient(135deg, var(--color-primary, #007BFF) 0%, var(--color-primary-dark, #0056b3) 100%);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(23, 162, 184, 0.2);
}

/* ============================================================
   INDIVIDUAL POST PAGE
   ============================================================ */

/* Breadcrumb */
.breadcrumb {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-size: 0.9rem;
    color: var(--text-light);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.breadcrumb a {
    color: var(--color-primary, #007BFF);
    text-decoration: none;
    transition: all 0.2s ease;
}

.breadcrumb a:hover {
    color: var(--color-primary-dark, #0056b3);
}

.breadcrumb span {
    color: var(--border-color);
}

/* Blog Post */
.blog-post {
    grid-column: 1;
}

/* Post Header */
.post-header {
    margin-bottom: 40px;
}

.post-category {
    display: inline-block;
    background: var(--color-primary, #007BFF);
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    text-decoration: none;
    margin-bottom: 20px;
    transition: all 0.2s ease;
}

.post-category:hover {
    background: var(--color-primary-dark, #0056b3);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(23, 162, 184, 0.2);
}

.post-title {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-dark);
    margin: 0 0 20px 0;
    line-height: 1.2;
}

@media (max-width: 768px) {
    .post-title {
        font-size: 1.8rem;
    }
}

.post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 25px;
    font-size: 0.95rem;
    color: var(--text-light);
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.post-meta span {
    display: flex;
    align-items: center;
    gap: 8px;
}

.post-meta i {
    color: var(--primary-color);
    width: 16px;
}

/* Featured Image */
.post-featured-image {
    width: 100%;
    max-height: 500px;
    overflow: hidden;
    border-radius: 8px;
    margin: 40px 0;
    box-shadow: var(--shadow-md);
}

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

/* Post Content */
.post-content {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--text-dark);
    margin: 40px 0;
}

.post-content h2 {
    font-size: 2rem;
    font-weight: 700;
    margin: 30px 0 15px 0;
    color: var(--text-dark);
}

.post-content h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 25px 0 12px 0;
    color: var(--text-dark);
}

.post-content p {
    margin: 0 0 15px 0;
}

.post-content ul,
.post-content ol {
    margin: 15px 0;
    padding-left: 25px;
}

.post-content li {
    margin: 8px 0;
}

.post-content blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 20px;
    margin: 25px 0;
    font-style: italic;
    color: var(--text-light);
}

.post-content strong {
    color: var(--text-dark);
    font-weight: 700;
}

/* Post Footer */
.post-footer {
    margin-top: 40px;
    padding: 25px;
    background: var(--bg-light);
    border-radius: 8px;
}

.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.post-tag {
    display: inline-block;
    padding: 6px 12px;
    background: white;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    border-radius: 20px;
    text-decoration: none;
    transition: all 0.3s;
    font-weight: 500;
}

.post-tag:hover {
    background: var(--primary-color);
    color: white;
}

/* Related Posts */
.related-posts {
    margin-top: 60px;
    padding-top: 40px;
    border-top: 2px solid var(--border-color);
}

.related-posts h2 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 30px;
    color: var(--text-dark);
}

.related-posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
}

.related-post-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
}

.related-post-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 24px -5px rgba(0, 0, 0, 0.15);
}

.related-post-image {
    width: 100%;
    height: 180px;
    overflow: hidden;
}

.related-post-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.related-post-card:hover .related-post-image img {
    transform: scale(1.05);
}

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

.related-post-content h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 10px 0;
}

.related-post-content h3 a {
    color: var(--text-dark);
    text-decoration: none;
    transition: color 0.3s;
}

.related-post-content h3 a:hover {
    color: var(--primary-color);
}

.related-post-content p {
    font-size: 0.9rem;
    color: var(--text-light);
    margin: 0 0 12px 0;
}

.related-post-meta {
    display: flex;
    gap: 15px;
    font-size: 0.85rem;
    color: var(--text-light);
}

.related-post-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(2, 178, 144, 0.3);
}

.btn-primary-outline {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-primary-outline:hover {
    background: var(--primary-color);
    color: white;
}

/* Responsive */
@media (max-width: 768px) {
    .blog-header {
        padding: 40px 15px;
    }

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

    .blog-header-content p {
        font-size: 1rem;
    }

    .post-meta {
        gap: 15px;
    }

    .related-posts-grid {
        grid-template-columns: 1fr;
    }
}

/* Book embed cards */
.blog-book-embed {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  border: 1px solid var(--color-gray-200, #e5e7eb);
  border-radius: 8px;
  padding: 0.75rem;
  margin: 1rem 0;
  text-decoration: none;
  color: inherit;
  max-width: 420px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.blog-book-embed:hover {
  border-color: var(--color-primary, #007BFF);
  box-shadow: var(--shadow-sm, 0 1px 2px rgba(0,0,0,.06));
}
.blog-book-embed img {
  width: 56px;
  height: 80px;
  object-fit: contain;
  flex-shrink: 0;
}
.blog-book-embed .blog-book-embed-title {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.blog-book-embed .blog-book-embed-author {
  display: block;
  color: var(--color-gray-500, #6b7280);
  font-size: 0.85rem;
}
.blog-book-embed .blog-book-embed-price {
  display: block;
  color: var(--color-primary, #0d6efd);
  font-weight: 600;
  margin-top: 0.15rem;
}

@media (max-width: 767px) {
  .blog-book-embed {
    max-width: none;
    align-items: flex-start;
  }

  .blog-book-embed .blog-book-embed-title {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    line-height: 1.35;
  }
}

/* Homepage latest blog */
.home-blog-latest {
  padding: 3.5rem 0;
  background: var(--color-gray-50, #f8fafc);
}
.home-blog-latest .home-blog-header {
  text-align: center;
  margin-bottom: 2.5rem;
}
.home-blog-latest .home-blog-header .section-eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-primary, #17a2b8);
  background: rgba(23, 162, 184, 0.1);
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  margin-bottom: 0.875rem;
}
.home-blog-latest .home-blog-header h2 {
  margin: 0 0 0.5rem;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--color-gray-900, #0f172a);
  line-height: 1.2;
}
.home-blog-latest .home-blog-header p {
  margin: 0 auto;
  max-width: 560px;
  color: var(--color-gray-500, #64748b);
  font-size: 1rem;
}
.home-blog-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}
.home-blog-card {
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--color-gray-200, #e2e8f0);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.home-blog-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
}
.home-blog-card-image {
  aspect-ratio: 16/10;
  background: var(--color-gray-100, #f1f5f9);
  overflow: hidden;
}
.home-blog-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.home-blog-card-body {
  padding: 1rem 1.1rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  flex: 1;
}
.home-blog-card-body h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--color-gray-900, #0f172a);
}
.home-blog-card-body p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--color-gray-500, #64748b);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.home-blog-card-meta {
  margin-top: auto;
  font-size: 0.8rem;
  color: var(--color-gray-400, #94a3b8);
}
.home-blog-more,
.home-blog-latest .home-section-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
  padding: 0.625rem 1.5rem;
  border: 1.5px solid var(--color-primary, #17a2b8);
  border-radius: 999px;
  background: transparent;
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--color-primary, #17a2b8);
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.home-blog-more:hover,
.home-blog-latest .home-section-cta:hover {
  background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
  color: #fff;
  border-color: transparent;
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(23, 162, 184, 0.3);
  text-decoration: none;
}
@media (max-width: 900px) {
  .home-blog-grid { grid-template-columns: 1fr; }
}