/* ============================================
   Stalag13 Mods Guide - Stylesheet
   ============================================ */

:root {
  --bg: #0d1117;
  --bg-secondary: #161b22;
  --card-bg: #1c2333;
  --card-border: #30363d;
  --accent: #c9442d;
  --accent-hover: #e0503a;
  --accent-glow: rgba(201, 68, 45, 0.3);
  --text: #e6edf3;
  --text-muted: #8b949e;
  --text-dim: #484f58;
  --green: #3fb950;
  --yellow: #d29922;
  --blue: #58a6ff;
  --purple: #bc8cff;
  --sidebar-width: 280px;
  --header-height: 60px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ---- HEADER ---- */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  z-index: 100;
  gap: 16px;
}

.header .logo {
  font-size: 1.3em;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}

.header .logo span {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 0.75em;
  margin-left: 8px;
}

.header .search-box {
  flex: 1;
  max-width: 480px;
  position: relative;
}

.header .search-box input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  background: var(--bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.9em;
  outline: none;
  transition: border-color 0.2s;
}

.header .search-box input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.header .search-box::before {
  content: "\1F50D";
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.85em;
  opacity: 0.5;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.5em;
  cursor: pointer;
  padding: 4px 8px;
}

/* ---- SIDEBAR ---- */
.sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--card-border);
  overflow-y: auto;
  padding: 16px 0;
  z-index: 90;
  transition: transform 0.3s;
}

.sidebar-section {
  padding: 0 16px;
  margin-bottom: 8px;
}

.sidebar-section h3 {
  font-size: 0.7em;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  padding: 8px 0;
}

.sidebar a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.88em;
  border-radius: 6px;
  margin: 1px 8px;
  transition: all 0.15s;
}

.sidebar a:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text);
}

.sidebar a.active {
  background: var(--accent-glow);
  color: var(--accent);
  font-weight: 600;
}

.sidebar a .mod-icon {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75em;
  flex-shrink: 0;
}

/* ---- MAIN CONTENT ---- */
.main {
  margin-left: var(--sidebar-width);
  margin-top: var(--header-height);
  padding: 32px;
  min-height: calc(100vh - var(--header-height));
}

/* ---- MOD PAGE ---- */
.mod-page {
  display: none;
  max-width: 1100px;
  animation: fadeIn 0.25s ease;
}

.mod-page.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.mod-header {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--card-border);
}

.mod-header h1 {
  font-size: 2em;
  font-weight: 700;
  margin-bottom: 8px;
}

.mod-header .mod-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  color: var(--text-muted);
  font-size: 0.85em;
}

.mod-header .mod-meta a {
  color: var(--blue);
  text-decoration: none;
}

.mod-header .mod-meta a:hover {
  text-decoration: underline;
}

.mod-tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.75em;
  font-weight: 600;
  background: rgba(255,255,255,0.06);
  color: var(--text-muted);
  margin-right: 6px;
}

.mod-tag.required { background: rgba(201,68,45,0.15); color: var(--accent); }
.mod-tag.framework { background: rgba(88,166,255,0.15); color: var(--blue); }
.mod-tag.building { background: rgba(63,185,80,0.15); color: var(--green); }
.mod-tag.clothing { background: rgba(188,140,255,0.15); color: var(--purple); }
.mod-tag.medical { background: rgba(210,153,34,0.15); color: var(--yellow); }
.mod-tag.admin { background: rgba(255,123,114,0.15); color: #ff7b72; }

/* ---- CARDS ---- */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
}

.card h2 {
  font-size: 1.15em;
  margin-bottom: 12px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card h3 {
  font-size: 0.95em;
  color: var(--text-muted);
  margin: 16px 0 8px;
}

.card p {
  color: var(--text-muted);
  font-size: 0.9em;
  margin-bottom: 8px;
}

.card ul {
  list-style: none;
  padding: 0;
}

.card ul li {
  padding: 4px 0;
  color: var(--text-muted);
  font-size: 0.9em;
}

.card ul li::before {
  content: "\25B8";
  color: var(--accent);
  margin-right: 8px;
}

/* ---- TABLES ---- */
.table-wrap {
  overflow-x: auto;
  margin: 12px 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88em;
}

thead th {
  background: rgba(0,0,0,0.3);
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 0.8em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 2px solid var(--card-border);
  white-space: nowrap;
}

tbody td {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--text-muted);
}

tbody tr:hover td {
  background: rgba(255,255,255,0.02);
}

.tier-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.8em;
  font-weight: 600;
}

.tier-1 { background: #1b4332; color: #4ecca3; }
.tier-2 { background: #3a2d0a; color: #f0c040; }
.tier-3 { background: #4a1525; color: #e0503a; }

/* ---- COLLAPSIBLE SECTIONS ---- */
.collapsible {
  cursor: pointer;
  user-select: none;
}

.collapsible::after {
  content: "\25BC";
  float: right;
  font-size: 0.7em;
  transition: transform 0.2s;
  color: var(--text-dim);
}

.collapsible.open::after {
  transform: rotate(180deg);
}

.collapsible-body {
  display: none;
  padding-top: 12px;
}

.collapsible.open + .collapsible-body {
  display: block;
}

/* ---- GRID LAYOUTS ---- */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.stat-card {
  background: rgba(0,0,0,0.2);
  border-radius: 8px;
  padding: 14px;
  text-align: center;
}

.stat-card .stat-value {
  font-size: 1.5em;
  font-weight: 700;
  color: var(--text);
}

.stat-card .stat-label {
  font-size: 0.75em;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-card.clickable {
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
}

.stat-card.clickable:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.stat-card.clickable .stat-value { color: var(--blue); }

.med-poison td { color: var(--accent) !important; font-style: italic; }

/* Popup list */
.med-popup-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.med-popup-overlay.visible { display: flex; }

.med-popup {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 24px;
  max-width: 700px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  animation: fadeIn 0.2s ease;
}

.med-popup h3 {
  font-size: 1.2em;
  margin-bottom: 16px;
  color: var(--accent);
}

.med-popup .close-btn {
  float: right;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5em;
  cursor: pointer;
  padding: 0 8px;
  line-height: 1;
}

.med-popup .close-btn:hover { color: var(--text); }

.med-popup table { font-size: 0.85em; }

/* ---- SEARCH HIGHLIGHTS ---- */
.search-match {
  background: rgba(201, 68, 45, 0.25);
  border-left: 3px solid var(--accent);
  padding-left: 8px;
}

/* ---- HOME PAGE ---- */
.home-hero {
  text-align: center;
  padding: 48px 0;
}

.home-hero h1 {
  font-size: 2.5em;
  margin-bottom: 12px;
}

.home-hero h1 .accent {
  color: var(--accent);
}

.home-hero p {
  color: var(--text-muted);
  font-size: 1.1em;
  max-width: 600px;
  margin: 0 auto;
}

.mod-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  margin-top: 32px;
}

.mod-grid-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  color: inherit;
  display: block;
}

.mod-grid-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.mod-grid-card h3 {
  font-size: 1em;
  margin-bottom: 6px;
  color: var(--text);
}

.mod-grid-card p {
  font-size: 0.82em;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ---- FOOTER ---- */
.footer {
  margin-top: 64px;
  padding: 24px 0;
  border-top: 1px solid var(--card-border);
  text-align: center;
  color: var(--text-dim);
  font-size: 0.8em;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .menu-toggle { display: block; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; padding: 20px 16px; }
  .header .logo span { display: none; }
  .mod-header h1 { font-size: 1.5em; }
  .home-hero h1 { font-size: 1.8em; }
  .grid-2 { grid-template-columns: 1fr; }
}

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--card-border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ---- INFO BOXES ---- */
.info-box {
  padding: 14px 16px;
  border-radius: 8px;
  font-size: 0.88em;
  margin: 12px 0;
}

.info-box.warning {
  background: rgba(210,153,34,0.1);
  border: 1px solid rgba(210,153,34,0.3);
  color: var(--yellow);
}

.info-box.info {
  background: rgba(88,166,255,0.1);
  border: 1px solid rgba(88,166,255,0.3);
  color: var(--blue);
}

.info-box.danger {
  background: rgba(201,68,45,0.1);
  border: 1px solid rgba(201,68,45,0.3);
  color: var(--accent);
}

/* ---- LINKS ---- */
.ext-link {
  color: var(--blue);
  text-decoration: none;
  font-size: 0.85em;
}

.ext-link:hover { text-decoration: underline; }

.links-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}

.link-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: rgba(255,255,255,0.05);
  border-radius: 16px;
  color: var(--blue);
  text-decoration: none;
  font-size: 0.82em;
  transition: background 0.15s;
}

.link-pill:hover {
  background: rgba(88,166,255,0.15);
}

/* ---- SYMPTOM SELECTOR ---- */
.symptom-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.88em;
  color: var(--text-muted);
  transition: all 0.15s;
  user-select: none;
}

.symptom-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

.symptom-btn:has(input:checked) {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--text);
}

.symptom-btn input {
  accent-color: var(--accent);
}
