/*
 * Checklist Builder, styles
 * Layered on top of page-checklists.css. Handles the interactive
 * add/remove/check states, progress bar, and email/print block.
 */

/* ── Control bar (progress + actions) ──────────── */
.ffc-builder__bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: center;
  padding: 18px 22px;
  background: #fff;
  border: 1px solid var(--ff-border);
  border-radius: var(--ff-radius);
  box-shadow: var(--ff-shadow-card);
  margin-bottom: 18px;
}

.ffc-builder__progress {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.ffc-builder__progress-text {
  font-size: 14px;
  font-weight: 700;
  color: var(--ff-navy);
  letter-spacing: 0.02em;
}
.ffc-builder__progress-bar {
  width: 100%;
  height: 8px;
  background: var(--ff-sand-alt);
  border-radius: 999px;
  overflow: hidden;
}
.ffc-builder__progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--ff-teal-dark), var(--ff-ocean));
  transition: width 0.25s ease-out;
}

.ffc-builder__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.ffh-btn--ghost {
  background: transparent;
  color: var(--ff-stone);
  border: 1px solid var(--ff-border);
}
.ffh-btn--ghost:hover {
  background: var(--ff-sand-alt);
  color: var(--ff-navy);
}

.ffc-builder__status {
  margin: 0 0 12px;
  min-height: 1.4em;
  font-size: 13px;
  color: var(--ff-stone);
}

/* "How does Apple Notes paste actually work?" disclosure, expanding
 * explanatory help next to the export buttons. Collapsed by default so
 * it doesn't crowd the toolbar. Prepares readers honestly for what the
 * copy/paste can and can't do before they try and get frustrated. */
.ffc-builder__apple-help {
  margin: 4px 0 18px;
  padding: 10px 14px;
  background: var(--ff-sand-alt);
  border: 1px solid var(--ff-border);
  border-radius: var(--ff-radius-sm);
  font-size: 14px;
  line-height: 1.55;
  color: var(--ff-muted);
}
.ffc-builder__apple-help > summary {
  cursor: pointer;
  color: var(--ff-ocean);
  font-weight: 700;
  list-style: none;
  padding: 2px 0;
}
.ffc-builder__apple-help > summary::-webkit-details-marker { display: none; }
.ffc-builder__apple-help > summary::marker { content: ""; }
.ffc-builder__apple-help > summary::after { content: " ↓"; }
.ffc-builder__apple-help[open] > summary::after { content: " ↑"; }
.ffc-builder__apple-help p,
.ffc-builder__apple-help ol { margin: 8px 0 0; padding-left: 20px; }
.ffc-builder__apple-help li { margin: 4px 0; }

/* ── Interactive item styles (override static check-circle) ── */
.ffc-section--interactive .ffc-item {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 8px 4px;
  border-radius: var(--ff-radius-sm);
  transition: background var(--ff-ease-fast);
}
.ffc-section--interactive .ffc-item:hover {
  background: var(--ff-sand-alt);
}
.ffc-section--interactive .ffc-item--checked .ffc-item__text {
  text-decoration: line-through;
  color: var(--ff-stone);
}

/* User-added items are tagged with a small "NEW" pill inserted INTO the
   label (via JS) rather than as a ::before pseudo-element, the previous
   pseudo-element approach became a grid item on the <li> and stretched
   across the full 1fr column on mobile, producing a green bar. Now the
   pill is inline text inside .ffc-item__label and behaves normally. */
.ffc-item__tag {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.14em;
  padding: 3px 7px;
  margin-right: 2px;
  background: var(--ff-teal);
  color: var(--ff-teal-dark);
  border-radius: var(--ff-radius-pill);
  height: 16px;
  line-height: 1;
}

.ffc-item__label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  flex: 1 1 auto;
  min-width: 0;
  padding: 6px 0;
}
.ffc-item__check {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  accent-color: var(--ff-ocean);
  cursor: pointer;
}
.ffc-item__text {
  font-size: 16px;
  line-height: 1.5;
  color: var(--ff-navy);
  min-width: 0;
  word-wrap: break-word;
}
.ffc-item__remove {
  background: transparent;
  border: none;
  color: var(--ff-stone);
  font-size: 18px;
  cursor: pointer;
  padding: 8px 10px;
  line-height: 1;
  border-radius: 50%;
  min-width: 40px;
  min-height: 40px;
  transition: color var(--ff-ease-fast), background var(--ff-ease-fast);
}
.ffc-item__remove:hover,
.ffc-item__remove:focus {
  color: var(--ff-coral);
  background: #ffe9e4;
  outline: none;
}

/* ── Add-item form ───────────────────────────────
   Rebuilt for mobile: 16px font prevents iOS auto-zoom; min-height 48px
   hits the iOS-recommended touch target; wraps to a second line on
   narrow phones rather than squeezing the button out of sight. */
.ffc-item__add {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--ff-border);
}
.ffc-item__add-input {
  flex: 1 1 180px;
  min-width: 0;
  padding: 12px 14px;
  font-size: 16px;
  line-height: 1.35;
  min-height: 48px;
  border: 1px solid var(--ff-border);
  border-radius: var(--ff-radius-sm);
  background: #fff;
  color: var(--ff-navy);
  font-family: inherit;
  -webkit-appearance: none;
          appearance: none;
}
.ffc-item__add-input:focus {
  outline: none;
  border-color: var(--ff-ocean);
  box-shadow: 0 0 0 3px rgba(0, 99, 128, 0.12);
}
.ffc-item__add-btn {
  flex: 0 0 auto;
  padding: 12px 18px !important;
  font-size: 14px !important;
  min-height: 48px;
}
@media (max-width: 480px) {
  .ffc-item__add-btn { flex: 1 1 auto; }
}

/* ── Email-this-customized-list block ──────────── */
.ffc-builder__email {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 32px;
  margin-top: 36px;
  padding: 28px;
  background: var(--ff-sand-alt);
  border: 1px solid var(--ff-border);
  border-radius: var(--ff-radius);
  align-items: center;
}
.ffc-builder__email-body h3 {
  font-size: 22px;
  line-height: 1.15;
  color: var(--ff-ocean);
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}
.ffc-builder__email-body p {
  font-size: 15px;
  line-height: 1.55;
  color: var(--ff-muted);
  margin: 0;
}

/* ── Print-only output ─────────────────────────── */
.ffc-print-only { display: none; }
@media print {
  @page { size: auto; margin: 14mm 16mm; }
  html, body { background: #fff !important; }
  body.ffc-printing > *:not(.ffc-print-only) { display: none !important; }
  .ffc-print-only {
    display: block;
    position: static;
    padding: 0;
    background: #fff;
    color: #000;
  }
  .ffc-print { font-family: "Plus Jakarta Sans", system-ui, sans-serif; }
  .ffc-print__head {
    border-bottom: 2px solid #006380;
    padding-bottom: 14px;
    margin-bottom: 14px;
  }
  .ffc-print__brand {
    display: block;
    font-size: 11px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #9a3d2e;
    font-weight: 800;
  }
  .ffc-print__head h1 {
    font-size: 24px;
    margin: 4px 0 2px;
    color: #006380;
  }
  .ffc-print__head p {
    font-size: 12px;
    color: #57534e;
    margin: 0;
  }
  .ffc-print__section {
    break-inside: avoid-page;
    margin-bottom: 18px;
  }
  .ffc-print__section h2 {
    font-size: 14px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #006380;
    margin: 16px 0 6px;
  }
  .ffc-print__list {
    list-style: none;
    padding: 0;
    margin: 0;
  }
  .ffc-print__list li {
    padding: 3px 0;
    font-size: 13px;
    line-height: 1.45;
    break-inside: avoid;
  }
  .ffc-print__box {
    font-family: "Courier New", monospace;
    margin-right: 4px;
  }
  .ffc-print__done span:last-child {
    text-decoration: line-through;
    color: #57534e;
  }
}

/* ── Responsive ────────────────────────────────── */
@media (max-width: 900px) {
  .ffc-builder__bar {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .ffc-builder__email {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .ffc-item__remove {
    opacity: 1; /* always visible on touch devices */
  }
}
