/* ============================================================
   Переключатели и выпадающие меню (js/controls.js)
   One quiet look for every switch: the pink gradient stays for the screen's
   main button only.
   ============================================================ */

/* ---------- segmented: soft thumb slides under the chosen option ---------- */

.pills.seg {
  position: relative;
  gap: 0;
  padding: 4px;
  border-radius: 999px;
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}
.pills.seg .pill {
  position: relative;
  z-index: 1;
  flex: 1 1 0;
  min-width: 0;
  padding: 9px 10px;
  background: none;
  box-shadow: none;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color var(--dur-fast) var(--ease-out), transform var(--dur-press) var(--ease-out);
}
.pills.seg .pill.active { background: none; box-shadow: none; color: var(--pink-deep); }
.pills.seg .pill:active { transform: scale(0.97); }

.seg-thumb {
  position: absolute;
  top: 4px; bottom: 4px; left: 0;
  width: 0;
  border-radius: 999px;
  background: var(--pink-soft);
  pointer-events: none;
  transition:
    transform 380ms cubic-bezier(0.34, 1.32, 0.64, 1),
    width 380ms cubic-bezier(0.34, 1.32, 0.64, 1);
}
.seg-instant .seg-thumb { transition: none; }

/* ---------- text tabs: an underline slides under the chosen one ---------- */

.pills.tabs-line {
  position: relative;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px;
  border-bottom: 1px solid var(--divider);
  overflow-x: auto;
  scrollbar-width: none;
}
.pills.tabs-line::-webkit-scrollbar { display: none; }
.pills.tabs-line .pill {
  flex: 0 0 auto;
  padding: 8px 0 11px;
  border-radius: 0;
  background: none;
  box-shadow: none;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  transition: color var(--dur-fast) var(--ease-out);
}
.pills.tabs-line .pill.active { background: none; box-shadow: none; color: var(--text); }
.pills.tabs-line .pill:active { transform: none; opacity: 0.7; }
.pills.tabs-line .seg-thumb {
  top: auto; bottom: 0;
  height: 3px;
  border-radius: 3px;
  background: var(--pink);
  transition:
    transform 320ms var(--ease-out),
    width 320ms var(--ease-out);
}

/* ---------- small chip buttons and their menu ---------- */

.chip-row {
  position: relative;
  display: flex;
  gap: 8px;
  align-items: center;
}
.chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px 0 12px;
  border: none;
  border-radius: 999px;
  background: var(--panel);
  box-shadow: var(--shadow-sm);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  transition: transform var(--dur-press) var(--ease-out), background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.chip-btn:active { transform: scale(0.96); }
.chip-btn svg { width: 17px; height: 17px; color: var(--pink-deep); flex: none; }
.chip-btn .chip-chev { width: 14px; height: 14px; color: var(--muted); transition: transform var(--dur-fast) var(--ease-out); }
.chip-btn[aria-expanded="true"] .chip-chev { transform: rotate(180deg); }
/* a toggle chip that is on */
.chip-btn.on { background: var(--pink-soft); color: var(--pink-deep); box-shadow: none; }

.chip-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  min-width: 190px;
  display: flex;
  flex-direction: column;
  padding: 6px;
  border-radius: var(--r-md);
  background: var(--panel);
  box-shadow: var(--shadow-lg), 0 0 0 1px var(--line);
  transform-origin: top left;
  opacity: 0;
  transform: scale(0.96) translateY(-4px);
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 180ms var(--ease-out),
    transform 220ms var(--ease-out),
    visibility 0s linear 220ms;
}
.chip-menu.open {
  opacity: 1;
  transform: none;
  visibility: visible;
  pointer-events: auto;
  transition:
    opacity 180ms var(--ease-out),
    transform 220ms var(--ease-out),
    visibility 0s;
}
/* on dark the cards are --panel too: lift the menu one step */
:root[data-theme="dark"] .chip-menu { background: var(--panel-soft); }
.chip-menu-center {
  left: 50%;
  width: min(340px, 100%);
  transform-origin: top center;
  margin-left: calc(min(340px, 100%) / -2);
  gap: 6px;
}
.chip-menu > button:not(.pill):not(.chip-menu-link) {
  border: none;
  background: none;
  text-align: left;
  padding: 11px 12px;
  border-radius: var(--r-sm);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.chip-menu > button:not(.pill):active { background: var(--pink-tint); }
.chip-menu > button.active { color: var(--pink-deep); }
.chip-menu > button.active::after { content: "✓"; float: right; font-weight: 800; }
.chip-menu .pills.seg { box-shadow: none; background: var(--panel-soft); }
.chip-menu-link {
  border: none;
  background: none;
  padding: 8px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--pink-deep);
}
