:root {
  --bg: #f6f6ef;
  --fg: #333;
  --link: #0000cc;
  --visited: purple;
  --muted: #666;
  --border: #d6d6d6;
  --button-bg: #ffffff;
  --input-bg: #fff;
  --input-border: #ccc;
}

body {
  font-family: Arial, Helvetica, sans-serif;
  margin: 2em auto;
  max-width: 600px; 
  background: var(--bg);
  color: var(--fg);
  transition: background 0.3s ease, color 0.3s ease;
}

.favicon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  border-radius: 4px;
  background-color: var(--fg);
}

#refresh-button {
  margin: 1rem 0;
  padding: 0.5rem 1rem;
  font-size: 1rem;
  color: var(--fg);
  background-color: var(--button-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s ease, color 0.3s ease;
}

#refresh-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

#search {
  display: block;
  margin-bottom: 1rem;
  padding: 0.5rem;
  font-size: 1rem;
  width: 100%;
  max-width: 580px;
  background-color: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 4px;
  color: var(--fg);
}

.last-updated, .next-update {
  margin: 0.5rem 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.loading-indicator {
  text-align: center;
  color: var(--muted);
  margin: 1rem 0;
}

h1 {
  font-size: 24px;
  border-bottom: 1px solid var(--border);
}

ul {
  list-style: none;
  padding: 0;
}

li {
  margin-bottom: 1em;
}

a {
  text-decoration: none;
  color: var(--link);
  font-weight: lighter;
}

a:hover {
  text-decoration: underline;
}

a.feed-link:visited {
  color: var(--muted);
}

.footer {
  text-align: center;
  margin-top: 1em;
}

.cache-status {
  margin-top: 0.3em;
  font-size: 0.85em;
  color: var(--muted);
  transition: opacity 0.3s ease;
}

.toast {
  position: fixed;
  bottom: 1em;
  right: 1em;
  padding: 0.8em 1.2em;
  border-radius: 0.5em;
  font-size: 0.9em;
  box-shadow: 0 0.5em 1em rgba(0,0,0,0.3);
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.4s ease, transform 0.4s ease;
  pointer-events: none;
  z-index: 1000;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

small, .meta {
  color: var(--muted);
  font-size: 0.9em;
}

.updated-label {
  color: var(--link);
  text-transform: uppercase;
}

/* LIGHT THEME */
body.light {
  --bg: #f6f6ef;
  --fg: #333;
  --link: #0000cc;
  --muted: #666;
  --border: #d6d6d6;
  --button-bg: #ffffff;
  --input-bg: #fff;
  --input-border: #ccc;
}

body.light .toast {
  background: #333;
  color: #fff;
}

/* DARK THEME */
body.dark {
  --bg: #1c1c1c;
  --fg: #eeeeee;
  --link: #4ea1ff;
  --muted: #999;
  --border: #444;
  --button-bg: #333;
  --input-bg: #2a2a2a;
  --input-border: #444;
}

body.dark .toast {
  background: #eee;
  color: #111;
}

/* ROSE PINE DAWN */
body.rosepine-dawn {
  --bg: #faf4ed;
  --fg: #575279;
  --link: #286983;
  --muted: #9893a5;
  --border: #d9a3c5;
  --button-bg: #f3ede6;
  --input-bg: #f3ede6;
  --input-border: #d9a3c5;
}

body.rosepine-dawn .toast {
  background: #d4b2c8;
  color: #191724;
}

/* ROSE PINE MOONLIGHT */
body.rosepine-moonlight {
  --bg: #232236;
  --fg: #f5f0fa;
  --link: #88c0d0;
  --muted: #72738c;
  --border: #ea9b97;
  --button-bg: #302e49;
  --input-bg: #302e49;
  --input-border: #ea9b97;
}

body.rosepine-moonlight .toast {
  background: #2e2d3a;
  color: #f5f0fa;
}

/* GRUVBOX LIGHT */
body.gruvbox-light {
  --bg: #fbf1c7;
  --fg: #3c3836;
  --link: #b57614;
  --muted: #928374;
  --border: #ebdbb2;
  --button-bg: #f9f5d7;
  --input-bg: #f9f5d7;
  --input-border: #ebdbb2;
}

body.gruvbox-light .toast {
  background: #b57614;
  color: #fffbe7;
}

/* GRUVBOX DARK */
body.gruvbox-dark {
  --bg: #282828;
  --fg: #ebdbb2;
  --link: #fabd2f;
  --muted: #a89984;
  --border: #504945;
  --button-bg: #3c3836;
  --input-bg: #3c3836;
  --input-border: #504945;
}

body.gruvbox-dark .toast {
  background: #fabd2f;
  color: #282828;
}

.title-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5em;
}

.theme-selector select {
  padding: 0.5em;
  font-size: 1em;
  background-color: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--fg);
  border-radius: 5px;
}

/* Pagination */
#pagination {
  display: flex;
  justify-content: center;
  margin-top: 1em;
  gap: 0.5em;
}

#pagination button {
  padding: 0.5rem 1rem;
  font-size: 1rem;
  color: var(--fg);
  background-color: var(--button-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s ease, color 0.3s ease;
}

#pagination button:hover {
  background-color: var(--link);
  color: #fff;
}

#pagination button.active {
  background-color: var(--link);
  color: white;
  font-weight: bold;
}

#pagination button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.site-url {
  color: var(--link);
  text-decoration: none;
  font-size: 0.9em;
  font-weight: 400;
}

.site-url:hover {
  text-decoration: underline;
}

.new-posts-separator {
  list-style: none;
  margin: 1em 0 1em 0;
  padding: 0;
  text-align: center;
}

.separator-line {
  display: flex;
  align-items: center;
  text-align: center;
  width: 100%;
  color: var(--muted);
}

.separator-line::before,
.separator-line::after {
  content: "";
  flex: 1;
  border-bottom: 2px solid var(--muted);
  opacity: 0.3;
}

.separator-line span {
  white-space: nowrap;
  background: var(--bg);
  padding: 0 1em;
  border-radius: 1em;
}

/* Responsive */
@media (max-width: 768px) {
  body {
    font-size: 0.9rem;
  }

  .title-bar {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .title-bar h1 {
    font-size: 1.8rem;
  }

  #refresh-button {
    font-size: 0.9rem;
    padding: 0.4rem 0.8rem;
  }

  #pagination button {
    font-size: 0.8rem;
    padding: 0.3rem 0.6rem;
  }

  .theme-selector select {
    font-size: 0.9rem;
  }

  .feed-content {
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .title-bar h1 {
    font-size: 1.5rem;
  }

  #search {
    margin-left: 10px;
    width: 335px;
  }

  #refresh-button {
    font-size: 0.8rem;
    padding: 0.3rem 0.6rem;
  }

  #pagination button {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
  }

  .theme-selector select {
    font-size: 0.8rem;
  }

  .feed-content {
    font-size: 0.8rem;
    margin-right: 10px;
  }

  .favicon {
    margin-left: 10px;
  }
}
