/* ============================================================
   CNC TOOLSUITE — Shared Stylesheet
   All pages import this for common variables, topbar, and nav
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&family=Barlow+Condensed:wght@300;400;600;700;900&display=swap');

/* ── CSS VARIABLES ─────────────────────────────────────────── */
:root {
  --bg:       #0d0f0e;
  --panel:    #131614;
  --card:     #161a17;
  --border:   #1f2620;
  --border2:  #2a312c;
  --accent:   #00ff88;
  --accent2:  #ffcc00;
  --warn:     #ff4444;
  --info:     #00ccff;
  --orange:   #ff6b35;
  --purple:   #cc66ff;
  --text:     #d4e0d6;
  --muted:    #4a5e4e;
  --input-bg: #0a0c0b;

  --topbar-h: 44px;
  --font-mono: 'Share Tech Mono', monospace;
  --font-ui:   'Barlow Condensed', sans-serif;
}

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

/* ── BODY BASE (each page sets its own height/overflow rules) ─ */
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  overflow-x: hidden;
}

/* ── SHARED TOPBAR ─────────────────────────────────────────── */
#topbar {
  height: var(--topbar-h);
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  position: relative;
  z-index: 200;
  flex-shrink: 0;
}

.tb-brand {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 3px;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 20px;
  border-right: 1px solid var(--border);
  height: 100%;
  text-decoration: none;
  white-space: nowrap;
}

.tb-dot {
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  animation: tb-pulse 2s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes tb-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 6px var(--accent); }
  50%       { opacity: 0.4; box-shadow: none; }
}

/* Nav links between tool modules */
.tb-nav {
  display: flex;
  align-items: center;
  height: 100%;
  border-right: 1px solid var(--border);
}

.tb-nav-link {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--muted);
  padding: 0 12px;
  height: 100%;
  display: flex;
  align-items: center;
  text-decoration: none;
  text-transform: uppercase;
  transition: color 0.15s, background 0.15s;
  border-right: 1px solid var(--border);
  white-space: nowrap;
}

.tb-nav-link:last-child { border-right: none; }

.tb-nav-link:hover { color: var(--accent); background: rgba(0,255,136,0.04); }

.tb-nav-link.active {
  color: var(--accent);
  border-bottom: 2px solid var(--accent);
}

.tb-nav-link .nav-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  margin-right: 5px;
  flex-shrink: 0;
}

/* Back to hub link */
.tb-back {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 2px;
  padding: 0 16px;
  border-right: 1px solid var(--border);
  height: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  transition: color 0.2s;
  white-space: nowrap;
}

.tb-back:hover { color: var(--accent); }

/* Module title */
.tb-title {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 2px;
  padding: 0 16px;
}

/* Right side of topbar */
.tb-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  height: 100%;
}

.tb-stat {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 1px;
  padding: 0 14px;
  border-left: 1px solid var(--border);
  height: 100%;
  display: flex;
  align-items: center;
  gap: 5px;
}

.tb-stat .v  { color: var(--accent); }
.tb-stat .vy { color: var(--accent2); }
.tb-stat .vr { color: var(--warn); }

#tb-clock {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 1px;
  padding: 0 14px;
  border-left: 1px solid var(--border);
  height: 100%;
  display: flex;
  align-items: center;
}

/* ── COMMON FORM ELEMENTS ──────────────────────────────────── */
.sf { margin-bottom: 9px; }

.sf label {
  display: block;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 1px;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 3px;
}

.sf input, .sf select {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 6px 8px;
  outline: none;
  appearance: none;
  transition: border-color 0.12s;
}

.sf input:focus, .sf select:focus { border-color: var(--accent); }
.sf select option { background: var(--input-bg); }

/* ── MODAL BASE ────────────────────────────────────────────── */
.m-ov {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.78);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.m-box {
  background: var(--panel);
  border: 1px solid var(--border2);
  width: 560px;
  max-width: 95vw;
  max-height: 92vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.m-hdr {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.m-ttl {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 3px;
  color: var(--accent);
  text-transform: uppercase;
}

.m-cls {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
}

.m-cls:hover { color: var(--warn); }

.m-body { padding: 16px 18px; flex: 1; overflow-y: auto; }

.m-foot {
  padding: 10px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 7px;
  justify-content: flex-end;
  flex-shrink: 0;
}

.m-btn {
  padding: 7px 18px;
  background: none;
  border: 1px solid var(--border2);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.12s;
}

.m-btn:hover { border-color: var(--text); }
.m-btn.pri { background: var(--accent); color: #000; border-color: var(--accent); }
.m-btn.pri:hover { background: #00ffaa; }
