/* inoff. Reusable Searchable Entity Picker Modal (#116 prototype)
   Full-screen on mobile (<768px), centered responsive dialog on desktop (>=768px).
   Cream surface (#fdf9f0), white list cards (#ffffff), dotted separators, shared outline icons. */

.epm-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1400;
  background: rgba(28, 28, 22, 0.42);
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 0;
  overscroll-behavior: contain;
}

.epm-backdrop.hidden {
  display: none;
}

.epm-dialog {
  position: fixed;
  left: 0;
  right: 0;
  top: var(--epm-top, 0px);
  height: var(--epm-vh, 100dvh);
  width: 100%;
  background: #fdf9f0;
  color: #1c1c16;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  outline: none;
  font-family: 'Sora', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.epm-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px max(14px, env(safe-area-inset-right, 14px)) 10px max(16px, env(safe-area-inset-left, 16px));
  background: #fdf9f0;
  border-bottom: 1px solid #e6e0d4;
}

.epm-title-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.epm-title-icon {
  color: #47626c;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.epm-title {
  margin: 0;
  font-family: 'Oswald', 'Arial Narrow', system-ui, sans-serif;
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #1c1c16;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.epm-close {
  width: 44px;
  height: 44px;
  border-radius: 9999px;
  border: 1px solid #d8d0c0;
  background: #ffffff;
  color: #47626c;
  font-size: 22px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.epm-close:hover,
.epm-close:focus-visible {
  background: #f3efe6;
  color: #1c1c16;
  outline: 2px solid #47626c;
  outline-offset: 2px;
}

.epm-search-bar {
  flex: 0 0 auto;
  padding: 10px max(16px, env(safe-area-inset-right, 16px)) 10px max(16px, env(safe-area-inset-left, 16px));
  background: #fdf9f0;
  border-bottom: 1px solid #ece6da;
}

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

.epm-search-icon {
  position: absolute;
  left: 13px;
  color: #47626c;
  pointer-events: none;
  display: inline-flex;
  align-items: center;
}

.epm-search-input {
  width: 100%;
  min-height: 46px;
  padding: 10px 44px 10px 40px;
  border-radius: 12px;
  border: 1px solid #d8d0c0;
  background: #ffffff;
  color: #1c1c16;
  font-family: inherit;
  font-size: 16px;
  line-height: 1.3;
  -webkit-appearance: none;
  appearance: none;
}

.epm-search-input:focus {
  outline: 2px solid #47626c;
  outline-offset: 1px;
  border-color: #47626c;
}

.epm-search-clear {
  position: absolute;
  right: 4px;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 9999px;
  background: transparent;
  color: #47626c;
  font-size: 20px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.epm-search-clear.hidden {
  display: none;
}

.epm-search-clear:hover,
.epm-search-clear:focus-visible {
  background: #f3efe6;
  color: #1c1c16;
}

.epm-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 12px max(16px, env(safe-area-inset-right, 16px)) 24px max(16px, env(safe-area-inset-left, 16px));
}

.epm-section-label {
  margin: 0 0 8px 2px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #47626c;
}

.epm-notice {
  margin: 0 0 10px;
  padding: 9px 12px;
  border-radius: 10px;
  background: #f3efe6;
  border: 1px solid #e2dacb;
  color: #59413a;
  font-size: 13px;
  line-height: 1.4;
}

.epm-list {
  background: #ffffff;
  border: 1px solid #d8d0c0;
  border-radius: 14px;
  box-shadow: 0 2px 8px rgba(28, 28, 22, 0.04);
  overflow: hidden;
}

.epm-row {
  width: 100%;
  min-height: 50px;
  padding: 11px 14px;
  border: none;
  background: transparent;
  color: #1c1c16;
  font-family: inherit;
  font-size: 15px;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  transition: background-color 0.12s ease;
}

.epm-row + .epm-row {
  border-top: 1px dotted #d8d0c0;
}

.epm-row:hover,
.epm-row:focus-visible {
  background: #f7f3ea;
  outline: none;
}

.epm-row.is-selected {
  background: #fcf6ec;
}

.epm-row-name {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 500;
  line-height: 1.3;
  overflow-wrap: break-word;
}

.epm-row.is-selected .epm-row-name {
  font-weight: 700;
}

.epm-row-right {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 1 42%;
  min-width: 0;
  text-align: right;
}

.epm-row-loc {
  font-size: 12px;
  font-weight: 500;
  color: #47626c;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.epm-row-dist {
  font-size: 12px;
  font-weight: 600;
  color: #47626c;
  white-space: nowrap;
  flex-shrink: 0;
}

.epm-row-icons {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.epm-row-check {
  color: #f36a36;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.epm-row-create {
  color: #c74814;
  font-weight: 600;
}

.epm-row-create .epm-row-name {
  font-weight: 600;
}

.epm-row-create-tag {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #c74814;
  flex-shrink: 0;
}

.epm-empty {
  padding: 20px 14px;
  text-align: center;
  color: #59413a;
  font-size: 14px;
}

/* Trigger input appearance when backed by the selection modal */
.player-picker-input.is-modal-trigger {
  cursor: pointer;
}

/* Landscape compact spacing on mobile */
@media (max-height: 519px) {
  .epm-header {
    padding-top: 8px;
    padding-bottom: 8px;
  }
  .epm-search-bar {
    padding-top: 8px;
    padding-bottom: 8px;
  }
  .epm-body {
    padding-top: 8px;
    padding-bottom: 14px;
  }
  .epm-row {
    min-height: 44px;
    padding: 8px 14px;
  }
}

/* Desktop responsive centered dialog (phones in landscape stay full-screen) */
@media (min-width: 768px) and (min-height: 520px) {
  .epm-backdrop {
    align-items: center;
    padding: 24px;
  }

  .epm-dialog {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    width: 100%;
    max-width: 480px;
    height: auto;
    max-height: min(620px, 86vh);
    border-radius: 16px;
    border: 1px solid #d8d0c0;
    box-shadow: 0 20px 50px rgba(28, 28, 22, 0.18);
    padding-top: 0;
    padding-bottom: 0;
  }
}
