/* ============================================================
   paGame SPA – Styles
   ============================================================ */

/* --- Reset / Base ----------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #f4f6f8;
  color: #1a1a2e;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* --- Header / Navigation ---------------------------------- */
.site-header {
  background: #1a1a2e;
  color: #ffffff;
  padding: 0 1rem;
  box-shadow: 0 2px 6px rgba(0,0,0,.3);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 2rem;
  height: 56px;
}

.site-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: .04em;
  color: #e94560;
  white-space: nowrap;
}

.site-nav {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.site-nav a {
  color: #c8cfe8;
  text-decoration: none;
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
  font-size: 0.9rem;
  transition: background 0.15s, color 0.15s;
}

.site-nav a:hover,
.site-nav a.active {
  background: #e94560;
  color: #fff;
}

/* --- Content container ------------------------------------ */
.content-container {
  max-width: 900px;
  margin: 2rem auto;
  padding: 0 1rem;
  flex: 1;
  width: 100%;
}

/* --- Card ------------------------------------------------- */
.card {
  background: #fff;
  border-radius: 8px;
  padding: 2rem;
  box-shadow: 0 1px 4px rgba(0,0,0,.1);
}

.card h1 {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  color: #1a1a2e;
  border-bottom: 2px solid #e94560;
  padding-bottom: .5rem;
}

.card h2 {
  font-size: 1.15rem;
  margin-bottom: 1rem;
  color: #1a1a2e;
}

/* --- Forms ------------------------------------------------ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 1.1rem;
}

.form-group label {
  font-size: 0.875rem;
  font-weight: 600;
  color: #444;
}

.form-group input {
  border: 1px solid #cdd5df;
  border-radius: 5px;
  padding: 0.55rem 0.75rem;
  font-size: 1rem;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}

.form-group input:focus {
  outline: none;
  border-color: #e94560;
  box-shadow: 0 0 0 3px rgba(233,69,96,.18);
}

.form-group input.invalid {
  border-color: #d9534f;
}

/* --- Buttons ---------------------------------------------- */
.btn {
  display: inline-block;
  padding: 0.6rem 1.4rem;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  transition: background 0.15s, transform 0.1s;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
  background: #e94560;
  color: #fff;
}

.btn-primary:hover { background: #c73350; }

.btn-primary:disabled {
  background: #aaa;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: #1a1a2e;
  color: #fff;
}

.btn-secondary:hover { background: #2e2e50; }

/* --- Status messages -------------------------------------- */
.status-box {
  border-radius: 5px;
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.95rem;
  display: none; /* shown via JS */
}

.status-box.visible { display: block; }

.status-box.success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.status-box.error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.status-box.info {
  background: #d1ecf1;
  color: #0c5460;
  border: 1px solid #bee5eb;
}

/* --- Tables ----------------------------------------------- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  font-size: 0.95rem;
}

.data-table th {
  background: #1a1a2e;
  color: #fff;
  padding: 0.6rem 0.9rem;
  text-align: left;
  font-weight: 600;
}

.data-table td {
  padding: 0.55rem 0.9rem;
  border-bottom: 1px solid #e8ecf2;
}

.data-table tbody tr:hover { background: #f0f4ff; }

.data-table tbody tr:nth-child(even) { background: #f7f9fc; }

.data-table tbody tr:nth-child(even):hover { background: #e8efff; }

/* Rank badges */
.rank-1 { color: #b8860b; font-weight: 700; }
.rank-2 { color: #808080; font-weight: 700; }
.rank-3 { color: #8b5c2a; font-weight: 700; }

/* --- Select ----------------------------------------------- */
.map-select-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.map-select-row select {
  border: 1px solid #cdd5df;
  border-radius: 5px;
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  min-width: 220px;
  background: #fff;
}

.map-select-row select:focus {
  outline: none;
  border-color: #e94560;
  box-shadow: 0 0 0 3px rgba(233,69,96,.18);
}

/* --- Docs view -------------------------------------------- */

/* Two-column layout: sidebar + content */
.docs-layout {
  display: grid;
  grid-template-columns: 210px 1fr;
  gap: 1.5rem;
  align-items: start;
}

/* Sidebar TOC */
.docs-toc {
  background: #fff;
  border-radius: 8px;
  padding: 1.1rem 1rem;
  box-shadow: 0 1px 4px rgba(0,0,0,.1);
  position: sticky;
  top: 72px;
}
.docs-toc h2 {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #888;
  margin-bottom: .65rem;
}
.docs-toc ul { list-style: none; }
.docs-toc ul li { margin-bottom: .05rem; }
.docs-toc ul li a {
  display: block;
  padding: .28rem .45rem;
  border-radius: 4px;
  color: #1a1a2e;
  text-decoration: none;
  font-size: .85rem;
  transition: background .15s, color .15s;
}
.docs-toc ul li a:hover { background: #e94560; color: #fff; }
.docs-toc ul li.toc-sub a { padding-left: 1rem; font-size: .8rem; color: #555; }
.docs-toc ul li.toc-sub a:hover { color: #fff; }

/* Section headings */
.docs-section { margin-bottom: 2rem; }
h1.docs-h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1a1a2e;
  border-bottom: 3px solid #e94560;
  padding-bottom: .35rem;
  margin-bottom: 1.1rem;
}
h2.docs-h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1a1a2e;
  margin: 1.25rem 0 .6rem;
}

/* Overview list */
.overview-list { list-style: none; padding: 0; }
.overview-list li {
  padding: .4rem 0;
  border-bottom: 1px solid #f0f0f0;
  font-size: .95rem;
  display: flex;
  align-items: center;
  gap: .6rem;
}
.overview-list li:last-child { border-bottom: none; }
.overview-list li::before {
  content: "";
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #e94560;
  flex-shrink: 0;
}

/* Command cards */
.command-card {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,.1);
  margin-bottom: 1.25rem;
  overflow: hidden;
  display: grid;
  grid-template-columns: 170px 1fr;
}
.command-card-img {
  background: #1a1a2e;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.1rem;
}
.command-card-img img {
  max-width: 120px;
  max-height: 120px;
  object-fit: contain;
  border-radius: 4px;
}
.command-card-body { padding: 1.25rem 1.5rem; }
.command-card-body h2 {
  font-size: 1.1rem;
  color: #1a1a2e;
  margin-bottom: .5rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.cmd-badge {
  display: inline-block;
  background: #e94560;
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  padding: .15rem .5rem;
  border-radius: 3px;
  letter-spacing: .03em;
}
.command-card-body p {
  font-size: .9rem;
  color: #444;
  line-height: 1.6;
  margin-bottom: .5rem;
}

/* Numpad grid */
.numpad {
  display: inline-grid;
  grid-template-columns: repeat(3, 40px);
  gap: 3px;
  margin: .6rem 0;
}
.numpad-key {
  width: 40px; height: 40px;
  background: #1a1a2e;
  color: #fff;
  border-radius: 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: .7rem;
  font-weight: 700;
  line-height: 1.2;
}
.numpad-key .key-num { font-size: .95rem; color: #e94560; }
.numpad-key.inactive { background: #eee; color: #bbb; }
.numpad-key.inactive .key-num { color: #ccc; }

/* Tags / pills */
.tag {
  display: inline-block;
  background: #f0f4ff;
  border: 1px solid #cdd5df;
  border-radius: 4px;
  padding: .12rem .5rem;
  font-size: .78rem;
  font-family: monospace;
  color: #1a1a2e;
  margin: .12rem .08rem;
}
.tag.solid   { background: #ffeaee; border-color: #f5b8c0; color: #8b1a2a; }
.tag.info    { background: #e8f4ff; border-color: #b8d9f5; color: #0a4d7e; }

/* kbd key */
kbd {
  display: inline-block;
  background: #1a1a2e;
  color: #fff;
  border-radius: 4px;
  padding: .12rem .45rem;
  font-size: .82rem;
  font-family: monospace;
  border-bottom: 2px solid #e94560;
}

/* Endpoint list */
.endpoint-list {
  list-style: none;
  margin-top: 0.5rem;
}

.endpoint-list li {
  display: flex;
  gap: 0.75rem;
  align-items: baseline;
  padding: 0.5rem 0;
  border-bottom: 1px solid #eee;
  flex-wrap: wrap;
}

.endpoint-list li:last-child { border-bottom: none; }

.method-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  white-space: nowrap;
  color: #fff;
}

.method-get  { background: #0d6efd; }
.method-post { background: #198754; }

.endpoint-path {
  font-family: monospace;
  font-size: 0.9rem;
  word-break: break-all;
  color: #1a1a2e;
}

.endpoint-desc {
  color: #555;
  font-size: 0.875rem;
}

.download-area {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid #eee;
}

/* Error code table */
.error-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
  margin-top: .6rem;
}
.error-table th {
  background: #1a1a2e;
  color: #fff;
  padding: .5rem .9rem;
  text-align: left;
  font-weight: 600;
}
.error-table td {
  padding: .45rem .9rem;
  border-bottom: 1px solid #e8ecf2;
}
.error-table tbody tr:hover { background: #f0f4ff; }
.error-table tbody tr:nth-child(even) { background: #f7f9fc; }
.error-table tbody tr:nth-child(even):hover { background: #e8efff; }
.code-cell {
  font-family: monospace;
  font-weight: 700;
  color: #e94560;
}

/* Responsive docs */
@media (max-width: 680px) {
  .docs-layout { grid-template-columns: 1fr; }
  .docs-toc { position: static; }
  .command-card { grid-template-columns: 1fr; }
  .command-card-img { padding: .9rem; flex-direction: row; gap: .75rem; }
  .command-card-img img { max-width: 70px; max-height: 70px; }
}

/* --- Loading spinner -------------------------------------- */
.spinner {
  display: inline-block;
  width: 1.1em;
  height: 1.1em;
  border: 2px solid #ccc;
  border-top-color: #e94560;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 0.4em;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* --- 404 -------------------------------------------------- */
.not-found {
  text-align: center;
  padding: 3rem 1rem;
  color: #666;
}

.not-found h1 { font-size: 3rem; color: #e94560; margin-bottom: 0.5rem; }

/* --- Responsive ------------------------------------------- */
@media (max-width: 600px) {
  .header-inner { height: auto; padding: 0.75rem 0; flex-wrap: wrap; gap: 0.75rem; }
  .site-nav a   { font-size: 0.85rem; padding: 0.3rem 0.5rem; }
  .card         { padding: 1.25rem; }
  .map-select-row { flex-direction: column; align-items: stretch; }
  .map-select-row select { min-width: unset; width: 100%; }
}
