/*
 * Base colours inspired by military field manuals.  Feel free to adjust
 * the CSS variables below to tailor the look of the book to your taste.
 */
:root {
  --dark-bg: #223128;
  --light-bg: #f8f2e3;
  --accent: #c1b28a;
  --ink: #1b1b1b;
}

/* Reset margins and provide a dark backdrop */
body {
  margin: 0;
  background-color: var(--dark-bg);
  font-family: "Segoe UI", Roboto, Ubuntu, Arial, sans-serif;
  color: var(--ink);
}

/* Top bar with game name */
.topbar {
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.2));
  color: var(--accent);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar .brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar .badge {
  background: linear-gradient(135deg, var(--dark-bg), #0f1f18);
  color: var(--accent);
  padding: 6px 12px;
  border-radius: 4px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.topbar h1 {
  font-size: 18px;
  margin: 0;
  color: #e9efe7;
  font-weight: 500;
}

.topbar .links {
  margin-left: auto;
  display: flex;
  gap: 15px;
}

.topbar .links a {
  color: var(--accent);
  text-decoration: none;
  font-size: 14px;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: 4px;
  transition: background 0.2s ease, border-color 0.2s ease;
}

/* Book container holds two pages side by side */
.book {
  display: grid;
  grid-template-columns: 1fr 1fr;
  max-width: 1400px;
  margin: 20px auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  border-radius: 10px;
  overflow: hidden;
}

.page {
  padding: 20px;
  background: var(--light-bg);
  color: var(--ink);
}

.page.left {
  border-right: 2px solid #c9ba94;
}

.page.right {
  border-left: 2px solid #c9ba94;
  display: flex;
  flex-direction: column;
}

/* Search row layout */
.form-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  margin-bottom: 8px;
  position: relative;
}

#searchInput,
#sortSelect {
  padding: 8px 10px;
  border: 1px solid #c7c1ae;
  border-radius: 6px;
  font-size: 14px;
  background: #fff;
  color: #000;
}

#searchInput:focus {
  outline: 2px solid var(--accent);
}

#searchBtn {
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--accent);
  border: 1px solid #b29f79;
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

#searchBtn:hover {
  background: #d3c49d;
}

/* Filters and stats */
.filters {
  display: flex;
  gap: 15px;
  align-items: center;
  margin-bottom: 10px;
}

.filters label {
  font-size: 14px;
  color: #555;
  display: flex;
  align-items: center;
  gap: 4px;
}

.stats {
  margin-left: auto;
  font-size: 12px;
  color: #444;
}

/* Results list */
.results {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 58vh;
  overflow-y: auto;
  padding-right: 4px;
}

.card {
  display: grid;
  grid-template-columns: 1fr 120px;
  gap: 10px;
  padding: 10px;
  background: #ffffff;
  border: 1px solid #d7d0b8;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.card:hover {
  background: #f5f0df;
}

.card .info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.card .info h3 {
  margin: 0;
  font-size: 16px;
}

.card .info image {
  width: 128px;
  height: 128px;
  object-fit: contain;
  margin-right: 8px;
}

.card .info .shop {
  font-size: 12px;
  color: #555;
}

.card .prices {
  display: flex;
  flex-direction: column;
  justify-content: center;
  font-size: 12px;
  align-items: flex-end;
}

.card .prices .buy {
  color: #184f1e;
  font-size: 18px;
  font-weight: bold;
}

.card .prices .sell {
  color: #7a1010;
  font-size: 18px;
  font-weight: bold;
}

/* Suggestions dropdown */
.suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  width: calc(100% - 20px);
  background: #fff;
  border: 1px solid #d7d0b8;
  border-radius: 6px;
  max-height: 200px;
  overflow-y: auto;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  z-index: 100;
}

.suggestions div {
  padding: 6px 10px;
  cursor: pointer;
  font-size: 14px;
}

.suggestions div:hover {
  background: #f5f0df;
}

/* Map area */
.map-container {
  position: relative;
  flex: 1;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid #c9ba94;
  margin-bottom: 10px;
  background: #000;
}

.map-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.marker {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: red;
  border: 2px solid #fff;
  transform: translate(-50%, -50%);
  display: none;
  pointer-events: none;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.4);
}

/* Details panel */
.panel {
  flex: 0 0 auto;
  background: #ffffff;
  border: 1px solid #d7d0b8;
  border-radius: 8px;
  padding: 10px;
  font-size: 14px;
  overflow-y: auto;
}

.panel h2 {
  margin-top: 0;
  font-size: 18px;
  margin-bottom: 6px;
}

#shopList .shopline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #eee;
  padding: 4px 0;
  cursor: pointer;
}

#shopList .shopline:last-child {
  border-bottom: none;
}

#shopList .shopline:hover {
  background: #f5f0df;
}

footer.footer {
  text-align: center;
  padding: 10px 20px;
  font-size: 12px;
  color: var(--accent);
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.2));
}

footer.footer a {
  color: var(--accent);
  text-decoration: underline
}

@media (max-width: 800px) {
  /* On smaller screens stack pages vertically */
  .book {
    grid-template-columns: 1fr;
  }
  .page.left {
    border-right: none;
    border-bottom: 2px solid #c9ba94;
  }
  .page.right {
    border-left: none;
  }
}