/* The choice field and its layer (Tour 31/32). */

/* A closed field: a row you tap, never an input — so it summons no keyboard. */
.picker__control {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  min-height: 3rem;
  padding: 0.75rem 0.875rem;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  font-size: 1rem;
  text-align: left;
  color: var(--text-dark);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.picker__control:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
}

.picker__value {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Grey means "not answered yet"; a real answer — "Aucun" included — is black. */
.picker__value--empty {
  color: var(--text-muted);
}

.picker__chevron {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--text-muted);
}

/* ---- The layer ---- */

.picker-layer {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  transform: translateX(100%);
  transition: transform 0.2s cubic-bezier(0.32, 0.72, 0, 1);
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.picker-layer--open {
  transform: translateX(0);
}

@media (prefers-reduced-motion: reduce) {
  .picker-layer {
    transition: none;
  }
}

body.picker-layer-open {
  overflow: hidden;
}

.picker-layer__head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: calc(env(safe-area-inset-top, 0) + 0.75rem) 1rem 0.75rem;
  flex-shrink: 0;
}

.picker-layer__back {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  color: var(--text-dark);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.picker-layer__back svg {
  width: 22px;
  height: 22px;
}

/* The field's own name, nothing else: the layer has one job. */
.picker-layer__title {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-dark);
}

.picker-layer__step {
  flex-shrink: 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.picker-layer__search {
  position: relative;
  flex-shrink: 0;
  padding: 0 1rem 0.75rem;
}

.picker-layer__search-icon {
  position: absolute;
  left: 1.75rem;
  top: 0.75rem;
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

.picker-layer__field {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.5rem 0.875rem 0.5rem 2.5rem;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--bg-off-white);
  font-size: 1rem;
  color: var(--text-dark);
}

.picker-layer__field:focus {
  outline: none;
  border-color: var(--color-primary);
  background: var(--bg-surface);
}

/* Step-1 recap on a two-step pick. */
.picker-layer__context {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-off-white);
  flex-shrink: 0;
}

.picker-layer__context-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.picker-layer__context-value {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  color: var(--text-dark);
}

.picker-layer__context-action {
  border: none;
  background: none;
  padding: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-primary);
  cursor: pointer;
}

.picker-layer__list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  margin: 0;
  padding: 0 0 1rem;
  list-style: none;
  -webkit-overflow-scrolling: touch;
}

.picker-layer__group {
  padding: 1rem 1rem 0.375rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.picker-layer__empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-muted);
}

/* ---- A row: identical everywhere, whatever the list holds ---- */

.picker-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  min-height: 52px;
  padding: 0.5rem 1rem;
  border: none;
  border-bottom: 1px solid var(--border-light);
  background: none;
  font-size: 1rem;
  text-align: left;
  color: var(--text-dark);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.picker-row:active {
  background: var(--bg-off-white);
}

.picker-row--selected {
  background: rgba(var(--color-primary-rgb), 0.08);
}

.picker-row--disabled {
  color: var(--text-muted);
  cursor: default;
}

.picker-row--none {
  border-bottom: 4px solid var(--border-light);
}

.picker-row--create {
  color: var(--color-primary);
  font-weight: 600;
  border-bottom: none;
}

.picker-row--create:disabled {
  color: var(--text-muted);
  cursor: default;
}

.picker-row__icon {
  width: 28px;
  flex-shrink: 0;
  font-size: 1.25rem;
  line-height: 1;
  text-align: center;
}

/* No emoji in the name: the initial, never a generic glyph that would read as
   a category the app ships. */
.picker-row__icon--initial {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-off-white);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.picker-row__icon--create,
.picker-row__icon--none {
  color: currentColor;
}

.picker-row__label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.picker-row__meta {
  flex-shrink: 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* ---- Naming a person or an account: chips, never a list (Tour 30d) ---- */

/* One row, glued under the field: 40px that survive any keyboard. */
.name-chips {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.name-chips::-webkit-scrollbar {
  display: none;
}

.name-chip {
  flex-shrink: 0;
  min-height: 36px;
  padding: 0.375rem 0.75rem;
  border: 1px solid var(--border-default);
  border-radius: 999px;
  background: var(--bg-surface);
  font-size: 0.875rem;
  color: var(--text-dark);
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.name-chip:active {
  background: var(--bg-off-white);
}

.name-chip--all {
  border-style: dashed;
  color: var(--color-primary);
  font-weight: 600;
}
