/* ─── MATRIX STYLING & BASE ────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg:          #060606;
  --bg1:         #090909;
  --bg2:         #0c0c0c;
  --bg3:         #101010;
  --border:      #181818;
  --border2:     #222222;
  --border3:     #2b2b2b;
  --text-dim:    #242424;
  --text-low:    #383838;
  --text-mid:    #555555;
  --text-hi:     #808080;
  --text-bright: #aaaaaa;
  --text-max:    #d5d5d5;
  --glow:        rgba(255,255,255,0.03);
  --font-ui:     'Rajdhani', sans-serif;
  --font-mono:   'Share Tech Mono', monospace;
}

html, body {
  width: 100%; height: 100%;
  background: var(--bg); color: #fff;
  font-family: var(--font-ui); overflow: hidden;
}

/* ─── INITIAL COLD BOOT DISPLAY ────────────────────────────── */
#boot {
  position: fixed; inset: 0; background: var(--bg); z-index: 9999;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  font-family: var(--font-mono); padding: 40px;
  transition: opacity 0.5s ease, transform 0.5s ease;
}
#boot.fade-out { opacity: 0; pointer-events: none; transform: scale(1.01); }
.boot-logo { font-size: 26px; letter-spacing: 14px; color: #fff; margin-bottom: 25px; text-indent: 14px; }
#boot-lines { width: 340px; height: 170px; overflow-y: auto; font-size: 9px; color: var(--text-mid); border: 0.5px solid var(--border); padding: 12px; background: var(--bg1); margin-bottom: 25px; display: flex; flex-direction: column; gap: 4px; }
#boot-lines::-webkit-scrollbar { width: 2px; }
#boot-lines::-webkit-scrollbar-thumb { background: var(--border3); }
.boot-line { opacity: 0.8; letter-spacing: 1px; }
.boot-line.ok { color: #fff; font-weight: 600; }
.boot-bar-wrap { width: 340px; height: 1px; background: var(--border2); margin-bottom: 12px; overflow: hidden; }
.boot-bar-fill { width: 0%; height: 100%; background: #fff; transition: width 1.5s cubic-bezier(0.1, 0.8, 0.1, 1); }
#boot-status { font-size: 8px; color: var(--text-hi); letter-spacing: 2px; }

/* ─── API INPUT GATEWAY INTERFACE ───────────────────────────── */
#api-overlay {
  position: fixed; inset: 0; background: rgba(6,6,6,0.98); z-index: 9998;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  font-family: var(--font-mono); padding: 30px;
}
#api-overlay.hidden { display: none !important; }
.overlay-logo { font-size: 28px; letter-spacing: 18px; color: #fff; text-indent: 18px; margin-bottom: 6px; }
.overlay-sub { font-size: 8px; color: var(--text-mid); letter-spacing: 3px; margin-bottom: 20px; }
.overlay-divider { width: 50px; height: 1px; background: var(--border3); margin-bottom: 20px; }
.overlay-instruction { font-size: 9px; color: var(--text-hi); letter-spacing: 1.5px; margin-bottom: 15px; }
#overlay-key-input { background: var(--bg2); border: 0.5px solid var(--border3); color: #fff; font-family: var(--font-mono); font-size: 11px; padding: 10px; width: 300px; text-align: center; outline: none; letter-spacing: 1.5px; margin-bottom: 16px; }
.overlay-btn { background: #fff; border: none; color: #000; font-family: var(--font-mono); font-size: 9px; padding: 10px 24px; cursor: pointer; font-weight: bold; letter-spacing: 2px; }
.overlay-note { font-size: 7px; color: var(--text-low); letter-spacing: 1px; text-align: center; margin-top: 24px; line-height: 1.5; }

/* ─── CORE HUD LAYOUT ───────────────────────────────────────── */
#app-container {
  position: relative; width: 100%; height: 100%; z-index: 10;
  display: grid; grid-template-columns: 210px 1fr; grid-template-rows: 50px 1fr 50px;
  grid-template-areas: "sidebar top" "sidebar workspace" "sidebar bottom";
}

#bg-canvas { position: fixed; inset: 0; z-index: 1; pointer-events: none; }

/* ─── ADVANCED HEADER PANEL & VECTOR LOGO ──────────────────── */
#top {
  grid-area: top; border-bottom: 0.5px solid var(--border);
  display: flex; justify-content: space-between; align-items: center; padding: 0 24px;
  background: linear-gradient(to bottom, rgba(6,6,6,0.8), rgba(6,6,6,0));
}
.top-left { display: flex; align-items: center; gap: 10px; }

/* SYSTEM EMBEDDED LOGO VECTORS */
.logo-vector-wrapper {
  width: 24px; height: 24px; display: flex; justify-content: center; align-items: center; color: var(--text-bright);
}
.milo-core-logo { width: 100%; height: 100%; overflow: visible; }
.rotating-ring-slow { transform-origin: center; animation: rotating ringCW 25s linear infinite; opacity: 0.3; }
.rotating-ring-fast { transform-origin: center; animation: rotating ringCCW 12s linear infinite; opacity: 0.6; }
.pulse-core-node { animation: nodePulseGlow 2s ease-in-out infinite alternate; }

@keyframes ringCW { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes ringCCW { from { transform: rotate(0deg); } to { transform: rotate(-360deg); } }
@keyframes nodePulseGlow { 0% { opacity: 0.4; fill: #666; } 100% { opacity: 1; fill: #fff; } }

.sys-logo { font-family: var(--font-mono); font-size: 11px; letter-spacing: 1.5px; color: var(--text-hi); margin-left: 4px; }
.status-wrap { display: flex; align-items: center; gap: 6px; border-left: 0.5px solid var(--border3); padding-left: 14px; margin-left: 4px; }
.pulse-dot { width: 5px; height: 5px; background: var(--text-low); border-radius: 50%; }
.pulse-dot.on { background: #fff; box-shadow: 0 0 8px #fff; }
.status-text { font-family: var(--font-mono); font-size: 8px; letter-spacing: 1px; color: var(--text-mid); }
.top-center { font-family: var(--font-mono); font-size: 10px; letter-spacing: 3px; color: var(--text-mid); text-transform: uppercase; }
#state-label.active { color: #fff; font-weight: bold; }

#hud-date-time-panel { display: flex; align-items: center; gap: 14px; font-family: var(--font-mono); font-size: 11px; color: var(--text-max); letter-spacing: 1.5px; }
#hud-calendar-date { color: var(--text-mid); border-right: 0.5px solid var(--border3); padding-right: 14px; }
#hud-day-string { color: var(--text-hi); font-weight: bold; border-right: 0.5px solid var(--border3); padding-right: 14px; }
#clock { color: #ffffff; font-weight: normal; }

/* ─── CONTAINER PANELS SPLIT VIEW ───────────────────────────── */
#workspace { grid-area: workspace; display: grid; grid-template-columns: 46fr 54fr; height: 100%; min-height: 0; }
#viewport { border-right: 0.5px solid var(--border); display: flex; justify-content: center; align-items: center; position: relative; }
#canvas-container { width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; max-width: 480px; max-height: 480px; aspect-ratio: 1; }
#sphere-canvas { width: 100%; height: 100%; display: block; }

#telemetry { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.panel-header { display: flex; align-items: center; gap: 14px; padding: 18px 24px 6px 24px; font-family: var(--font-mono); font-size: 9px; color: var(--text-mid); letter-spacing: 1.5px; }
.panel-line { flex: 1; height: 0.5px; background: var(--border); }
#chat-history { flex: 1; overflow-y: auto; padding: 12px 24px 24px 24px; display: flex; flex-direction: column; gap: 20px; min-height: 0; }
#chat-history::-webkit-scrollbar { width: 3px; }
#chat-history::-webkit-scrollbar-thumb { background: var(--border2); }

/* ─── DATA RESPONSES STREAM INTERFACE ───────────────────────── */
.msg { display: flex; flex-direction: column; gap: 5px; animation: msgFade 0.25s linear forwards; max-width: 92%; }
.msg.user { align-self: flex-end; align-items: flex-end; }
.msg.ai { align-self: flex-start; align-items: flex-start; width: 100%; }
.msg-label { font-family: var(--font-mono); font-size: 8px; letter-spacing: 2px; color: var(--text-low); }
.msg.user .msg-label { color: var(--text-mid); }
.msg div:nth-child(2) { font-size: 14px; line-height: 1.52; font-weight: 400; letter-spacing: 0.2px; white-space: pre-wrap; word-break: break-word; width: 100%; }
.msg.user div:nth-child(2) { color: var(--text-max); background: var(--bg2); border: 0.5px solid var(--border2); padding: 8px 14px; }
.msg.ai div:nth-child(2) { color: var(--text-bright); padding: 2px 0; }

@keyframes msgFade { from { opacity: 0; } to { opacity: 1; } }

.milo-dynamic-link { color: #ffffff !important; text-decoration: underline; text-underline-offset: 4px; font-weight: 500; transition: opacity 0.15s; word-break: break-all; }
.milo-dynamic-link:hover { opacity: 0.6; }

.milo-hologram-map-frame { margin: 14px 0 !important; border: 0.5px solid var(--border3); border-radius: 2px; overflow: hidden; height: 240px; width: 100%; max-width: 540px; background: #000; }
.milo-hologram-map-frame iframe { border: 0; width: 100%; height: 100%; filter: grayscale(1) invert(0.95) contrast(1.05); opacity: 0.88; }

/* ─── PREMIUM JARVIS HOLO-DIAGRAM ENGINE COMPONENT CARD ────── */
.milo-blueprint-card {
  margin: 16px 0; background: #080808; border: 0.5px solid #222; border-left: 2px solid #fff; padding: 20px; width: 100%; max-width: 560px; font-family: var(--font-mono); box-shadow: 0 10px 30px rgba(0,0,0,0.8); display: flex; flex-direction: column; gap: 14px; position: relative; overflow: hidden;
}
.milo-blueprint-card::before { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(30,30,30,0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(30,30,30,0.05) 1px, transparent 1px); background-size: 10px 10px; pointer-events: none; }
.milo-blueprint-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 0.5px solid #222; padding-bottom: 8px; position: relative; }
.milo-blueprint-title { font-size: 11px; color: #fff; letter-spacing: 2px; text-transform: uppercase; font-weight: 600; }
.milo-blueprint-tag { font-size: 8px; color: var(--text-mid); background: #111; padding: 2px 6px; border: 0.5px solid #222; letter-spacing: 1px; }

/* Dynamic Flowchart Render Framework */
.milo-blueprint-flow { display: flex; flex-direction: column; gap: 10px; padding: 6px 0; position: relative; }
.milo-blueprint-node {
  background: #0d0d0d; border: 0.5px solid #2b2b2b; padding: 10px 14px; position: relative; display: flex; align-items: center; justify-content: space-between; z-index: 2; transition: border-color 0.2s;
}
.milo-blueprint-node:hover { border-color: #555; }
.milo-node-label { font-size: 11px; color: #fff; letter-spacing: 1px; display: flex; align-items: center; gap: 8px; }
.milo-node-label::before { content: "■"; font-size: 6px; color: var(--text-hi); }
.milo-node-desc { font-size: 10px; color: var(--text-mid); text-transform: uppercase; }
.milo-blueprint-vector-arrow { width: 100%; display: flex; justify-content: center; margin: -4px 0; color: var(--text-low); font-size: 10px; height: 12px; line-height: 12px; }

/* Interactive Waveform Monitor Elements */
.milo-blueprint-waveform-box { height: 45px; border: 0.5px solid #1c1c1c; background: #040404; position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.milo-blueprint-wave { width: 100%; height: 100%; stroke: #555; stroke-width: 0.75; stroke-dasharray: 1000; stroke-dashoffset: 1000; animation: waveDraw 4s linear infinite; }
@keyframes waveDraw { to { stroke-dashoffset: 0; } }
.milo-waveform-overlay-text { position: absolute; left: 8px; top: 6px; font-size: 7px; color: var(--text-low); letter-spacing: 1.5px; }

.milo-blueprint-caption { font-size: 9px; color: var(--text-hi); letter-spacing: 0.5px; line-height: 1.42; border-top: 0.5px solid #1c1c1c; padding-top: 10px; margin-top: 4px; text-transform: uppercase; }

/* ─── HUD LOADING INTERFACE INDICATOR ───────────────────────── */
#typing-indicator { display: none; padding: 4px 0; }
#typing-indicator.show { display: flex; }
.dots-wrap { display: flex; align-items: center; gap: 3px; height: 16px; }
.dots-wrap .dot { width: 3px; height: 3px; background: var(--text-mid); border-radius: 50%; animation: dotPulse 1s infinite alternate; }
.dots-wrap .dot:nth-child(2) { animation-delay: 0.15s; }
.dots-wrap .dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes dotPulse { 0% { opacity: 0.3; } 100% { opacity: 1; } }

/* ─── SIDEBAR PROTOCOL CORE ─────────────────────────────────── */
#sidebar { grid-area: sidebar; border-right: 0.5px solid var(--border); background: var(--bg1); display: flex; flex-direction: column; padding: 20px; gap: 18px; }
.info-block { display: flex; flex-direction: column; gap: 6px; }
.flex-grow { flex-grow: 1; }
.info-label { font-family: var(--font-mono); font-size: 8px; color: var(--text-mid); letter-spacing: 1.5px; }

.select-wrapper { position: relative; width: 100%; }
#model-select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 5; }
.select-display { background: var(--bg2); border: 0.5px solid var(--border2); color: var(--text-hi); font-family: var(--font-mono); font-size: 8px; padding: 8px 12px; letter-spacing: 1.5px; text-transform: uppercase; text-align: center; }

.meter-track { width: 100%; height: 2px; background: var(--bg3); overflow: hidden; position: relative; }
.meter-fill { width: 0%; height: 100%; background: #555; transition: width 0.2s ease; }
.meter-val { font-family: var(--font-mono); font-size: 8px; color: var(--text-low); text-align: right; margin-top: 2px; }

.capabilities-list { display: flex; flex-direction: column; gap: 5px; }
.capabilities-list span { font-family: var(--font-mono); font-size: 8px; color: var(--text-low); letter-spacing: 1.2px; }

/* ─── TERMINAL FOOTER BAR INTERACTION ──────────────────────── */
#bottom { grid-area: bottom; border-top: 0.5px solid var(--border); display: flex; align-items: center; padding: 0 18px; gap: 12px; }
#voice-btn { width: 30px; height: 30px; background: var(--bg2); border: 0.5px solid var(--border2); cursor: pointer; display: flex; justify-content: center; align-items: center; color: var(--text-mid); flex-shrink: 0; }
#voice-btn svg { width: 14px; height: 14px; }
#voice-btn.listening { color: #fff; background: #141414; border-color: #444; }

#text-input { flex: 1; background: var(--bg2); border: 0.5px solid var(--border2); color: var(--text-bright); font-family: var(--font-ui); font-size: 13px; letter-spacing: 0.5px; padding: 10px 14px; outline: none; }
#text-input:focus { border-color: var(--border3); }
#text-input::placeholder { color: var(--text-dim); font-size: 10px; letter-spacing: 2px; }

.btn { background: var(--bg2); border: 0.5px solid var(--border2); color: var(--text-mid); font-family: var(--font-mono); font-size: 8px; padding: 8px 14px; cursor: pointer; letter-spacing: 1.5px; text-transform: uppercase; width: 100%; text-align: center; }
.btn:hover { background: var(--bg3); color: var(--text-hi); }
.btn.active { background: #141414; color: var(--text-bright); border-color: #444; }
.btn.danger { border-color: rgba(100,30,30,0.3); color: rgba(130,60,60,0.7); background: rgba(15,8,8,0.2); }
.btn.danger:hover { background: rgba(25,10,10,0.4); color: rgba(180,80,80,0.9); border-color: rgba(150,50,50,0.5); }
