/* =========================================================
   Lists popups + shared family toggle
   Scoped to Lists tab only.
   ========================================================= */

#listsTab .overview-list-family-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #5b3ff4;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

#listsTab .overview-list-family-toggle input {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  width: 38px;
  height: 22px;
  flex: 0 0 auto;
  margin: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(218, 222, 236, 0.95);
  box-shadow: inset 0 0 0 1px rgba(142, 151, 181, 0.18);
  cursor: pointer;
  outline: none;
  transition: background 180ms ease, box-shadow 180ms ease;
}

#listsTab .overview-list-family-toggle input::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 2px 7px rgba(28, 33, 58, 0.22);
  transition: transform 180ms ease;
}

#listsTab .overview-list-family-toggle input:checked {
  background: linear-gradient(135deg, #16a34a, #22c55e);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18), 0 8px 18px rgba(22, 163, 74, 0.2);
}

#listsTab .overview-list-family-toggle input:checked::before {
  transform: translateX(16px);
}

#listsTab .overview-list-family-toggle input:focus-visible {
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}

#listsTab .overview-card-title-row {
  gap: 12px;
}

#listsTab .overview-card-actions {
  min-width: 0;
}

#listsTab .overview-meals-title-row .overview-card-actions,
#listsTab .overview-recipes-title-row .overview-card-actions,
#listsTab .overview-shopping-title-row .overview-card-actions,
#listsTab .overview-tasks-title-row .overview-card-actions {
  gap: 10px;
}

#listsTab .overview-extra-list-modal-backdrop {
  z-index: 5400;
}

#listsTab .overview-extra-list-modal {
  max-width: 560px;
}

#listsTab .overview-extra-list-modal.is-view-only .overview-extra-list-modal-form {
  display: none !important;
}

#listsTab .overview-extra-list-modal-form {
  grid-template-columns: minmax(0, 1fr) minmax(120px, 0.42fr) auto;
  align-items: end;
}

#listsTab .overview-recipes-modal .overview-extra-list-modal-form {
  grid-template-columns: minmax(0, 1fr) auto;
}

#listsTab .overview-extra-list-notes-field {
  grid-column: 1 / -1;
}

#listsTab .overview-extra-list-modal-form select,
#listsTab .overview-extra-list-modal-form textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(226, 230, 242, 0.96);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.96);
  color: #1f2937;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  outline: none;
  padding: 10px 11px;
  box-shadow: 0 7px 16px rgba(31, 41, 55, 0.04);
}

#listsTab .overview-extra-list-modal-form textarea {
  min-height: 78px;
  resize: vertical;
  line-height: 1.32;
}

#listsTab .overview-extra-list-modal-form select:focus,
#listsTab .overview-extra-list-modal-form textarea:focus {
  border-color: rgba(91, 63, 244, 0.42);
  box-shadow: 0 0 0 4px rgba(91, 63, 244, 0.1);
}

#listsTab .overview-extra-list-modal-list {
  min-height: 0;
  max-height: min(46vh, 440px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  padding-right: 4px;
}

#listsTab .overview-extra-list-modal-list .overview-extra-list-empty {
  min-height: 180px;
}

#listsTab .overview-extra-list-main small {
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

@media (max-width: 820px) {
  #listsTab .overview-card-title-row {
    align-items: flex-start;
  }

  #listsTab .overview-card-actions {
    gap: 8px !important;
  }

  #listsTab .overview-list-family-toggle {
    font-size: 11px;
    gap: 7px;
  }

  #listsTab .overview-list-family-toggle input {
    width: 36px;
    height: 21px;
  }

  #listsTab .overview-list-family-toggle input::before {
    width: 15px;
    height: 15px;
  }

  #listsTab .overview-list-family-toggle input:checked::before {
    transform: translateX(15px);
  }

  #listsTab .overview-extra-list-modal {
    width: min(94vw, 560px);
    max-height: min(82vh, 720px);
  }

  #listsTab .overview-extra-list-modal-form,
  #listsTab .overview-recipes-modal .overview-extra-list-modal-form {
    grid-template-columns: 1fr;
  }

  #listsTab .overview-extra-list-modal-form .overview-task-add-button {
    width: 100%;
  }

  #listsTab .overview-extra-list-modal-list {
    max-height: min(42vh, 380px);
  }
}

@media (max-width: 430px) {
  #listsTab .overview-card-title-row {
    display: grid !important;
    grid-template-columns: 1fr;
  }

  #listsTab .overview-card-actions {
    width: 100%;
    justify-content: space-between !important;
  }

  #listsTab .overview-list-family-toggle-modal span {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  #listsTab .overview-list-family-toggle input,
  #listsTab .overview-list-family-toggle input::before {
    transition: none !important;
  }
}

/* Meals/Recipes modal fix: hide the mobile lower nav just like Shopping/Tasks modals. */
@media (max-width: 820px) {
  body.overview-meals-modal-open .mobile-bottom-nav,
  body.overview-recipes-modal-open .mobile-bottom-nav,
  body:has(#overviewMealsModalBackdrop:not([hidden])) .mobile-bottom-nav,
  body:has(#overviewRecipesModalBackdrop:not([hidden])) .mobile-bottom-nav {
    display: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transform: translateY(120%) !important;
  }

  body.overview-meals-modal-open #listsTab .overview-meals-modal-backdrop,
  body.overview-recipes-modal-open #listsTab .overview-recipes-modal-backdrop,
  body:has(#overviewMealsModalBackdrop:not([hidden])) #listsTab .overview-meals-modal-backdrop,
  body:has(#overviewRecipesModalBackdrop:not([hidden])) #listsTab .overview-recipes-modal-backdrop {
    z-index: 6000 !important;
  }

  body.overview-meals-modal-open #listsTab .overview-meals-modal,
  body.overview-recipes-modal-open #listsTab .overview-recipes-modal,
  body:has(#overviewMealsModalBackdrop:not([hidden])) #listsTab .overview-meals-modal,
  body:has(#overviewRecipesModalBackdrop:not([hidden])) #listsTab .overview-recipes-modal {
    max-height: calc(100dvh - 26px) !important;
  }
}
