/* Overall page background */
html, body {
  height: 100%;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  margin: 0;
  padding: 2rem 1rem;

  /* Fallback colour behind the image */
  background-color: #020617;

  /* Mirror Dungeon background */
  background-image: url("mirror-s6.png");
  background-size: contain;        /* keep the original size of the image */
  background-position: center top;
  background-repeat: no-repeat;
  background-attachment: fixed;  /* stays put while you scroll */

  color: #e5e7eb; /* light grey text */
}

/* Title */
h1 {
  text-align: center;
  margin-bottom: 1.5rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;

  /* Cherry blossom red → pink gradient */
  background-image: linear-gradient(
    90deg,
    #ef4444,
    #fb7185,
    #fecaca
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;

  /* Thin dark outline so it stands out on busy areas */
  -webkit-text-stroke: 1px rgba(15, 23, 42, 0.95);
  text-stroke: 1px rgba(15, 23, 42, 0.95); /* non-standard, safe to leave */

  /* Soft highlight / halo around the letters */
  text-shadow:
    0 0 3px rgba(248, 250, 252, 0.8),
    0 0 8px rgba(15, 23, 42, 0.9);
}

/* Card-style sections */
section {
  max-width: 960px;
  margin: 0 auto 1.5rem auto; /* center each card again */

  /* slightly more transparent, and a tiny blur for readability */
  background: rgba(15, 23, 42, 0.86); /* was 0.94 */
  border: 1px solid #1f2937;
  border-radius: 10px;
  padding: 1rem 1.25rem;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.6);

  backdrop-filter: blur(3px);          /* frosted-glass feel */
  -webkit-backdrop-filter: blur(3px);  /* Safari */
}

/* Inputs & labels */
label {
  display: block;
  margin: 0.5rem 0;
  font-size: 0.95rem;
}

input[type="number"],
input[type="text"] {
  background: #020617;
  border: 1px solid #4b5563;
  border-radius: 4px;
  padding: 0.25rem 0.4rem;
  color: #e5e7eb;
}

input[type="number"]:focus,
input[type="text"]:focus {
  outline: none;
  border-color: #f97316; /* orange accent */
}

/* Buttons */
button {
  margin-top: 0.4rem;
  margin-right: 0.3rem;
  padding: 0.35rem 0.8rem;
  cursor: pointer;
  border-radius: 4px;
  border: 1px solid #4b5563;
  background: linear-gradient(to bottom, #111827, #020617);
  color: #e5e7eb;
  font-size: 0.9rem;
  transition: background 0.15s ease, transform 0.05s ease, border-color 0.15s ease;
}

button:hover {
  background: linear-gradient(to bottom, #1f2937, #020617);
  border-color: #f97316;
}

button:active {
  transform: translateY(1px);
}

/* Result box */
pre {
  background: #020617;
  padding: 0.75rem;
  border-radius: 6px;
  white-space: pre-wrap;
  border: 1px solid #374151;
  max-height: 400px;
  overflow-y: auto;
}

.hidden {
  display: none;
}

#settings {
  margin-top: 2rem;
}

.sinner-block {
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 0.75rem;
  margin-bottom: 0.75rem;
}

.sinner-block h3 {
  margin: 0 0 0.5rem;
}

.sinner-block h4 {
  margin: 0.5rem 0 0.25rem;
  font-size: 0.9rem;
}

.sinner-block label {
  display: block;
  font-size: 0.9rem;
}
#saved-teams {
  margin-top: 2rem;
}

#savedTeamsList {
  margin-top: 0.75rem;
}

.saved-team-card {
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.5rem;
}

.saved-team-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.saved-team-name {
  font-weight: bold;
}

.saved-team-meta {
  font-size: 0.8rem;
  opacity: 0.7;
}

.saved-team-actions button {
  margin-left: 0.25rem;
  padding: 0.2rem 0.5rem;
  font-size: 0.8rem;
}
#run-setup button,
#settings button,
#saved-teams button {
  margin-top: 0.4rem;
}
.ownership-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.25rem;
}

.ownership-item span {
  font-size: 0.9rem;
}
/* Search bar */
#ownershipSearchBar {
  margin: 0.5rem 0 0.75rem;
}

#ownershipSearchBar input {
  margin-left: 0.25rem;
}

/* Collapsible sinner blocks */
.sinner-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  background: #020617;               /* dark header */
  padding: 0.4rem 0.6rem;
  border-radius: 4px;
  margin-bottom: 0.3rem;
  border: 1px solid #334155;         /* subtle border */
}

.sinner-header-name {
  font-weight: bold;
  color: #f9fafb;                    /* bright text */
}

.sinner-header-toggle {
  font-size: 0.8rem;
  color: #9ca3af;                    /* lighter grey */
  opacity: 1;                        /* no extra fading */
}

.sinner-body {
  margin-top: 0.25rem;
}

/* Ownership items with images */
.ownership-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.25rem;
}

.ownership-item span {
  font-size: 0.9rem;
}

/* Search highlighting */
.ownership-item.search-hit {
  background: #fff6d9;
  outline: 1px solid #f0ad4e;
  border-radius: 4px;
}
/* Sinner ownership list blocks */
.sinner-block {
  margin-bottom: 0.75rem;
}

.sinner-body.hidden {
  display: none;
}

.ownership-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.25rem;
  font-size: 0.9rem;
}

.ownership-item img {
  width: 140px;
  height: auto;
  border-radius: 4px;
}

.run-field-group {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  margin-bottom: 0.75rem;
}

.inline-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 500;
}

.field-label {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 0.15rem;
}

.sinner-select-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  margin-bottom: 0.5rem;
}

.sinner-select-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9rem;
}

.run-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0;
}

#runPresetsSection {
  margin-top: 1.75rem;
}

.preset-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

#runPresetNameInput {
  min-width: 260px;
}

.small-note {
  font-size: 0.8rem;
  opacity: 0.8;
  margin-top: 0.25rem;
}

/* Run presets list */
.run-preset-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.run-preset-name {
  font-weight: 500;
}

.run-preset-actions {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.run-preset-actions button {
  margin-top: 0; /* override global button margin so they line up nicely */
}

/* Search highlight (if you added this earlier, keep it) */
.search-hit {
  outline: 1px solid #f97316;
  background: rgba(249, 115, 22, 0.12);
}

/* --- NEW: keyword filter bar --- */

#keywordFilterBar {
  margin: 0.5rem 0 0.75rem;
}

#keywordFilters {
  margin-top: 0.35rem;
}

.keyword-filter {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-right: 0.5rem;
  margin-bottom: 0.25rem;
  font-size: 0.85rem;
}

#activeKeywordFiltersDisplay {
  margin-left: 0.5rem;
  font-size: 0.85rem;
  opacity: 0.85;
}
/* --- Shop / EGO Gift tools --- */

#shopToolsSection {
  margin-top: 1.5rem;
}

#egoGiftLists {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0.75rem 0;
}

.gift-list-column {
  flex: 1 1 220px;
  min-width: 200px;
}

.gift-list {
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid #374151;
  border-radius: 6px;
  padding: 0.35rem;
  background: rgba(15, 23, 42, 0.9);
}

.gift-row {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: #e5e7eb;
  font-size: 0.85rem;
  padding: 0.15rem 0.25rem;
  border-radius: 3px;
  cursor: pointer;
}

.gift-row:hover {
  background: rgba(249, 115, 22, 0.15);
}

.gift-row.selected {
  background: rgba(34, 197, 94, 0.18);
}

.gift-row.banned {
  opacity: 0.5;
  cursor: default;
}

.gift-row.banned:hover {
  background: transparent;
}

/* reuse existing keyword-filter style for gift keywords, so nothing special needed */
/* Grey out the "no re-obtain" label when the main rule is off */
#giftNoReacquireLabel.disabled {
  opacity: 0.5;
  pointer-events: none; /* label won't intercept clicks */
}
/* Grouped EGO gift lists */
.gift-category-block {
  margin-bottom: 0.75rem;
}

.gift-category-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-weight: 600;
  padding: 0.15rem 0;
}

.gift-category-toggle {
  font-size: 0.8rem;
  opacity: 0.8;
}

/* Body is hidden when collapsed (the JS toggles .hidden) */
.gift-category-body.hidden {
  display: none;
}

/* Gift rows with icons */
.gift-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* You can tweak the size to match your layout */
.gift-icon {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.gift-name {
  flex: 1;
  text-align: left;
}
/* Extra spacing so "Run completed" is harder to misclick */
.run-completed-btn {
  margin-top: 1.25rem;
}
/* Top navigation between sections */
#pageNav {
  max-width: 960px;
  margin: 0.75rem auto 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  justify-content: flex-start;
  font-size: 0.85rem;
}

#pageNav a {
  text-decoration: none;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background-color: rgba(0, 0, 0, 0.35);
}

#pageNav a:hover {
  border-color: rgba(255, 255, 255, 0.6);
}

/* Run setup dimmed while a run is active */
#runSetupControls.collapsed {
  opacity: 0.5;
  pointer-events: none;
  filter: grayscale(0.2);
}
/* Button hierarchy */
button {
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    transform 0.05s ease,
    box-shadow 0.15s ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.45);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

/* Primary */
.btn-primary {
  background-color: #2f83ff;
  border: 1px solid #6aa5ff;
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background-color: #4b96ff;
}

/* Secondary */
.btn-secondary {
  background-color: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
}

.btn-secondary:hover:not(:disabled) {
  background-color: rgba(255, 255, 255, 0.06);
}

/* Danger */
.btn-danger {
  background-color: rgba(200, 70, 70, 0.15);
  border: 1px solid rgba(255, 120, 120, 0.7);
  color: #ffb4b4;
}

.btn-danger:hover:not(:disabled) {
  background-color: rgba(220, 90, 90, 0.25);
}
#runResult {
  margin-top: 0.5rem;
  padding: 1rem 1.25rem;
  background-color: rgba(0, 0, 0, 0.55);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-family: "Consolas", "Fira Code", monospace;
  font-size: 0.9rem;
  line-height: 1.4;
  max-height: 520px;
  overflow-y: auto;
  white-space: pre-wrap; /* wrap long lines instead of horizontal scroll */
}

/* Copy result button aligned to the right under the pre */
#copyResultBtn {
  display: block;
  margin-top: 0.5rem;
  margin-left: auto;
}
.chip-row {
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip {
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  font-size: 0.75rem;
  background-color: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.2);
}
#egoGiftFilters {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  background-color: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.12);
  margin-bottom: 0.75rem;
}

#egoGiftLists {
  margin-top: 0.5rem;
}
#ownershipContainer .ownership-item.search-hit {
  background-color: rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  outline: 1px solid rgba(255, 255, 255, 0.4);
}
.gift-row,
.sinner-select-item {
  transition: background-color 0.12s ease, transform 0.06s ease;
}

.gift-row:hover,
.sinner-select-item:hover {
  background-color: rgba(255, 255, 255, 0.06);
  transform: translateY(-1px);
}

.gift-row.selected {
  background-color: rgba(255, 255, 255, 0.09);
}
/* --- Left side navigation --- */

.page-layout {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;

  /* NEW: center the nav + content group on the page */
  max-width: 1200px;
  margin: 0 auto;
}

/* Main column flexes, nav stays narrow */
#mainContent {
  flex: 1 1 auto;
}

/* Vertical, sticky nav */
#sideNav {
  flex: 0 0 180px;          /* width of the nav column */
  position: sticky;
  top: 1rem;                /* distance from top when sticking */
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 10;
}

.side-nav-button {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  font: inherit;
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.side-nav-button:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.side-nav-button:active {
  transform: translateY(0);
}

.side-nav-title {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.8;
  margin: 0 0 0.5rem 0;
}

/* Mobile: nav goes back to top as a row of buttons */
@media (max-width: 900px) {
  .page-layout {
    flex-direction: column;
  }

  #sideNav {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .side-nav-button {
    flex: 1 1 auto;
    text-align: center;
  }
}
