/* public/list/style.css
   ListLink-specific overrides
   --------------------------------------
   Most styling lives in /assets/ui.css.
   This file is intentionally lightweight,
   matching the design pattern for Slot/Vote/Sheet.

   Spec: List Tool (Shared Grocery / Checklist Lists), v2026-01-19
*/

/* Keep textareas sane if List ever adds one (admin has Description textarea) */
.section-card textarea {
  resize: vertical;
}

/* ----------------------------------------------------------
   LIST (participant/activity page) UI hooks
   ----------------------------------------------------------
   NOTE:
   - The participant HTML/JS for listlink will own the DOM,
     but we predefine stable, non-invasive classes/IDs here.
   - These rules are safe if unused (no drift).
*/

/* Main list surface (optional container) */
.listWrap {
  margin-top: 12px;
  border-radius: 12px;
  border: 1px solid var(--ring);
  background: var(--card);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
  overflow: hidden;
}

/* Add-item row (input + button) */
.listAddRow {
  display: flex;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid var(--ring);
  background: var(--card);
}

.listAddRow input[type="text"] {
  flex: 1 1 auto;
  min-width: 0;
}

.listAddRow .btn-primary,
.listAddRow button {
  width: auto;
  padding-inline: 14px;
}

/* Items list (UL/OL or div stack) */
.listItems {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Each item row: checkbox + text + drag handle + delete */
.listItem {
  display: grid;
  grid-template-columns: 28px 1fr 28px 44px;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-top: 1px solid var(--ring);
  background: var(--card);
}

.listItem:first-child {
  border-top: none;
}

.listItem:hover {
  background: var(--card-soft);
}

/* Checkbox alignment */
.listItem input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
}

/* Item text (editable or read-only) */
.listItemText {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

/* If the participant UI uses an <input> for inline edit, keep it looking like text */
.listItemTextInput {
  width: 100% !important;
  border: 1px solid transparent !important;
  background: transparent !important;
  padding: 6px 8px !important;
  border-radius: 10px !important;
  box-shadow: none !important;
  font-family: var(--font-sans) !important;
  font-size: 1rem !important;
}

.listItemTextInput:focus {
  outline: none !important;
  border-color: var(--ring) !important;
  background: var(--accent-soft) !important;
  box-shadow: inset 0 0 0 1px var(--accent) !important;
}

/* Done state */
.listItem.isDone .listItemText,
.listItem.isDone .listItemTextInput {
  color: var(--muted);
  text-decoration: line-through;
}

/* Drag handle: "grab" affordance */
.listDrag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 10px;
  border: 1px solid var(--ring);
  background: var(--card);
  color: var(--muted);
  cursor: grab;
  user-select: none;
}

.listDrag:active {
  cursor: grabbing;
}

/* While dragging, allow a visual hint (JS can add .isDragging) */
.listItem.isDragging {
  opacity: 0.6;
}

/* Delete button */
.listDelete {
  width: 44px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid var(--ring);
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
}

.listDelete:hover {
  background: #fff5f5;
  border-color: #fecaca;
  color: #b91c1c;
}

/* Optional empty state */
.listEmpty {
  padding: 14px 12px;
  color: var(--muted);
}

/* ----------------------------------------------------------
   PREVIEW (creator/admin pages)
   ---------------------------------------------------------- */

.previewWrap img {
  border-radius: var(--radius);
  max-width: 100%;
  display: block;
}

.previewWrap {
  border: 1px solid var(--ring);
  border-radius: 12px;
  overflow: hidden;
  background: var(--card);
}

/* ----------------------------------------------------------
   PARITY WITH SLOT/VOTE/SHEET CREATE PAGES
   Fix: extra spacing above "Live preview" and "Details"
   Fix: excessive/growing gaps between form fields
----------------------------------------------------------- */

/* Condense extra vertical gaps inside List forms only (create + admin) */
form > * + * {
  margin-top: 8px;
}

/* Reduce spacing BELOW the page header */
main > .page-header {
  padding-bottom: 4px !important;
  margin-bottom: 4px !important;
}

/* Reduce spacing ABOVE all section cards (Live preview, Details, etc.) */
main > .section-card {
  margin-top: 6px !important;
  padding-top: 10px !important;
}

/* Reduce spacing ABOVE the title inside each card (<h2>) */
.section-card > h2:first-child {
  margin-top: 2px !important;
}

/* Mobile tightening */
@media (max-width: 768px) {
  main > .page-header {
    padding-bottom: 2px !important;
    margin-bottom: 2px !important;
  }

  main > .section-card {
    margin-top: 4px !important;
    padding-top: 8px !important;
  }

  .section-card > h2:first-child {
    margin-top: 0 !important;
  }

  .listItem {
    grid-template-columns: 28px 1fr 28px 40px;
    gap: 8px;
    padding: 10px 10px;
  }

  .listDelete {
    width: 40px;
  }
}