/* ==========================================================================
   Reusable components: buttons, inputs, cards, avatars, pills.
   ========================================================================== */

/* ----------------------------------------------------------------- buttons */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 22px;
  border: 0;
  border-radius: var(--radius-pill);
  font-size: 15px;
  font-weight: 600;
  transition: transform 0.12s ease, opacity 0.16s ease, background 0.16s ease;
}

.button:active {
  transform: scale(0.98);
}

.button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.button--primary {
  background: var(--action-fill);
  color: var(--on-primary, #fff);
  box-shadow: 0 6px 20px var(--accent-glow);
}

.button--ghost {
  background: var(--surface-raised);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}

.button--danger {
  background: rgba(244, 63, 94, 0.16);
  color: #ffb3c0;
  border: 1px solid rgba(244, 63, 94, 0.4);
}

.button--block {
  width: 100%;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  color: var(--text-muted);
  transition: background 0.16s ease, color 0.16s ease;
}

.icon-button:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.avatar-button {
  padding: 0;
  background: none;
  border: 0;
  line-height: 0;
}

.link {
  background: none;
  border: 0;
  padding: 0;
  color: var(--accent-soft);
  font-weight: 600;
  font-size: 14px;
}

.link:hover {
  text-decoration: underline;
}

/* ------------------------------------------------------------------ inputs */
.input {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border-soft);
  color: var(--text);
  transition: border-color 0.16s ease, background 0.16s ease;
}

.input::placeholder {
  color: var(--text-dim);
}

.input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface-raised);
}

.input.is-invalid {
  border-color: var(--danger);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field--inline {
  position: relative;
}

.field__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.field__hint {
  font-size: 12px;
  color: var(--text-dim);
}

.field__error {
  font-size: 12.5px;
  color: #ff8fa3;
}

.field__counter {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: var(--text-dim);
  pointer-events: none;
}

.search {
  position: relative;
  display: flex;
  align-items: center;
}

.search__icon {
  position: absolute;
  left: 16px;
  color: var(--text-dim);
  pointer-events: none;
}

.search__input {
  width: 100%;
  padding: 14px 16px 14px 46px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--border-soft);
  color: var(--text);
}

.search__input:focus {
  outline: none;
  border-color: var(--accent);
}

.search__input::placeholder {
  color: var(--text-dim);
}

/* ------------------------------------------------------------------- cards */
.card {
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card__head {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--accent-soft);
}

.card__head h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.card__hint {
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--text-dim);
}

/* Square picker with a dashed frame and a camera badge, as in the create-room mockup. */
.image-picker {
  position: relative;
  align-self: center;
  width: 156px;
  height: 156px;
  padding: 6px;
  border-radius: 22px;
  border: 1.5px dashed var(--accent);
  background: none;
  color: var(--text-muted);
}

.image-picker__preview,
.image-picker__empty {
  width: 100%;
  height: 100%;
  border-radius: 16px;
}

.image-picker__preview {
  display: block;
  object-fit: cover;
}

.image-picker__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--surface-raised);
  font-size: 13px;
}

.image-picker__badge {
  position: absolute;
  left: 50%;
  bottom: 14px;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: rgba(10, 6, 24, 0.7);
  border: 1px solid var(--border);
  color: #fff;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ----------------------------------------------------------------- avatars */
/* The root is unclipped so the status dot can sit on the rim; only the inner
   media element clips the image to a circle. */
.avatar {
  position: relative;
  display: inline-block;
  flex: none;
  border-radius: 50%;
  color: #fff;
  font-weight: 700;
  line-height: 1;
}

.avatar__media {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(145deg, hsl(var(--avatar-hue, 265) 70% 58%), hsl(var(--avatar-hue, 265) 65% 38%));
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Sized in px by the component so it scales with the avatar, not the page. */
.avatar__initial {
  font-size: 1em;
  line-height: 1;
}

.avatar--speaking {
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.avatar--host {
  box-shadow: 0 0 0 3px var(--gold);
}

.avatar__status {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 26%;
  height: 26%;
  min-width: 10px;
  min-height: 10px;
  border-radius: 50%;
  background: var(--success);
  border: 2px solid var(--bg);
  box-sizing: content-box;
}

.avatar-stack {
  display: inline-flex;
  align-items: center;
}

.avatar-stack .avatar__media,
.avatar-stack__more {
  border: 2px solid var(--surface);
}

.avatar-stack .avatar,
.avatar-stack__more {
  margin-right: -10px;
}

.avatar-stack__more {
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-hover);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
}

/* ----------------------------------------------------------- pills & chips */
.pill {
  min-height: 32px;
  padding: 4px 11px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--border-soft);
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.16s ease, color 0.16s ease;
}

.pill.is-active {
  background: var(--action-fill);
  border-color: transparent;
  color: var(--on-primary, #fff);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: var(--radius-pill);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
}

.chip--gold {
  color: var(--gold);
  border-color: rgba(251, 191, 36, 0.35);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.level-chip {
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  background: rgba(58, 148, 244, 0.18);
  color: var(--accent-soft);
  font-size: 12px;
  font-weight: 700;
}

.tab-bar {
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--border-soft);
}

.tab {
  flex: 1;
  min-height: 36px;
  padding: 5px 8px;
  border: 0;
  border-radius: var(--radius-pill);
  background: none;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  transition: background 0.16s ease, color 0.16s ease;
}

.tab.is-active {
  background: var(--action-fill);
  color: var(--on-primary, #fff);
}

/* Horizontal rails scroll rather than forcing the page to scroll sideways. */
.filter-rail,
.category-rail {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.filter-rail::-webkit-scrollbar,
.category-rail::-webkit-scrollbar {
  display: none;
}

.category-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 0;
  background: none;
  border: 0;
  color: var(--text-muted);
  font-size: 12.5px;
}

.category-chip__icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 18px;
  background: var(--surface-raised);
  border: 1px solid var(--border-soft);
  font-size: 24px;
}

/* --------------------------------------------------------------- selectors */
.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 10px;
}

.choice-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 8px;
  border-radius: var(--radius);
  background: var(--surface-raised);
  border: 1.5px solid transparent;
  color: var(--text-muted);
  font-size: 13px;
}

.choice-tile__icon {
  font-size: 22px;
}

.choice-tile.is-selected {
  border-color: var(--accent);
  background: rgba(58, 148, 244, 0.16);
  color: var(--text);
}

.choice-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.choice-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--surface-raised);
  border: 1.5px solid transparent;
  color: var(--text-muted);
  text-align: left;
}

.choice-card strong {
  display: block;
  color: var(--text);
  font-size: 14.5px;
}

.choice-card span span,
.choice-card__body span {
  font-size: 12.5px;
}

.choice-card.is-selected {
  border-color: var(--accent);
  background: rgba(58, 148, 244, 0.16);
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--border-soft);
}

.card .setting-row:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.setting-row__hint {
  font-size: 12.5px;
  color: var(--text-dim);
}

.stepper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stepper__button {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 18px;
  line-height: 1;
}

.stepper__value {
  min-width: 34px;
  text-align: center;
  font-weight: 700;
}

.switch {
  position: relative;
  width: 52px;
  height: 30px;
  flex: none;
  border-radius: var(--radius-pill);
  background: var(--surface-hover);
  border: 1px solid var(--border);
  transition: background 0.18s ease;
}

.switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.18s ease;
}

.switch.is-on {
  background: var(--accent);
  border-color: transparent;
}

.switch.is-on::after {
  transform: translateX(22px);
}

/* ------------------------------------------------------------- menu rows */
.menu-list {
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border-soft);
  overflow: hidden;
}

.menu-row {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  padding: 15px 16px;
  background: none;
  border: 0;
  border-top: 1px solid var(--border-soft);
  text-align: left;
  color: var(--text);
}

.menu-row:first-child {
  border-top: 0;
}

.menu-row:hover {
  background: var(--surface-hover);
}

.menu-row__icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 12px;
  background: rgba(58, 148, 244, 0.16);
  color: var(--accent-soft);
}

.menu-row__body {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.menu-row__body span {
  font-size: 12.5px;
  color: var(--text-dim);
}

.menu-row__chevron {
  color: var(--text-dim);
}
