/* ============================================================
   BEACON ATLAS - 3D Holographic City Map
   CRT Terminal Aesthetic
   ============================================================ */

:root {
  --green: #33ff33;
  --green-dim: #1a8c1a;
  --green-glow: #00ff0044;
  --amber: #ffb000;
  --amber-dim: #996a00;
  --red: #ff4444;
  --cyan: #00ffff;
  --gold: #ffd700;
  --pink: #ff88cc;
  --purple: #8888ff;
  --magenta: #ff44ff;
  --bg-dark: #0a0a0a;
  --bg-terminal: #000800;
  --bg-panel: rgba(0, 8, 0, 0.92);
  --border: #1a331a;
  --text-dim: #668866;
  --text-body: #a0c8a0;
  --font-mono: 'IBM Plex Mono', 'Share Tech Mono', 'Courier New', monospace;
  --font-display: 'VT323', 'IBM Plex Mono', monospace;
}

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

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg-dark);
  font-family: var(--font-mono);
  color: var(--green);
}

/* --- Canvas --- */
#atlas-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 1;
}

/* --- CRT Overlay --- */
.crt-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 100;
  background:
    repeating-linear-gradient(
      0deg,
      rgba(0, 255, 0, 0.015) 0px,
      transparent 1px,
      transparent 3px
    ),
    radial-gradient(ellipse at center, transparent 60%, rgba(0, 0, 0, 0.4) 100%);
}

/* --- HUD (top-left) --- */
.hud {
  position: fixed;
  top: 16px; left: 16px;
  z-index: 50;
  pointer-events: none;
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1.4;
  color: var(--green);
  text-shadow: 0 0 8px var(--green-glow);
}

.hud-title {
  font-size: 28px;
  color: var(--amber);
  text-shadow: 0 0 12px rgba(255, 176, 0, 0.4);
  letter-spacing: 2px;
}

.hud-stats {
  font-size: 18px;
  color: var(--text-dim);
  margin-top: 4px;
}

.hud-stats span {
  color: var(--green);
}

/* --- Controls hint (bottom-left) --- */
.controls-hint {
  position: fixed;
  bottom: 16px; left: 16px;
  z-index: 50;
  pointer-events: none;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.6;
  opacity: 0.7;
}

/* --- Info Panel (right side) --- */
.info-panel {
  position: fixed;
  top: 16px; right: 16px;
  bottom: 16px;
  width: 420px;
  z-index: 60;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  transform: translateX(460px);
  transition: transform 0.3s ease-out;
  box-shadow:
    0 0 20px rgba(0, 255, 0, 0.05),
    inset 0 0 40px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.info-panel.open {
  transform: translateX(0);
}

/* Panel titlebar */
.panel-titlebar {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  background: rgba(0, 20, 0, 0.6);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 12px;
  flex-shrink: 0;
}

.panel-dots {
  display: flex;
  gap: 6px;
  margin-right: 12px;
}

.panel-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--green-dim);
  border: 1px solid var(--green);
  cursor: pointer;
}

.panel-dot:hover {
  background: var(--red);
  border-color: var(--red);
}

.panel-path {
  color: var(--text-dim);
  flex: 1;
}

.panel-path .prompt {
  color: var(--green);
}

/* Panel content */
.panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
  scrollbar-width: thin;
  scrollbar-color: var(--green-dim) transparent;
}

.panel-content::-webkit-scrollbar {
  width: 6px;
}

.panel-content::-webkit-scrollbar-thumb {
  background: var(--green-dim);
  border-radius: 3px;
}

/* Terminal output lines */
.t-cmd {
  color: var(--green);
  margin-bottom: 8px;
}

.t-cmd .dollar {
  color: var(--amber);
  margin-right: 6px;
}

.t-label {
  color: var(--text-dim);
  display: inline-block;
  min-width: 110px;
}

.t-value {
  color: var(--green);
}

.t-section {
  color: var(--amber);
  margin: 12px 0 6px;
  border-bottom: 1px dashed var(--amber-dim);
  padding-bottom: 2px;
  font-size: 11px;
  letter-spacing: 1px;
}

/* Grade badge */
.grade-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 3px;
  font-weight: bold;
  font-size: 14px;
  margin-right: 8px;
}

.grade-S { background: rgba(255, 215, 0, 0.2); color: var(--gold); border: 1px solid var(--gold); }
.grade-A { background: rgba(51, 255, 51, 0.15); color: var(--green); border: 1px solid var(--green); }
.grade-B { background: rgba(0, 255, 255, 0.15); color: var(--cyan); border: 1px solid var(--cyan); }
.grade-C { background: rgba(255, 176, 0, 0.15); color: var(--amber); border: 1px solid var(--amber); }
.grade-D { background: rgba(255, 68, 68, 0.15); color: var(--red); border: 1px solid var(--red); }
.grade-F { background: rgba(85, 85, 85, 0.2); color: #999; border: 1px solid #555; }

/* Progress bars */
.bar-row {
  display: flex;
  align-items: center;
  margin: 3px 0;
}

.bar-label {
  color: var(--text-dim);
  min-width: 90px;
  font-size: 12px;
}

.bar-track {
  flex: 1;
  height: 10px;
  background: rgba(0, 20, 0, 0.5);
  border: 1px solid var(--border);
  margin: 0 8px;
  position: relative;
}

.bar-fill {
  height: 100%;
  transition: width 0.4s ease;
}

.bar-value {
  font-size: 11px;
  color: var(--text-dim);
  min-width: 55px;
  text-align: right;
}

/* Contract rows */
.contract-row {
  display: flex;
  align-items: center;
  margin: 4px 0;
  padding: 4px 6px;
  border-left: 2px solid var(--green-dim);
  font-size: 12px;
}

.contract-row.rent { border-color: var(--green); }
.contract-row.buy { border-color: var(--gold); }
.contract-row.lease_to_own { border-color: var(--amber); }

.contract-type {
  text-transform: uppercase;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 2px;
  margin-right: 8px;
  min-width: 55px;
  text-align: center;
}

.contract-state {
  margin-left: auto;
  font-size: 10px;
  text-transform: uppercase;
  padding: 1px 5px;
  border-radius: 2px;
}

.state-active { color: var(--green); background: rgba(51, 255, 51, 0.1); }
.state-renewed { color: var(--cyan); background: rgba(0, 255, 255, 0.1); }
.state-offered { color: var(--amber); background: rgba(255, 176, 0, 0.1); }
.state-listed { color: var(--text-dim); background: rgba(100, 100, 100, 0.1); }
.state-expired { color: #999; background: rgba(80, 80, 80, 0.1); }
.state-breached { color: var(--red); background: rgba(255, 68, 68, 0.15); }

/* Calibration rows */
.cal-row {
  display: flex;
  align-items: center;
  margin: 3px 0;
  font-size: 12px;
}

.cal-name {
  min-width: 140px;
  color: var(--text-body);
}

.cal-bar {
  width: 80px;
  height: 8px;
  background: rgba(0, 20, 0, 0.5);
  border: 1px solid var(--border);
  margin: 0 8px;
}

.cal-fill {
  height: 100%;
  background: var(--cyan);
}

.cal-score {
  color: var(--cyan);
  font-size: 11px;
}

/* City panel styles */
.city-residents {
  margin-top: 8px;
}

.resident-row {
  display: flex;
  align-items: center;
  padding: 3px 0;
  font-size: 12px;
  cursor: pointer;
}

.resident-row:hover {
  color: var(--amber);
}

.resident-grade {
  min-width: 30px;
  text-align: center;
}

.resident-name {
  flex: 1;
  color: var(--green);
}

.resident-role {
  color: var(--text-dim);
  font-size: 11px;
}

/* --- Chat Interface --- */
.chat-messages {
  max-height: 200px;
  overflow-y: auto;
  padding: 8px 0;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: rgba(0, 4, 0, 0.4);
  scrollbar-width: thin;
  scrollbar-color: var(--green-dim) transparent;
}

.chat-messages::-webkit-scrollbar {
  width: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: var(--green-dim);
}

.chat-hint {
  padding: 12px 10px;
  color: var(--text-dim);
  font-style: italic;
  font-size: 12px;
  text-align: center;
}

.chat-msg {
  padding: 4px 10px;
  font-size: 12px;
  line-height: 1.5;
  word-wrap: break-word;
}

.chat-user {
  color: var(--amber);
}

.chat-agent {
  color: var(--green);
}

.chat-error {
  color: var(--red);
  font-size: 11px;
}

.chat-prefix {
  color: var(--text-dim);
  margin-right: 6px;
  font-size: 11px;
}

.chat-typing {
  padding: 4px 10px;
  color: var(--cyan);
  font-size: 11px;
}

.typing-dots::after {
  content: '...';
  animation: blink-dots 1.2s infinite;
}

@keyframes blink-dots {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

.chat-input-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  border-top: 1px solid var(--border);
}

.chat-dollar {
  color: var(--amber);
  font-size: 14px;
  font-weight: bold;
  flex-shrink: 0;
}

.chat-input {
  flex: 1;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 6px 10px;
  color: var(--green);
  font-family: var(--font-mono);
  font-size: 12px;
  outline: none;
  caret-color: var(--green);
}

.chat-input:focus {
  border-color: var(--green-dim);
  box-shadow: 0 0 6px var(--green-glow);
}

.chat-input::placeholder {
  color: var(--text-dim);
  opacity: 0.6;
}

.chat-input:disabled {
  opacity: 0.5;
}

.chat-send {
  background: transparent;
  border: 1px solid var(--green-dim);
  border-radius: 3px;
  color: var(--green);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 5px 10px;
  cursor: pointer;
  flex-shrink: 0;
  letter-spacing: 1px;
}

.chat-send:hover {
  background: rgba(51, 255, 51, 0.1);
  border-color: var(--green);
  text-shadow: 0 0 4px var(--green-glow);
}

/* --- CRT Form Controls --- */
.crt-select, .crt-input {
  background: rgba(0, 8, 0, 0.8);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--green);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 5px 8px;
  outline: none;
  flex: 1;
  max-width: 200px;
}

.crt-select:focus, .crt-input:focus {
  border-color: var(--green-dim);
  box-shadow: 0 0 6px var(--green-glow);
}

.crt-select option {
  background: #001a00;
  color: var(--green);
}

.crt-input::placeholder {
  color: var(--text-dim);
  opacity: 0.5;
}

.crt-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 6px 14px;
  cursor: pointer;
  letter-spacing: 1px;
}

.crt-btn:hover {
  border-color: var(--amber-dim);
  color: var(--amber);
}

.crt-btn-primary {
  border-color: var(--amber-dim);
  color: var(--amber);
}

.crt-btn-primary:hover {
  background: rgba(255, 176, 0, 0.1);
  border-color: var(--amber);
  text-shadow: 0 0 6px rgba(255, 176, 0, 0.3);
}

.crt-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.contract-new-btn {
  margin-top: 8px;
  padding: 8px 12px;
  border: 1px dashed var(--amber-dim);
  border-radius: 3px;
  color: var(--amber);
  font-family: var(--font-mono);
  font-size: 12px;
  text-align: center;
  cursor: pointer;
  letter-spacing: 1px;
  transition: all 0.2s;
}

.contract-new-btn:hover {
  background: rgba(255, 176, 0, 0.08);
  border-color: var(--amber);
  text-shadow: 0 0 8px rgba(255, 176, 0, 0.3);
  box-shadow: 0 0 12px rgba(255, 176, 0, 0.1);
}

.contract-field {
  display: flex;
  align-items: center;
  margin: 6px 0;
  gap: 8px;
}

/* --- HUD Action Button --- */
.hud-action {
  margin-top: 8px;
  font-size: 16px;
  color: var(--amber);
  cursor: pointer;
  pointer-events: auto;
  font-family: var(--font-display);
  letter-spacing: 1px;
  text-shadow: 0 0 8px rgba(255, 176, 0, 0.3);
  transition: text-shadow 0.2s;
}

.hud-actions {
  display: flex;
  gap: 16px;
}

.hud-action:hover {
  text-shadow: 0 0 14px rgba(255, 176, 0, 0.6);
  color: #ffc833;
}

/* --- Bounty cards --- */
.bounty-card {
  background: rgba(0, 20, 0, 0.6);
  border: 1px solid var(--border);
  border-left: 3px solid #ffd700;
  padding: 8px 10px;
  margin: 6px 0;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.bounty-card:hover {
  border-color: #ffd700;
  background: rgba(255, 215, 0, 0.06);
}

.bounty-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 6px 0;
}

.bounty-link {
  color: var(--green);
  text-decoration: none;
  font-size: 12px;
  font-family: var(--font-mono);
  padding: 4px 8px;
  border: 1px solid var(--border);
  transition: border-color 0.2s, color 0.2s;
}

.bounty-link:hover {
  border-color: var(--green);
  color: #44ff44;
  text-shadow: 0 0 6px rgba(51, 255, 51, 0.3);
}

/* --- Tooltip --- */
.tooltip {
  position: fixed;
  z-index: 80;
  padding: 4px 10px;
  background: var(--bg-panel);
  border: 1px solid var(--green-dim);
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--green);
  pointer-events: none;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.15s;
  text-shadow: 0 0 4px var(--green-glow);
}

.tooltip.visible {
  opacity: 1;
}

/* --- Loading screen --- */
.loading-screen {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 200;
  background: var(--bg-dark);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  transition: opacity 0.5s;
}

.loading-screen.fade-out {
  opacity: 0;
  pointer-events: none;
}

.loading-title {
  font-size: 36px;
  color: var(--amber);
  text-shadow: 0 0 20px rgba(255, 176, 0, 0.4);
  margin-bottom: 16px;
  letter-spacing: 3px;
}

.loading-bar {
  width: 300px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.loading-fill {
  width: 0%;
  height: 100%;
  background: var(--green);
  box-shadow: 0 0 10px var(--green);
  transition: width 0.3s;
}

.loading-status {
  margin-top: 12px;
  font-size: 14px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .info-panel {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: 55vh;
    border-radius: 12px 12px 0 0;
    transform: translateY(100%);
  }

  .info-panel.open {
    transform: translateY(0);
  }

  .hud {
    top: 8px; left: 8px;
    font-size: 18px;
  }

  .hud-title { font-size: 22px; }
  .hud-stats { font-size: 14px; }

  .controls-hint { display: none; }
}


/* GET LISTED button - golden accent */
#hud-get-listed {
  background: rgba(255, 215, 0, 0.12) !important;
  border-color: #ffd700 !important;
  color: #ffd700 !important;
  animation: gold-pulse 3s ease-in-out infinite;
}

#hud-get-listed:hover {
  background: rgba(255, 215, 0, 0.25) !important;
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.3);
}

@keyframes gold-pulse {
  0%, 100% { border-color: #ffd70066; }
  50% { border-color: #ffd700; box-shadow: 0 0 8px rgba(255, 215, 0, 0.2); }
}

/* Advertise panel responsive */
@media (max-width: 900px) {
  #advertise-panel {
    width: 95vw !important;
  }
  #advertise-panel > div:nth-child(3) {
    grid-template-columns: 1fr !important;
  }
}

/* Accessibility: Respect user's reduced motion preference (WCAG 2.3.3) */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
