/* ==========================================================================
   Shared Bible Passage Picker
   ========================================================================== */

.passage-picker-column {
  position: relative;
  overflow: visible;
  padding: 0 8px;
  border-right: 1px solid lightgray;
}

.passage-picker {
  position: relative;
}

.passage-picker-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-width: 180px;
  height: 30px;
  min-height: 30px;
  padding: 0 0.6rem;
  border: 1px solid #2f9ae0;
  border-radius: 6px;
  background: #fff;
  color: #172033;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.passage-picker-toggle:hover,
.passage-picker-toggle[aria-expanded="true"] {
  border-color: #1f7fc2;
  box-shadow: 0 0 0 2px rgba(47, 154, 224, 0.14);
}

.passage-picker-toggle:focus-visible,
.passage-picker-close:focus-visible,
.passage-picker-open:focus-visible,
.passage-picker-field select:focus-visible {
  outline: 2px solid #1f7fc2;
  outline-offset: 2px;
}

#current-passage-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.passage-picker-chevron {
  flex: 0 0 auto;
  font-size: 0.7em;
  transition: transform 0.2s ease;
}

.passage-picker-toggle[aria-expanded="true"]
.passage-picker-chevron {
  transform: rotate(180deg);
}

.passage-picker-panel {
  position: absolute;
  z-index: 5000;
  top: calc(100% + 8px);
  left: 0;
  width: min(640px, calc(100vw - 24px));
  padding: 1rem;
  border: 1px solid #b8cee1;
  border-radius: 10px;
  background: #fdfefe;
  box-shadow: 0 18px 45px rgba(19, 42, 66, 0.24);
  color: #172033;
  text-align: left;
}

.passage-picker-panel[hidden] {
  display: none;
}

.passage-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.9rem;
}

.passage-picker-header h2 {
  margin: 0;
  font-family: "Libre Baskerville", serif;
  font-size: 1rem;
  line-height: 1.3;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.passage-picker-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #26384a;
  font-size: 1.65rem;
  line-height: 1;
  cursor: pointer;
}

.passage-picker-close:hover {
  background: #eaf3fa;
}

.passage-picker-fields {
  display: grid;
  grid-template-columns:
    minmax(120px, 0.8fr)
    minmax(180px, 1.35fr)
    minmax(140px, 1fr)
    72px;
  column-gap: 14px;
  row-gap: 10px;
  align-items: end;
}

.passage-picker-field {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  min-width: 0;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.1;
}

.passage-picker-field > span {
  display: block;
  margin: 0;
  padding: 0;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.1;
  color: #172033;
}

.passage-picker-field select {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  height: 36px;
  min-height: 36px;
  padding: 0 0.5rem;
  border: 1px solid #aac1d4;
  border-radius: 5px;
  background: #fff;
  color: #172033;
  font-family: inherit;
  font-size: 0.88rem;
}

.passage-picker-field select:disabled {
  background: #edf2f5;
  color: #7a8792;
  cursor: not-allowed;
}

.passage-picker-field:nth-child(4) {
  width: 72px;
}

.passage-picker-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 1rem;
}

.passage-picker-open {
  min-width: 150px;
  height: 36px;
  min-height: 36px;
  padding: 0 1rem;
  border: 1px solid #1d44b8;
  border-radius: 6px;
  background: #1d44b8;
  color: #fff;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}

.passage-picker-open:hover:not(:disabled) {
  background: #15338a;
}

.passage-picker-open:disabled {
  border-color: #aeb9c3;
  background: #c7d0d7;
  cursor: not-allowed;
}

/*
 * Only the picker receives responsive behavior here.
 * The full site-wide responsive redesign remains separate.
 */
@media only screen and (max-width: 700px) {
  .passage-picker-toggle {
    min-width: 0;
    max-width: 55vw;
    height: 34px;
    min-height: 34px;
  }

  .passage-picker-panel {
    position: fixed;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: 88vh;
    overflow-y: auto;
    padding:
      1rem
      1rem
      calc(1rem + env(safe-area-inset-bottom));
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 16px 16px 0 0;
  }

  .passage-picker-fields {
    grid-template-columns: 1fr;
    gap: 0.8rem;
  }

  .passage-picker-field:nth-child(4) {
    width: 100%;
  }

  .passage-picker-field select,
  .passage-picker-open {
    width: 100%;
    height: auto;
    min-height: 48px;
    font-size: 1rem;
  }

  .passage-picker-open {
    min-width: 0;
  }

  body.passage-picker-is-open::before {
    content: "";
    position: fixed;
    z-index: 4999;
    inset: 0;
    background: rgba(11, 22, 34, 0.48);
  }
}
