/* NebulaOS styles
   dark spacey theme. I tried to keep it flat and clean, no big gradients.
   glow comes from box-shadows and borders mostly */

:root {
  --bg: #07080d;
  --panel: #0d0f17;
  --panel-2: #12141f;
  --line: rgba(120, 160, 255, 0.14);
  --line-strong: rgba(120, 160, 255, 0.30);
  --text: #d7ddf0;
  --muted: #7c85a3;
  --accent: #5aa9ff;
  --accent-dim: #2b3a5c;
  --good: #4fd6a0;
  --warn: #ffcf5a;
  --danger: #ff6b7d;
  --glow: rgba(90, 169, 255, 0.35);
}

/* light-ish theme, still kind of a "day sky" vibe but not white blinding */
body.light {
  --bg: #e9edf7;
  --panel: #ffffff;
  --panel-2: #f2f4fb;
  --line: rgba(40, 70, 140, 0.16);
  --line-strong: rgba(40, 70, 140, 0.32);
  --text: #1c2238;
  --muted: #5b6580;
  --accent: #2f6fe0;
  --accent-dim: #b9caef;
  --glow: rgba(47, 111, 224, 0.25);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: "Segoe UI", Tahoma, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  user-select: none;
}

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

/* ---------- boot screen ---------- */
#boot {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s ease;
}
#boot.hidden { opacity: 0; pointer-events: none; }
.boot-inner { text-align: center; }
.boot-logo {
  font-size: 42px;
  letter-spacing: 8px;
  color: var(--text);
}
.boot-logo span { color: var(--accent); }
.boot-bar {
  width: 240px;
  height: 4px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  margin: 22px auto 12px;
  overflow: hidden;
}
.boot-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  box-shadow: 0 0 12px var(--glow);
  animation: bootload 2.1s ease forwards;
}
@keyframes bootload { to { width: 100%; } }
.boot-text { color: var(--muted); font-size: 12px; letter-spacing: 2px; }

/* ---------- desktop ---------- */
#desktop {
  position: absolute;
  top: 24px;
  left: 24px;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.icon {
  width: 92px;
  padding: 12px 6px;
  text-align: center;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 6px;
  transition: background 0.15s, border-color 0.15s;
}
.icon:hover {
  background: rgba(90, 169, 255, 0.08);
  border-color: var(--line);
}
.icon-glyph {
  font-size: 26px;
  color: var(--accent);
  height: 34px;
  line-height: 34px;
}
.icon span {
  display: block;
  font-size: 12px;
  margin-top: 6px;
  color: var(--text);
}

/* ---------- windows ---------- */
#window-layer {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none; /* layer ignores clicks, windows re-enable it */
}
.window {
  position: absolute;
  min-width: 300px;
  min-height: 180px;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: 0 18px 50px rgba(0,0,0,0.55), 0 0 0 1px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  pointer-events: auto;
  animation: pop 0.18s cubic-bezier(0.2, 0.8, 0.3, 1);
}
@keyframes pop {
  from { transform: scale(0.96) translateY(6px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}
.window.minimized { display: none; }

.titlebar {
  height: 38px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  padding: 0 10px;
  cursor: grab;
  flex: 0 0 auto;
}
.titlebar:active { cursor: grabbing; }
.titlebar .dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  margin-right: 6px;
  background: var(--accent-dim);
}
.titlebar .title {
  font-size: 13px;
  margin-left: 6px;
  color: var(--text);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.win-btns { display: flex; gap: 6px; }
.win-btns button {
  width: 22px; height: 22px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
}
.win-btns button:hover { color: var(--text); border-color: var(--line-strong); }
.win-btns .close:hover { color: var(--danger); border-color: var(--danger); }

.win-body {
  flex: 1;
  overflow: auto;
  padding: 14px;
}

/* little resize grip in bottom right corner */
.resize-grip {
  position: absolute;
  right: 2px; bottom: 2px;
  width: 14px; height: 14px;
  cursor: nwse-resize;
}
.resize-grip::after {
  content: "";
  position: absolute;
  right: 3px; bottom: 3px;
  width: 6px; height: 6px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
}

/* ---------- taskbar ---------- */
#taskbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: 46px;
  z-index: 50;
  background: rgba(10, 12, 20, 0.82);
  border-top: 1px solid var(--line-strong);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  padding: 0 12px;
}
body.light #taskbar { background: rgba(255,255,255,0.72); }
.tb-left, .tb-right { flex: 0 0 auto; display: flex; align-items: center; gap: 10px; }
.tb-center { flex: 1; display: flex; gap: 8px; padding: 0 12px; overflow-x: auto; }
.tb-logo {
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--accent);
  cursor: pointer;
}
.tb-task {
  font-size: 12px;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}
.tb-task.active { border-color: var(--accent); color: var(--accent); }
.tb-task:hover { border-color: var(--line-strong); }
#themeToggle {
  width: 30px; height: 30px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 6px;
  cursor: pointer;
  font-size: 15px;
}
#themeToggle:hover { border-color: var(--line-strong); }
.tb-clock {
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  color: var(--text);
  min-width: 56px;
  text-align: right;
}

/* ---------- shared app bits ---------- */
h3.app-h { margin: 0 0 4px; font-size: 15px; }
p.app-sub { margin: 0 0 14px; color: var(--muted); font-size: 12px; }
button.btn {
  border: 1px solid var(--line-strong);
  background: var(--panel-2);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}
button.btn:hover { border-color: var(--accent); color: var(--accent); }
button.btn.primary { border-color: var(--accent); color: var(--accent); }
input.field, textarea.field {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 13px;
  outline: none;
}
input.field:focus, textarea.field:focus { border-color: var(--accent); }
textarea.field { resize: vertical; min-height: 60px; }

/* ---------- Mission Control ---------- */
.mc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.mc-card {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}
.mc-card .label { font-size: 11px; color: var(--muted); letter-spacing: 1px; text-transform: uppercase; }
.mc-card .big { font-size: 26px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.meter {
  height: 8px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 8px;
}
.meter > div {
  height: 100%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--glow);
  width: 0;
  transition: width 0.5s ease;
}
.meter.warn > div { background: var(--warn); }
.meter.bad > div { background: var(--danger); }
.status-row { display: flex; align-items: center; gap: 8px; font-size: 13px; margin: 6px 0; }
.status-row .led { width: 9px; height: 9px; border-radius: 50%; background: var(--good); box-shadow: 0 0 8px var(--good); }
.status-row .led.warn { background: var(--warn); box-shadow: 0 0 8px var(--warn); }

/* ---------- Astro Notes ---------- */
.note-list { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.note {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 12px;
  position: relative;
}
.note h4 { margin: 0 0 4px; font-size: 13px; }
.note p { margin: 0; font-size: 12px; color: var(--muted); white-space: pre-wrap; word-break: break-word; }
.note .del {
  position: absolute; top: 8px; right: 8px;
  border: none; background: transparent; color: var(--muted);
  cursor: pointer; font-size: 15px;
}
.note .del:hover { color: var(--danger); }
.empty { color: var(--muted); font-size: 12px; text-align: center; padding: 20px 0; }

/* ---------- Star Explorer ---------- */
.star-card {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  margin-top: 12px;
}
.star-name { font-size: 20px; margin: 0 0 2px; }
.star-class { font-size: 12px; color: var(--accent); letter-spacing: 1px; }
.star-rows { margin-top: 14px; display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 13px; }
.star-rows .k { color: var(--muted); }
.star-rows .v { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- File Bay ---------- */
.fb-crumb { font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.fb-crumb b { color: var(--text); }
.fb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; }
.fb-item {
  text-align: center;
  padding: 12px 6px;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
}
.fb-item:hover { background: rgba(90,169,255,0.08); border-color: var(--line); }
.fb-item .fi { font-size: 28px; color: var(--accent); }
.fb-item .fi.folder { color: var(--warn); }
.fb-item span { display: block; font-size: 11px; margin-top: 6px; word-break: break-word; }

/* ---------- Comms Radio ---------- */
.radio-face {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}
.freq-display {
  font-size: 34px;
  font-variant-numeric: tabular-nums;
  text-align: center;
  color: var(--accent);
  letter-spacing: 2px;
}
.freq-unit { font-size: 14px; color: var(--muted); }
.freq-slider { width: 100%; margin: 14px 0 6px; accent-color: var(--accent); }
.signal-bars { display: flex; align-items: flex-end; gap: 3px; height: 34px; justify-content: center; margin: 10px 0; }
.signal-bars span {
  width: 6px;
  background: var(--accent);
  box-shadow: 0 0 6px var(--glow);
  border-radius: 2px;
  transition: height 0.15s ease;
}
.transmission {
  margin-top: 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  font-size: 13px;
  min-height: 54px;
  line-height: 1.5;
  color: var(--good);
  font-family: "Consolas", monospace;
}
.radio-controls { display: flex; gap: 8px; margin-top: 12px; }

/* ---------- right click menu ---------- */
.ctx-menu {
  position: fixed;
  z-index: 200;
  min-width: 168px;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  padding: 5px;
  box-shadow: 0 12px 34px rgba(0,0,0,0.5);
  display: none;
}
.ctx-menu.show { display: block; }
.ctx-item {
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 5px;
  cursor: pointer;
  color: var(--text);
}
.ctx-item:hover { background: rgba(90,169,255,0.10); color: var(--accent); }

/* ---------- notification toasts ---------- */
#toasts {
  position: fixed;
  right: 16px;
  bottom: 60px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}
.toast {
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text);
  box-shadow: 0 8px 24px rgba(0,0,0,0.45);
  animation: toastIn 0.25s ease;
}
.toast.leaving { animation: toastOut 0.3s ease forwards; }
@keyframes toastIn {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}
@keyframes toastOut {
  to { transform: translateX(20px); opacity: 0; }
}

/* ---------- wallpapers ----------
   these are just different dark tints layered over the starfield.
   kept subtle on purpose, nothing loud. */
body.wp-0 { background: #07080d; }
body.wp-1 { background: #0a0710; }   /* faint violet */
body.wp-2 { background: #050a0d; }   /* deep teal-ish */
body.wp-3 { background: #0b0709; }   /* warm ember */
body.light.wp-0 { background: #e9edf7; }
body.light.wp-1 { background: #efe9f7; }
body.light.wp-2 { background: #e6f0f2; }
body.light.wp-3 { background: #f2ecea; }

/* ---------- stardance easter egg ---------- */
body.stardance .window,
body.stardance #taskbar,
body.stardance .icon-glyph {
  animation: stardanceGlow 1.4s ease-in-out infinite;
}
@keyframes stardanceGlow {
  0%   { box-shadow: 0 0 18px rgba(90,169,255,0.5); }
  33%  { box-shadow: 0 0 18px rgba(255,120,200,0.5); }
  66%  { box-shadow: 0 0 18px rgba(120,255,180,0.5); }
  100% { box-shadow: 0 0 18px rgba(90,169,255,0.5); }
}
.stardance-banner {
  position: fixed;
  top: 22%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 400;
  font-size: 26px;
  letter-spacing: 2px;
  padding: 16px 28px;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  animation: stardanceGlow 1.4s ease-in-out infinite;
}

/* About window text */
.about-body { font-size: 13px; line-height: 1.6; }
.about-body .logo { font-size: 22px; letter-spacing: 4px; }
.about-body .logo span { color: var(--accent); }
.about-body ul { margin: 10px 0 0; padding-left: 18px; color: var(--muted); }

/* thin scrollbars so it feels custom */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--accent-dim); border-radius: 5px; }
::-webkit-scrollbar-track { background: transparent; }
