/* ============================================
   RESET & BASE STYLES
   ============================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: #e8f4f8;
  color: #212529;
  line-height: 1.6;
}

a {
  text-decoration: none;
  color: inherit;
}

/* ============================================
   LAYOUT
   ============================================ */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

/* ============================================
   SITE HEADER
   ============================================ */
.site-header {
  border-bottom: 3px solid #0077be;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
}

.site-title {
  color: #0077be;
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  text-decoration: none;
  transition: color 0.2s ease;
}

.site-title:hover {
  color: #005a8f;
}

.site-subtitle {
  color: #6c757d;
  font-size: 1rem;
}

/* ============================================
   FORM CONTROLS
   ============================================ */
input[type="text"],
select {
  width: 100%;
  padding: 0.5rem 1rem;
  border: 1px solid #b8dce8;
  border-radius: 0.375rem;
  font-size: 1rem;
  transition: border-color 0.15s;
}

input[type="text"]:focus,
select:focus {
  outline: none;
  border-color: #0077be;
  box-shadow: 0 0 0 0.25rem rgba(0, 119, 190, 0.25);
}

/* ============================================
   SEARCH & CONTROLS (Index Page)
   ============================================ */
.controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.search-box {
  flex: 1;
  max-width: 400px;
}

.result-count {
  color: #6c757d;
  font-size: 0.95rem;
}

/* ============================================
   ARTICLES GRID (Index Page)
   ============================================ */
.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

/* ============================================
   ARTICLE CARDS (Index Page)
   ============================================ */
.article-card {
  background: white;
  border-radius: 0.5rem;
  box-shadow: 0 2px 4px rgba(0, 119, 190, 0.15);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  overflow: hidden;
  color: inherit;
  display: flex;
  flex-direction: column;
  height: 100%;
  border: 1px solid #d4e9f3;
}

.article-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 16px rgba(0, 119, 190, 0.25);
  border-color: #0077be;
}

.article-image-wrapper {
  width: 100%;
  aspect-ratio: 4/3;
  background: linear-gradient(135deg, #e8f4f8 0%, #d4e9f3 100%);
  overflow: hidden;
}

.article-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.article-content {
  padding: 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.article-date {
  color: #6c757d;
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
}

.article-date::before {
  content: "🎣 ";
}

.article-title {
  color: #0077be;
  font-size: 1.1rem;
  font-weight: 600;
  transition: color 0.2s ease;
  flex: 1;
}

.article-card:hover .article-title {
  color: #005a8f;
}

/* ============================================
   ARTICLE PAGE
   ============================================ */
.article-wrapper {
  background: white;
  border-radius: 0.5rem;
  box-shadow: 0 2px 4px rgba(0, 119, 190, 0.15);
  padding: 2rem;
  border: 1px solid #d4e9f3;
}

.article-header {
  border-bottom: 2px solid #e8f4f8;
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
}

.article-header h1 {
  color: #0077be;
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.article-meta {
  color: #6c757d;
  font-size: 0.95rem;
}

.article-meta::before {
  content: "🎣 ";
}

.article-featured-image {
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 4px 8px rgba(0, 119, 190, 0.2);
  border: 3px solid #e8f4f8;
}

.article-body {
  font-size: 1.05rem;
  line-height: 1.7;
  color: #212529;
}

.article-body img {
  max-width: 100%;
  height: auto;
  border-radius: 0.375rem;
  margin: 1rem 0;
  border: 2px solid #e8f4f8;
}

.article-body h2,
.article-body h3,
.article-body h4 {
  margin-top: 1.5rem;
  margin-bottom: 1rem;
  color: #0077be;
}

.article-body p {
  margin-bottom: 1rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: #0077be;
  text-decoration: none;
  font-weight: 500;
  margin-bottom: 1.5rem;
  transition: color 0.2s ease;
}

.back-link:hover {
  color: #005a8f;
}

.back-link::before {
  content: "← ";
}

/* ============================================
   PAGINATION
   ============================================ */
.pagination-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.pagination-controls label {
  margin-right: 0.5rem;
  font-size: 0.95rem;
}

.pagination-controls select {
  width: auto;
  display: inline-block;
}

.pagination {
  display: flex;
  list-style: none;
  gap: 0.25rem;
}

.pagination button {
  padding: 0.5rem 0.75rem;
  border: 1px solid #b8dce8;
  background: white;
  color: #0077be;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 0.95rem;
}

.pagination button:hover:not(:disabled) {
  background: #0077be;
  color: white;
  border-color: #0077be;
}

.pagination button.active {
  background: #0077be;
  color: white;
  border-color: #0077be;
}

.pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============================================
   LOADING SPINNER
   ============================================ */
.loading {
  text-align: center;
  padding: 4rem 1rem;
}

.spinner {
  display: inline-block;
  width: 2rem;
  height: 2rem;
  border: 0.25rem solid #0077be;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

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

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
  text-align: center;
  padding: 4rem 1rem;
  color: #6c757d;
}

.empty-state::before {
  content: "🔍";
  display: block;
  font-size: 3rem;
  margin-bottom: 1rem;
}

/* ============================================
   ERROR STATE
   ============================================ */
.error-state {
  text-align: center;
  padding: 4rem 1rem;
}

.error-state::before {
  content: "⚠️";
  display: block;
  font-size: 3rem;
  margin-bottom: 1rem;
}

.error-state h2 {
  color: #0077be;
  margin-bottom: 0.5rem;
}

.error-state p {
  color: #6c757d;
  margin-bottom: 1.5rem;
}

.btn {
  display: inline-block;
  padding: 0.5rem 1.5rem;
  background: #0077be;
  color: white;
  border: none;
  border-radius: 0.375rem;
  font-size: 1rem;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s ease;
}

.btn:hover {
  background: #005a8f;
  color: white;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 768px) {
  .site-title {
    font-size: 2rem;
  }

  .controls {
    flex-direction: column;
    align-items: stretch;
  }

  .search-box {
    max-width: 100%;
  }

  .pagination-wrapper {
    flex-direction: column;
  }

  .articles-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  }

  .article-wrapper {
    padding: 1.5rem;
  }

  .article-header h1 {
    font-size: 1.5rem;
  }

  .article-body {
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 1rem 0.75rem;
  }

  .site-title {
    font-size: 1.75rem;
  }

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

  .article-wrapper {
    padding: 1rem;
  }
}
