/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: #333;
  background-color: #fafafa;
}

/* Typography for Traditional Chinese */
body, h1, h2, h3, h4, h5, h6, p, span, div {
  font-feature-settings: "liga", "kern";
  text-rendering: optimizeLegibility;
}

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

/* Header */
.header {
  background-color: #B92025;
  color: white;
  padding: 1.5rem 0;
  margin-bottom: 2rem;
}

.header h1 {
  font-size: 1.8rem;
  font-weight: 600;
}

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

.header a:hover {
  text-decoration: none;
  color: inherit;
}

/* Cards */
.card {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  padding: 1.5rem;
  margin-bottom: 1rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.card-clickable {
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

/* Grid layout for categories */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}


/* Buttons */
.btn {
  background-color: #B92025;
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  transition: background-color 0.2s ease;
}

.btn:hover {
  background-color: #a01d22;
}

.btn:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}


/* Loading */
.loading {
  text-align: center;
  padding: 2rem;
  color: #666;
}

/* Error */
.error {
  color: #B92025;
  text-align: center;
  padding: 1.5rem;
  background-color: #ffeaea;
  border: 1px solid #f5c6cb;
  border-radius: 8px;
  margin: 1rem 0;
}

.error p {
  margin: 0 0 1rem 0;
  font-size: 1rem;
  line-height: 1.4;
}

.error p:last-child {
  margin-bottom: 0;
}

.error .btn {
  margin-top: 1rem;
  padding: 0.75rem 1.5rem;
  font-size: 0.9rem;
}

/* Daily Quote Section */
.daily-quote-section {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  color: #333;
  margin: -2rem -1rem 2rem -1rem;
  padding: 2rem 1rem;
  text-align: center;
}

.daily-quote-content {
  max-width: 700px;
  margin: 0 auto;
  padding: 1.5rem;
}

.quote-text {
  font-size: 1.3rem;
  line-height: 1.25;
  margin-bottom: 1rem;
  font-weight: 400;
  color: #444;
  font-style: italic;
  white-space: pre-line;
}

.quote-source {
  font-size: 0.9rem;
  color: #666;
  font-weight: 500;
}

/* Content Sections */
.content-section {
  margin-bottom: 3rem;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #f0f0f0;
}

.section-header h2 {
  font-size: 1.4rem;
  color: #B92025;
  font-weight: 600;
}

.view-all-link {
  color: #B92025;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border: 1px solid #B92025;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.view-all-link:hover {
  background-color: #B92025;
  color: white;
}

/* Content Grid */
.content-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

/* Tabs */
.tabs-container {
  margin-bottom: 2rem;
  border-bottom: 1px solid #e0e0e0;
}

.tabs {
  display: flex;
  gap: 0;
}

.tab-button {
  background: none;
  border: none;
  padding: 1rem 2rem;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  color: #666;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
}

.tab-button:hover {
  color: #B92025;
  background-color: #f8f8f8;
}

.tab-button.active {
  color: #B92025;
  border-bottom-color: #B92025;
}

/* Articles List */
.articles-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

/* Individual Article Page */
.article-content {
  max-width: 800px;
  margin: 0 auto;
}

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

.article-header h1 {
  font-size: 2rem;
  font-weight: 700;
  color: #333;
  margin-bottom: 1rem;
  line-height: 1.3;
}

.article-meta {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  color: #666;
}

.article-featured-image {
  width: 100%;
  max-width: 600px;
  height: auto;
  border-radius: 12px;
  margin: 0 auto;
  display: block;
}

.article-excerpt {
  font-size: 1.1rem;
  line-height: 1.8;
  color: #444;
  margin-bottom: 2rem;
}

.article-actions {
  text-align: center;
  padding: 2rem 0;
  border-top: 1px solid #e0e0e0;
}

/* Loading More */
.loading-more {
  text-align: center;
  padding: 2rem;
  color: #666;
}

.loading-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid #e0e0e0;
  border-top: 2px solid #B92025;
  border-radius: 50%;
  margin: 0 auto 1rem;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.scroll-sentinel {
  height: 1px;
}

/* Breadcrumb */
.breadcrumb {
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

.breadcrumb a {
  color: #B92025;
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .container {
    padding: 0.75rem;
  }

  .categories-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  .content-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }


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

  .daily-quote-section {
    margin: -1.5rem -0.75rem 2rem -0.75rem;
    padding: 1.5rem 0.75rem;
  }

  .daily-quote-content {
    padding: 1rem;
  }

  .quote-text {
    font-size: 1.2rem;
    line-height: 1.25;
    margin-bottom: 1rem;
    font-weight: 400;
    color: #444;
    font-style: italic;
    white-space: pre-line;
  }

  .quote-source {
    font-size: 0.85rem;
  }

  .section-header {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
  }

  .section-header h2 {
    font-size: 1.2rem;
    flex: 1;
    min-width: 0;
  }

  .view-all-link {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .tab-button {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
  }

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

  .article-meta {
    flex-direction: column;
    gap: 0.5rem;
  }

  .articles-list {
    gap: 1rem;
  }

  .error {
    padding: 1rem;
    margin: 0.5rem 0;
  }

  .error p {
    font-size: 0.9rem;
  }

  .error .btn {
    padding: 0.6rem 1rem;
    font-size: 0.8rem;
  }
}