* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #333;
  min-height: 100vh;
  padding: 20px;
}

.header {
  text-align: center;
  color: white;
  margin-bottom: 30px;
}

.header h1 {
  font-size: 3em;
  font-weight: 700;
  margin-bottom: 10px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

#last-updated {
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.9em;
}

.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 25px;
  max-width: 1400px;
  margin: 0 auto;
}

.news-card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
  cursor: pointer;
}

.news-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 20px rgba(0, 0, 0, 0.2);
}

.news-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.news-image.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 3em;
  font-weight: bold;
}

.news-content {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.news-title {
  font-size: 1.3em;
  font-weight: 600;
  margin-bottom: 12px;
  line-height: 1.3;
}

.news-title a {
  text-decoration: none;
  color: #2c3e50;
  transition: color 0.2s;
}

.news-title a:hover {
  color: #667eea;
}

.news-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.85em;
  color: #7f8c8d;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid #ecf0f1;
}

.news-meta span {
  display: inline-flex;
  align-items: center;
}

.news-meta .source {
  font-weight: 600;
  color: #667eea;
}

.news-meta .category {
  background: #667eea;
  color: white;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.9em;
}

.news-snippet {
  color: #555;
  font-size: 0.95em;
  line-height: 1.6;
  margin-bottom: 12px;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.origin-category {
  font-size: 0.8em;
  color: #9b59b6;
  padding: 8px 12px;
  background: #f8f9fa;
  border-radius: 6px;
  margin-top: auto;
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  overflow: auto;
  animation: fadeIn 0.3s;
}

.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-content {
  background: white;
  border-radius: 12px;
  max-width: 1000px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: slideIn 0.3s;
}

.modal-header {
  position: sticky;
  top: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 20px;
  border-radius: 12px 12px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: start;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.5em;
  flex: 1;
  padding-right: 20px;
}

.close-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  font-size: 2em;
  cursor: pointer;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  flex-shrink: 0;
}

.close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.modal-body {
  padding: 30px;
}

.modal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 2px solid #ecf0f1;
  font-size: 0.9em;
  color: #7f8c8d;
}

.modal-meta .source {
  font-weight: 600;
  color: #667eea;
}

.modal-meta .category {
  background: #667eea;
  color: white;
  padding: 4px 12px;
  border-radius: 12px;
}

.modal-full-content {
  line-height: 1.8;
  color: #333;
}

.modal-full-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 15px 0;
}

.modal-full-content p {
  margin-bottom: 15px;
}

.modal-footer {
  padding: 20px 30px;
  background: #f8f9fa;
  border-radius: 0 0 12px 12px;
  text-align: center;
}

.source-link {
  display: inline-block;
  background: #667eea;
  color: white;
  padding: 12px 30px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  transition: background 0.2s;
}

.source-link:hover {
  background: #5568d3;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideIn {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.loading,
.error {
  text-align: center;
  color: white;
  font-size: 1.2em;
  padding: 40px;
}

.error {
  background: rgba(231, 76, 60, 0.9);
  border-radius: 8px;
  max-width: 600px;
  margin: 0 auto;
}

@media (max-width: 768px) {
  .news-grid {
    grid-template-columns: 1fr;
  }

  .header h1 {
    font-size: 2em;
  }

  .modal-content {
    max-height: 95vh;
  }

  .modal-header h2 {
    font-size: 1.2em;
  }
}