/* Custom feeds: the row of feeds under the top bar, the feed editor, rules and popular feeds (js/pages/feeds.js). */

/* ---------- The feed row ---------- */

.feed-tabs {
  position: relative;
  z-index: 1;
  height: var(--feedbar-height);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
}

.feed-tabs__row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 100%;
  padding: 0 20px;
  overflow-x: auto;
  scrollbar-width: none;
}

.feed-tabs__tab,
.feed-tabs__add {
  display: flex;
  flex: none;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  color: var(--ink-soft);
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.feed-tabs__tab:hover,
.feed-tabs__add:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.feed-tabs__tab.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-text);
}

.feed-tabs__add {
  padding: 0 10px;
  border-style: dashed;
  color: var(--accent-text);
}

@media (max-width: 820px) {
  /* Centred when they fit, scrolling from the first feed when they don't. */
  .feed-tabs__row {
    justify-content: flex-start;
    padding: 0 16px;
  }
  .feed-tabs__row > :first-child {
    margin-left: auto;
  }
  .feed-tabs__row > :last-child {
    margin-right: auto;
  }
}

/* ---------- A custom feed's page ---------- */

.feed-header {
  display: grid;
  gap: 8px;
  padding: 18px 20px;
}

.feed-header__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.feed-header__name {
  font-size: 1.4rem;
}

.feed-header__update {
  color: var(--accent-text);
  font-size: 0.9rem;
}

.feed-header__update a {
  font-weight: 700;
  text-decoration: underline;
}

.feed-header__about summary,
.feed-social__parts summary,
.rule-editor__help summary {
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.feed-header__about ul {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

/* ---------- The editor ---------- */

.feed-editor__heading {
  margin-top: 8px;
  font-size: 1.05rem;
}

.feed-editor__basics {
  display: grid;
  gap: 14px;
  padding: 18px 20px;
}

/* Each social (Friends, Pulse, Forums, Business) in the editor, with its weight and its parts. */
.feed-social {
  display: grid;
  gap: 10px;
  padding: 16px 20px;
}

.feed-weights {
  display: flex;
  flex-wrap: nowrap;
}

.feed-weights .segmented__option {
  flex: 1;
  padding: 7px 0;
  text-align: center;
}

.feed-social__parts {
  display: grid;
  gap: 8px;
}

.feed-social__part {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}

.feed-social__part .feed-weights {
  width: min(260px, 100%);
}

.feed-social__part .feed-weights .segmented__option {
  padding: 5px 0;
  font-size: 0.8rem;
}

.feed-social__manage {
  color: var(--accent-text);
  font-size: 0.9rem;
  font-weight: 600;
}

.feed-update {
  display: grid;
  gap: 12px;
  padding: 18px 20px;
  border-color: var(--accent);
}

.feed-update__compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  font-size: 0.88rem;
}

.feed-update__compare ul {
  margin: 4px 0 0;
  padding-left: 18px;
  color: var(--ink-soft);
}

@media (max-width: 560px) {
  .feed-update__compare {
    grid-template-columns: 1fr;
  }
}

/* ---------- Rules: Simple and Code ---------- */

.rule-editor {
  display: grid;
  gap: 14px;
  padding: 4px;
}

.rule-editor__tabs {
  justify-self: start;
}

.rule-editor__body {
  display: grid;
  gap: 10px;
}

.rule-editor__rule {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-left: 3px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
}

.rule-editor__rule--more {
  border-left-color: var(--success);
}

.rule-editor__rule--less {
  border-left-color: #e0a420;
}

.rule-editor__rule--hide {
  border-left-color: var(--danger);
}

.rule-editor__sentence {
  font-weight: 600;
}

.rule-editor__sentence--draft {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.85rem;
  font-weight: 500;
}

.rule-editor__preview {
  margin-top: 4px;
  font-size: 0.85rem;
}

.rule-editor__preview ul {
  margin: 4px 0 0;
  padding-left: 18px;
  color: var(--ink-soft);
}

.rule-editor__builder {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.rule-editor__choice {
  display: grid;
  gap: 6px;
}

.rule-editor__label {
  color: var(--ink-soft);
  font-size: 0.85rem;
  font-weight: 600;
}

.rule-editor__chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.rule-editor__word {
  flex: 1;
  min-width: 140px;
  padding: 6px;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
}

.rule-editor__word:focus {
  outline: none;
}

.rule-editor__draft {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.rule-editor__code {
  min-height: 140px;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.88rem;
  line-height: 1.7;
}

.rule-editor__ok {
  color: var(--success);
  font-size: 0.88rem;
  font-weight: 600;
}

.rule-editor__problem {
  color: var(--danger);
  font-size: 0.88rem;
  font-weight: 600;
}

.rule-editor__help table {
  width: 100%;
  margin-top: 8px;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.rule-editor__help td {
  padding: 5px 8px 5px 0;
  border-top: 1px solid var(--line);
  vertical-align: top;
}

.rule-editor__help td:last-child {
  color: var(--ink-soft);
}

/* ---------- Popular feeds ---------- */

.feed-popular {
  display: grid;
  gap: 8px;
  padding: 16px 18px;
}

.feed-popular__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.feed-popular__rules {
  margin: 0;
  padding-left: 18px;
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.feed-mix__bar {
  display: flex;
  height: 8px;
  overflow: hidden;
  border-radius: 4px;
  background: var(--surface-sunken);
}

.feed-mix__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: 6px;
  color: var(--ink-faint);
  font-size: 0.8rem;
}

.feed-mix__legend i {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 4px;
  border-radius: 2px;
}

/* ---------- Settings → Feeds ---------- */

.feed-list {
  display: grid;
}

.feed-list__row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.feed-list__row:first-child {
  border-top: 0;
}

.feed-list__move {
  display: flex;
  flex-direction: column;
}

.feed-list__text {
  display: grid;
  flex: 1;
  min-width: 0;
}

.feed-list__text small {
  color: var(--ink-faint);
  font-size: 0.8rem;
}

.feed-tag {
  justify-self: start;
  display: inline-block;
  margin-right: 4px;
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  background: var(--surface-sunken);
  color: var(--ink-soft);
  font-size: 0.7rem;
  font-weight: 700;
}

.feed-tag--new {
  background: var(--accent-soft);
  color: var(--accent-text);
}

.feed-group {
  display: grid;
  gap: 8px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.feed-group__top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.feed-group__top .btn {
  margin-left: auto;
}

.feed-group__members {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.feed-group__add {
  width: auto;
  min-width: 160px;
}

.feed-group__new {
  display: flex;
  gap: 8px;
}
