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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: #f5f5f5;
  color: #333;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.6;
}

header {
  background: #fff;
  padding: 1rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

header h1 {
  font-size: 1.5rem;
  color: #1a1a1a;
}

.selectors {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

#language,
#category {
  padding: 0.5rem 1rem;
  font-size: 1rem;
  border: 2px solid #ddd;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  min-width: 150px;
}

#language:focus,
#category:focus {
  outline: none;
  border-color: #0066cc;
}

/* Main & Feed */
main {
  flex: 1;
  padding: 1rem;
  max-width: 700px;
  margin: 0 auto;
  width: 100%;
}

.feed {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Feed Cards */
.feed-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  animation: card-fade-in 0.4s ease-out;
}

.feed-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.feed-card-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.feed-card-thumb {
  width: 100%;
  max-height: 250px;
  object-fit: cover;
  display: block;
}

.feed-card-body {
  padding: 1.25rem;
}

.feed-card-title {
  font-size: 1.25rem;
  color: #1a1a1a;
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.feed-card-extract {
  color: #555;
  font-size: 0.9375rem;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.feed-card-action {
  color: #0066cc;
  font-size: 0.875rem;
  font-weight: 500;
}

@keyframes card-fade-in {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Skeleton Loading Cards */
.skeleton-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.skeleton-thumb {
  width: 100%;
  height: 180px;
  background: #e0e0e0;
  animation: shimmer 1.5s infinite;
}

.skeleton-body {
  padding: 1.25rem;
}

.skeleton-title {
  height: 1.25rem;
  width: 70%;
  background: #e0e0e0;
  border-radius: 4px;
  margin-bottom: 0.75rem;
  animation: shimmer 1.5s infinite;
}

.skeleton-line {
  height: 0.875rem;
  background: #e0e0e0;
  border-radius: 4px;
  margin-bottom: 0.5rem;
  animation: shimmer 1.5s infinite;
}

.skeleton-line:nth-child(2) { width: 100%; }
.skeleton-line:nth-child(3) { width: 90%; }
.skeleton-line:nth-child(4) { width: 75%; }

@keyframes shimmer {
  0% { opacity: 0.6; }
  50% { opacity: 1; }
  100% { opacity: 0.6; }
}

/* Load More Spinner */
.load-more {
  display: flex;
  justify-content: center;
  padding: 2rem 0;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #e0e0e0;
  border-top-color: #0066cc;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Error Banner */
.error-banner {
  text-align: center;
  padding: 1.5rem;
  color: #dc3545;
}

.error-banner p {
  margin-bottom: 0.75rem;
}

.error-banner button {
  padding: 0.5rem 1.5rem;
  font-size: 0.9375rem;
  background: #0066cc;
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

.error-banner button:hover {
  background: #0052a3;
}

/* Scroll-to-Top Button */
.scroll-top-btn {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: #0066cc;
  color: #fff;
  font-size: 1.25rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transition: background 0.2s, transform 0.2s, opacity 0.3s;
  z-index: 50;
}

.scroll-top-btn:hover {
  background: #0052a3;
  transform: scale(1.1);
}

/* Footer */
footer {
  text-align: center;
  padding: 1rem;
  color: #666;
  font-size: 0.875rem;
}

footer a {
  color: #0066cc;
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* RTL support */
[dir="rtl"] .feed-card-body {
  text-align: right;
}

[dir="rtl"] .feed-card-action {
  text-align: right;
}

/* Mobile responsive */
@media (max-width: 600px) {
  header {
    flex-direction: column;
    text-align: center;
  }

  header h1 {
    font-size: 1.25rem;
  }

  .selectors {
    width: 100%;
    flex-direction: column;
  }

  #language,
  #category {
    width: 100%;
  }

  main {
    padding: 0.5rem;
  }

  .feed-card-body {
    padding: 1rem;
  }

  .feed-card-title {
    font-size: 1.125rem;
  }

  .feed-card-extract {
    font-size: 0.875rem;
  }

  .feed-card-thumb {
    max-height: 200px;
  }

  .scroll-top-btn {
    bottom: 1rem;
    right: 1rem;
    width: 42px;
    height: 42px;
    font-size: 1rem;
  }
}
