/* Central theme (spec §6: "do not hardcode colours into business logic" --
   map.js/panels.js read these via getComputedStyle rather than embedding
   hex values, so retheming never touches JS). Palette follows the sibling
   apps' "eve-panel" dark slate/sky look (see ~/Blueprints/CLAUDE.md's
   restyle notes: slate-900 panels with a faint sky gradient bleeding down
   from the top edge, slate-700/800 borders, angled-corner clip-path
   frames) so this reads as part of the same eveiskflow.com family. */
:root {
  --bg: #0b1120;
  --panel-bg: #0f172a;
  --panel-border: #1e293b;
  --panel-border-light: #334155;
  --text: #e2e8f0;
  --text-dim: #94a3b8;
  --accent: #38bdf8;
  --accent-dim: #0ea5e9;
  --danger: #f87171;

  /* Security-status visual hierarchy (spec §6). */
  --sec-highsec: #38bdf8;
  --sec-lowsec: #fbbf24;
  --sec-nullsec: #f87171;
  --sec-unknown: #a78bfa;

  /* Online/offline/stale character status (spec §11). */
  --status-online: #34d399;
  --status-offline: #64748b;
  --status-stale: #fbbf24;

  /* Base HSL character-marker hue is derived per-character (a deterministic
     hash of character_id) in map.js -- these two control the shared
     saturation/lightness so every marker still reads as one palette family. */
  --char-marker-saturation: 85%;
  --char-marker-lightness: 65%;

  --panel-notch: 14px;
  --chrome-notch: 8px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overflow: hidden;
}

#map-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
}

#map-canvas canvas {
  display: block;
  touch-action: none;
}

.eve-panel {
  background: var(--panel-bg);
  background-image: linear-gradient(to bottom, rgba(56, 189, 248, 0.08), transparent 60px);
  border: 1px solid var(--panel-border-light);
  clip-path: polygon(
    var(--panel-notch) 0,
    100% 0,
    100% calc(100% - var(--panel-notch)),
    calc(100% - var(--panel-notch)) 100%,
    0 100%,
    0 var(--panel-notch)
  );
}

button,
.button {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border-light);
  color: var(--text);
  font: inherit;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.75rem;
  padding: 0.5em 0.9em;
  cursor: pointer;
  clip-path: polygon(
    var(--chrome-notch) 0,
    100% 0,
    100% calc(100% - var(--chrome-notch)),
    calc(100% - var(--chrome-notch)) 100%,
    0 100%,
    0 var(--chrome-notch)
  );
}

button:hover,
.button:hover {
  border-color: var(--accent);
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.35);
}

button:disabled,
.button:disabled {
  opacity: 0.5;
  cursor: default;
  box-shadow: none;
}

.button--primary {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: #04121c;
  font-weight: 600;
}

input[type="text"],
input[type="search"] {
  background: var(--bg);
  border: 1px solid var(--panel-border-light);
  color: var(--text);
  font: inherit;
  padding: 0.5em 0.7em;
}

input[type="text"]:focus,
input[type="search"]:focus {
  outline: 1px solid var(--accent);
}

/* ---- Layout shell ---- */

#topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 1rem;
  pointer-events: none;
}

#topbar > * {
  pointer-events: auto;
}

#breadcrumb {
  font-size: 0.85rem;
  color: var(--text-dim);
  padding: 0.4rem 0.8rem;
}

#breadcrumb button {
  background: none;
  border: none;
  color: var(--accent);
  clip-path: none;
  padding: 0 0.2em;
  text-transform: none;
  letter-spacing: normal;
  font-size: inherit;
}

#breadcrumb button:hover {
  text-decoration: underline;
  box-shadow: none;
}

#search-box {
  flex: 0 0 auto;
  position: relative;
}

#search-input {
  width: 220px;
}

#search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 320px;
  max-height: 360px;
  overflow-y: auto;
  padding: 0.4rem 0;
  display: none;
}

#search-results.open {
  display: block;
}

.search-result {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.8rem;
  cursor: pointer;
  font-size: 0.85rem;
}

.search-result:hover {
  background: rgba(56, 189, 248, 0.12);
}

.search-result .kind {
  color: var(--text-dim);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

#account-controls {
  margin-left: auto;
  display: flex;
  gap: 0.5rem;
}

#map-controls {
  position: fixed;
  bottom: 1rem;
  left: 1rem;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

#map-controls .row {
  display: flex;
  gap: 0.4rem;
}

#character-panel {
  position: fixed;
  top: 4rem;
  right: 1rem;
  z-index: 10;
  width: 260px;
  max-height: calc(100vh - 6rem);
  overflow-y: auto;
  padding: 0.8rem;
  font-size: 0.85rem;
}

#character-panel h2 {
  margin: 0 0 0.6rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}

.character-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0;
  cursor: pointer;
}

.character-row .swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: none;
}

.character-row .status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
  margin-left: auto;
}

.character-row .name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.character-row .location {
  display: block;
  color: var(--text-dim);
  font-size: 0.75rem;
}

#info-panel {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 10;
  width: 300px;
  max-height: 50vh;
  overflow-y: auto;
  padding: 0.9rem 1rem;
  display: none;
}

#info-panel.open {
  display: block;
}

#info-panel h2 {
  margin: 0 0 0.3rem;
  font-size: 1rem;
}

#info-panel .subtitle {
  color: var(--text-dim);
  font-size: 0.75rem;
  margin-bottom: 0.6rem;
}

#info-panel dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 0.6rem;
  margin: 0;
  font-size: 0.8rem;
}

#info-panel dt {
  color: var(--text-dim);
}

#info-panel dd {
  margin: 0;
}

#info-panel .close {
  position: absolute;
  top: 0.4rem;
  right: 0.5rem;
  background: none;
  border: none;
  color: var(--text-dim);
  clip-path: none;
  padding: 0.2rem 0.5rem;
}

#nav-toggle {
  display: none;
}

/* ---- Mobile / tablet ---- */
@media (max-width: 640px) {
  #topbar {
    flex-wrap: wrap;
  }

  #search-input {
    width: 100%;
  }

  #search-box {
    order: 3;
    flex: 1 1 100%;
  }

  #account-controls {
    margin-left: 0;
  }

  #character-panel {
    top: auto;
    bottom: 4.5rem;
    right: 0.5rem;
    left: 0.5rem;
    width: auto;
    max-height: 40vh;
  }

  #info-panel {
    left: 0.5rem;
    right: 0.5rem;
    width: auto;
    bottom: 0.5rem;
  }

  #map-controls {
    bottom: 0.5rem;
    left: 0.5rem;
  }
}
