/* =============================================================================
   WeDaita News & Blog Custom Styles
   Consistent with existing WeDaita design patterns
   ============================================================================= */

/* News & Blog Hero Sections */
#news-hero, #blog-hero {
  background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
  position: relative;
  overflow: hidden;
}

#blog-hero {
  background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
}

.news-hero-content h1,
.blog-hero-content h1 {
  text-shadow: 0 2px 4px rgba(0,0,0,0.2);
  font-weight: 700;
}

.news-hero-content .lead,
.blog-hero-content .lead {
  font-size: 1.2rem;
  line-height: 1.6;
  text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* Blog Stats in Hero */
.blog-stats {
  margin-top: 2rem;
}

.stat-item {
  text-align: center;
  color: white;
}

.stat-number {
  font-size: 2.5rem;
  font-weight: bold;
  line-height: 1;
  text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.stat-label {
  font-size: 0.9rem;
  opacity: 0.9;
  margin-top: 0.25rem;
}

/* Featured Cards in Hero */
.featured-news-card,
.featured-post-card {
  transform: translateY(0);
  transition: transform 0.3s ease;
}

.featured-news-card:hover,
.featured-post-card:hover {
  transform: translateY(-5px);
}

.featured-news-card .card,
.featured-post-card .card {
  border: none;
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

/* News Article Cards */
.news-article-card {
  border: none;
  transition: all 0.3s ease;
  overflow: hidden;
  background: #fff;
}

.news-article-card:hover {
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
  transform: translateY(-2px);
}

.news-image-container {
  position: relative;
  overflow: hidden;
}

.news-card-img {
  height: 200px;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.news-card-placeholder {
  height: 200px;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.news-article-card:hover .news-card-img {
  transform: scale(1.05);
}

.news-category-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 10;
}

.news-title-link:hover {
  color: #007bff !important;
  text-decoration: none;
}

.news-summary {
  font-size: 0.95rem;
  line-height: 1.5;
  color: #6c757d;
}

.news-tags .badge {
  font-size: 0.75rem;
  font-weight: normal;
}

.news-footer {
  border-top: 1px solid #f8f9fa;
  padding-top: 0.75rem;
}

/* Blog Post Cards (Different styling from news) */
.blog-post-card {
  border: none;
  border-left: 4px solid #28a745;
  transition: all 0.3s ease;
  background: #fff;
}

.blog-post-card:hover {
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
  border-left-color: #007bff;
}

.blog-image-container {
  position: relative;
  overflow: hidden;
}

.blog-card-img {
  height: 180px;
  object-fit: cover;
  width: 100%;
  transition: transform 0.3s ease;
}

.blog-card-placeholder {
  height: 180px;
  background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.blog-post-card:hover .blog-card-img {
  transform: scale(1.05);
}

.blog-category-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 10;
}

.blog-title-link:hover {
  color: #28a745 !important;
  text-decoration: none;
}

/* Code Preview in Blog Cards */
.code-preview-container {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 0.375rem;
  overflow: hidden;
}

.code-header {
  background: #343a40;
  color: white;
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
}

.code-snippet {
  background: #2d3748;
  color: #e2e8f0;
  padding: 0.75rem;
  margin: 0;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 0.85rem;
  line-height: 1.4;
  overflow-x: auto;
}

/* Filters Section */
#news-filters, .blog-filters {
  background: #f8f9fa;
  border-bottom: 1px solid #e9ecef;
}

.news-filter-form select,
.news-filter-form input,
.blog-filter-form select,
.blog-filter-form input {
  border: 1px solid #ced4da;
  border-radius: 0.375rem;
  font-size: 0.9rem;
}

.news-filter-form select:focus,
.news-filter-form input:focus,
.blog-filter-form select:focus,
.blog-filter-form input:focus {
  border-color: #007bff;
  box-shadow: 0 0 0 0.2rem rgba(0,123,255,0.25);
}

/* Badge Styles */
.badge-outline-primary {
  color: #007bff;
  border: 1px solid #007bff;
  background: transparent;
}

.badge-outline-secondary {
  color: #6c757d;
  border: 1px solid #6c757d;
  background: transparent;
}

.badge-outline-info {
  color: #17a2b8;
  border: 1px solid #17a2b8;
  background: transparent;
}

.badge-outline-success {
  color: #28a745;
  border: 1px solid #28a745;
  background: transparent;
}

/* Sidebar Styles */
.blog-sidebar .card {
  border: none;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
  margin-bottom: 1.5rem;
}

.blog-sidebar .card-header {
  background: #f8f9fa;
  border-bottom: 1px solid #e9ecef;
  font-weight: 600;
}

.category-list .category-link {
  padding: 0.5rem 0;
  border-bottom: 1px solid #f8f9fa;
  transition: all 0.2s ease;
}

.category-list .category-link:hover {
  background: #f8f9fa;
  margin-left: 5px;
}

.category-list .category-link:last-child {
  border-bottom: none;
}

/* Author Profile Cards */
.author-card {
  padding: 1rem;
  border: 1px solid #e9ecef;
  border-radius: 0.5rem;
  background: #fff;
  transition: all 0.3s ease;
}

.author-card:hover {
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  transform: translateY(-2px);
}

/* Article/Post Detail Pages */
.article-title, .post-title {
  color: #212529;
  font-weight: 700;
  line-height: 1.2;
}

.article-summary, .post-summary {
  font-size: 1.25rem;
  line-height: 1.6;
  color: #6c757d;
}

.article-byline, .post-byline {
  font-size: 0.9rem;
}

.article-byline > div, .post-byline > div {
  white-space: nowrap;
}

/* Article/Post Content */
.article-text, .post-text {
  font-size: 1.1rem;
  line-height: 1.8;
  color: #212529;
}

.article-text h1, .article-text h2, .article-text h3,
.post-text h1, .post-text h2, .post-text h3 {
  margin-top: 2rem;
  margin-bottom: 1rem;
  color: #212529;
}

.article-text h1, .post-text h1 {
  font-size: 2rem;
  border-bottom: 2px solid #e9ecef;
  padding-bottom: 0.5rem;
}

.article-text h2, .post-text h2 {
  font-size: 1.5rem;
  color: #007bff;
}

.article-text h3, .post-text h3 {
  font-size: 1.25rem;
  color: #28a745;
}

.article-text p, .post-text p {
  margin-bottom: 1.5rem;
}

.article-text blockquote, .post-text blockquote {
  border-left: 4px solid #007bff;
  padding-left: 1rem;
  margin: 1.5rem 0;
  font-style: italic;
  background: #f8f9fa;
  padding: 1rem;
  border-radius: 0.25rem;
}

.article-text pre, .post-text pre {
  background: #2d3748;
  color: #e2e8f0;
  padding: 1rem;
  border-radius: 0.375rem;
  overflow-x: auto;
  font-size: 0.9rem;
  line-height: 1.5;
}

.article-text code:not(pre code), .post-text code:not(pre code) {
  background: #f8f9fa;
  color: #e83e8c;
  padding: 0.2rem 0.4rem;
  border-radius: 0.25rem;
  font-size: 0.9em;
}

/* Social Sharing Buttons */
.sharing-buttons .btn {
  border-radius: 2rem;
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
}

/* Comments Section */
.comments-section {
  background: #f8f9fa;
  padding: 2rem;
  border-radius: 0.5rem;
}

.comment {
  background: white;
  padding: 1rem;
  border-radius: 0.5rem;
  border: 1px solid #e9ecef;
}

.comment-avatar {
  flex-shrink: 0;
}

.comment-header {
  font-size: 0.9rem;
}

.comment-text {
  font-size: 0.95rem;
  line-height: 1.6;
}

/* Newsletter Signup */
.newsletter-form .input-group {
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  border-radius: 0.5rem;
  overflow: hidden;
}

.newsletter-form .form-control {
  border: none;
  font-size: 0.95rem;
}

.newsletter-form .btn {
  border: none;
  font-weight: 600;
}

/* Pagination */
.pagination .page-link {
  color: #007bff;
  border: 1px solid #dee2e6;
  padding: 0.5rem 0.75rem;
  margin: 0 0.125rem;
  border-radius: 0.375rem;
}

.pagination .page-item.active .page-link {
  background: #007bff;
  border-color: #007bff;
}

.pagination .page-link:hover {
  background: #e9ecef;
  border-color: #adb5bd;
}

/* Table of Contents */
#table-of-contents ul {
  font-size: 0.9rem;
}

#table-of-contents a {
  color: #6c757d;
  padding: 0.25rem 0;
  display: block;
}

#table-of-contents a:hover {
  color: #007bff;
  text-decoration: none;
  padding-left: 0.5rem;
}

/* Related Content */
.related-article, .related-post {
  padding: 0.75rem 0;
  border-bottom: 1px solid #f8f9fa;
}

.related-article:last-child, .related-post:last-child {
  border-bottom: none;
}

.related-image img {
  border-radius: 0.375rem;
}

/* Responsive Design */
@media (max-width: 768px) {
  .stat-item {
    margin-bottom: 1rem;
  }
  
  .stat-number {
    font-size: 2rem;
  }
  
  .news-article-card, .blog-post-card {
    margin-bottom: 1rem;
  }
  
  .blog-post-card .row {
    flex-direction: column;
  }
  
  .blog-card-img {
    height: 200px;
    width: 100%;
  }
  
  .article-byline, .post-byline {
    flex-direction: column;
    align-items: flex-start !important;
  }
  
  .article-byline > div, .post-byline > div {
    margin-bottom: 0.5rem;
  }
  
  .sharing-buttons .btn {
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
  }
}

@media (max-width: 576px) {
  .display-4 {
    font-size: 2rem;
  }
  
  .lead {
    font-size: 1.1rem;
  }
  
  .featured-news-card, .featured-post-card {
    margin-top: 2rem;
  }
  
  .blog-sidebar {
    margin-top: 3rem;
  }
}

/* Loading States */
.loading-skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Print Styles */
@media print {
  .news-article-card, .blog-post-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #dee2e6;
  }
  
  .sharing-buttons, .newsletter-form, .comments-section {
    display: none;
  }
}

/* Accessibility Improvements */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* Focus styles for better keyboard navigation */
.news-title-link:focus,
.blog-title-link:focus,
.category-link:focus {
  outline: 2px solid #007bff;
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .news-article-card, .blog-post-card {
    border: 2px solid #000;
  }
  
  .badge {
    border: 1px solid #000;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .news-article-card, .blog-post-card, .author-card {
    transition: none;
  }
  
  .news-card-img, .blog-card-img {
    transition: none;
  }
}