/* ═══════════════════════════════════════════
   TRANSPARENT FEED — FORMULA SETTINGS SCREEN
   MediaTea Design System: Dark mode, Glassmorphism
   ═══════════════════════════════════════════ */

:root {
  --bg:         #000000;
  --surface:    rgba(255,255,255,0.06);
  --surface-2:  rgba(255,255,255,0.10);
  --surface-3:  rgba(255,255,255,0.14);
  --border:     rgba(255,255,255,0.08);
  --border-2:   rgba(255,255,255,0.14);
  --text:       #f5f5f5;
  --text-2:     rgba(255,255,255,0.55);
  --text-3:     rgba(255,255,255,0.35);
  --purple:     #b590cc;
  --purple-dim: rgba(181,144,204,0.15);
  --purple-mid: rgba(181,144,204,0.35);

  /* Signal colors */
  --clr-authority:  #60a5fa;
  --clr-velocity:   #fb923c;
  --clr-recency:    #4ade80;
  --clr-diversity:  #2dd4bf;
  --clr-topics:     #a78bfa;
  --clr-publishers: #f472b6;

  --radius:     16px;
  --radius-sm:  10px;
  --radius-xs:  6px;
}

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

body {
  background: #111;
  font-family: 'Inter', -apple-system, sans-serif;
  color: var(--text);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  padding: 30px 20px;
  gap: 32px;
}

/* ═══ LEGEND PANEL ═══ */
.legend-panel {
  position: fixed;
  top: 30px;
  left: 30px;
  width: 280px;
  background: rgba(30,30,30,0.95);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  padding: 20px;
  backdrop-filter: blur(20px);
  z-index: 100;
}
.legend-title { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.legend-desc { font-size: 12px; color: var(--text-2); line-height: 1.5; margin-bottom: 12px; }
.legend-divider { height: 1px; background: var(--border-2); margin: 12px 0; }
.legend-features { display: flex; flex-direction: column; gap: 10px; }
.lf-item { display: flex; gap: 10px; align-items: flex-start; }
.lf-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 4px; flex-shrink: 0; }
.lf-label { font-size: 12px; font-weight: 600; display: block; }
.lf-sub { font-size: 11px; color: var(--text-3); display: block; line-height: 1.4; }
.legend-hint { font-size: 11px; color: var(--text-3); line-height: 1.5; font-style: italic; }

/* ═══ PHONE FRAME ═══ */
.prototype-wrapper {
  display: flex;
  justify-content: center;
  padding-top: 0;
}
.phone-frame {
  width: 393px;
  height: 852px;
  background: var(--bg);
  border-radius: 50px;
  border: 3px solid #333;
  position: relative;
  overflow: hidden;
  box-shadow: 0 25px 80px rgba(0,0,0,0.6);
}
.phone-notch {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 126px;
  height: 34px;
  background: #000;
  border-radius: 0 0 20px 20px;
  z-index: 50;
}
.phone-screen {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 47px;
}

/* ═══ SETTINGS HEADER ═══ */
.settings-header {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: 56px 20px 12px;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}
.settings-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.settings-back {
  font-size: 16px;
  color: var(--purple);
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}
.settings-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.3px;
}
.settings-save {
  font-size: 14px;
  color: var(--purple);
  background: none;
  border: none;
  cursor: pointer;
  font-weight: 600;
}

/* ═══ SCROLLABLE CONTENT ═══ */
.settings-scroll {
  height: calc(100% - 90px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 16px 40px;
  scroll-behavior: smooth;
}
.settings-scroll::-webkit-scrollbar { display: none; }

/* ═══ PRESET BAR ═══ */
.preset-bar {
  display: flex;
  gap: 0;
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 3px;
  margin: 16px 0 20px;
  border: 1px solid var(--border);
}
.preset-btn {
  flex: 1;
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
}
.preset-btn.active {
  background: var(--purple);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(181,144,204,0.3);
}

/* ═══ SECTION HEADERS ═══ */
.section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-3);
  margin: 24px 0 12px 4px;
}

/* ═══ PARAMETER CARD ═══ */
.param-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  transition: border-color 0.3s ease;
}
.param-card:hover {
  border-color: var(--border-2);
}

.param-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}
.param-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.param-icon svg {
  width: 18px;
  height: 18px;
}
.param-name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.2px;
}
.param-desc {
  font-size: 12px;
  color: var(--text-2);
  margin: 2px 0 14px 42px;
  line-height: 1.4;
}

/* ═══ SLIDER ═══ */
.slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 4px 0;
}
.slider-label-left,
.slider-label-right {
  font-size: 10px;
  color: var(--text-3);
  width: 44px;
  flex-shrink: 0;
}
.slider-label-right {
  text-align: right;
}
.slider-wrap {
  flex: 1;
  position: relative;
}
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  outline: none;
  cursor: pointer;
  background: var(--surface-2);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  cursor: pointer;
  transition: transform 0.15s ease;
}
input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}
input[type="range"]:active::-webkit-slider-thumb {
  transform: scale(1.2);
}

.slider-value {
  font-size: 20px;
  font-weight: 700;
  width: 30px;
  text-align: center;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

/* ═══ RUBRIC (always visible, de-emphasized) ═══ */
.rubric {
  margin: 10px 0 0 0;
  padding: 10px 12px;
  background: rgba(255,255,255,0.03);
  border-radius: var(--radius-xs);
  border: 1px solid rgba(255,255,255,0.04);
}
.rubric-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 6px;
}
.rubric-items {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
}
.rubric-item {
  font-size: 11px;
  color: var(--text-3);
  white-space: nowrap;
}
.rubric-item .pts {
  font-weight: 600;
  color: var(--text-2);
}

/* ═══ TOPIC + PUBLISHER TOGGLE SELECTOR ═══ */
.topics-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.topic-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.topic-name {
  font-size: 14px;
  font-weight: 500;
  flex-shrink: 0;
}

/* ═══ TRI-TOGGLE — 3 visible options side by side ═══ */
.tri-toggle {
  display: flex;
  background: rgba(255,255,255,0.05);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
  border: 1px solid var(--border);
}
.tri-toggle-btn {
  padding: 5px 10px;
  border: none;
  background: transparent;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.25s ease;
  font-family: inherit;
  min-width: 52px;
  text-align: center;
}
.tri-toggle-btn.active-low {
  background: rgba(251,146,60,0.15);
  color: #fb923c;
  font-weight: 600;
}
.tri-toggle-btn.active-mod {
  background: rgba(255,255,255,0.10);
  color: var(--text);
  font-weight: 600;
}
.tri-toggle-btn.active-high {
  background: var(--purple-dim);
  color: var(--purple);
  font-weight: 600;
}

/* ═══ PUBLISHER PREFERENCE SECTION ═══ */
.publisher-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.publisher-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.pub-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.pub-info {
  flex: 1;
  min-width: 0;
}
.pub-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pub-factual {
  font-size: 10px;
  color: var(--text-3);
  margin-top: 1px;
}
.pub-factual .factual-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 3px;
  vertical-align: middle;
}
.factual-dot.very-high { background: #22c55e; }
.factual-dot.high { background: #4ade80; }
.factual-dot.mostly { background: #facc15; }
.factual-dot.mixed { background: #f97316; }

/* ═══ PUBLISHER TRI-TOGGLE ═══ */
.pub-toggle {
  display: flex;
  background: rgba(255,255,255,0.05);
  border-radius: 7px;
  padding: 2px;
  gap: 1px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.pub-toggle-btn {
  padding: 4px 7px;
  border: none;
  background: transparent;
  color: var(--text-3);
  font-size: 10px;
  font-weight: 500;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.25s ease;
  font-family: inherit;
  white-space: nowrap;
}
.pub-toggle-btn.active-fav {
  background: rgba(250,204,21,0.15);
  color: #facc15;
  font-weight: 600;
}
.pub-toggle-btn.active-neutral {
  background: rgba(255,255,255,0.10);
  color: var(--text);
  font-weight: 600;
}
.pub-toggle-btn.active-less {
  background: rgba(251,146,60,0.15);
  color: #fb923c;
  font-weight: 600;
}
.pub-toggle-btn.active-block {
  background: rgba(239,68,68,0.15);
  color: #ef4444;
  font-weight: 600;
}

/* ═══ LOAD MORE ═══ */
.load-more-btn {
  width: 100%;
  padding: 12px;
  border: 1px dashed var(--border-2);
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  margin-top: 8px;
}
.load-more-btn:hover {
  background: var(--surface);
  color: var(--text);
}

/* ═══ SAVE PRESET BUTTON ═══ */
.save-preset-wrap {
  margin: 28px 0 30px;
}
.save-preset-btn {
  width: 100%;
  padding: 14px;
  background: var(--purple-dim);
  border: 1px solid var(--purple-mid);
  color: var(--purple);
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.25s ease;
  font-family: inherit;
}
.save-preset-btn:hover {
  background: var(--purple-mid);
}

/* ═══ TOAST ═══ */
.toast {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(40,40,40,0.95);
  border: 1px solid var(--border-2);
  border-radius: 12px;
  padding: 12px 20px;
  backdrop-filter: blur(20px);
  z-index: 200;
  transition: transform 0.4s cubic-bezier(0.34,1.2,0.64,1);
  pointer-events: none;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
}
.toast-text {
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
}

/* ═══ COLOR UTILITIES ═══ */
.bg-authority  { background: rgba(96,165,250,0.15); }
.bg-velocity   { background: rgba(251,146,60,0.15); }
.bg-recency    { background: rgba(74,222,128,0.15); }
.bg-diversity  { background: rgba(45,212,191,0.15); }
.bg-topics     { background: rgba(167,139,250,0.15); }
.bg-publishers { background: rgba(244,114,182,0.15); }

.clr-authority  { color: var(--clr-authority); }
.clr-velocity   { color: var(--clr-velocity); }
.clr-recency    { color: var(--clr-recency); }
.clr-diversity  { color: var(--clr-diversity); }
.clr-topics     { color: var(--clr-topics); }
.clr-publishers { color: var(--clr-publishers); }

/* ═══ SLIDER TRACK COLORING ═══ */
input[type="range"].slider-authority { accent-color: var(--clr-authority); }
input[type="range"].slider-velocity { accent-color: var(--clr-velocity); }
input[type="range"].slider-recency  { accent-color: var(--clr-recency); }
input[type="range"].slider-diversity { accent-color: var(--clr-diversity); }
input[type="range"].slider-topics   { accent-color: var(--clr-topics); }
input[type="range"].slider-publishers { accent-color: var(--clr-publishers); }

/* ═══ RESPONSIVE ═══ */
@media (max-width: 800px) {
  .legend-panel { display: none; }
  body { padding: 10px; }
}
