/* ════════════════════════════════════════════════════════════
   Aurora Family Hub — Pantry v2 Styles  (Phase 1)
   hub-pantry-v2.css

   Loaded AFTER hub-styles.css. Extends and overrides only the
   shopping-list-specific rules. Does not touch any custom
   properties already defined in hub-styles.css.
════════════════════════════════════════════════════════════ */

/* ─── UNIT SELECT  (beside qty in add-row) ──────────────── */
.shop-unit-select {
  height: 32px;
  border: 1.5px solid var(--input-border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--text-2);
  font-size: 12px;
  font-family: inherit;
  padding: 0 6px;
  cursor: pointer;
  transition: border-color .15s;
  flex-shrink: 0;
  min-width: 52px;
}
.shop-unit-select:focus {
  outline: none;
  border-color: var(--mint);
}

/* ─── SECTION HEADERS (collapsible) ─────────────────────── */
.shop-cat-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-2);
  margin: 14px 0 7px;
  cursor: pointer;
  user-select: none;
  border-radius: 8px;
  padding: 4px 4px;
  transition: background .15s;
}
.shop-cat-header:hover { background: rgba(196,168,232,0.07); }
.shop-cat-header:focus-visible {
  outline: 2px solid var(--lavender);
  outline-offset: 2px;
}
.shop-cat-header.first { margin-top: 2px; }
.shop-cat-icon { font-size: 14px; line-height: 1; }
.shop-cat-name { flex: 1; }
.shop-cat-chevron {
  font-size: 14px;
  color: var(--text-3);
  transition: transform .2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
}
.shop-cat-header.collapsed .shop-cat-chevron { transform: rotate(-90deg); }

/* Keep existing .shop-cat-count but ensure it works on new header too */
.shop-cat-header .shop-cat-count {
  background: rgba(0,0,0,0.06);
  border-radius: 99px;
  padding: 1px 6px;
  font-size: 9px;
  color: var(--text-3);
  font-weight: 600;
}

/* ─── CHIP LABEL WRAP (two-line layout for brand/notes) ─── */
.shop-chip-label-wrap {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.shop-chip-label {
  /* keep existing cursor pointer */
  cursor: pointer;
  font-size: 13px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.shop-chip-info {
  font-size: 10px;
  color: var(--text-3);
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}
.shop-chip-info em {
  font-style: normal;
  font-weight: 600;
  color: var(--text-2);
}

/* ─── RECURRING INDICATOR ──────────────────────────────── */
.shop-chip-rec {
  font-size: 9px;
  opacity: 0.5;
  flex-shrink: 0;
  line-height: 1;
}
.shop-chip.recurring {
  border-style: dashed;
}

/* ─── EXPANDED CHIP  (inline detail panel) ─────────────── */
.shop-chip.expanded {
  border-color: var(--lavender);
  background: var(--lav-soft);
}
.shop-chip-detail {
  background: var(--lav-soft);
  border: 1.5px solid var(--lav-mid);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin: 4px 0 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: slideDown .18s ease;
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.shop-detail-label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11px;
  color: var(--text-2);
  font-weight: 600;
  letter-spacing: .04em;
}
.shop-detail-input,
.shop-detail-select {
  border: 1.5px solid var(--input-border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text-1);
  font-family: inherit;
  font-size: 13px;
  padding: 5px 9px;
  transition: border-color .15s;
  font-weight: 400;
}
.shop-detail-input:focus,
.shop-detail-select:focus {
  outline: none;
  border-color: var(--lavender);
}
.shop-detail-actions {
  display: flex;
  gap: 8px;
  margin-top: 2px;
}
.shop-detail-save {
  flex: 1;
  padding: 6px 12px;
  border-radius: 99px;
  border: none;
  background: var(--lavender);
  color: #fff;
  font-size: 12px;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: filter .15s;
}
.shop-detail-save:hover { filter: brightness(1.08); }
.shop-detail-cancel {
  padding: 6px 12px;
  border-radius: 99px;
  border: 1.5px solid var(--lav-mid);
  background: transparent;
  color: var(--text-2);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s;
}
.shop-detail-cancel:hover { background: var(--lav-soft); }

/* ─── COLLECTED / RECURRING SEPARATORS ─────────────────── */
.shop-collected-sep {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  color: var(--text-3);
  margin: 16px 0 8px;
  font-weight: 600;
  letter-spacing: .04em;
}
.shop-collected-sep::before,
.shop-collected-sep::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--card-border);
}
.shop-recurring-sep {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  color: var(--mint);
  margin: 10px 0 6px;
  font-weight: 600;
  letter-spacing: .04em;
}
.shop-recurring-sep::before,
.shop-recurring-sep::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--mint-mid);
}
.shop-chips-recurring { opacity: 0.65; }

/* ─── STAPLES SUB-PANEL ─────────────────────────────────── */
.shop-staples-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--mint);
  margin: 18px 0 6px;
  padding: 6px 8px;
  border-radius: 8px;
  background: var(--mint-soft);
  border: 1px solid var(--mint-mid);
  cursor: pointer;
  user-select: none;
  transition: filter .15s;
  letter-spacing: .04em;
}
.shop-staples-header:hover { filter: brightness(0.97); }
.shop-staples-header:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 2px;
}
.shop-staples-header .shop-cat-count {
  background: var(--mint-mid);
  color: #fff;
}
.shop-staples-header .shop-cat-chevron { margin-left: auto; }
.shop-staples-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 6px;
  animation: slideDown .18s ease;
}
.shop-staple-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--mint-soft);
  font-size: 12px;
  cursor: pointer;
  transition: background .15s, opacity .15s;
  border: 1px solid transparent;
}
.shop-staple-row:hover { filter: brightness(0.96); }
.shop-staple-row.got { opacity: 0.45; }
.shop-staple-row.got .shop-staple-label { text-decoration: line-through; color: var(--text-3); }
.shop-staple-check { font-size: 11px; color: var(--mint); margin-right: 4px; width: 14px; flex-shrink: 0; }
.shop-staple-label { color: var(--text-1); flex: 1; }
.shop-staple-rec {
  font-size: 10px;
  color: var(--mint);
  font-weight: 600;
  text-transform: capitalize;
}

/* ─── AUTOCOMPLETE DROPDOWN ─────────────────────────────── */
#shop-ac-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 120;
  background: var(--popup-bg);
  border: 1.5px solid var(--lav-mid);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 28px rgba(196,168,232,0.22);
  max-height: 220px;
  overflow-y: auto;
  animation: slideDown .15s ease;
}
#shop-ac-dropdown.hidden { display: none; }
.shop-ac-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  color: var(--text-1);
  transition: background .12s;
  border-radius: 0;
}
.shop-ac-item:hover,
.shop-ac-item:focus { background: var(--lav-soft); outline: none; }
.shop-ac-item:first-child { border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.shop-ac-item:last-child  { border-radius: 0 0 var(--radius-sm) var(--radius-sm); }
.shop-ac-cat   { font-size: 14px; flex-shrink: 0; }
.shop-ac-label { flex: 1; font-weight: 500; }
.shop-ac-brand {
  font-size: 11px;
  color: var(--text-2);
  font-style: italic;
}
.shop-ac-unit {
  font-size: 10px;
  color: var(--text-3);
  background: rgba(0,0,0,0.05);
  border-radius: 6px;
  padding: 1px 5px;
}
.shop-ac-count {
  font-size: 10px;
  color: var(--text-3);
  flex-shrink: 0;
}

/* ─── INPUT WRAPPER  (needs position:relative for AC dropdown) */
.shop-input-wrap {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ─── CHIP ADJUSTMENTS for new markup ───────────────────── */
/* Ensure chip wraps correctly with label-wrap inside */
.shop-chip {
  white-space: normal; /* override old nowrap — label-wrap handles it */
  align-items: flex-start;
}
.shop-chip-cb,
.shop-chip-del,
.shop-chip-add,
.shop-chip-qty,
.shop-chip-src,
.shop-chip-rec {
  flex-shrink: 0;
  margin-top: 1px; /* align with first line of label */
}

/* ─── DARK MODE COMPATIBILITY ────────────────────────────── */
/* ─── BULK ADD — PASTE TAB ──────────────────────────────── */
.shop-paste-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 0 8px;
}
.shop-paste-hint {
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.5;
}
.shop-paste-hint em {
  font-style: normal;
  color: var(--text-2);
  font-weight: 500;
}
.shop-paste-textarea {
  width: 100%;
  min-height: 120px;
  max-height: 35vh;
  resize: vertical;
  border: 1.5px solid var(--input-border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--text-1);
  font-family: inherit;
  font-size: 13px;
  padding: 9px 11px;
  line-height: 1.55;
  transition: border-color .15s;
}
.shop-paste-textarea:focus {
  outline: none;
  border-color: var(--lavender);
}
.shop-paste-parse-btn {
  align-self: flex-end;
  padding: 7px 18px;
  border-radius: 99px;
  border: none;
  background: var(--lavender);
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: filter .15s;
}
.shop-paste-parse-btn:hover { filter: brightness(1.08); }

/* Preview area */
.shop-paste-preview {
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: slideDown .18s ease;
}
.shop-paste-preview.hidden { display: none; }
.shop-paste-preview-scroll {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 40vh;
  overflow-y: auto;
  border: 1.5px solid var(--lav-mid);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  background: var(--lav-soft);
}
.shop-paste-row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 4px;
  border-radius: 8px;
  font-size: 13px;
  transition: background .12s;
}
.shop-paste-row:hover { background: rgba(196,168,232,0.10); }
.shop-paste-row-cat   { font-size: 15px; flex-shrink: 0; }
.shop-paste-row-label { flex: 1; color: var(--text-1); font-weight: 500; }
.shop-paste-row-qty {
  font-size: 11px;
  color: var(--lavender);
  font-weight: 700;
  flex-shrink: 0;
}
.shop-paste-merge {
  font-size: 10px;
  color: var(--mint);
  font-weight: 600;
  flex-shrink: 0;
  white-space: nowrap;
}
.shop-paste-row-remove {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.07);
  color: var(--text-3);
  font-size: 9px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity .12s;
  font-family: inherit;
  padding: 0;
}
.shop-paste-row:hover .shop-paste-row-remove { opacity: 1; }
.shop-paste-row-remove:hover { background: var(--danger-soft); color: var(--danger); }

/* Confirm row */
.shop-paste-confirm-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.shop-paste-summary {
  font-size: 11px;
  color: var(--text-3);
  font-weight: 600;
}
.shop-paste-confirm-btn {
  padding: 8px 20px;
  border-radius: 99px;
  border: none;
  background: var(--mint);
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: filter .15s;
}
.shop-paste-confirm-btn:hover { filter: brightness(1.08); }
.shop-paste-empty {
  font-size: 12px;
  color: var(--text-3);
  text-align: center;
  padding: 12px 0;
}

/* ─── DARK MODE COMPATIBILITY ────────────────────────────── */
@media (prefers-color-scheme: dark) {
  html:not([data-hub-theme="minecraft"]):not([data-hub-theme="lego"]) {
    .shop-chip-detail {
      background: rgba(196,168,232,0.08);
      border-color: rgba(196,168,232,0.25);
    }
    .shop-detail-input,
    .shop-detail-select {
      background: rgba(255,255,255,0.08);
      color: #e8dff5;
      border-color: rgba(196,168,232,0.25);
    }
    #shop-ac-dropdown {
      background: rgba(26,16,42,0.99);
      border-color: rgba(196,168,232,0.25);
    }
    .shop-ac-item:hover,
    .shop-ac-item:focus { background: rgba(196,168,232,0.12); }
    .shop-staples-header {
      background: rgba(142,203,168,0.12);
      border-color: rgba(142,203,168,0.25);
    }
    .shop-staple-row {
      background: rgba(142,203,168,0.08);
    }
    .shop-paste-textarea {
      background: rgba(255,255,255,0.06);
      color: #e8dff5;
      border-color: rgba(196,168,232,0.25);
    }
    .shop-paste-preview-scroll {
      background: rgba(196,168,232,0.06);
      border-color: rgba(196,168,232,0.20);
    }
  }
}

/* ─── CHIP EDIT BUTTON ───────────────────────────────────── */
.shop-chip-edit {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-3);
  font-size: 10px;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  line-height: 1;
  opacity: 0;
  transition: opacity .15s, background .15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.shop-chip:hover .shop-chip-edit { opacity: 1; }
.shop-chip-edit:hover { background: rgba(196,168,232,0.2); }

/* ─── PRODUCE EMOJI ICON IN CHIP ────────────────────────── */
.shop-chip-produce-icon {
  font-size: 13px;
  line-height: 1;
  flex-shrink: 0;
}

/* ─── SHOP ITEM EDIT MODAL ───────────────────────────────── */
.shop-edit-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.42);
  z-index: 600;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 0 16px;
  animation: fadeIn .15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.shop-edit-modal-box {
  background: var(--popup-bg, #fff);
  border: 1.5px solid var(--card-border);
  border-radius: 16px 16px 12px 12px;
  padding: 16px 16px 18px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 -4px 32px rgba(0,0,0,0.18);
  animation: slideUp .18s ease;
}
.shop-edit-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.shop-edit-modal-title {
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-1);
}
.shop-edit-modal-close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-3);
  cursor: pointer;
  line-height: 1;
  padding: 0 2px;
}
.shop-edit-modal-fields {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 12px;
}
.shop-edit-modal-actions {
  display: flex;
  gap: 8px;
}
