/* ==================== MODLIST PAGE STYLES ==================== */

:root {
  --toc-radius: 10px;
  --toc-sticky-top: 10px;
  --toc-open-max: 480px;
  --toc-compact-min: 200px;
  --toc-compact-max: 20vh;
}

/* ------------------ BASE ------------------ */

html {
  background: linear-gradient(180deg, var(--bg1), var(--bg2));
  min-height: 100%;
}

body {
  font-family: system-ui, sans-serif;
  background: #0b0f14; /* solid fallback for iOS theme-color sampling */
  color: var(--text);
  margin: 0;
  padding: 0;
  text-align: center;
  min-height: 100%;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background:
    repeating-linear-gradient(
      0deg,
      rgba(255, 255, 255, 0.015),
      rgba(255, 255, 255, 0.015) 1px,
      transparent 1px,
      transparent 2px
    );
  opacity: 0.25;
  pointer-events: none;
  z-index: 0;
}

/* ------------------ LAYOUT ------------------ */

.container {
  max-width: 1100px;
  margin: 40px auto;
  padding: 0 24px 80px;
  text-align: left;
}

/* ------------------ TITLE ------------------ */

#title {
  text-align: center;
  margin-bottom: 24px;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* ------------------ TOC ------------------ */

.guide-toc {
  margin: 0 0 36px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--toc-radius);
  background: linear-gradient(180deg, var(--bg1), var(--bg2));
  position: sticky;
  top: var(--toc-sticky-top);
  z-index: 10;
  overflow: hidden;
  opacity: 0;
  transition:
    background .25s ease,
    border-color .25s ease,
    box-shadow .25s ease,
    opacity 400ms ease-out;
}

.guide-toc.compact {
  border-color: rgba(255, 255, 255, 0.05);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.18);
}

.guide-toc-toggle {
  width: 100%;
  text-align: left;
  padding: 6px 18px;
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-shadow: 0 0 6px rgba(95, 208, 255, 0.25);
  transition: background 0.2s ease, text-shadow 0.2s ease;
}

.guide-toc-toggle:hover {
  background: rgba(255, 255, 255, 0.02);
  text-shadow: 0 0 8px rgba(95, 208, 255, 0.4);
}

.guide-toc-toggle::after {
  content: "+";
  font-size: 1.6rem;
  line-height: 1;
}

.guide-toc.open .guide-toc-toggle::after {
  content: "−";
}

.guide-toc-content {
  max-height: 0;
  overflow: hidden;
  padding: 0 18px;
  transition:
    max-height .28s cubic-bezier(0.22, 1, 0.36, 1),
    padding .28s cubic-bezier(0.22, 1, 0.36, 1);
}

.guide-toc.open .guide-toc-content {
  max-height: min(var(--toc-open-max), 60vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px 18px 14px;
}

.guide-toc.open.compact .guide-toc-content {
  min-height: var(--toc-compact-min);
  max-height: var(--toc-compact-max);
  overflow-y: auto;
}

/* Scrollbar */
.guide-toc-content::-webkit-scrollbar { width: 4px; }
.guide-toc-content::-webkit-scrollbar-track { background: transparent; }
.guide-toc-content::-webkit-scrollbar-thumb {
  background: rgba(95, 208, 255, 0);
  border-radius: 2px;
}
.guide-toc.compact:hover .guide-toc-content::-webkit-scrollbar-thumb {
  background: rgba(95, 208, 255, 0.25);
}
.guide-toc.compact .guide-toc-content::-webkit-scrollbar-thumb:hover {
  background: rgba(95, 208, 255, 0.45);
}
.guide-toc-content {
  scrollbar-width: none;
  scrollbar-color: transparent transparent;
}
.guide-toc.compact:hover .guide-toc-content {
  scrollbar-width: thin;
  scrollbar-color: rgba(95, 208, 255, 0.25) transparent;
}

.guide-toc.compact::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 32px;
  background: linear-gradient(to bottom, transparent, var(--bg2));
  pointer-events: none;
}

.guide-toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.guide-toc li {
  margin: 2px 0;
  position: relative;
}

.guide-toc li::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(95, 208, 255, 0.18), transparent);
}

.guide-toc li:last-child::after {
  display: none;
}

.guide-toc a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 12px;
  border-radius: 6px;
  color: var(--muted);
  text-decoration: none;
  transition: color .2s ease, background .2s ease;
}

.guide-toc a:hover {
  color: var(--accent);
  background: rgba(255, 255, 255, 0.02);
}

.toc-strip {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}

.toc-count {
  margin-left: auto;
  font-size: 0.8rem;
  color: rgba(127, 184, 214, 0.5);
  white-space: nowrap;
}

/* ------------------ CATEGORY SECTIONS ------------------ */

.category-section {
  margin-bottom: 48px;
  /* opacity controlled by JS */
}

.category-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 16px;
  color: var(--accent);
  font-size: 1.25rem;
  font-weight: 600;
  text-shadow:
    0 0 8px rgba(95, 208, 255, 0.35),
    0 0 20px rgba(95, 208, 255, 0.18);
  padding: 10px 0;
}

.category-heading-strip {
  display: inline-block;
  width: 10px;
  height: 20px;
  border-radius: 3px;
  flex-shrink: 0;
}

/* ------------------ TABLE (tracker-style) ------------------ */

.table-wrapper {
  border-radius: 10px;
  border: 1px solid transparent;
  background:
    linear-gradient(
      180deg,
      rgba(21, 26, 35, 0.985),
      rgba(16, 21, 29, 0.985)
    );
  overflow: hidden;
}

/* Scan beam — single beam on the content container spanning all tables */
#modlist-content {
  position: relative;
}

#modlist-content::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 110px;
  top: -110px;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(
    to bottom,
    rgba(95, 208, 255, 0.00)  0%,
    rgba(95, 208, 255, 0.10) 25%,
    rgba(95, 208, 255, 0.35) 45%,
    rgba(95, 208, 255, 0.20) 55%,
    rgba(95, 208, 255, 0.08) 70%,
    rgba(95, 208, 255, 0.00) 100%
  );
  filter: blur(6px);
  z-index: 2;
  /* pointer-events: none already set above */
}

#modlist-content.scanning::after {
  opacity: 1;
  animation: modlist-scan var(--scan-duration, 2000ms) linear forwards;
}

@keyframes modlist-scan {
  from { top: var(--scan-from, -70px); }
  to   { top: var(--scan-to, 100%);   }
}

/* Row scan-hit highlight */
tbody tr {
  position: relative;
}

tbody tr::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0),
    rgba(255, 255, 255, 0.06),
    rgba(255, 255, 255, 0)
  );
  opacity: 0;
  transition: opacity 180ms ease-out;
}

tbody tr.scan-hit::after {
  opacity: 1;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

thead {
  position: relative;
}

thead::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(95, 208, 255, 0.14),
    transparent
  );
  pointer-events: none;
}

th {
  padding: 10px 14px;
  text-align: left;
  background:
    linear-gradient(
      180deg,
      rgba(28, 36, 50, 0.92),
      rgba(18, 24, 34, 0.96)
    );
  color: #8fd8ff;
  font-weight: 600;
  text-shadow: 0 0 6px rgba(95, 208, 255, 0.18);
}

td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.025);
  vertical-align: middle;
}

tbody tr:last-child td {
  border-bottom: none;
}

tr {
  height: 44px;
  position: relative;
  transition: background 180ms ease;
}

tr::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(
      90deg,
      color-mix(in srgb, var(--strip-color) 8%, transparent),
      transparent 58%
    );
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

@media (hover: hover) {
  tr:hover::before { opacity: 1; }
  tr:hover { background: rgba(255, 255, 255, 0.018); }
  tr:hover .category-strip::before {
    filter: saturate(1.2) brightness(1.15);
    box-shadow: 0 0 8px var(--strip-color), inset 0 0 8px rgba(255, 255, 255, 0.3);
    transition: none;
  }
}

/* Fixed column widths — strip and date are fixed, mod name takes the rest */

.col-strip {
  width: 16px;
  min-width: 16px;
  max-width: 16px;
  padding: 0 !important;
}

.col-date {
  width: 230px;
  min-width: 230px;
  white-space: nowrap;
}

/* CATEGORY STRIP CELL */

.category-strip {
  padding: 0 !important;
  position: relative;
}

.category-strip::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--strip-color, #fff);
  transition: filter 400ms ease-out, box-shadow 400ms ease-out;
}

/* MOD LINKS */

.mod-name a {
  color: var(--accent);
  text-decoration: none;
  text-shadow: 0 0 4px rgba(95, 208, 255, 0.08);
  transition: color .18s ease, text-shadow .18s ease;
}

.mod-name a:hover {
  color: #8fddff;
  text-decoration: none;
  text-shadow:
    0 0 8px rgba(95, 208, 255, 0.45),
    0 0 18px rgba(95, 208, 255, 0.18);
}

/* DATE CELL */

.mod-date {
  color: var(--muted);
}

/* ------------------ FOOTER ------------------ */

#modlist-footer {
  margin-top: 8px;
  padding-bottom: 8px;
  text-align: left;
  font-size: 0.9rem;
  color: var(--muted);
  opacity: 0.6;
}

/* ------------------ LOADING / ERROR ------------------ */

.modlist-status {
  text-align: center;
  color: var(--muted);
  padding: 48px 0;
  font-size: 1rem;
}

.modlist-error {
  color: #e06c75;
}

/* ------------------ MOBILE (max-width: 1099px) ------------------ */

@media (max-width: 1099px) {
  .container {
    margin: 24px auto;
    padding: 0 12px 60px;
    box-sizing: border-box;
  }

  tr {
    height: auto;
    min-height: 44px;
  }

  .col-date {
    width: 130px;
    min-width: 130px;
    white-space: normal;
  }
}

@media (max-width: 768px) {
  .category-heading {
    font-size: 1.1rem;
  }

  th, td {
    padding: 8px 10px;
  }

  .mod-name a {
    white-space: normal;
    word-break: break-word;
  }
}

@media (max-width: 500px) {
  .col-date {
    width: 100px;
    min-width: 100px;
  }
}
