/**
 * Blogs CSS
 * Styles for public blog list and individual blog pages
 * Updated: 2025-12-17
 */

/* ==========================================================================
   Blog List Page
   ========================================================================== */

.blogs-main {
  padding: 2rem 1rem;
  max-width: 1200px;
  margin: 0 auto;
}

.blogs-header {
  text-align: center;
  margin-bottom: 2rem;
}

.blogs-header h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  color: #1d1d1f;
}

.blogs-header p {
  color: #6e6e73;
  font-size: 1.125rem;
}

/* Search Bar */
.blogs-search {
  margin-bottom: 2rem;
}

.search-form {
  display: flex;
  gap: 0.5rem;
  max-width: 600px;
  margin: 0 auto;
  align-items: stretch;
}

/* Override Pico CSS for search input */
.search-form .search-input {
  flex: 1;
  min-width: 0;
  padding: 0.75rem 1rem !important;
  border: 1px solid #d1d5db !important;
  border-radius: 8px !important;
  font-size: 1rem !important;
  background: white !important;
  margin: 0 !important;
  height: auto !important;
  width: auto !important;
}

.search-form .search-input:focus {
  outline: none !important;
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1) !important;
}

/* Override Pico CSS for search button */
.search-form .search-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.5rem !important;
  padding: 0.75rem 1.25rem !important;
  background: #3b82f6 !important;
  color: white !important;
  border: none !important;
  border-radius: 8px !important;
  cursor: pointer !important;
  font-size: 1rem !important;
  font-weight: 500 !important;
  transition: background 0.2s !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  width: auto !important;
  margin: 0 !important;
}

.search-form .search-btn:hover {
  background: #2563eb !important;
}

.search-form .search-btn .icon-sm {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.search-results {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: #f3f4f6;
  border-radius: 8px;
  font-size: 0.875rem;
  color: #4b5563;
}

.clear-search-btn {
  padding: 0.25rem 0.75rem;
  background: white;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.75rem;
  color: #374151;
  transition: all 0.2s;
}

.clear-search-btn:hover {
  background: #f9fafb;
  border-color: #9ca3af;
}

/* Blog Grid */
.blogs-grid {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Blog Card */
.blog-card {
  padding: 1.5rem;
  background: white;
  border: 1px solid #e5e5e5;
  border-radius: 12px;
  transition: all 0.2s ease;
}

.blog-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border-color: #d1d5db;
}

.blog-card a {
  text-decoration: none;
  color: inherit;
  display: block;
}

.blog-card-title {
  font-size: 1.375rem;
  font-weight: 600;
  margin: 0 0 0.5rem 0;
  color: #1d1d1f;
  line-height: 1.3;
}

.blog-card:hover .blog-card-title {
  color: #3b82f6;
}

.blog-card-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  color: #6e6e73;
  margin-bottom: 0.75rem;
}

.blog-author {
  font-weight: 500;
}

.blog-card-excerpt {
  color: #424245;
  line-height: 1.6;
  margin: 0;
  font-size: 1rem;
}

/* Loading State */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: #6e6e73;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #e5e5e5;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 1rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  text-align: center;
  color: #6e6e73;
}

.empty-icon {
  width: 64px;
  height: 64px;
  margin-bottom: 1rem;
  stroke: #9ca3af;
}

.empty-state p {
  margin: 0.25rem 0;
}

/* Load More */
.load-more-container {
  text-align: center;
  margin-top: 2rem;
}

/* Error Message */
.error-message {
  text-align: center;
  color: #dc2626;
  padding: 2rem;
}


/* ==========================================================================
   Individual Blog Page
   ========================================================================== */

.blog-single-main {
  padding: 2rem 1rem;
  max-width: 1200px;
  margin: 0 auto;
}

.blog-post {
  background: white;
  border-radius: 12px;
  padding: 2rem;
}

.blog-post-header {
  margin-bottom: 2rem;
  border-bottom: 1px solid #e5e5e5;
  padding-bottom: 1.5rem;
}

.blog-post-header .back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: #6e6e73;
  text-decoration: none;
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
  transition: color 0.2s;
}

.blog-post-header .back-link:hover {
  color: #3b82f6;
}

.blog-post-header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  color: #1d1d1f;
  margin: 0 0 1rem 0;
  line-height: 1.2;
}

.blog-post-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #6e6e73;
  font-size: 0.9375rem;
}

.blog-post-meta .blog-author {
  font-weight: 500;
}

/* Blog Content */
.blog-content {
  line-height: 1.8;
  font-size: 1.0625rem;
  color: #1d1d1f;
}

.blog-content h1,
.blog-content h2,
.blog-content h3,
.blog-content h4,
.blog-content h5,
.blog-content h6 {
  margin-top: 2rem;
  margin-bottom: 1rem;
  font-weight: 600;
  line-height: 1.3;
}

.blog-content h1 { font-size: 2rem; }
.blog-content h2 { font-size: 1.75rem; }
.blog-content h3 { font-size: 1.5rem; }
.blog-content h4 { font-size: 1.25rem; }
.blog-content h5 { font-size: 1.125rem; }
.blog-content h6 { font-size: 1rem; }

.blog-content p {
  margin-bottom: 1.25rem;
}

.blog-content a {
  color: #3b82f6;
  text-decoration: underline;
}

.blog-content a:hover {
  color: #2563eb;
}

.blog-content ul,
.blog-content ol {
  margin: 1rem 0;
  padding-left: 1.5rem;
}

.blog-content li {
  margin-bottom: 0.5rem;
}

.blog-content blockquote {
  border-left: 4px solid #3b82f6;
  margin: 1.5rem 0;
  padding: 1rem 1.5rem;
  background: #f8fafc;
  border-radius: 0 8px 8px 0;
  font-style: italic;
  color: #4b5563;
}

.blog-content pre {
  background: #1e293b;
  color: #e2e8f0;
  padding: 1.25rem;
  border-radius: 8px;
  overflow-x: auto;
  margin: 1.5rem 0;
  font-size: 0.875rem;
  line-height: 1.6;
}

.blog-content code {
  font-family: 'SF Mono', Monaco, 'Andale Mono', monospace;
  font-size: 0.875em;
}

.blog-content p code,
.blog-content li code {
  background: #f1f5f9;
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
  color: #be185d;
}

.blog-content hr {
  border: none;
  border-top: 1px solid #e5e5e5;
  margin: 2rem 0;
}

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

/* Blog Footer */
.blog-post-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e5e5e5;
}

.blog-post-footer .back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: #3b82f6;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.blog-post-footer .back-link:hover {
  color: #2563eb;
}

/* Icon Sizes */
.icon-sm {
  width: 20px;
  height: 20px;
}


/* ==========================================================================
   Responsive Design
   ========================================================================== */

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

  .search-form {
    flex-direction: column;
  }

  .search-btn {
    justify-content: center;
  }

  .blog-card {
    padding: 1.25rem;
  }

  .blog-card-title {
    font-size: 1.25rem;
  }

  .blog-post {
    padding: 1.5rem;
  }

  .blog-post-header h1 {
    font-size: 1.875rem;
  }

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