@keyframes pulse-green {
  0% {
    transform: scale(0.95);
    opacity: 0.7;
  }

  50% {
    transform: scale(1.1);
    opacity: 1;
  }

  100% {
    transform: scale(0.95);
    opacity: 0.7;
  }
}

@keyframes pulse-bg {
  0% {
    background-color: var(--card-bg);
  }

  50% {
    background-color: rgba(0, 86, 179, 0.2);
    border-color: var(--accent-blue);
  }

  100% {
    background-color: var(--card-bg);
  }
}

/* Animation for when a new voice command arrives */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* --- Root Variables for Blueprint Theme --- */
:root {
  --bg-paper: #f4f7f9;
  --line-color: rgba(0, 86, 179, 0.08);
  --accent-blue: #0056b3;
  --text-main: #2c3e50;
  --text-muted: #7f8c8d;
  --card-bg: #ffffff;
  --success-green: #27ae60;
  --warning-amber: #f39c12;
  --error-red: #e74c3c;
  --font-main: 'Roboto', sans-serif;
  --font-mono: 'Roboto Mono', monospace;

  --grid-color: rgba(0, 150, 255, 0.07);
  --grid-line: rgba(0, 150, 255, 0.15);
  /* --bg-dark: #000a12; */
}

/* --- The Blueprint Background --- */
body {
  background-color: var(--bg-dark);
  /* Dual Grid System: Large 100px squares + Small 20px subdivisions */
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px),
    linear-gradient(var(--grid-color) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
  background-size: 100px 100px, 100px 100px, 20px 20px, 20px 20px;
  background-position: -1px -1px;
  margin: 0;

  font-family: 'Roboto Mono', monospace;
  color: var(--text-main);
  overflow-wrap: break-word;
  word-break: break-all;
}

/* --- Blueprint Framework --- */
.blueprint-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 20px 30px 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.blueprint {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}

.blueprint-header {
  border-bottom: 2px solid var(--accent-blue);
  margin-bottom: 25px;
}

.blueprint-grid {
  width: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
  grid-template-columns: 1fr;
  /* flex: 1; */
  /* Keeps scrollbars inside the panes */
  overflow: hidden;
  gap: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.blueprint-report {
  width: 100%;
  margin-top: 10px;
  border: 1px solid var(--line-color);
  background: #ffffff;
  border-radius: 4px;
  overflow: hidden;
  /* Keeps the internal rows clean */
}

.data-row-split {
  display: grid;
  grid-template-columns: 5fr 4fr; /* 2 equal columns */
  gap: 20px;
}

.telemetry-pane {
  flex: 65;
  border-right: 1px solid var(--grid-line);
  padding: 20px;
  overflow-y: auto;
}

#sateav-chat-history {
  max-height: 200px; 
  overflow-y: auto;
}

#sateav-query, #sateav-response {
  width: 100%; 
  background: transparent; 
  border: none; 
  border-bottom: 1px solid var(--line-color); 
  font-family: var(--font-mono); 
  outline: none;
  overflow: hidden; /* Hide the scrollbar */
  box-sizing: border-box; 
  resize: none; 
}

.sateav-pane {
  flex: 35;
  padding: 20px;
  background: rgba(0, 15, 30, 0.4);
  /* Subtle glassmorphism */
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

/* SATEAV's "Thinking" Glow */
.led-on {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-blue);
  box-shadow: 0 0 10px var(--accent-blue);
  animation: pulse 1.5s infinite;
}

/* --- Brand & Typography --- */
.brand-slug {
  font-family: 'Roboto', sans-serif;
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -0.5px;
  color: var(--text-main);
  margin-bottom: 10px;
}

.logo-e {
  color: var(--accent-blue);
  font-size: 1.4rem;
}

.divider {
  color: var(--line-color);
  margin: 0 10px;
  font-weight: 300;
}

/* --- System Status Indicators --- */
.status-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--line-color);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.65rem;
  font-weight: bold;
  color: var(--text-muted);
}

.status-chip.connected .dot {
  width: 6px;
  height: 6px;
  background-color: var(--success-green);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--success-green);
  animation: pulse-green 2s infinite;
}

/* --- Node Cards --- (0.08) */
.node-card {
  background: var(--card-bg);
  border: 1px solid rgba(0, 0, 0, 0.08); 
  border-left: 4px solid #d1d8e0;
  /* Default neutral border */
  padding: 20px;
  box-shadow: 4px 4px 0px rgba(0, 0, 0, 0.02);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.node-card.highlight {
  border-left-color: var(--accent-blue);
}

.node-card.other {
  border-left-color: var(--warning-amber);
}

/* --- Socket.io "Active" State --- */
/* When Alexa triggers an update, we add this class via JS */
.node-card.voice-active {
  border-left-color: var(--success-green);
  background-color: rgba(39, 174, 96, 0.03);
  transform: scale(1.02);
}

/* --- Typography & Data --- */
.node-label {
  font-size: 0.7rem;
  font-weight: bold;
  color: var(--text-muted);
  margin-bottom: 15px;
  letter-spacing: 1px;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.data-focus {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 10px 0;
}

.chat-input-wrapper{
  margin-top: 15px;
}

.currency {
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--accent-blue);
  opacity: 0.6;

}

#sales-val {
  font-size: 3rem;
  margin: 0;
  color: var(--text-main);
}

#forecast-val {
  font-size: 2rem;
  margin: 0;
  color: var(--text-main);
}

#forecast-range {
  font-size: 0.9rem;
  margin: 0;
  color: var(--text-muted);
}

.context-footer {
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px dashed var(--line-color);
  padding-top: 10px;
  margin-top: 10px;
}

.highlight {
  color: var(--accent-blue);
  font-size: 1.1rem;
}

/* --- Row Logic --- */
.report-row {
  display: flex;
  padding: 15px 20px;
  border-bottom: 1px solid var(--line-color);
  align-items: center;
  transition: background 0.3s ease;
}

.report-row.header {
  background: rgba(0, 86, 179, 0.03);
  font-size: 0.7rem;
  font-weight: bold;
  color: var(--text-muted);
}

.report-row.data-node:hover {
  background: rgba(0, 86, 179, 0.01);
}

.col-month {
  flex: 1.5;
  font-weight: 500;
}

.col-value, .col-sales {
  flex: 2;
  text-align: right;
  font-weight: bold;
}

.col-month span, .col-value span, .col-sales span {
  display: none;
}

.chart-container {
  width: 100%;
  min-width: 0;
  min-height: 0;
  position: relative; 
}

#prophetChart {
  width: 100%;
  height: 100%;
}

/* --- Intent Feed Container --- */
#intent-feed {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 300px;
  /* Limits growth, allows scrolling for history */
  overflow-y: auto;
}

.feed-item {
  padding: 12px 0;
  border-bottom: 1px dashed var(--line-color);
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: all 0.3s ease;
}

.feed-item::before {
  content: attr(data-time);
  /* If you use data-time attribute in JS */
  font-size: 0.65rem;
  color: var(--accent-blue);
  font-weight: bold;
  text-transform: uppercase;
}

.feed-item:last-child {
  border-bottom: none;
}

/* Styling for muted/initial system messages */
.feed-item.muted {
  color: var(--text-muted);
  font-style: italic;
  opacity: 0.7;
}

.feed-item.new-entry {
  color: var(--accent-blue);
  animation: slideIn 0.4s ease-out forwards;
  border-left: 2px solid var(--accent-blue);
  font-style: italic;
  padding-left: 10px;
}

.feed-item.alexa-reply {
  border-left: 2px solid var(--accent-blue);
  padding-left: 10px;
  background: rgba(0, 86, 179, 0.02);
}

.voice-label {
  font-weight: bold;
  color: var(--accent-blue);
  font-size: 0.75rem;
}

.channel-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.channel {
  display: flex;
  justify-content: space-between;
  padding: 10px;
  border: 1px solid var(--line-color);
  border-radius: 4px;
  font-size: 0.75rem;
}

.blueprint-footer {
  margin-top: auto;
  padding: 20px 0;
  border-top: 1px solid var(--line-color);
  font-size: 0.65rem;
  color: var(--text-muted);
  text-align: center;
  letter-spacing: 0.5px;
}

.pulse-alert {
  animation: pulse-bg 2s ease-in-out;
}

.pulse-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  background: var(--success-green);
  border-radius: 50%;
  margin-right: 8px;
  animation: pulse-green 2s infinite;
}

.legal-slug {
  margin-bottom: 10px;
}

.legal-slug a:hover {
  color: var(--text-main);
}

.footer-links a {
  color: var(--text-muted); text-decoration: none; margin: 0 10px;
}

.modal-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0, 10, 20, 0.85);
  backdrop-filter: blur(5px);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
}

.modal-content {
  width: 90%; max-width: 400px;
  text-align: center;
  animation: slideIn 0.3s ease-out;
}

.blueprint-input {
  width: 80%; padding: 10px; margin: 20px 0;
  background: transparent; border: 1px solid var(--line-color);
  color: var(--text-main); font-family: var(--font-mono);
}

.btn-primary { 
  background: var(--accent-blue); color: white; border: none; padding: 10px 20px; cursor: pointer; display: none;
}

.btn-secondary { 
  background: transparent; color: var(--text-muted); border: 1px solid var(--line-color); padding: 10px 20px; cursor: pointer; margin-right: 10px; 
}

@media (max-width: 1024px) {
  .blueprint-grid {
    flex-direction: column;
    /* Stacks panes on tablets/phones */
    overflow-y: auto;
  }

  .telemetry-pane,
  .sateav-pane {
    flex: none;
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--grid-line);
  }

  .sateav-pane {
    height: 50vh;
    /* Fixed height for chat on mobile */
  }
}

@media (max-width: 768px) {
  .blueprint-grid {
    grid-template-columns: 1fr;
  }

  .node-card {
    padding: 25px 20px;
  }

  .node-label {
    font-size: 0.75rem;
    letter-spacing: 1.5px;
  }

  .voice-label {
    font-size: 0.95rem;
  }

}

@media (max-width: 600px) {
  .blueprint-wrapper {
    padding: 10px 10px 30px 10px;
  }

  .data-row-split {
    grid-template-columns: 1fr;
  }

  .node-card {
    padding: 20px 15px;
  }

  .node-label {
    letter-spacing: 1.5px;
  }

  .chat-input-wrapper{
    margin-top: 10px;
  }

  .feed-item {
    padding: 6px 0;
  }

  .report-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 15px 10px;
  }

  .report-row.header {
    display: none;
    /* Hide headers on tiny screens to save space */
  }

  .col-month {
    color: var(--accent-blue);
    font-size: 750;
  }

  .col-month, .col-value, .col-sales {
    width: 100%;
    text-align: left;
  }

  .col-month span, .col-value span, .col-sales span {
    display: inline;
    margin-right: 20px;
    font-weight: normal;
    color: var(--text-muted);
    font-size: 0.75rem;
  }

  .col-sales span {
    margin-right: 25px;
  }

  .chart-container {
    min-height: 350px;
  }

  .highlight {
    font-size: 0.9rem;
  }

  .modal-content {
    min-height: 200px;
  }

  .blueprint-input {
    height: 30px; 
  }

  .btn-primary { 
    height: 50px; width: 75%;
  }

  .btn-secondary { 
    height: 50px; width: 75%;
  }
}

@media (max-width: 480px) {
  .divider {
    margin: 0px;
  }

  #sales-val {
    font-size: 2.5rem;
  }
}