/* NPC Tracker styles (scaffold) */
/* Root card styles are defined by global .card; NPC overrides below */

/* Colin Location panel */
#npcTrackerCard .npc-screenshot-wrap { margin-top: 10px; display: flex; justify-content: center; }
#npcTrackerCard .npc-screenshot {
  width: 100%;
  max-width: 420px; /* base fallback */
  height: auto;
  max-height: 240px; /* base fallback */
  object-fit: contain; /* ensure full image fits inside */
  display: block;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
}
  #npcTrackerCard.blurred {
    position: relative;
  }
  #npcTrackerCard.blurred > h2,
  #npcTrackerCard.blurred .npc-tabs,
  #npcTrackerCard.blurred #npcColinSection,
  #npcTrackerCard.blurred #npcChopSection {
    filter: blur(12px) grayscale(35%);
    pointer-events: none;
    user-select: none;
  }
  #npcTrackerCard.blurred::after {
    content: 'Locked — MDM Only';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text);
    font-weight: 700;
    letter-spacing: 0.5px;
    background: radial-gradient(ellipse at center, rgba(0,0,0,0.50) 0%, rgba(0,0,0,0.60) 45%, rgba(0,0,0,0.70) 100%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: inherit;
    opacity: 0.8;
  }
#npcTrackerCard .npc-meta { display:flex; justify-content:space-between; align-items:center; gap:8px; margin-top:8px; font-size:0.9rem; color: var(--text-secondary); }
#npcTrackerCard .npc-meta .left { display:flex; align-items:center; gap:8px; }
#npcTrackerCard .npc-meta { flex-wrap: nowrap; }
#npcTrackerCard .npc-meta .left { flex: 1; min-width: 0; }
#npcTrackerCard .npc-meta .npc-open { flex-shrink: 0; }
#npcTrackerCard .npc-open { display:none; align-items:center; gap:6px; padding:6px 10px; text-decoration:none; border:1px solid var(--border-color); border-radius:6px; background: var(--card-hover); color: var(--text); }
#npcTrackerCard .npc-open:hover { background: var(--card-bg); }
#npcTrackerCard .npc-placeholder { display:flex; align-items:center; gap:10px; margin-top:10px; padding:12px; border:1px dashed var(--border-color); border-radius:8px; background: rgba(255,187,77,.05); color: var(--text-secondary); }
#npcTrackerCard .npc-placeholder i { color: var(--accent); opacity: 0.9; }

/* Compact editor buttons (icon-only) */
#npcTrackerCard .npc-editor-btn.icon-only {
  width: 28px;
  height: 28px;
  min-width: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}
#npcTrackerCard .npc-editor-btn.icon-only i { font-size: 0.9rem; }

/* Keep input and buttons on the same row */
#npcTrackerCard .npc-editor-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}
#npcTrackerCard .npc-editor-row input {
  flex: 1;
  min-width: 0;
}

/* Small label above image */
#npcTrackerCard .npc-section-label {
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}
#npcTrackerCard.view-only .npc-section-label { margin-top: 12px; }

/* View-only mode: center the screenshot and metadata */
#npcTrackerCard.view-only .npc-screenshot-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding-top: 24px;
  /* Keep the card height steady and prevent tall images from stretching the panel */
  min-height: 240px;
}
#npcTrackerCard.can-edit .npc-screenshot {
  max-width: 340px;   /* smaller for editors */
  max-height: 200px;
}
#npcTrackerCard.view-only .npc-screenshot {
  width: auto;          /* override base 100% width so it can center naturally */
  max-width: 90%;       /* larger for non-editors */
  max-height: 220px;    /* cap height in view-only to keep panel compact */
  object-fit: contain;
}
#npcTrackerCard.view-only .npc-meta { justify-content: center; }

/* Tabs */
#npcTrackerCard .npc-tabs { border-bottom: 1px solid var(--border-color); padding-bottom: 4px; }
#npcTrackerCard .npc-tab-btn {
  appearance: none; border: 1px solid var(--border-color); background: var(--card-bg);
  color: var(--text); padding: 6px 10px; border-radius: 8px; cursor: pointer; font-weight: 600;
}
#npcTrackerCard .npc-tab-btn.active { background: var(--accent-light); border-color: var(--accent); color: var(--accent); }
#npcTrackerCard .npc-tab-btn i { margin-right: 6px; opacity: 0.85; }

/* Chop Spots inputs: allow shrinking and wrapping */
#npcTrackerCard #npcChopSection .panel-soft .chop-input-row {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(0,1fr) auto;
  gap: 8px;
  align-items: center;
  width: 100%;
}
#npcTrackerCard #npcChopSection .panel-soft .chop-input-row input {
  min-width: 0;
  width: 100%;
}
#npcTrackerCard #npcChopSection .panel-soft .chop-input-row button {
  width: auto;
  justify-self: start;
}
@media (max-width: 640px) {
  #npcTrackerCard #npcChopSection .panel-soft .chop-input-row { grid-template-columns: 1fr; }
}

#npcTrackerCard #chopFooter { flex-wrap: wrap; }
/* Centered footer layout: [index] [GPS button] [delete] */
#npcTrackerCard .chop-footer { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 6px; }
#npcTrackerCard .chop-footer #chopIndex { justify-self: start; }
#npcTrackerCard .chop-footer .chop-footer-center { justify-self: center; }
#npcTrackerCard .chop-footer .chop-footer-right { justify-self: end; }
/* Smaller, icon-centered footer buttons */
#npcTrackerCard #chopFooter .btn-slim {
  padding: 4px;
  min-width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Smaller GPS icon/button in view-only mode */
#npcTrackerCard.view-only #chopFooter .btn-slim {
  padding: 2px;
  min-width: 26px;
  height: 26px;
}
#npcTrackerCard.view-only #chopFooter .btn-slim i {
  font-size: 0.9rem;
}

/* Modern footer styling */
#npcTrackerCard .chop-footer {
  padding: 8px 10px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: var(--card-bg);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
#npcTrackerCard #chopFooter .btn-slim { border: 1px solid var(--border-color); border-radius: 10px; background: var(--card-hover); transition: background 160ms ease, transform 100ms ease, box-shadow 160ms ease; }
#npcTrackerCard #chopFooter .btn-slim:hover { background: var(--card-bg); transform: translateY(-1px); box-shadow: 0 3px 8px rgba(0,0,0,0.10); }

/* Sleek image hover */
#npcTrackerCard .chop-img-proof { transition: transform 140ms ease; will-change: transform; }
#npcTrackerCard .chop-img-proof:hover { transform: scale(1.01); }

/* Chop Spots slider */
#npcTrackerCard { overflow-x: hidden; }
#npcTrackerCard .chop-slider {
  margin-top: 10px;
  display: grid; grid-template-columns: 28px minmax(0,1fr) 28px; align-items: center; gap: 6px;
}
#npcTrackerCard .chop-track {
  width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  position: relative;
  border: 0;
  border-radius: 8px;
  background: transparent;
  max-height: 400px; /* allow slightly taller preview */
}
#npcTrackerCard.view-only .chop-track { max-height: 440px; }
#npcTrackerCard .chop-track > div { display: flex; width: 100%; max-width: 100%; }
#npcTrackerCard #chopSlides { display: flex; transition: transform 220ms ease; width: 100%; max-width: 100%; min-width: 0; }
#npcTrackerCard .chop-slide { width: 100%; max-width: 100%; min-width: 0; padding: 4px 6px; box-sizing: border-box; flex: 0 0 100%; }
#npcTrackerCard .chop-title { font-weight: 700; margin-bottom: 8px; color: var(--accent); }
#npcTrackerCard .chop-pair { display: grid; grid-template-columns: 1fr; gap: 8px; align-items: center; justify-items: center; }
#npcTrackerCard .chop-img {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 200px; /* slightly larger previews */
  object-fit: contain;
  display: block;
  margin: 0 auto;
  background: transparent;
  border: 0;
  border-radius: 6px;
}
#npcTrackerCard .chop-frame {
  display: inline-block;
  background: var(--card-bg);
  border: 2px solid var(--accent);
  border-radius: 10px;
  padding: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 120ms ease;
  max-width: min(420px, 100%);
}
#npcTrackerCard .chop-frame:hover { border-color: var(--accent); box-shadow: 0 6px 16px rgba(0,0,0,0.18); transform: translateY(-1px); }
#npcTrackerCard .chop-frame:focus-within { border-color: var(--accent); box-shadow: 0 6px 16px rgba(0,0,0,0.18); }
#npcTrackerCard.view-only .chop-img { max-height: 240px; }
/* Indicate the Chop preview is clickable */
#npcTrackerCard .chop-img-proof { cursor: pointer; }
/* Hide GPS image by default; only show when toggled */
#npcTrackerCard .chop-img-gps { display: none !important; }
#npcTrackerCard .chop-slide.show-gps .chop-img-gps { display: block !important; }
/* Safety: if a second framed image exists, hide it unless slide is toggled to show GPS */
#npcTrackerCard .chop-pair > .chop-frame:nth-child(2) img { display: none !important; }
#npcTrackerCard .chop-slide.show-gps .chop-pair > .chop-frame:nth-child(2) img { display: block !important; }
#npcTrackerCard .chop-nav { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; border: 1px solid var(--border-color); background: var(--card-hover); color: var(--text); box-shadow: 0 2px 6px rgba(0,0,0,0.08); transition: background 160ms ease, box-shadow 160ms ease, transform 100ms ease; }
#npcTrackerCard .chop-nav:hover { background: var(--card-bg); box-shadow: 0 4px 10px rgba(0,0,0,0.12); transform: translateY(-1px); }

@media (max-width: 540px) {
  #npcTrackerCard .chop-img { max-height: 130px; }
  #npcTrackerCard .chop-track { max-height: 270px; }
  #npcTrackerCard.view-only .chop-img { max-height: 150px; }
  #npcTrackerCard.view-only .chop-track { max-height: 300px; }
}

/* Small screens: slightly lower the cap for Colin screenshot in view-only */
@media (max-width: 540px) {
  #npcTrackerCard.view-only .npc-screenshot { max-height: 180px; }
}

/* Freeze NPC card hover/focus so it doesn't "pop" larger when interacting */
#npcTrackerCard:hover { transform: none !important; box-shadow: 0 2px 6px rgba(0,0,0,0.03) !important; }
#npcTrackerCard:hover::before { transform: none !important; }
#npcTrackerCard:focus-within { z-index: auto !important; overflow: hidden !important; }

/* Meta time freshness pill (green = fresh in current reset window, red = stale) */
#npcTrackerCard .npc-meta .npc-meta-time {
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid transparent;
  line-height: 1.2;
  white-space: nowrap; /* keep "12:10 AM" on one line */
  display: inline-block;
}
#npcTrackerCard .npc-meta .npc-meta-time.fresh {
  color: var(--success, #2e7d32);
  background: rgba(46, 125, 50, 0.10);
  border-color: rgba(46, 125, 50, 0.35);
}
#npcTrackerCard .npc-meta .npc-meta-time.stale {
  color: var(--danger, #e53935);
  background: rgba(229, 57, 53, 0.10);
  border-color: rgba(229, 57, 53, 0.35);
}

/* Compact legend for view-only users: explains green/red without taking space */
#npcTrackerCard .npc-legend {
  display: none;
  margin-top: 2px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-align: center;
}
#npcTrackerCard.view-only .npc-legend { display: block; }
#npcTrackerCard .npc-legend .green { color: var(--success, #2e7d32); font-weight: 700; }
#npcTrackerCard .npc-legend .red { color: var(--danger, #e53935); font-weight: 700; }

  /* Click hint: only for view-only users, below legend */
  #npcTrackerCard .npc-click-hint { display: none; }
  #npcTrackerCard.view-only .npc-click-hint {
    display: block;
    margin-top: 4px;
    text-align: center;
    color: var(--text-secondary);
    opacity: 0.6;
    font-style: italic;
    font-size: 0.78rem;
  }
