/* ═══════════════════════════════════════════════════════════════
   SC MISSIONS — Dark HUD Interface
   Star Citizen inspired design
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;500;600;700;900&family=Exo+2:ital,wght@0,300;0,400;0,500;1,300&display=swap');

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
  --bg-void:       #060a0f;
  --bg-deep:       #0b1017;
  --bg-panel:      #0f1620;
  --bg-card:       #131c28;
  --bg-card-hover: #1a2538;
  --bg-selected:   #0e2035;

  --border-dim:    rgba(0, 200, 255, 0.08);
  --border-normal: rgba(0, 200, 255, 0.18);
  --border-bright: rgba(0, 200, 255, 0.45);

  --cyan:          #00c8ff;
  --cyan-dim:      #0099cc;
  --cyan-glow:     rgba(0, 200, 255, 0.15);
  --green:         #00e5a0;
  --green-glow:    rgba(0, 229, 160, 0.15);
  --red:           #ff3b3b;
  --red-dim:       #cc2222;
  --red-glow:      rgba(255, 59, 59, 0.15);
  --gold:          #ffc844;
  --white:         #e8f4ff;
  --text-dim:      #8aabbf;
  --text-muted:    #4a6880;

  --font-hud:      'Orbitron', monospace;
  --font-body:     'Exo 2', sans-serif;
  --fz:            17px;   /* adjustable base font size */

  --transition:    150ms ease;
  --radius:        3px;
}

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

html { font-size: 14px; scroll-behavior: smooth; }

body {
  background: var(--bg-void);
  color: var(--white);
  font-family: var(--font-body);
  font-weight: 300;
  line-height: 1.5;
  min-height: 100vh;
  overflow: hidden;
}

/* Scanline overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.03) 2px,
    rgba(0,0,0,0.03) 4px
  );
  pointer-events: none;
  z-index: 1000;
}

/* ── Layout ──────────────────────────────────────────────────── */
.app {
  display: grid;
  grid-template-rows: 56px 1fr;
  grid-template-columns: 340px 1fr;
  grid-template-areas:
    "header header"
    "sidebar detail";
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ── Header ─────────────────────────────────────────────────── */
.header {
  grid-area: header;
  background: var(--bg-deep);
  border-bottom: 1px solid var(--border-normal);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  position: relative;
  z-index: 10;
}

.header::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  opacity: 0.4;
}

.header-logo {
  font-family: var(--font-hud);
  font-size: 16px;
  font-weight: 700;
  color: var(--cyan);
  letter-spacing: 3px;
  text-transform: uppercase;
  text-shadow: 0 0 20px var(--cyan);
  white-space: nowrap;
}

.header-logo span {
  color: var(--text-dim);
  font-weight: 400;
}

.header-spacer { flex: 1; }

/* Verified toggle */
.verified-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  background: var(--bg-panel);
  border: 1px solid var(--border-normal);
  border-radius: var(--radius);
  cursor: pointer;
  user-select: none;
  transition: var(--transition);
}
.verified-toggle:hover { border-color: var(--border-bright); }

.toggle-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  transition: var(--transition);
}
.toggle-dot.unverified {
  background: var(--red);
  box-shadow: 0 0 8px var(--red);
}
.toggle-dot.all {
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
}

.toggle-label {
  font-family: var(--font-hud);
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* Lang switch */
.lang-switch {
  display: flex;
  border: 1px solid var(--border-normal);
  border-radius: var(--radius);
  overflow: hidden;
}
.lang-btn {
  padding: 6px 12px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-family: var(--font-hud);
  font-size: 10px;
  letter-spacing: 1px;
  cursor: pointer;
  transition: var(--transition);
}
.lang-btn.active, .lang-btn:hover {
  background: var(--cyan);
  color: var(--bg-void);
}

/* Search */
.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.search-wrap svg {
  position: absolute;
  left: 10px;
  color: var(--text-muted);
  pointer-events: none;
}
.search-input {
  background: var(--bg-panel);
  border: 1px solid var(--border-normal);
  border-radius: var(--radius);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 13px;
  padding: 6px 12px 6px 32px;
  width: 200px;
  outline: none;
  transition: var(--transition);
}
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus {
  border-color: var(--cyan-dim);
  box-shadow: 0 0 0 2px var(--cyan-glow);
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  grid-area: sidebar;
  background: var(--bg-panel);
  border-right: 1px solid var(--border-normal);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--border-normal) transparent;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border-normal); border-radius: 2px; }

/* Mission type group */
.type-group { border-bottom: 1px solid var(--border-dim); }

.type-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  cursor: pointer;
  background: var(--bg-panel);
  border-left: 2px solid transparent;
  transition: var(--transition);
  user-select: none;
}
.type-header:hover { background: var(--bg-card); border-left-color: var(--cyan-dim); }
.type-header.active { border-left-color: var(--cyan); }

.type-icon {
  width: 20px;
  height: 20px;
  color: var(--cyan-dim);
  flex-shrink: 0;
}

.type-name {
  font-family: var(--font-hud);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  flex: 1;
}
.type-header.active .type-name { color: var(--white); }

.type-count {
  font-family: var(--font-hud);
  font-size: 11px;
  font-weight: 600;
  color: var(--cyan);
  background: var(--cyan-glow);
  border: 1px solid var(--border-dim);
  border-radius: 2px;
  padding: 1px 7px;
  min-width: 26px;
  text-align: center;
}

.type-chevron {
  color: var(--text-muted);
  transition: transform var(--transition);
  flex-shrink: 0;
}
.type-header.open .type-chevron { transform: rotate(180deg); }

/* Mission list inside type */
.mission-list {
  display: none;
  background: var(--bg-deep);
}
.mission-list.open { display: block; }

.mission-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 16px 10px 30px;
  border-bottom: 1px solid var(--border-dim);
  cursor: pointer;
  transition: var(--transition);
  border-left: 2px solid transparent;
  position: relative;
}
.mission-item:hover { background: var(--bg-card-hover); }
.mission-item.selected {
  background: var(--bg-selected);
  border-left-color: var(--cyan);
}
.mission-item.unverified { border-left-color: var(--red-dim); }
.mission-item.unverified.selected { border-left-color: var(--red); }

.mission-item-info { flex: 1; min-width: 0; }

.mission-item-title {
  font-size: var(--fz);
  font-weight: 500;
  color: var(--white);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mission-item.unverified .mission-item-title { color: #ffaaaa; }

.mission-item-contractor {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

.mission-item-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  flex-shrink: 0;
}

.mission-reward {
  font-family: var(--font-hud);
  font-size: 11px;
  font-weight: 600;
  color: var(--gold);
}
.mission-item.unverified .mission-reward { color: #ff7777; }

.mission-availability {
  font-size: 10px;
  color: var(--text-muted);
}

/* ── Detail Panel ─────────────────────────────────────────────── */
.detail {
  grid-area: detail;
  background: var(--bg-deep);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--border-normal) transparent;
  position: relative;
}

.detail::-webkit-scrollbar { width: 4px; }
.detail::-webkit-scrollbar-track { background: transparent; }
.detail::-webkit-scrollbar-thumb { background: var(--border-normal); border-radius: 2px; }

/* Empty state */
.detail-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 16px;
  color: var(--text-muted);
}
.detail-empty svg { opacity: 0.2; }
.detail-empty p {
  font-family: var(--font-hud);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* Detail content */
.detail-inner {
  padding: 28px 36px;
  width: 100%;
  box-sizing: border-box;
}

.detail-header {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-dim);
}

.detail-title-block { flex: 1; }

.detail-title {
  font-family: var(--font-hud);
  font-size: 20px;
  font-weight: 700;
  color: var(--white);
  line-height: 1.2;
  margin-bottom: 10px;
  text-shadow: 0 0 30px rgba(255,255,255,0.1);
}

.detail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius);
  font-family: var(--font-hud);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.badge-verified {
  background: var(--green-glow);
  border: 1px solid var(--green);
  color: var(--green);
}
.badge-unverified {
  background: var(--red-glow);
  border: 1px solid var(--red);
  color: var(--red);
}
.badge-type {
  background: var(--cyan-glow);
  border: 1px solid var(--border-normal);
  color: var(--cyan-dim);
}

.detail-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 160px;
  text-align: right;
}
.detail-meta-row { display: flex; flex-direction: column; }
.detail-meta-label {
  font-size: 9px;
  font-family: var(--font-hud);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
}
.detail-meta-value {
  font-family: var(--font-hud);
  font-size: 13px;
  font-weight: 600;
  color: var(--gold);
}
.detail-meta-value.small { font-size: 11px; color: var(--text-dim); }

/* Two-column content */
.detail-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 20px;
}

@media (max-width: 900px) {
  .detail-columns { grid-template-columns: 1fr; }
  .app { grid-template-columns: 300px 1fr; }
}

.detail-section { margin-bottom: 20px; }

.detail-section-title {
  font-family: var(--font-hud);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--cyan-dim);
  padding-bottom: 8px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border-dim);
  display: flex;
  align-items: center;
  gap: 8px;
}
.detail-section-title::before {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  border: 1px solid var(--cyan);
  transform: rotate(45deg);
}

.detail-text {
  font-size: var(--fz);
  font-weight: 300;
  color: var(--text-dim);
  white-space: normal;
  line-height: 1.7;
}

/* ── Rich-text block elements (rt-*) ── */
.detail-text .rt-h1,
.detail-text .rt-h2,
.detail-text .rt-h3 {
  font-family: var(--font-hud);
  color: var(--cyan);
  letter-spacing: .06em;
  line-height: 1.3;
}
.detail-text .rt-h1 { font-size: 1.15em; margin: .75em 0 .25em; }
.detail-text .rt-h2 { font-size: 1.05em; margin: .65em 0 .2em; }
.detail-text .rt-h3 { font-size:  .95em; margin: .55em 0 .15em; }

.detail-text .rt-hr {
  border: none;
  border-top: 1px solid rgba(0,200,255,.25);
  margin: .6em 0;
}

.detail-text .rt-bq {
  border-left: 3px solid var(--cyan);
  margin: .4em 0;
  padding: .2em .75em;
  color: rgba(232,244,255,.6);
  font-style: italic;
}

.detail-text .rt-ul,
.detail-text .rt-ol {
  margin: .3em 0;
  padding-left: 1.4em;
}
.detail-text .rt-ul li,
.detail-text .rt-ol li { margin: .1em 0; }

.detail-text .rt-pre {
  background: rgba(0,200,255,.06);
  border: 1px solid rgba(0,200,255,.18);
  border-radius: 4px;
  padding: .5em .8em;
  overflow-x: auto;
  font-size: .85em;
  margin: .4em 0;
}
.detail-text .rt-pre code { font-family: 'Courier New', monospace; }

.detail-text .rt-code {
  background: rgba(0,200,255,.1);
  color: var(--cyan);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: .9em;
  font-family: 'Courier New', monospace;
}

.detail-text .rt-yt {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border: 1px solid rgba(0,200,255,.2);
  border-radius: 4px;
  margin: .5em 0;
}
.detail-text .rt-yt iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border: none;
}

.detail-text .rt-link {
  color: var(--cyan);
  text-decoration: underline;
}
.detail-text .rt-link:hover { opacity: .8; }

.detail-text .rt-p { margin: 0 0 .2em; }
.detail-text .rt-br { height: .5em; }

.objectives-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.objectives-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: var(--fz);
  color: var(--white);
}
.objectives-list li::before {
  content: '◆';
  color: var(--cyan);
  font-size: 10px;
  margin-top: 3px;
  flex-shrink: 0;
  text-shadow: 0 0 8px var(--cyan);
}

/* Lang column labels */
.lang-col-header {
  font-family: var(--font-hud);
  font-size: 9px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 4px 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius);
  display: inline-block;
  margin-bottom: 10px;
}

/* Font size control */
.fontsize-ctrl {
  display: flex;
  align-items: center;
  gap: 2px;
  border: 1px solid var(--border-normal);
  border-radius: var(--radius);
  overflow: hidden;
}
.fz-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-family: var(--font-hud);
  font-size: 10px;
  letter-spacing: 1px;
  padding: 6px 10px;
  cursor: pointer;
  transition: var(--transition);
  line-height: 1;
  user-select: none;
}
.fz-btn:hover:not(:disabled) {
  background: var(--cyan);
  color: var(--bg-void);
}
.fz-btn:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}
.fz-value {
  font-family: var(--font-hud);
  font-size: 9px;
  color: var(--text-muted);
  padding: 0 6px;
  letter-spacing: 0.5px;
  min-width: 24px;
  text-align: center;
  border-left: 1px solid var(--border-dim);
  border-right: 1px solid var(--border-dim);
}

/* Search results overlay */
.search-results {
  position: absolute;
  top: 56px;
  left: 0;
  right: 0;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-normal);
  max-height: 300px;
  overflow-y: auto;
  z-index: 20;
  display: none;
}
.search-results.open { display: block; }
.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-dim);
  transition: var(--transition);
}
.search-result-item:hover { background: var(--bg-card-hover); }
.search-result-title { font-size: 13px; color: var(--white); flex: 1; }
.search-result-meta { font-size: 11px; color: var(--text-muted); }

/* Loading spinner */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border-dim);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Animations ───────────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.detail-inner { animation: fadeIn 200ms ease; }

/* ── Scrollbar unified ─────────────────────────────────────────── */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-normal) transparent;
}

/* ── Sidebar: type name block with EN + HU subtitle ────────────── */
.type-name-block {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.type-name-hu {
  font-family: var(--font-body);
  font-size: 9px;
  font-weight: 300;
  letter-spacing: 0.5px;
  text-transform: none;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Sidebar: mission HU title subtitle ───────────────────────── */
.mission-item-title-hu {
  font-size: 11px;
  font-weight: 300;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Detail: HU title subtitle ────────────────────────────────── */
.detail-title-hu {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 300;
  font-style: italic;
  color: var(--text-muted);
  margin-top: 5px;
  line-height: 1.3;
}

/* ── Detail: bilingual two-column layout ───────────────────────── */
.detail-bilingual {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin-top: 24px;
}

@media (max-width: 1000px) {
  .detail-bilingual { grid-template-columns: 1fr; gap: 0; }
}

.detail-lang-col {
  /* column — sections stack vertically inside */
}

/* EN / HU language badge above each column */
.detail-lang-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-hud);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  padding: 5px 14px;
  border-radius: var(--radius);
  margin-bottom: 18px;
}

.detail-lang-badge.en {
  background: rgba(0, 200, 255, 0.08);
  border: 1px solid var(--cyan);
  color: var(--cyan);
  box-shadow: 0 0 12px rgba(0, 200, 255, 0.1);
}

.detail-lang-badge.hu {
  background: rgba(0, 229, 160, 0.08);
  border: 1px solid var(--green);
  color: var(--green);
  box-shadow: 0 0 12px rgba(0, 229, 160, 0.1);
}

/* ── Contractor filter (sticky top inside sidebar) ────────────── */
.contractor-filter-wrap {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-normal);
  padding: 10px 12px;
  flex-shrink: 0;
}

.contractor-select {
  width: 100%;
  background: var(--bg-void);
  border: 1px solid var(--border-normal);
  border-radius: var(--radius);
  color: var(--text-dim);
  font-family: var(--font-hud);
  font-size: 10px;
  letter-spacing: 0.5px;
  padding: 7px 10px;
  cursor: pointer;
  outline: none;
  transition: var(--transition);
}

.contractor-select:hover,
.contractor-select:focus {
  border-color: var(--cyan);
  color: var(--white);
}

/* ── Rich text formatting rendered in detail panel ────────────── */
/* Applied by renderText() in app.js — [c]text[/c] → cyan highlight */
.text-cyan {
  color: var(--cyan);
  text-shadow: 0 0 8px rgba(0, 200, 255, 0.4);
}

/* Bold and italic inside detail-text inherit font */
.detail-text strong { font-weight: 600; color: var(--white); }
.detail-text em     { font-style: italic; color: var(--text-dim); }

/* Same for objectives list items */
.objectives-list li strong { font-weight: 600; color: var(--white); }
.objectives-list li em     { font-style: italic; }
.objectives-list li .text-cyan { color: var(--cyan); text-shadow: 0 0 8px rgba(0,200,255,0.4); }

