/* =============================================================
   Wish-O-Matic — App Styles
   App-specific styles; shared tokens/base live in:
   ../shared/moonshot-theme.css
   ============================================================= */

/* ── HEADER ── */
.app-header {
  background: var(--surface);
  border-bottom: 2px solid var(--gold);
  padding: 14px 16px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.app-eyebrow {
  font-size: 10px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 2px;
}

.app-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.3rem, 5vw, 1.8rem);
  font-weight: 900;
  color: var(--cream);
  line-height: 1;
  margin-top: 2px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  flex-wrap: nowrap;
}

.undo-btn {
  background: transparent;
  color: var(--muted);
  border: 1.5px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  padding: 10px 13px;
  min-height: 40px;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.18s;
  white-space: nowrap;
  opacity: 0.35;
  pointer-events: none;
}

.undo-btn.active {
  opacity: 1;
  pointer-events: all;
  color: var(--cream);
  border-color: rgba(255,255,255,0.25);
}

.undo-btn.active:active {
  transform: scale(0.95);
  background: var(--faint);
}

.apps-btn {
  background: transparent;
  color: var(--muted);
  border: 1.5px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  padding: 10px 11px;
  min-height: 40px;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 15px;
  line-height: 1;
  transition: all 0.18s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.apps-btn:hover { color: var(--gold); border-color: rgba(201,168,76,0.4); }
.apps-btn:active { transform: scale(0.95); }

.data-btn {
  background: transparent;
  color: var(--muted);
  border: 1.5px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  padding: 10px 11px;
  min-height: 40px;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  line-height: 1;
  transition: all 0.18s;
}
.data-btn:hover { color: var(--gold); border-color: rgba(201,168,76,0.4); }
.data-btn:active { transform: scale(0.95); }

/* ── GOLD BUTTON MODIFIER ── */
.btn-confirm.gold { background: var(--gold); }

/* Delete button in modal — sits left of Cancel/Confirm */
.btn-delete {
  background: rgba(185,64,64,0.1);
  color: var(--dusty-red);
  border: 1px solid rgba(185,64,64,0.25);
  border-radius: 12px;
  padding: 12px;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.btn-delete:hover  { background: rgba(185,64,64,0.2); }
.btn-delete:active { transform: scale(0.96); }

/* ── DASHBOARD ── */
.dashboard {
  background: var(--surface);
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.dash-stat {
  background: var(--card);
  border-radius: 14px;
  padding: 14px 10px;
  text-align: center;
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.dash-stat::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}

.dash-stat.s-wish::before  { background: var(--gold); }
.dash-stat.s-cats::before  { background: var(--slate); }
.dash-stat.s-val::before   { background: var(--mustard); }

.dash-num {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  font-weight: 900;
  line-height: 1;
  margin-bottom: 4px;
}

.dash-stat.s-wish .dash-num { color: var(--gold); }
.dash-stat.s-cats .dash-num { color: var(--slate); }
.dash-stat.s-val  .dash-num { color: var(--mustard); font-size: 1.4rem; }

.dash-label {
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

/* ── FILTER BAR ── */
.filter-bar {
  background: var(--surface);
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.filter-bar::-webkit-scrollbar { display: none; }

.filter-label {
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.filter-pill {
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: 20px;
  padding: 5px 13px;
  font-family: 'Nunito', sans-serif;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.18s;
}

.filter-pill.active {
  background: var(--gold);
  border-color: var(--gold);
  color: #1c1a15;
}

.filter-pill:active { transform: scale(0.94); }

.manage-tags-btn {
  background: transparent;
  border: 1.5px dashed rgba(255,255,255,0.15);
  color: var(--muted);
  border-radius: 20px;
  padding: 5px 12px;
  font-family: 'Nunito', sans-serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: border-color 0.2s, color 0.2s;
}

.manage-tags-btn:hover, .manage-tags-btn:active {
  border-color: var(--gold);
  color: var(--gold);
}

/* ── WISH CONTAINER ── */
.wish-container {
  padding: 20px 16px 100px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── CATEGORY GROUP ── */
.wish-category {
  background: var(--card);
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--border);
  animation: cardIn 0.3s ease;
}

.wish-category-header {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid var(--border);
}

.wish-category-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.wish-category-name {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--cream);
  flex: 1;
}

.wish-category-count {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  background: var(--faint);
  padding: 3px 9px;
  border-radius: 20px;
  flex-shrink: 0;
}

.wish-category-value {
  font-size: 11px;
  color: var(--gold);
  font-weight: 700;
  flex-shrink: 0;
}

.collapse-icon {
  color: var(--muted);
  font-size: 11px;
  transition: transform 0.25s;
  flex-shrink: 0;
}

.wish-category.collapsed .collapse-icon { transform: rotate(-90deg); }

.wish-category-body {
  overflow: hidden;
  transition: max-height 0.32s ease, opacity 0.28s ease;
  max-height: 2000px;
  opacity: 1;
}

.wish-category.collapsed .wish-category-body { max-height: 0; opacity: 0; }

/* ── WISH ITEMS GRID ── */
.wish-items-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  padding: 14px;
}

@media (min-width: 560px) {
  .wish-items-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }
}

/* ── WISH ITEM CARD ── */
.wish-item-card {
  background: var(--surface);
  border-radius: 16px;
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: row;
  transition: border-color 0.2s;
  animation: cardIn 0.25s ease;
  position: relative;
  min-height: 130px;
}

.wish-item-card:active { border-color: rgba(201,168,76,0.3); }

.wish-item-card.dragging { opacity: 0.4; }
.wish-item-card.drag-over {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(201,168,76,0.25);
}

/* Drag handle — top-right corner of card */
.wish-drag-handle {
  position: absolute;
  top: 7px;
  right: 8px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: -1px;
  opacity: 0;
  cursor: grab;
  touch-action: none;
  user-select: none;
  padding: 4px 5px;
  border-radius: 6px;
  transition: opacity 0.15s;
  z-index: 2;
}

.wish-item-card:hover .wish-drag-handle { opacity: 0.5; }
.wish-drag-handle:active { opacity: 1 !important; cursor: grabbing; }

@media (hover: none) {
  .wish-drag-handle { opacity: 0.35; }
}

/* Photo placeholder */
.wish-photo {
  width: 110px;
  flex-shrink: 0;
  background: var(--faint);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  border-right: 1px solid var(--border);
}

.wish-photo-icon {
  font-size: 24px;
  opacity: 0.35;
}

.wish-photo-label {
  font-size: 9px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

.wish-photo-lock {
  position: absolute;
  top: 7px;
  right: 7px;
  background: rgba(0,0,0,0.55);
  border-radius: 8px;
  padding: 3px 7px;
  font-size: 9px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 3px;
}

.wish-photo:hover .wish-photo-lock {
  background: rgba(201,168,76,0.2);
  color: var(--gold);
}

.wish-item-body {
  padding: 13px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
  min-width: 0;
}

.wish-item-name {
  font-family: 'Playfair Display', serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--cream);
  line-height: 1.3;
}

.wish-item-price {
  font-size: 15px;
  font-weight: 700;
  color: var(--gold);
}

.wish-item-price.no-price { color: var(--muted); font-style: italic; font-weight: 400; font-size: 13px; }

.wish-item-notes {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.wish-item-url {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--teal);
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0.5px;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wish-item-url:hover { color: var(--sage); }

.wish-item-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
  padding-top: 10px;
}

.wish-action-btn {
  flex: 1;
  border: none;
  border-radius: 10px;
  padding: 10px 6px;
  min-height: 40px;
  font-family: 'Nunito', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wish-action-btn:active { transform: scale(0.94); }

.wish-btn-bought {
  background: rgba(201,168,76,0.15);
  color: var(--gold);
  border: 1px solid rgba(201,168,76,0.3);
}

.wish-btn-bought:active { background: rgba(201,168,76,0.25); }

.wish-btn-delete {
  background: rgba(185,64,64,0.1);
  color: var(--dusty-red);
  border: 1px solid rgba(185,64,64,0.2);
  flex: 0;
  min-width: 40px;
  padding: 10px 12px;
  position: relative;
  overflow: hidden;
}

.wish-btn-delete:active { background: rgba(185,64,64,0.2); }

.wish-btn-delete.holding {
  background: rgba(185,64,64,0.2);
  border-color: rgba(185,64,64,0.5);
}

/* Hold-to-delete progress ring */
.wish-delete-ring-svg {
  display: none;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.wish-btn-delete.holding .wish-delete-ring-svg { display: block; }

.wish-delete-ring {
  fill: none;
  stroke: var(--dusty-red);
  stroke-width: 2.5;
  stroke-dasharray: 101;
  stroke-dashoffset: 101;
  stroke-linecap: round;
  transform-origin: center;
  transform: rotate(-90deg);
  transition: stroke-dashoffset 0.7s linear;
}

.wish-btn-delete.holding .wish-delete-ring { stroke-dashoffset: 0; }

.wish-btn-edit {
  background: rgba(91,127,166,0.12);
  color: var(--slate);
  border: 1px solid rgba(91,127,166,0.2);
  flex: 0;
  min-width: 40px;
  padding: 10px 12px;
}

.wish-btn-edit:active { background: rgba(91,127,166,0.22); }

/* ── INLINE NEW CATEGORY ROW ── */
.wish-new-cat-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.wish-new-cat-input {
  flex: 1;
  background: var(--surface);
  border: 1.5px dashed rgba(201,168,76,0.25);
  border-radius: 10px;
  padding: 9px 13px;
  color: var(--text);
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}

.wish-new-cat-input:focus {
  border-color: var(--gold);
  border-style: solid;
}

.wish-new-cat-input::placeholder { color: var(--muted); }

.wish-new-cat-btn {
  background: var(--gold);
  color: #1c1a15;
  border: none;
  border-radius: 10px;
  padding: 9px 16px;
  min-height: 40px;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  display: none;
  transition: transform 0.1s;
}

.wish-new-cat-btn.visible { display: block; }
.wish-new-cat-btn:active { transform: scale(0.96); }

/* ── CATEGORY FOOTER (hold-to-delete) ── */
.wish-category-footer {
  display: flex;
  justify-content: flex-end;
  padding: 6px 14px 12px;
}

.wish-cat-delete-btn {
  background: transparent;
  border: 1.5px solid transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 5px 12px;
  border-radius: 20px;
  opacity: 0.45;
  transition: opacity 0.2s, color 0.2s, border-color 0.2s;
  display: flex;
  align-items: center;
  gap: 5px;
}

.wish-cat-delete-btn:hover { opacity: 0.8; border-color: rgba(185,64,64,0.4); color: var(--dusty-red); }
.wish-cat-delete-btn svg { display: none; width: 14px; height: 14px; flex-shrink: 0; }
.wish-cat-delete-btn.holding svg { display: block; }
.wish-cat-delete-btn.holding { opacity: 1; border-color: var(--dusty-red); color: var(--dusty-red); }

/* Delete ring progress animation */
.delete-ring {
  fill: none;
  stroke: var(--dusty-red);
  stroke-width: 2;
  stroke-dasharray: 38;
  stroke-dashoffset: 38;
  stroke-linecap: round;
  transform-origin: center;
  transform: rotate(-90deg);
  transition: stroke-dashoffset 0.7s linear;
}

.wish-cat-delete-btn.holding .delete-ring { stroke-dashoffset: 0; }

/* ── TAG OPTION (category selector in modal) ── */
.tag-option {
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: 20px;
  padding: 6px 12px;
  min-height: 36px;
  font-family: 'Nunito', sans-serif;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
}

.tag-option.selected {
  background: var(--gold);
  border-color: var(--gold);
  color: #1c1a15;
}

/* ── TAG MANAGER ── */
.tag-manage-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
  max-height: 200px;
  overflow-y: auto;
}

.tag-manage-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border-radius: 10px;
  padding: 9px 12px;
}

.tag-manage-name { flex: 1; font-size: 14px; color: var(--text); }

.tag-manage-delete {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  opacity: 0.4;
  transition: opacity 0.2s, color 0.2s;
  padding: 8px;
  min-width: 36px;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  margin: -8px;
}

.tag-manage-delete:active { opacity: 1; color: var(--dusty-red); }

.tag-add-row { display: flex; gap: 8px; }

/* ── WISH EMPTY STATE ── */
.wish-empty {
  text-align: center;
  padding: 50px 30px 40px;
  animation: fadeIn 0.4s ease;
}

.wish-empty-icon { font-size: 3.5rem; margin-bottom: 14px; }

.wish-empty h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem;
  color: var(--cream);
  margin-bottom: 8px;
}

.wish-empty p { color: var(--muted); font-size: 13px; line-height: 1.6; }

/* ── DATA MODAL ── */
.data-modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 6px;
}

.btn-data-action {
  width: 100%;
  padding: 13px 16px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--faint);
  color: var(--cream);
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.18s, background 0.18s;
}
.btn-data-action:hover { border-color: var(--gold); background: var(--card); }
.btn-data-action:active { transform: scale(0.98); }
.btn-data-action .action-sub {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
  margin-top: 2px;
}

.import-warning {
  font-size: 12px;
  color: var(--rust);
  background: rgba(196,92,42,0.1);
  border: 1px solid rgba(196,92,42,0.25);
  border-radius: 8px;
  padding: 9px 12px;
  margin-top: 4px;
  display: none;
}
.import-warning.visible { display: block; }

/* ── ADD WISH FAB ── */
.wish-fab {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: var(--gold);
  color: #1c1a15;
  border: none;
  border-radius: 24px;
  padding: 13px 26px;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0,0,0,0.45);
  z-index: 100;
  transition: transform 0.15s, box-shadow 0.15s;
  white-space: nowrap;
  letter-spacing: 0.5px;
}

.wish-fab:active { transform: translateX(-50%) scale(0.95); box-shadow: 0 2px 10px rgba(0,0,0,0.4); }

/* ── CELEBRATION OVERLAY ── */
.celebration-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.88);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.celebration-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.celebration-modal {
  background: var(--card);
  border-radius: 24px;
  padding: 36px 28px 30px;
  width: 100%;
  max-width: 340px;
  border: 1px solid rgba(201,168,76,0.35);
  text-align: center;
  position: relative;
  overflow: hidden;
  transform: scale(0.85);
  transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1);
}

.celebration-overlay.open .celebration-modal { transform: scale(1); }

.celebration-modal::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--amber), var(--gold), var(--mustard), var(--gold), var(--amber));
  background-size: 200%;
  animation: shimmer 2s linear infinite;
}

@keyframes shimmer {
  0%   { background-position: 200% center; }
  100% { background-position: -200% center; }
}

.celebration-emoji {
  font-size: 3.5rem;
  margin-bottom: 12px;
  display: block;
  animation: popIn 0.5s cubic-bezier(0.34,1.56,0.64,1) 0.1s both;
}

@keyframes popIn {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.celebration-modal h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.6rem;
  color: var(--gold);
  margin-bottom: 8px;
}

.celebration-item-name {
  font-size: 14px;
  color: var(--cream);
  font-weight: 600;
  margin-bottom: 6px;
}

.celebration-sub {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 24px;
}

.celebration-close {
  background: var(--gold);
  color: #1c1a15;
  border: none;
  border-radius: 14px;
  padding: 13px 28px;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.1s;
  width: 100%;
}

.celebration-close:active { transform: scale(0.97); }

/* Confetti canvas */
#confetti-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 499;
  opacity: 0;
  transition: opacity 0.2s;
}

#confetti-canvas.active { opacity: 1; }

/* ── PHOTO TOOLTIP ── */
.photo-tooltip {
  position: fixed;
  background: var(--card);
  border: 1px solid rgba(201,168,76,0.3);
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 12px;
  color: var(--gold);
  font-weight: 600;
  font-family: 'Nunito', sans-serif;
  z-index: 400;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  white-space: nowrap;
}

.photo-tooltip.show { opacity: 1; }
