/* ============================================================
   PRIMUS Command Center — Design System
   Colors: bg #09090E / gold #C9A84C / card #1A1A2E
   Fonts:  Orbitron (headings) · DM Sans (body)
   ============================================================ */

:root {
  --bg:             #09090E;
  --card:           #1A1A2E;
  --gold:           #C9A84C;
  --gold-light:     #D4B95E;
  --gold-dark:      #B8993E;
  --gold-glow:      rgba(201, 168, 76, 0.3);
  --text:           rgba(255, 255, 255, 0.92);
  --text-dim:       rgba(255, 255, 255, 0.55);
  --border:         rgba(201, 168, 76, 0.25);
  --red:            #e8625e;
  --yellow:         #e8b25e;
  --green:          #5ee886;
  --blue:           #5ea8e8;
  --radius-card:    16px;
  --radius-sm:      8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  min-height: 100vh;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}

/* Dotted background pattern for depth */
body {
  background-image:
    radial-gradient(circle at 0 0, rgba(201,168,76,0.04) 0, transparent 50%),
    radial-gradient(circle at 100% 100%, rgba(201,168,76,0.03) 0, transparent 50%);
  background-attachment: fixed;
}

h1, h2, h3, h4, h5, .heading {
  font-family: 'Orbitron', 'DM Sans', sans-serif;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--text);
}

h1 { font-size: 1.6rem; letter-spacing: 0.05em; }
h2 { font-size: 1.15rem; text-transform: uppercase; letter-spacing: 0.08em; }
h3 { font-size: 1rem; }

.mono { font-family: 'JetBrains Mono', 'SF Mono', Menlo, monospace; }

/* ============================================================
   @property for animated gold angle (neon border)
   ============================================================ */
@property --angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}
@keyframes primus-rotate { to { --angle: 360deg; } }

/* ============================================================
   GOLD TEXT — metallic gradient
   ============================================================ */
.gold-text {
  background-image: linear-gradient(135deg,
    #BF953F 0%, #FCF6BA 20%, #B38728 40%,
    #FBF5B7 60%, #AA771C 80%, #E8B87C 100%);
  background-size: 200% 200%;
  background-repeat: no-repeat;
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  animation: metal-shine 6s ease-in-out infinite;
}
@keyframes metal-shine {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ============================================================
   CARD — glass + traveling neon gold border
   ============================================================ */
.card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 18px 20px;
  isolation: isolate;
  overflow: hidden;
}
.card::before {
  content: '';
  position: absolute;
  inset: -1.5px;
  border-radius: calc(var(--radius-card) + 1px);
  padding: 1.5px;
  background: conic-gradient(
    from var(--angle, 0deg),
    #8b6914 0deg, #b8860b 40deg, #d4af37 90deg, #ffd700 130deg,
    #fff4b8 160deg, #ffd700 190deg, #d4af37 230deg, #b8860b 280deg, #8b6914 360deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  animation: primus-rotate 8s linear infinite;
  pointer-events: none;
  z-index: 1;
}
.card::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: calc(var(--radius-card) + 4px);
  background: conic-gradient(
    from var(--angle, 0deg),
    transparent 0deg,
    rgba(255, 244, 184, 0.2) 60deg,
    rgba(218, 165, 32, 0.12) 140deg,
    transparent 240deg, transparent 360deg);
  filter: blur(10px);
  opacity: 0.5;
  animation: primus-rotate 8s linear infinite;
  pointer-events: none;
  z-index: -1;
}
.card > * { position: relative; z-index: 2; }

.card-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--gold);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ============================================================
   APP SHELL — header, tab bar
   ============================================================ */
#app {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 14px 90px;  /* bottom padding for fixed tab bar */
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 4px 22px;
}
.header .logo {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.15em;
}
.header .logo .dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
  margin-right: 8px;
  box-shadow: 0 0 12px currentColor;
  animation: pulse 2s ease-in-out infinite;
}
.header .status {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-align: right;
}
@keyframes pulse { 0%,100% {opacity: 1;} 50% {opacity: 0.4;} }

/* Tab bar — fixed bottom */
.tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: rgba(9, 9, 14, 0.9);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-top: 1px solid rgba(201, 168, 76, 0.15);
  display: flex;
  justify-content: space-around;
  padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
  z-index: 100;
}
.tabbar button {
  flex: 1;
  background: transparent;
  border: 0;
  color: var(--text-dim);
  font-family: 'Orbitron', sans-serif;
  font-size: 0.55rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 6px 4px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: color 0.2s ease;
}
.tabbar button .icon { font-size: 1.3rem; line-height: 1; }
.tabbar button.active { color: var(--gold); }
.tabbar button:active { transform: scale(0.92); }

.screen { display: none; }
.screen.active { display: block; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from {opacity:0; transform:translateY(8px);} to {opacity:1; transform:none;} }

/* ============================================================
   DASHBOARD — big status indicator
   ============================================================ */
.status-big {
  text-align: center;
  padding: 28px 18px;
}
.status-big .label {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.25em;
  color: var(--text-dim);
  text-transform: uppercase;
}
.status-big .value {
  font-family: 'Orbitron', sans-serif;
  font-size: 2.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-top: 6px;
  text-shadow: 0 0 28px var(--gold-glow);
}
.status-big.ok .value { color: var(--green); }
.status-big.warn .value { color: var(--yellow); }
.status-big.err .value { color: var(--red); }

.status-big .value::before {
  content: '';
  display: inline-block;
  width: 14px; height: 14px;
  margin-right: 10px;
  border-radius: 50%;
  background: currentColor;
  vertical-align: middle;
  box-shadow: 0 0 24px currentColor;
  animation: pulse 2s ease-in-out infinite;
}

/* Stat grid */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}
.stat {
  padding: 14px 16px;
}
.stat .metric {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-top: 4px;
}
.stat .unit { font-size: 0.8rem; color: var(--text-dim); margin-left: 4px; }
.stat .sub  { font-size: 0.72rem; color: var(--text-dim); margin-top: 2px; letter-spacing: 0.05em;}

/* Gauge (response time) */
.gauge {
  height: 6px;
  background: rgba(201,168,76,0.1);
  border-radius: 10px;
  overflow: hidden;
  margin-top: 10px;
}
.gauge-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--gold), var(--red));
  transform-origin: left;
  transition: transform 0.6s cubic-bezier(.4,0,.2,1);
}

/* Uptime bar */
.uptime-bar {
  display: flex;
  gap: 3px;
  margin-top: 10px;
  height: 32px;
}
.uptime-bar .day {
  flex: 1;
  background: var(--green);
  border-radius: 3px;
  opacity: 0.85;
  transition: transform 0.3s ease;
}
.uptime-bar .day.warn { background: var(--yellow); }
.uptime-bar .day.err  { background: var(--red); }
.uptime-bar .day.unk  { background: rgba(255,255,255,0.1); }

/* ============================================================
   ALERTS TAB — feed
   ============================================================ */
.alert {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: start;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.02);
  margin-bottom: 8px;
  border-left: 3px solid var(--green);
}
.alert.warn { border-left-color: var(--yellow); }
.alert.err  { border-left-color: var(--red); }
.alert .icon { font-size: 1.15rem; }
.alert .body { min-width: 0; }
.alert .title {
  font-weight: 500;
  font-size: 0.9rem;
}
.alert .meta {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 2px;
}
.alert .time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  color: var(--text-dim);
  text-align: right;
}

/* ============================================================
   COMMAND TAB — terminal-style chat + quick buttons
   ============================================================ */
.cmd-log {
  background: rgba(0,0,0,0.3);
  border-radius: var(--radius-sm);
  padding: 14px;
  min-height: 200px;
  max-height: 420px;
  overflow-y: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  line-height: 1.5;
}
.cmd-entry { margin-bottom: 14px; }
.cmd-entry .user {
  color: var(--gold);
  font-weight: 600;
}
.cmd-entry .user::before { content: '> '; }
.cmd-entry .output {
  color: var(--text);
  margin-top: 4px;
  white-space: pre-wrap;
  opacity: 0.85;
}
.cmd-entry.working .output::after {
  content: '';
  display: inline-block;
  width: 8px; height: 14px;
  background: var(--gold);
  margin-left: 4px;
  animation: blink 1s infinite;
  vertical-align: middle;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0} }

.quick-cmds {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}
.quick-btn {
  background: rgba(201,168,76,0.08);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 14px 10px;
  border-radius: var(--radius-sm);
  font-family: 'Orbitron', sans-serif;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.2s ease;
}
.quick-btn:active { transform: scale(0.97); }
.quick-btn:hover  { border-color: var(--gold); background: rgba(201,168,76,0.12); }
.quick-btn .icon  { font-size: 1.2rem; }

/* ============================================================
   DEPLOY TAB
   ============================================================ */
.deploy-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.02);
  margin-bottom: 6px;
  font-size: 0.82rem;
}
.deploy-item .sha {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: var(--gold);
  background: rgba(201,168,76,0.1);
  padding: 3px 7px;
  border-radius: 4px;
}
.deploy-item .msg {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.deploy-item .when {
  font-size: 0.7rem;
  color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
}

/* ============================================================
   METRICS TAB — placeholder visuals
   ============================================================ */
.metrics-placeholder {
  padding: 34px 18px;
  text-align: center;
  color: var(--text-dim);
}
.metrics-placeholder .big {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.2rem;
  color: var(--gold);
  margin-bottom: 10px;
  letter-spacing: 0.1em;
}

/* ============================================================
   UTIL / misc
   ============================================================ */
.muted { color: var(--text-dim); }
.small { font-size: 0.72rem; }
.spaced { letter-spacing: 0.08em; }
.text-center { text-align: center; }
.stack > * + * { margin-top: 12px; }
