/* ============================================================
   common.css — PronteraMarket shared base styles
   ============================================================ */

/* ─── CSS Variables ──────────────────────────────────────────── */
:root {
  --bg: #0d1117; --bg2: #161b22; --bg3: #1c2333; --bg4: #242d3d;
  --gold: #d4a843; --gold2: #f0c050; --gold3: #a88030;
  --blue: #58a6ff; --green: #3fb950; --red: #f85149; --purple: #bc8cff;
  --text: #e6edf3; --text2: #8b949e; --text3: #6e7681;
  --border: #30363d; --shadow: rgba(0,0,0,0.4);
}

/* ─── Reset ──────────────────────────────────────────────────── */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ─── Header ─────────────────────────────────────────────────── */
.header {
  background: linear-gradient(135deg, #1a1208 0%, #2d1f0a 50%, #1a1208 100%);
  border-bottom: 2px solid var(--gold3);
  padding: 16px 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gold);
  text-shadow: 0 0 20px rgba(212,168,67,0.3);
  text-decoration: none;
}
.logo small {
  font-size: 0.7rem;
  color: var(--text2);
  font-weight: 400;
  display: block;
}

/* ─── Stats bar ──────────────────────────────────────────────── */
.stats { display: flex; gap: 20px; flex-wrap: wrap; }
.stat { text-align: center; }
.stat-val { font-size: 1.2rem; font-weight: 700; color: var(--gold2); }
.stat-label {
  font-size: 0.65rem;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ─── Navigation (horizontal, scrollable on mobile) ──────────── */
.nav {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.nav-link {
  padding: 10px 20px;
  color: var(--text2);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  font-size: 0.85rem;
  transition: all 0.2s;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.nav-link:hover { color: var(--text); }
.nav-link.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

/* ─── Main content area ──────────────────────────────────────── */
main {
  max-width: 1200px;
  margin: 16px auto;
  padding: 0 16px;
}

/* ─── Buttons ────────────────────────────────────────────────── */
.btn {
  padding: 8px 16px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  transition: all 0.2s;
}
.btn-gold { background: var(--gold); color: #000; }
.btn-gold:hover { background: var(--gold2); }
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text2);
}
.btn-outline:hover {
  border-color: var(--gold);
  color: var(--gold);
}
.btn-red { background: var(--red); color: #fff; }

/* ─── Music player ───────────────────────────────────────────── */
.music-wrap {
  position: relative;
  display: inline-block;
  vertical-align: middle;
  margin-left: 4px;
}
.music-btn {
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  font-size: 1.5rem;
  padding: 0;
  transition: all 0.2s;
  line-height: 1;
  position: relative;
  top: -6px;
}
.music-btn:hover { color: var(--gold); }
.music-btn.playing { color: var(--gold); }
.music-vol-wrap {
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(calc(-50% - 5px));
  background: var(--bg2);
  border: 1px solid var(--gold3);
  border-radius: 10px;
  padding: 0 14px;
  margin-left: 10px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 200;
  display: flex;
  align-items: center;
  height: 32px;
}
.music-wrap:hover .music-vol-wrap {
  opacity: 1;
  pointer-events: auto;
}
.music-vol-wrap::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 50%;
  transform: translateY(-50%);
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-right: 6px solid var(--gold3);
}
.music-vol {
  width: 100px;
  height: 6px;
  accent-color: var(--gold);
  cursor: pointer;
}

/* ─── Loading & empty states ─────────────────────────────────── */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--text2);
}
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.empty {
  text-align: center;
  padding: 40px;
  color: var(--text3);
}

/* ─── Detail overlay ─────────────────────────────────────────── */
.wiki-detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.wiki-detail {
  background: var(--bg2);
  border: 1px solid var(--gold3);
  border-radius: 12px;
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  position: relative;
}
.wiki-detail-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--bg4);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 30px;
  height: 30px;
  color: var(--text2);
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.wiki-detail-close:hover {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}
.wiki-detail h2 {
  color: var(--gold);
  margin-bottom: 16px;
  font-size: 1.2rem;
}
.wiki-detail-img {
  text-align: center;
  margin-bottom: 16px;
}
.wiki-detail-img img {
  max-width: 100%;
  max-height: 300px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 600px) {
  .header-content {
    flex-direction: column;
    text-align: center;
  }
  .nav {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }
  .nav-link {
    white-space: nowrap;
    flex-shrink: 0;
  }
  .wiki-detail {
    margin: 10px;
    padding: 16px;
  }
}
