/* 7MINER GLOBAL VARIABLE SYSTEM */
:root {
  color-scheme: dark;
  /* Retro CRT Themes */
  --bg: #080a08;
  --screen: #10150f;
  --panel: #111d14;
  --panel-2: #0b120d;
  --text: #d8ffe0;
  --text-dim: #7fab87;
  --accent: #46ff72;
  --accent-2: #f0ff8f;
  --line: #285f34;
  --shadow: rgba(70, 255, 114, 0.18);
  
  /* Sci-Fi Accent Colors */
  --accent-orange: #ff7b00;
  --accent-blue: #00f0ff;
  --accent-green: #00ff88;
  --accent-red: #ff3c3c;
  --accent-purple: #bd00ff;
  --accent-yellow: #ffee00;
  
  /* Sci-Fi Theme-specific colors (Defaults to Neon Blue theme) */
  --sf-bg: #03080e;
  --sf-screen: #040a12;
  --sf-panel: rgba(10, 22, 38, 0.65);
  --sf-panel-border: #102c4c;
  --sf-accent: #00f0ff;
  --sf-accent-2: #ff7b00;
  --sf-text: #e2f3ff;
  --sf-text-dim: #8ba7bd;
  --sf-shadow: rgba(0, 240, 255, 0.2);
}

/* RETRO COLOR SWITCHES */
body[data-theme="amber"] {
  --bg: #0d0904;
  --screen: #1a1108;
  --panel: #21170b;
  --panel-2: #140d06;
  --text: #ffe9bd;
  --text-dim: #c69f58;
  --accent: #ffb13d;
  --accent-2: #fff09a;
  --line: #815821;
  --shadow: rgba(255, 177, 61, 0.18);
}

body[data-theme="cyan"] {
  --bg: #05090d;
  --screen: #07141a;
  --panel: #0b1d25;
  --panel-2: #061016;
  --text: #d6fbff;
  --text-dim: #74aeb8;
  --accent: #41dfff;
  --accent-2: #b6fff6;
  --line: #24677a;
  --shadow: rgba(65, 223, 255, 0.18);
}

/* SCI-FI THEME COLOR SELECTIONS */
body[data-sci-theme="neon"] {
  --sf-bg: #03080e;
  --sf-screen: #040a12;
  --sf-panel: rgba(10, 22, 38, 0.7);
  --sf-panel-border: rgba(0, 240, 255, 0.25);
  --sf-accent: #00f0ff;
  --sf-accent-2: #ff7b00;
  --sf-text: #e2f3ff;
  --sf-text-dim: #8ba7bd;
  --sf-shadow: rgba(0, 240, 255, 0.2);
}

body[data-sci-theme="cyber"] {
  --sf-bg: #08030c;
  --sf-screen: #0d0515;
  --sf-panel: rgba(26, 8, 42, 0.65);
  --sf-panel-border: rgba(255, 0, 127, 0.28);
  --sf-accent: #ff007f;
  --sf-accent-2: #ffee00;
  --sf-text: #ffeef7;
  --sf-text-dim: #b89cae;
  --sf-shadow: rgba(255, 0, 127, 0.25);
}

body[data-sci-theme="matrix"] {
  --sf-bg: #020803;
  --sf-screen: #031006;
  --sf-panel: rgba(6, 24, 12, 0.7);
  --sf-panel-border: rgba(0, 255, 102, 0.25);
  --sf-accent: #00ff66;
  --sf-accent-2: #ffffff;
  --sf-text: #e0ffe8;
  --sf-text-dim: #8cbfa0;
  --sf-shadow: rgba(0, 255, 102, 0.22);
}

/* BASE reset */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Courier New", Consolas, monospace;
  overflow: hidden;
  user-select: none;
}

/* Apply Sci-Fi backgrounds to body if active */
body[data-ui-mode="sci-fi"] {
  background: 
    radial-gradient(circle at 50% 30%, rgba(0, 168, 204, 0.04), transparent 50%),
    linear-gradient(rgba(255, 255, 255, 0.005) 50%, transparent 50%) 0 0 / 100% 4px,
    var(--sf-bg);
  color: var(--sf-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

button {
  font: inherit;
  border-radius: 3px;
}

/* TERMINAL CHASSIS */
.terminal-shell {
  position: relative;
  width: 456px;
  height: 312px;
  background: var(--screen);
  padding: 6px;
  box-sizing: border-box;
  border: 2px solid var(--line);
  box-shadow:
    0 0 0 3px #050705,
    0 0 24px var(--shadow),
    inset 0 0 20px rgba(0, 0, 0, 0.6);
  margin: 4px auto;
  display: flex;
  flex-direction: column;
}

body[data-ui-mode="sci-fi"] .terminal-shell {
  background: var(--sf-screen);
  border: 1px solid var(--sf-panel-border);
  box-shadow:
    0 0 20px rgba(0, 0, 0, 0.8),
    inset 0 0 20px rgba(0, 240, 255, 0.03);
}

/* TOP HEADER */
.topbar {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 4px;
  border-bottom: 2px solid var(--line);
  margin-bottom: 4px;
  height: 24px;
}

body[data-ui-mode="sci-fi"] .topbar {
  border-bottom: 1px solid var(--sf-panel-border);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.topbar-left h1 {
  font-size: 0.95rem;
  margin: 0;
  color: var(--accent);
  text-shadow: 0 0 8px var(--shadow);
  font-weight: bold;
  letter-spacing: 0.5px;
}

body[data-ui-mode="sci-fi"] .topbar-left h1 {
  color: var(--sf-accent);
  text-shadow: 0 0 8px var(--sf-shadow);
  font-family: "Courier New", monospace;
  font-weight: 900;
  letter-spacing: 1px;
}

.topbar-btn {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.6rem;
  padding: 0px 4px;
  cursor: pointer;
  height: 16px;
  line-height: 14px;
  font-weight: bold;
}

body[data-ui-mode="sci-fi"] .topbar-btn {
  background: rgba(0, 240, 255, 0.06);
  border: 1px solid var(--sf-panel-border);
  color: var(--sf-text);
  font-family: inherit;
  font-size: 0.65rem;
  text-transform: uppercase;
}

.topbar-btn:hover {
  background: var(--accent);
  color: #061009;
}

body[data-ui-mode="sci-fi"] .topbar-btn:hover {
  background: var(--sf-accent);
  color: #03080e;
  border-color: var(--sf-accent);
  box-shadow: 0 0 6px var(--sf-shadow);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Gear Icon & Action buttons */
.icon-btn {
  background: transparent;
  border: none;
  color: var(--sf-text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
}

.icon-btn:hover {
  color: var(--sf-accent);
}

.gear-icon {
  width: 14px;
  height: 14px;
  animation: spin-hover 8s linear infinite;
  animation-play-state: paused;
}

.icon-btn:hover .gear-icon {
  animation-play-state: running;
}

@keyframes spin-hover {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* LED STATUS Lights */
.led-strip {
  display: flex;
  align-items: center;
  gap: 6px;
}

.led-item {
  display: flex;
  align-items: center;
  gap: 2.5px;
  font-size: 0.55rem;
  color: var(--sf-text-dim);
  font-weight: bold;
}

.led-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #333;
  display: inline-block;
  box-shadow: inset 0 0 2px rgba(0,0,0,0.5);
}

.led-dot.blue.active {
  background: var(--accent-blue);
  box-shadow: 0 0 5px var(--accent-blue);
}
.led-dot.green.active {
  background: var(--accent-green);
  box-shadow: 0 0 5px var(--accent-green);
}
.led-dot.orange.active {
  background: var(--accent-orange);
  box-shadow: 0 0 5px var(--accent-orange);
}

/* Swatches visible only in Retro CRT mode */
body[data-ui-mode="sci-fi"] #retro-theme-row {
  display: none !important;
}

.theme-row {
  display: flex;
  gap: 3px;
}

.swatch {
  width: 12px;
  height: 12px;
  border: 1px solid var(--line);
  cursor: pointer;
  border-radius: 50%;
  background: #46ff72;
}
.swatch.amber { background: #ffb13d; }
.swatch.cyan { background: #41dfff; }
.swatch.active {
  outline: 1.5px solid var(--accent-2);
  outline-offset: 1px;
}

/* GRID LAYOUT */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 5px;
  flex: 1;
  margin-top: 2px;
}

.pixel-panel {
  border: 2px solid var(--line);
  background: var(--panel);
  padding: 4px 6px;
  display: flex;
  flex-direction: column;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.4);
}

body[data-ui-mode="sci-fi"] .pixel-panel {
  border: 1px solid var(--sf-panel-border);
  background: var(--sf-panel);
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(4px);
}

/* Specific Sci-fi Glowing panels */
body[data-ui-mode="sci-fi"] .pixel-panel.panel-blue {
  border-color: rgba(0, 240, 255, 0.25);
  box-shadow: 0 2px 10px rgba(0, 240, 255, 0.03);
}
body[data-ui-mode="sci-fi"] .pixel-panel.panel-orange {
  border-color: rgba(255, 123, 0, 0.25);
  box-shadow: 0 2px 10px rgba(255, 123, 0, 0.03);
}
body[data-ui-mode="sci-fi"] .pixel-panel.panel-purple {
  border-color: rgba(189, 0, 255, 0.25);
  box-shadow: 0 2px 10px rgba(189, 0, 255, 0.03);
}

.panel-header {
  font-size: 0.58rem;
  color: var(--accent-2);
  border-bottom: 1px dashed var(--line);
  padding-bottom: 2px;
  margin-bottom: 4px;
  font-weight: bold;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 4px;
}

body[data-ui-mode="sci-fi"] .panel-header {
  color: var(--sf-text-dim);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-family: inherit;
  font-weight: bold;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.panel-icon {
  width: 9px;
  height: 9px;
  color: var(--sf-accent);
}

.panel-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* PANEL 1: STATUS CIRCULAR HUD */
.status-container-wrapper {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.hud-circle-wrapper {
  position: relative;
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  display: none; /* Only in sci-fi */
}

body[data-ui-mode="sci-fi"] .hud-circle-wrapper {
  display: block;
}

.hud-svg {
  width: 100%;
  height: 100%;
}

.hud-center-text {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.hud-center-text .status-val {
  font-size: 0.75rem;
  color: var(--sf-accent);
  text-shadow: 0 0 6px var(--sf-shadow);
  font-weight: bold;
  margin-top: 0;
}

.status-sub-text {
  font-size: 0.45rem;
  color: var(--sf-text-dim);
  margin-top: -1px;
}

.hud-details-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2.5px;
  min-width: 100px;
  padding-left: 2px;
}

body[data-ui-mode="sci-fi"] .hud-circle-wrapper {
  margin-right: 6px;
}

/* PANEL 2: WAVE GRAPH & SUB-BOXES */
.metrics-container-wrapper {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.metrics-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.hashrate-info {
  display: flex;
  flex-direction: column;
}

.hashrate-info .sub-label {
  font-size: 0.5rem;
  color: var(--sf-text-dim);
  font-weight: bold;
}

.hashrate-wave-svg {
  width: 74px;
  height: 20px;
  display: none; /* Only in sci-fi */
}

body[data-ui-mode="sci-fi"] .hashrate-wave-svg {
  display: block;
}

.wave-path {
  stroke-dasharray: 1000;
  stroke-dashoffset: 0;
  animation: wave-dash 24s linear infinite;
}

@keyframes wave-dash {
  to {
    stroke-dashoffset: -1000;
  }
}

.metrics-bottom-row {
  display: flex;
  gap: 4px;
}

.metric-sub-box {
  flex: 1;
  background: var(--panel-2);
  border: 1px solid var(--line);
  padding: 3px;
  display: flex;
  flex-direction: column;
  align-items: center;
  border-radius: 2px;
}

body[data-ui-mode="sci-fi"] .metric-sub-box {
  background: rgba(255, 123, 0, 0.03);
  border: 1px solid rgba(255, 123, 0, 0.15);
}

.box-label {
  font-size: 0.48rem;
  color: var(--sf-text-dim);
  font-weight: bold;
}

.metric-sub-box strong {
  font-size: 0.72rem;
}

.shares-val {
  font-size: 0.65rem !important;
  color: var(--sf-text);
  white-space: nowrap;
}

.divider {
  color: rgba(255,255,255,0.15);
}

/* PANEL 3: COPYABLE ROWS */
.copy-row {
  cursor: pointer;
  transition: background 0.15s ease;
  padding: 2.5px 4px;
  border-radius: 2px;
}

.copy-row:hover {
  background: rgba(255, 255, 255, 0.04);
}

body[data-ui-mode="sci-fi"] .copy-row:hover {
  background: rgba(0, 240, 255, 0.04);
}

.row-left {
  display: flex;
  align-items: center;
  gap: 4.5px;
}

.row-icon {
  width: 9px;
  height: 9px;
  color: var(--sf-text-dim);
}

.row-right-copy {
  display: flex;
  align-items: center;
  gap: 4px;
}

.copy-icon {
  width: 8px;
  height: 8px;
  color: var(--sf-text-dim);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.copy-row:hover .copy-icon {
  opacity: 0.8;
}

.truncated-val {
  max-width: 130px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-block;
}

/* PANEL 4: HARDWARE PROGRESS GAUGES */
.system-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.system-gauge-col {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cpu-gauge-wrapper {
  position: relative;
  width: 32px;
  height: 32px;
  display: none; /* Only in sci-fi */
}

body[data-ui-mode="sci-fi"] .cpu-gauge-wrapper {
  display: block;
}

.cpu-svg {
  width: 100%;
  height: 100%;
}

.cpu-text {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.55rem;
  font-weight: bold;
  color: var(--sf-accent);
}

.ram-label {
  display: flex;
  flex-direction: column;
  font-size: 0.65rem;
}

.ram-label .dim {
  font-size: 0.5rem;
  color: var(--sf-text-dim);
  font-weight: bold;
}

.system-temp-col {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.temp-title {
  font-size: 0.48rem;
  color: var(--sf-text-dim);
  font-weight: bold;
}

.temp-val-wrapper {
  display: flex;
  align-items: center;
  gap: 3px;
}

.therm-icon {
  width: 9px;
  height: 9px;
  color: var(--accent-orange);
}

/* STANDARD ROW RE-STYLES */
.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.68rem;
  line-height: 1.2;
  margin-bottom: 2.5px;
}

.detail-row span {
  color: var(--text-dim);
}

body[data-ui-mode="sci-fi"] .detail-row span {
  color: var(--sf-text-dim);
  font-size: 0.62rem;
  font-weight: 500;
}

.status-val, .hash-val {
  font-size: 0.95rem;
  color: var(--accent);
  display: block;
  line-height: 1;
  font-weight: bold;
}

body[data-ui-mode="sci-fi"] .status-val {
  color: var(--sf-accent);
}

body[data-ui-mode="sci-fi"] .hash-val {
  color: var(--sf-accent);
  font-size: 1.1rem;
}

.sub-text {
  font-size: 0.55rem;
  color: var(--text-dim);
  margin: 1px 0 4px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mono {
  color: var(--accent-2);
}

body[data-ui-mode="sci-fi"] .mono {
  color: var(--sf-accent-2);
  font-family: "Courier New", monospace;
  font-weight: bold;
}

/* BOTTOM STATUS BAR */
.bottom-bar {
  display: none; /* Hidden in retro mode */
  height: 20px;
  border-top: 1px solid var(--sf-panel-border);
  margin-top: 5px;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
}

body[data-ui-mode="sci-fi"] .bottom-bar {
  display: flex;
}

.bottom-item {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 0.55rem;
  color: var(--sf-text-dim);
  font-weight: bold;
}

.bottom-icon {
  width: 9px;
  height: 9px;
  color: var(--sf-accent);
}

.bottom-item strong {
  color: var(--sf-accent-2);
  font-size: 0.58rem;
}

.status-running {
  display: flex;
  align-items: center;
  gap: 3.5px;
  color: var(--accent-green) !important;
}

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

.pulse-dot.green {
  background: var(--accent-green);
  box-shadow: 0 0 4px var(--accent-green);
  animation: pulse-glow 1.5s infinite alternate;
}

@keyframes pulse-glow {
  from { opacity: 0.4; }
  to { opacity: 1; }
}

.logo-badge-container {
  position: relative;
}

.logo-badge {
  background: linear-gradient(135deg, var(--sf-accent), var(--sf-accent-2));
  color: #03080e;
  font-weight: 900;
  font-size: 0.7rem;
  width: 15px;
  height: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  box-shadow: 0 0 6px var(--sf-shadow);
}

/* OVERLAYS & MODALS */
#sleep-overlay, #block-overlay, #status-overlay, #settings-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.95);
  z-index: 10000;
  display: flex;
  justify-content: center;
  align-items: center;
}

body[data-ui-mode="sci-fi"] #sleep-overlay {
  background: #000000 !important;
}

.sleep-msg {
  color: #1a1a1a;
  font-family: monospace;
  font-size: 0.85rem;
  user-select: none;
  text-transform: uppercase;
  letter-spacing: 2px;
}

/* settings modal panel */
.settings-panel-overlay, .status-panel-overlay {
  width: 90%;
  max-width: 400px;
  border: 2px solid var(--line);
  background: var(--screen);
  padding: 10px 14px;
  box-shadow: 0 0 16px var(--shadow);
  box-sizing: border-box;
}

body[data-ui-mode="sci-fi"] .settings-panel-overlay,
body[data-ui-mode="sci-fi"] .status-panel-overlay {
  border: 1px solid var(--sf-panel-border);
  background: rgba(13, 27, 46, 0.96);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8);
  border-radius: 6px;
}

.settings-section {
  margin-bottom: 10px;
}

.settings-label {
  font-size: 0.58rem;
  color: var(--sf-text-dim);
  display: block;
  margin-bottom: 4px;
  font-weight: bold;
  letter-spacing: 0.5px;
}

.settings-row {
  display: flex;
  gap: 5px;
  justify-content: space-between;
}

.settings-btn {
  flex: 1;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--sf-panel-border);
  color: var(--sf-text);
  font-size: 0.62rem;
  padding: 4px 0;
  cursor: pointer;
  font-weight: bold;
  text-transform: uppercase;
}

.settings-btn:hover {
  background: rgba(0, 240, 255, 0.08);
}

.settings-btn.active {
  background: var(--sf-accent);
  color: #03080e;
  border-color: var(--sf-accent);
}

/* COMMAND ACTIONS BUTTONS */
.command {
  border-radius: 2px;
  transition: all 0.15s ease;
}

/* Toast popup notification */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 240, 255, 0.9);
  color: #03080e;
  padding: 4px 10px;
  font-size: 0.65rem;
  font-weight: bold;
  border-radius: 2px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.5);
  z-index: 11000;
  pointer-events: none;
  animation: fade-in-out 1.5s ease forwards;
}

@keyframes fade-in-out {
  0% { opacity: 0; transform: translate(-50%, 10px); }
  15% { opacity: 1; transform: translate(-50%, 0); }
  85% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, -10px); }
}

/* LCD Physical layout tweaks */
@media (max-width: 500px), (max-height: 360px) {
  body {
    background: var(--bg);
  }

  .terminal-shell {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    margin-left: 4px !important;
    margin-right: auto !important;
    border: none;
    box-shadow: none;
    padding: 4px 6px;
    width: 472px;
    height: 320px;
  }
}

/* POOL STATUS BANNER & BULLET */
.pool-status-banner {
  display: flex;
  align-items: center;
  gap: 4px;
  border-top: 1px solid var(--line);
  padding-top: 4px;
  margin-top: 3px;
  width: 100%;
}

body[data-ui-mode="sci-fi"] .pool-status-banner {
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.bullet-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  display: inline-block;
  background: var(--accent);
  box-shadow: 0 0 4px var(--accent);
}

.bullet-dot.green {
  background: var(--accent-green) !important;
  box-shadow: 0 0 4px var(--accent-green) !important;
}

.bullet-dot.orange {
  background: var(--accent-orange) !important;
  box-shadow: 0 0 4px var(--accent-orange) !important;
}

.bullet-dot.red {
  background: var(--accent-red) !important;
  box-shadow: 0 0 4px var(--accent-red) !important;
}
