/* =====================================================
   BLOG STYLES - Vui Cười Lên
   ===================================================== */

/* Blog Hero */
.blog-hero {
  background: linear-gradient(135deg, #FFF5FA 0%, #FFECF4 100%);
}

/* Blog Filters */
.blog-filters {
  padding: 30px 0;
  background: var(--white);
  border-bottom: 1px solid var(--light-color);
  position: sticky;
  top: 80px;
  z-index: 100;
}

.blog-filters .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.filter-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-tab {
  padding: 10px 20px;
  border: none;
  background: var(--light-color);
  border-radius: 25px;
  font-weight: 600;
  color: var(--text-light);
  cursor: pointer;
  transition: var(--transition);
}

.filter-tab:hover {
  background: var(--primary-light);
  color: var(--white);
}

.filter-tab.active {
  background: var(--gradient-primary);
  color: var(--white);
}

.blog-search {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--light-color);
  padding: 10px 20px;
  border-radius: 25px;
  min-width: 280px;
}

.blog-search i {
  width: 20px;
  height: 20px;
  color: var(--text-muted);
}

.blog-search input {
  border: none;
  background: transparent;
  font-size: 0.95rem;
  width: 100%;
  outline: none;
  font-family: inherit;
}

/* Blog Listing */
.blog-listing {
  padding: 60px 0;
  background: var(--light-color);
  min-height: 400px;
}

.blog-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 30px;
}

/* Blog Card */
.blog-card {
  background: var(--white);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}

.blog-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-lg);
}

.blog-card-thumb {
  position: relative;
  height: 200px;
  overflow: hidden;
}

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

.blog-card:hover .blog-card-thumb img {
  transform: scale(1.05);
}

.blog-card-category {
  position: absolute;
  top: 15px;
  left: 15px;
  background: var(--gradient-primary);
  color: var(--white);
  padding: 5px 15px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

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

.blog-card-meta {
  display: flex;
  gap: 15px;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

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

.blog-card-meta i {
  width: 14px;
  height: 14px;
}

.blog-card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--dark-color);
  margin-bottom: 10px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

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

.blog-card-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--primary-color);
  font-weight: 600;
  font-size: 0.9rem;
  transition: var(--transition);
  margin-top: auto;
}

.blog-card-link:hover {
  gap: 12px;
}

.blog-card-link i {
  width: 18px;
  height: 18px;
}

/* Blog Pagination */
.blog-pagination {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 50px;
}

.page-btn {
  width: 45px;
  height: 45px;
  border: none;
  background: var(--white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--text-color);
  cursor: pointer;
  transition: var(--transition);
}

.page-btn:hover,
.page-btn.active {
  background: var(--gradient-primary);
  color: var(--white);
}

.page-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Blog Newsletter */
.blog-newsletter {
  padding: 60px 0;
  background: var(--white);
}

.newsletter-box {
  display: flex;
  align-items: center;
  gap: 30px;
  background: var(--gradient-primary);
  padding: 40px;
  border-radius: var(--border-radius-lg);
  color: var(--white);
}

.newsletter-box > i {
  width: 60px;
  height: 60px;
  flex-shrink: 0;
}

.newsletter-content {
  flex: 1;
}

.newsletter-content h3 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.newsletter-content p {
  opacity: 0.9;
}

.newsletter-box .btn {
  background: var(--white);
  color: var(--primary-color);
  white-space: nowrap;
}

.newsletter-box .btn:hover {
  background: var(--dark-color);
  color: var(--white);
}

/* =====================================================
   SINGLE POST STYLES
   ===================================================== */

.blog-post {
  background: var(--light-color);
}

.post-hero {
  padding: 140px 0 40px;
  background: linear-gradient(135deg, #FFF5FA 0%, #FFECF4 100%);
}

.post-layout {
  display: grid;
  grid-template-columns: 1fr 350px;
  gap: 40px;
  padding: 40px 0 80px;
}

.post-main {
  background: var(--white);
  border-radius: var(--border-radius-lg);
  padding: 40px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  min-width: 0; /* Fix grid overflow */
  max-width: 100%;
}

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

.post-category {
  display: inline-block;
  background: var(--gradient-primary);
  color: var(--white);
  padding: 6px 18px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 15px;
}

.post-title {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--dark-color);
  line-height: 1.3;
  margin-bottom: 20px;
}

.post-meta {
  display: flex;
  gap: 25px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.post-meta span {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

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

.post-excerpt {
  font-size: 1.1rem;
  color: var(--text-light);
  line-height: 1.7;
  padding: 20px;
  background: var(--light-color);
  border-left: 4px solid var(--primary-color);
  border-radius: 0 var(--border-radius) var(--border-radius) 0;
}

/* Post Thumbnail */
.post-thumbnail {
  margin: 0 0 30px;
  border-radius: var(--border-radius-lg);
  overflow: hidden;
}

.post-thumbnail img {
  width: 100%;
  height: auto;
  display: block;
}

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

.post-content h2 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--dark-color);
  margin: 35px 0 15px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--light-color);
}

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

.post-content h4 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--dark-color);
  margin: 20px 0 10px;
}

.post-content p {
  margin-bottom: 18px;
}

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

.post-content li {
  margin-bottom: 10px;
  line-height: 1.7;
}

.post-content ul li {
  list-style-type: disc;
}

.post-content ol li {
  list-style-type: decimal;
}

.post-content strong {
  color: var(--dark-color);
}

.post-content a {
  color: var(--primary-color);
  text-decoration: underline;
}

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

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

.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--border-radius);
  margin: 20px 0;
}

.post-content pre,
.post-content code {
  background: #2d2d2d;
  color: #f8f8f2;
  border-radius: var(--border-radius);
}

.post-content code {
  padding: 3px 8px;
  font-size: 0.9em;
}

.post-content pre {
  padding: 20px;
  overflow-x: auto;
  margin: 20px 0;
}

.post-content pre code {
  padding: 0;
  background: none;
}

/* Overflow protection */
.post-content {
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
  overflow: hidden;
}

.post-content pre {
  max-width: 100%;
  overflow-x: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* Quill Editor Output Styles */
.post-content .ql-align-center {
  text-align: center;
}

.post-content .ql-align-right {
  text-align: right;
}

.post-content .ql-align-justify {
  text-align: justify;
}

.post-content .ql-indent-1 {
  padding-left: 3em;
}

.post-content .ql-indent-2 {
  padding-left: 6em;
}

.post-content .ql-indent-3 {
  padding-left: 9em;
}

.post-content .ql-syntax,
.post-content pre.ql-syntax {
  background: #1e1e1e;
  color: #d4d4d4;
  padding: 16px 20px;
  border-radius: 8px;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.5;
  overflow-x: auto;
  max-width: 100%;
  margin: 20px 0;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.post-content .ql-video {
  width: 100%;
  max-width: 100%;
  aspect-ratio: 16/9;
  border-radius: 8px;
  margin: 20px 0;
}

/* Fix for Quill list styles */
.post-content ul[data-checked="true"],
.post-content ul[data-checked="false"] {
  list-style: none;
  padding-left: 1.5em;
}

.post-content ul[data-checked="true"] li::before {
  content: '☑';
  margin-right: 8px;
}

.post-content ul[data-checked="false"] li::before {
  content: '☐';
  margin-right: 8px;
}

/* Tables from Quill */
.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  overflow-x: auto;
  display: block;
}

.post-content table td,
.post-content table th {
  border: 1px solid #ddd;
  padding: 12px;
  text-align: left;
}

.post-content table th {
  background: var(--light-color);
  font-weight: 600;
}

/* Responsive images */
.post-content img {
  max-width: 100% !important;
  height: auto !important;
  display: block;
  margin: 20px auto;
}

/* Post Footer */
.post-footer {
  margin-top: 40px;
  padding-top: 30px;
  border-top: 1px solid var(--light-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}

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

.post-tag {
  background: var(--light-color);
  color: var(--text-color);
  padding: 6px 15px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  transition: var(--transition);
}

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

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

.post-share span {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.share-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  color: var(--white);
}

.share-btn i {
  width: 18px;
  height: 18px;
}

.share-btn.facebook { background: #1877F2; }
.share-btn.twitter { background: #1DA1F2; }
.share-btn.linkedin { background: #0A66C2; }
.share-btn.copy { background: var(--text-muted); }

.share-btn:hover {
  transform: scale(1.1);
}

/* Post Sidebar */
.post-sidebar {
  display: flex;
  flex-direction: column;
  gap: 25px;
}

.sidebar-widget {
  background: var(--white);
  border-radius: var(--border-radius-lg);
  padding: 25px;
  box-shadow: var(--shadow-sm);
}

.sidebar-widget h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--dark-color);
  margin-bottom: 20px;
}

.sidebar-widget h3 i {
  width: 20px;
  height: 20px;
  color: var(--primary-color);
}

.related-posts-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.related-post-item {
  display: flex;
  gap: 15px;
}

.related-post-item img {
  width: 80px;
  height: 60px;
  object-fit: cover;
  border-radius: var(--border-radius);
  flex-shrink: 0;
}

.related-post-item h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--dark-color);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: var(--transition);
}

.related-post-item:hover h4 {
  color: var(--primary-color);
}

.related-post-item span {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: block;
  margin-top: 5px;
}

.cta-widget {
  background: var(--gradient-primary);
  color: var(--white);
}

.cta-widget h3 {
  color: var(--white);
}

.cta-widget h3 i {
  color: var(--white);
}

.cta-widget p {
  opacity: 0.9;
  margin-bottom: 20px;
  line-height: 1.6;
}

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

.cta-widget .btn:hover {
  background: var(--dark-color);
  color: var(--white);
}

.btn-block {
  display: block;
  width: 100%;
  text-align: center;
}

/* More Posts Section */
.more-posts {
  padding: 60px 0;
  background: var(--white);
}

.more-posts h2 {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--dark-color);
  margin-bottom: 40px;
}

.more-posts h2 i {
  width: 28px;
  height: 28px;
  color: var(--primary-color);
}

/* Loading */
.loading-posts {
  text-align: center;
  padding: 60px;
  color: var(--text-muted);
}

.loading-posts .loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--light-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 15px;
}

/* Empty State */
.empty-posts {
  text-align: center;
  padding: 80px 40px;
  color: var(--text-muted);
}

.empty-posts i {
  width: 60px;
  height: 60px;
  margin-bottom: 20px;
  opacity: 0.5;
}

.empty-posts h3 {
  font-size: 1.3rem;
  color: var(--dark-color);
  margin-bottom: 10px;
}

/* Responsive */
@media (max-width: 1024px) {
  .blog-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .post-layout {
    grid-template-columns: 1fr;
  }

  .post-sidebar {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .sidebar-widget {
    flex: 1;
    min-width: 280px;
  }
}

@media (max-width: 768px) {
  .blog-filters .container {
    flex-direction: column;
  }

  .blog-search {
    width: 100%;
    min-width: auto;
  }

  .filter-tabs {
    width: 100%;
    justify-content: center;
  }

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

  .post-main {
    padding: 25px;
  }

  .post-title {
    font-size: 1.6rem;
  }

  .post-meta {
    gap: 15px;
  }

  .newsletter-box {
    flex-direction: column;
    text-align: center;
    padding: 30px;
  }

  .newsletter-box > i {
    width: 50px;
    height: 50px;
  }

  .post-footer {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Homepage Blog Section */
.blog-section {
  padding: 80px 0;
  background: var(--light-color);
}

.blog-section .section-header {
  text-align: center;
  margin-bottom: 50px;
}

.blog-section .blog-grid {
  margin-bottom: 40px;
}

.blog-section .btn-view-all {
  display: block;
  text-align: center;
}

.text-center {
  text-align: center;
}
