:root {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --border: #2a2a2a;
  --text: #e8e8e8;
  --muted: #888;
  --accent: #c9a227;
  --accent-hover: #e0b82e;
  --font-sans: "DM Sans", system-ui, sans-serif;
  --font-serif: "Newsreader", Georgia, serif;

  /* New breaking news colors, derived from brand color #ead0ad */
  --breaking-bg: #82281e; /* A deep, serious red-brown */
  --breaking-text: #ead0ad;
  --breaking-badge-color: #EF4444;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1.5rem 2rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}

.header h1 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.tagline {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.last-updated {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-left: auto;
}

.view-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.view-toggle .tab {
  padding: 0.4rem 0.75rem;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  background: transparent;
  border: none;
  cursor: pointer;
}

.view-toggle .tab:hover {
  color: var(--text);
}

.view-toggle .tab.tab-active {
  color: var(--bg);
  background: var(--accent);
}

.btn-refresh, .btn-breaking-sample {
  padding: 0.5rem 1rem;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--bg);
  background: var(--accent);
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.btn-refresh:hover, .btn-breaking-sample:hover {
  background: var(--accent-hover);
}

.main {
  max-width: 52rem;
  margin: 0 auto;
  padding: 2rem;
  position: relative;
}

.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.5rem 1rem;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 6px;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 500;
  z-index: 100;
  transition: opacity 0.3s ease;
}

.toast.toast-fade {
  opacity: 0;
}

.loading,
.error {
  text-align: center;
  padding: 2rem;
  color: var(--muted);
}

.error {
  color: #d66;
}

.sections {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.news-section {
  margin: 0;
}

.section-title {
  margin: 0 0 1rem;
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: -0.02em;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  width: 10;
}

.articles {
  list-style: none;
  margin: 0;
  padding: 0;
}

.empty-state {
  padding: 1.5rem 0;
  color: var(--muted);
  font-style: italic;
}

.article {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.article:first-child {
  padding-top: 0;
}

/* Breaking news preset: red background + badge */
.article--breaking {
  background: var(--breaking-bg);
  border-left: 4px solid var(--breaking-badge-color);
  margin: 0 -0.5rem;
  padding: 1rem 0.5rem 1.25rem 1.5rem;
  border-radius: 0 6px 6px 0;
  border-bottom-color: rgba(180, 40, 45, 0.4);
}

.article__breaking-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #fff;
  background: var(--breaking-badge-color);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  margin-bottom: 0.5rem;
}

.ai-content--breaking {
  border: 2px solid var(--breaking-badge-color);
  background: var(--breaking-bg);
}

.ai-content--breaking .article__breaking-badge {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 2;
  margin-bottom: 0;
}

.source {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  margin-bottom: 0.35rem;
}

.article a {
  color: inherit;
  text-decoration: none;
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.4;
  display: block;
}

.article a:hover {
  text-decoration: underline;
  color: var(--accent);
}

.article-rtl a,
.article-rtl .description {
  text-align: right;
  font-size: 1.05rem;
}

.description {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.5;
}

.meta {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.meta time {
  font-variant-numeric: tabular-nums;
}

/* AI-generated content (image + Persian summary) */
.ai-content {
  position: relative;
  background: var(--surface);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 2rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.ai-content .image-container {
  width: 100%;
  aspect-ratio: 675 / 1200;
  position: relative;
  background: #000;
}

.ai-content img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ai-content .ai-description {
  padding: 1.5rem 1rem;
  text-align: right;
  font-size: 1.1rem;
  line-height: 1.7;
  color: var(--text);
  font-family: var(--font-serif);
  max-width: 100%;
  min-width: 0;
}

.ai-content .ai-description a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.ai-content .ai-description a:hover {
  text-decoration: underline;
}

.ai-content .ai-source {
  font-size: 0.9rem;
  color: var(--muted);
  text-align: right;
  margin-top: 1.75rem;
}

.ai-content .btn-regenerate {
  display: block;
  margin: 0 0 0.75rem auto;
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--bg);
  background: var(--accent);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
}

.ai-content .btn-regenerate:hover {
  background: var(--accent-hover);
}

.ai-content .ai-title {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 700;
  text-align: right;
  direction: rtl;
  margin-bottom: 0.75rem;
  color: var(--accent);
  word-wrap: break-word;
  overflow-wrap: break-word;
  width: 100%;
}

/* Breaking news sample card styling */
.breaking-sample-container {
  background: var(--surface);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 2rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.breaking-sample-card {
  background: var(--breaking-bg);
  border: none;
}

.breaking-sample-card .ai-title {
  color: var(--breaking-text);
  font-size: 1.8rem; /* Make breaking title larger */
}

.breaking-sample-card .ai-description p {
  color: var(--breaking-text);
}

.breaking-sample-card .ai-source {
  color: rgba(255, 255, 255, 0.7);
}
