/* Global Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: #f8f9ff;
  color: #1a1a1a;
  line-height: 1.6;
  padding-top: 100px; /* Space for fixed header */
}

/* Blog Header */
.blog-header {
  background: linear-gradient(135deg, #ffffff 0%, #f0f4ff 100%);
  padding: 80px 20px;
  text-align: center;
  border-bottom: 1px solid #e5e7eb;
}

.blog-title {
  font-size: 48px;
  font-weight: 800;
  color: #1a1a1a;
  margin-bottom: 24px;
  line-height: 1.2;
}

.blog-subtitle {
  font-size: 20px;
  color: #4b5563;
  max-width: 800px;
  margin: 0 auto 40px; /* Added margin for search separation */
  line-height: 1.6;
}

/* Search Bar (Copied from Servicios) */
.search-container {
  display: flex;
  justify-content: center;
  margin-bottom: 0px; /* Handled by container padding/margin */
  position: relative;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

#blogSearch {
  width: 100%;
  padding: 16px 48px 16px 24px;
  border: 2px solid #e5e7eb;
  border-radius: 50px;
  font-size: 18px;
  transition: all 0.3s ease;
  outline: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

#blogSearch:focus {
  border-color: #467ff7;
  box-shadow: 0 8px 24px rgba(70, 127, 247, 0.15);
}

.search-icon {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  stroke: #9ca3af;
  fill: none;
  stroke-width: 2;
  pointer-events: none;
  transition: stroke 0.3s ease;
}

#blogSearch:focus + .search-icon {
  stroke: #467ff7;
}

/* No Results Message */
.no-results-message {
  text-align: center;
  padding: 60px 20px;
  background: #ffffff; /* Slightly different from page bg */
  border-radius: 16px;
  margin-bottom: 40px;
  animation: fadeIn 0.4s ease-out;
  border: 1px solid #e5e7eb;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.no-results-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  color: #9ca3af;
  background: #f9fafb;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e5e7eb;
}

.no-results-icon svg {
  width: 32px;
  height: 32px;
}

.no-results-message h3 {
  font-size: 20px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 8px;
}

.no-results-message p {
  color: #6b7280;
  font-size: 16px;
}

/* Blog Grid */
.blog-container {
  max-width: 1400px;
  margin: 60px auto;
  padding: 0 24px;
}

.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 40px;
}

/* Article Card */
.article-card {
  background: #ffffff;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Scroll Reveal Animation */
.article-card {
  opacity: 0;
  transform: translateY(30px);
  transition:
    opacity 0.6s ease-out,
    transform 0.6s ease-out;
}

.article-card.visible {
  opacity: 1;
  transform: translateY(0);
}

.article-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 32px rgba(70, 127, 247, 0.15);
  border-color: #467ff7;
}

.article-image-wrapper {
  position: relative;
  width: 100%;
  padding-top: 60%; /* Aspect ratio */
  overflow: hidden;
  background: #e8f0ff;
}

.article-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.article-card:hover .article-image {
  transform: scale(1.05);
}

.article-content {
  padding: 32px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.article-category {
  font-size: 14px;
  font-weight: 700;
  color: #467ff7;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.article-title {
  font-size: 24px;
  font-weight: 800;
  color: #1a1a1a;
  margin-bottom: 16px;
  line-height: 1.3;
}

.article-excerpt {
  font-size: 16px;
  color: #6b7280;
  line-height: 1.7;
  margin-bottom: 24px;
  flex: 1;
}

.article-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid #f3f4f6;
  padding-top: 20px;
}

.read-more {
  color: #467ff7;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: gap 0.3s ease;
}

.read-more:hover {
  gap: 12px;
}

.read-more svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

.article-date {
  font-size: 14px;
  color: #9ca3af;
}

/* Responsive */
@media (max-width: 768px) {
  body {
    padding-top: 70px;
  }

  .blog-header {
    padding: 60px 20px;
  }

  .blog-title {
    font-size: 36px;
  }

  .blog-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .article-title {
    font-size: 22px;
  }
}

/* Blog Post Detail */
.blog-post-hero {
  width: 100%;
  height: 50vh;
  min-height: 400px;
  max-height: 600px;
  position: relative;
  overflow: hidden;
  margin-top: -80px; /* Offset header padding */
}

.blog-post-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.blog-post-hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.2),
    rgba(0, 0, 0, 0.5)
  );
}

.blog-post-container {
  max-width: 900px;
  margin: -100px auto 60px; /* Overlap hero */
  position: relative;
  background: #fff;
  border-radius: 20px;
  padding: 60px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.05);
  z-index: 10;
}

.blog-post-meta {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  color: #467ff7;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 14px;
  align-items: center;
}

.blog-post-date {
  color: #9ca3af;
  font-weight: 400;
}

.blog-post-title {
  font-size: 42px;
  font-weight: 800;
  margin-bottom: 32px;
  color: #1a1a1a;
  line-height: 1.2;
}

.blog-post-body {
  font-size: 18px;
  line-height: 1.8;
  color: #374151;
}

.blog-post-body p {
  margin-bottom: 24px;
}

.blog-post-body h2 {
  font-size: 28px;
  margin: 48px 0 24px;
  color: #1a1a1a;
  font-weight: 700;
}

.blog-post-body ul {
  margin-bottom: 24px;
  padding-left: 24px;
}

.blog-post-body li {
  margin-bottom: 12px;
  color: #374151;
}

.back-to-blog {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 40px;
  color: #467ff7;
  text-decoration: none;
  font-weight: 700;
  font-size: 16px;
  transition: transform 0.3s ease;
}

.back-to-blog:hover {
  transform: translateX(-5px);
}

@media (max-width: 768px) {
  .blog-post-container {
    margin: -60px 20px 40px;
    padding: 32px 24px;
  }
  .blog-post-title {
    font-size: 30px;
  }
  .blog-post-hero {
    height: 40vh;
    min-height: 300px;
  }
}
