/* ============================================
   NATIONSPACE — Retro Space Theme
   Early 2000s NationStates aesthetic + MS Paint
   ============================================ */

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

body {
  background-color: #0a0a1a;
  color: #ccc;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

/* --- Star Background --- */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  background-image:
    radial-gradient(1px 1px at 10% 20%, #fff 50%, transparent 50%),
    radial-gradient(1px 1px at 30% 70%, #fff 50%, transparent 50%),
    radial-gradient(1px 1px at 50% 10%, #fff 50%, transparent 50%),
    radial-gradient(1px 1px at 70% 40%, #fff 50%, transparent 50%),
    radial-gradient(1px 1px at 90% 80%, #fff 50%, transparent 50%),
    radial-gradient(1px 1px at 15% 90%, #ddd 50%, transparent 50%),
    radial-gradient(1px 1px at 45% 45%, #ddd 50%, transparent 50%),
    radial-gradient(1px 1px at 75% 15%, #eee 50%, transparent 50%),
    radial-gradient(1px 1px at 85% 55%, #ddd 50%, transparent 50%),
    radial-gradient(1px 1px at 5% 50%, #eee 50%, transparent 50%),
    radial-gradient(1px 1px at 25% 35%, #fff 50%, transparent 50%),
    radial-gradient(1px 1px at 55% 85%, #fff 50%, transparent 50%),
    radial-gradient(1px 1px at 65% 60%, #ddd 50%, transparent 50%),
    radial-gradient(1px 1px at 95% 25%, #eee 50%, transparent 50%),
    radial-gradient(1px 1px at 40% 5%, #fff 50%, transparent 50%),
    radial-gradient(1px 1px at 80% 95%, #ddd 50%, transparent 50%),
    radial-gradient(2px 2px at 20% 55%, #fff 50%, transparent 50%),
    radial-gradient(2px 2px at 60% 30%, #eee 50%, transparent 50%);
  background-color: #0a0a1a;
}

/* --- Page Layout (sidebar + main) --- */
.page-layout {
  display: flex;
  min-height: 100vh;
}

.site-sidebar {
  width: 200px;
  flex-shrink: 0;
  background-color: rgba(10, 10, 26, 0.95);
  border-right: 2px solid #336699;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 50;
}

.sidebar-brand {
  padding: 20px 15px 15px;
  border-bottom: 1px solid #336699;
}

.page-main {
  flex: 1;
  min-width: 0;
  padding: 20px 25px;
}

/* --- Site Title (in sidebar) --- */
.site-title {
  font-family: "Courier New", monospace;
  font-size: 20px;
  font-weight: bold;
  color: #fff;
  letter-spacing: 4px;
  text-transform: uppercase;
  text-shadow: 0 0 10px rgba(51, 102, 153, 0.5);
}

.site-subtitle {
  font-size: 10px;
  color: #667;
  letter-spacing: 1px;
  margin-top: 4px;
}

/* --- Sidebar Navigation --- */
.sidebar-nav {
  list-style: none;
  padding: 10px 0;
}

.sidebar-nav li {
  margin: 0;
}

.sidebar-link {
  display: block;
  padding: 8px 15px;
  font-family: "Courier New", monospace;
  font-size: 13px;
  color: #c9a227;
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: background-color 0.15s, border-color 0.15s;
}

.sidebar-link:hover {
  color: #fff;
  background-color: #1a1a3e;
  border-left-color: #336699;
}

.sidebar-link.active {
  color: #fff;
  background-color: #1a1a3e;
  border-left-color: #c9a227;
}

/* --- Links --- */
a {
  color: #c9a227;
  text-decoration: underline;
}

a:hover {
  color: #fff;
}

a:visited {
  color: #a88520;
}

/* --- Headings --- */
h1, h2, h3 {
  color: #fff;
  font-family: Georgia, "Times New Roman", serif;
}

h1 {
  font-size: 22px;
  border-bottom: 2px double #336699;
  padding-bottom: 6px;
  margin-bottom: 15px;
}

h2 {
  font-size: 18px;
  border-bottom: 1px solid #336699;
  padding-bottom: 4px;
  margin-bottom: 12px;
  margin-top: 25px;
}

h3 {
  font-size: 15px;
  margin-bottom: 8px;
  margin-top: 15px;
}

/* --- Tables --- */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 15px 0;
  font-size: 13px;
}

th, td {
  border: 1px solid #336699;
  padding: 6px 10px;
  text-align: left;
}

th {
  background-color: #1a1a3e;
  color: #c9a227;
  font-family: "Courier New", monospace;
  font-weight: bold;
  font-size: 12px;
  text-transform: uppercase;
  cursor: pointer;
  user-select: none;
}

th:hover {
  background-color: #252550;
}

th.sorted-asc::after {
  content: ' ▲';
}

th.sorted-desc::after {
  content: ' ▼';
}

tr:nth-child(even) {
  background-color: #111;
}

tr:nth-child(odd) {
  background-color: #1a1a2e;
}

tr:hover {
  background-color: #222244;
}

td.num {
  text-align: right;
  font-family: "Courier New", monospace;
}

/* --- Data / Stats --- */
.stat-label {
  font-family: "Courier New", monospace;
  color: #888;
  font-size: 12px;
  text-transform: uppercase;
}

.stat-value {
  font-family: "Courier New", monospace;
  color: #fff;
  font-size: 14px;
}

.data-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 15px;
  margin: 10px 0;
}

/* --- Buttons --- */
button, .btn {
  font-family: "Courier New", monospace;
  font-size: 12px;
  padding: 5px 15px;
  background-color: #1a1a3e;
  color: #c9a227;
  border: 1px solid #336699;
  cursor: pointer;
  text-transform: uppercase;
}

button:hover, .btn:hover {
  background-color: #252550;
  color: #fff;
}

/* --- Forms / Search --- */
input[type="text"], input[type="search"], input[type="password"] {
  font-family: "Courier New", monospace;
  font-size: 13px;
  padding: 6px 10px;
  background-color: #111;
  color: #ccc;
  border: 1px solid #336699;
  outline: none;
  width: 300px;
}

input[type="text"]:focus, input[type="search"]:focus, input[type="password"]:focus {
  border-color: #c9a227;
  color: #fff;
}

.search-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 15px 0;
}

/* --- Space Map Canvas --- */
.map-container {
  border: 2px solid #336699;
  margin: 15px 0;
  position: relative;
  background-color: #000;
  cursor: grab;
  overflow: hidden;
}

.map-container:active {
  cursor: grabbing;
}

.map-canvas {
  display: block;
  width: 100%;
  image-rendering: pixelated;
}

.map-tooltip {
  position: absolute;
  background-color: #1a1a3e;
  border: 1px solid #336699;
  color: #ccc;
  font-family: "Courier New", monospace;
  font-size: 11px;
  padding: 4px 8px;
  pointer-events: none;
  white-space: nowrap;
  display: none;
  z-index: 10;
}

/* --- Live Feed --- */
.live-feed {
  border: 1px solid #336699;
  background-color: #0a0a12;
  height: 200px;
  overflow-y: auto;
  font-family: "Courier New", monospace;
  font-size: 11px;
  padding: 8px;
  margin: 15px 0;
}

.live-feed-title {
  font-family: "Courier New", monospace;
  font-size: 12px;
  color: #c9a227;
  text-transform: uppercase;
  margin-bottom: 5px;
}

.feed-event {
  padding: 2px 0;
  border-bottom: 1px solid #111;
  color: #8a8;
}

.feed-event .timestamp {
  color: #555;
}

.feed-event .nation-name {
  color: #c9a227;
}

.feed-event .region-name {
  color: #6af;
}

/* --- Planet / Detail Cards --- */
.detail-card {
  border: 2px solid #336699;
  background-color: #111;
  padding: 15px;
  margin: 15px 0;
}

.detail-header {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 15px;
}

.detail-header img {
  image-rendering: pixelated;
  width: 80px;
  height: 80px;
}

.planet-sprite, .ship-sprite {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* --- Nation List --- */
.nation-list {
  list-style: none;
  padding: 0;
  columns: 2;
  column-gap: 20px;
  font-family: "Courier New", monospace;
  font-size: 12px;
}

.nation-list li {
  padding: 2px 0;
}

.nation-list li::before {
  content: '> ';
  color: #336699;
}

/* --- Badges / Tags --- */
.badge {
  display: inline-block;
  font-family: "Courier New", monospace;
  font-size: 10px;
  padding: 2px 6px;
  border: 1px solid;
  text-transform: uppercase;
}

.badge-wa {
  border-color: #4a4;
  color: #4a4;
}

.badge-delegate {
  border-color: #c9a227;
  color: #c9a227;
}

.badge-locked {
  border-color: #a44;
  color: #a44;
}

.badge-dead {
  border-color: #666;
  color: #666;
}

/* --- Guide Sections --- */
.guide-section {
  border: 1px solid #336699;
  background-color: #111;
  padding: 15px 20px;
  margin: 15px 0;
}

.guide-section h2 {
  margin-top: 0;
}

.guide-section p {
  margin: 8px 0;
}

.guide-section code {
  font-family: "Courier New", monospace;
  color: #6af;
  background-color: #1a1a2e;
  padding: 1px 4px;
}

/* --- Loading / Status --- */
.loading {
  font-family: "Courier New", monospace;
  color: #555;
  text-align: center;
  padding: 20px;
}

.loading::after {
  content: '...';
  animation: dots 1.5s steps(3) infinite;
}

@keyframes dots {
  0% { content: '.'; }
  33% { content: '..'; }
  66% { content: '...'; }
}

.error-msg {
  color: #c44;
  font-family: "Courier New", monospace;
  font-size: 12px;
  padding: 8px;
  border: 1px solid #c44;
  background-color: #1a0a0a;
  margin: 10px 0;
}

/* --- Footer --- */
.site-footer {
  text-align: center;
  padding: 15px 0;
  margin-top: 30px;
  border-top: 1px solid #336699;
  font-size: 11px;
  color: #555;
  font-family: "Courier New", monospace;
}

/* --- Layout Helpers --- */
.flex-row {
  display: flex;
  gap: 15px;
}

.flex-col {
  display: flex;
  flex-direction: column;
}

.main-content {
  flex: 1;
  min-width: 0;
}

.content-sidebar {
  width: 280px;
  flex-shrink: 0;
}

/* --- Claim / Verification Forms --- */
.claim-form {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 10px 0;
}

.claim-form input[type="text"] {
  width: 250px;
}

.claim-status {
  border: 1px solid #336699;
  background-color: #111;
  padding: 12px;
  margin: 10px 0;
  font-family: "Courier New", monospace;
  font-size: 13px;
}

.claim-status .countdown {
  color: #c9a227;
  font-size: 16px;
  font-weight: bold;
}

.claim-status .instructions {
  color: #8a8;
  margin: 8px 0;
}

.form-error {
  color: #c44;
  font-family: "Courier New", monospace;
  font-size: 12px;
  margin: 5px 0;
}

.form-success {
  color: #4a4;
  font-family: "Courier New", monospace;
  font-size: 12px;
  margin: 5px 0;
}

/* --- Pagination --- */
.pagination {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  margin: 15px 0;
  font-family: "Courier New", monospace;
  font-size: 12px;
}

.pagination button:disabled {
  opacity: 0.4;
  cursor: default;
}

.pagination .page-info {
  color: #888;
}

/* --- Section Spacing --- */
.page-section {
  margin: 25px 0;
}

.page-section h2:first-child {
  margin-top: 0;
}

/* --- Verified Badge --- */
.verified-badge {
  color: #4a4;
  font-weight: bold;
}

/* --- Inline Form --- */
.inline-form {
  max-width: 400px;
  margin: 10px 0;
}

.inline-form input[type="text"],
.inline-form input[type="password"] {
  width: 100%;
  margin-bottom: 10px;
}

/* --- Team Detail --- */
.spaceship-list {
  list-style: none;
  padding: 0;
  font-family: "Courier New", monospace;
  font-size: 12px;
}

.spaceship-list li {
  padding: 4px 0;
  border-bottom: 1px solid #1a1a3e;
}

.spaceship-list li::before {
  content: '> ';
  color: #336699;
}

/* --- Member List --- */
.member-list {
  list-style: none;
  padding: 0;
  font-family: "Courier New", monospace;
  font-size: 12px;
}

.member-list li {
  padding: 4px 0;
  border-bottom: 1px solid #1a1a3e;
}

.member-list li::before {
  content: '> ';
  color: #c9a227;
}

/* --- Modal Overlay --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(10, 10, 26, 0.85);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 100;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background-color: #0a0a1a;
  border: 2px solid #336699;
  max-width: 500px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 20px;
  position: relative;
}

.modal h2 {
  margin-top: 0;
}

.modal-close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: none;
  border: none;
  color: #888;
  font-size: 20px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.modal-close:hover {
  color: #fff;
  background: none;
}

/* --- Action Buttons --- */
.action-buttons {
  display: flex;
  gap: 10px;
  margin: 20px 0;
}

.action-btn {
  font-family: "Courier New", monospace;
  font-size: 13px;
  padding: 8px 20px;
  background-color: #1a1a3e;
  color: #c9a227;
  border: 1px solid #336699;
  cursor: pointer;
  text-transform: uppercase;
}

.action-btn:hover {
  background-color: #252550;
  color: #fff;
}

/* --- Feed Status Dot --- */
.feed-status {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
  background-color: #666;
}

.feed-status-connected {
  background-color: #4a4;
}

.feed-status-reconnecting {
  background-color: #c9a227;
}

.feed-status-disconnected {
  background-color: #666;
}

/* --- Breadcrumb --- */
.breadcrumb {
  font-family: "Courier New", monospace;
  font-size: 12px;
  color: #888;
  margin-bottom: 10px;
}

.breadcrumb a {
  color: #c9a227;
}

.breadcrumb a:hover {
  color: #fff;
}

/* --- Map Legend --- */
.map-legend {
  display: flex;
  gap: 15px;
  justify-content: center;
  padding: 8px 0;
  font-family: "Courier New", monospace;
  font-size: 11px;
  color: #888;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

/* --- Button Loading State --- */
button.btn-loading,
button:disabled {
  opacity: 0.6;
  cursor: default;
}

/* --- Battle History Table --- */
.battle-history-table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 12px;
}

.battle-history-table th {
  cursor: default;
}

/* --- SSE Event Categories --- */
.feed-move {
  color: #4a4 !important;
}

.feed-cte {
  color: #a44 !important;
}

.feed-delegate {
  color: #c9a227 !important;
  font-weight: bold;
}

.feed-system {
  color: #6af !important;
  font-style: italic;
}

/* --- WFE Content --- */
.wfe-content {
  font-size: 13px;
  line-height: 1.6;
  color: #ccc;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* --- Modal Steps (Progress Indicator) --- */
.modal-steps {
  display: flex;
  list-style: none;
  padding: 0;
  margin: 12px 0 16px;
  gap: 0;
}

.modal-steps li {
  flex: 1;
  text-align: center;
  font-family: "Courier New", monospace;
  font-size: 11px;
  color: #555;
  padding: 6px 4px;
  border-bottom: 2px solid #333;
  transition: color 0.2s, border-color 0.2s;
}

.modal-steps li.step-active {
  color: #c9a227;
  border-bottom-color: #c9a227;
}

.modal-steps li.step-done {
  color: #4a4;
  border-bottom-color: #4a4;
}

.modal-steps li.step-done::after {
  content: ' \2713';
}

/* --- Next Steps (What's Next Panel) --- */
.next-steps {
  border: 1px solid #336699;
  background-color: #0a0a1a;
  padding: 12px 16px;
  margin: 12px 0;
}

.next-steps h3 {
  font-family: "Courier New", monospace;
  font-size: 13px;
  color: #c9a227;
  margin: 0 0 8px;
  text-transform: uppercase;
}

.next-steps-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.next-steps-list li {
  padding: 4px 0;
  font-family: "Courier New", monospace;
  font-size: 12px;
}

.next-steps-list li::before {
  content: '> ';
  color: #336699;
}

.next-steps-list a {
  color: #c9a227;
  text-decoration: underline;
  cursor: pointer;
}

.next-steps-list a:hover {
  color: #fff;
}

/* --- Modal Narrative --- */
.modal-narrative {
  font-style: italic;
  color: #999;
  margin: 8px 0 14px;
  font-size: 13px;
  line-height: 1.5;
}

.modal-narrative strong {
  color: #c9a227;
  font-style: normal;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .page-layout {
    flex-direction: column;
  }

  .site-sidebar {
    width: 100%;
    height: auto;
    position: relative;
    border-right: none;
    border-bottom: 2px solid #336699;
  }

  .sidebar-brand {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 10px 15px;
  }

  .site-title {
    font-size: 18px;
    letter-spacing: 3px;
  }

  .sidebar-nav {
    display: flex;
    flex-wrap: wrap;
    padding: 0 10px 8px;
    gap: 0;
  }

  .sidebar-nav li {
    flex: none;
  }

  .sidebar-link {
    padding: 5px 10px;
    border-left: none;
    border-bottom: 3px solid transparent;
    font-size: 12px;
  }

  .sidebar-link:hover {
    border-left: none;
    border-bottom-color: #336699;
  }

  .sidebar-link.active {
    border-left: none;
    border-bottom-color: #c9a227;
  }

  .page-main {
    padding: 15px 10px;
  }

  .flex-row {
    flex-direction: column;
  }

  .content-sidebar {
    width: 100%;
  }

  input[type="text"], input[type="search"], input[type="password"] {
    width: 100%;
  }

  .nation-list {
    columns: 1;
  }

  .action-buttons {
    flex-direction: column;
  }

  .modal {
    width: 95%;
    max-height: 90vh;
  }
}
