/* ================================================================
   JARVIS AI OS — frontend/css/style.css
   Dynamic Core & Voice Conversation System v2.0
   ================================================================ */

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

:root {
  /* Core colour palette */
  --cyan:             #00d4ff;
  --cyan-dim:         rgba(0, 212, 255, 0.45);
  --cyan-faint:       rgba(0, 212, 255, 0.10);
  --cyan-ghost:       rgba(0, 212, 255, 0.04);
  --blue:             #0088cc;
  --blue-dark:        #003355;
  --bg-deep:          #000814;
  --bg-panel:         rgba(0, 18, 35, 0.82);
  --bg-panel-border:  rgba(0, 212, 255, 0.18);
  --text-primary:     rgba(0, 212, 255, 0.92);
  --text-dim:         rgba(0, 180, 220, 0.60);
  --text-faint:       rgba(0, 150, 190, 0.38);
  --ready:            #00ff88;
  --online:           #00ffcc;
  --standby:          #ffaa00;
  --error:            #ff3344;
  --speaking-color:   #bb66ff;
  --white-dim:        rgba(255, 255, 255, 0.88);

  /* Sizing */
  --header-h:         58px;
  --footer-h:         40px;
  --panel-w:          240px;
  --core-size:        min(40vw, 390px);

  /* Dynamic Animation speeds */
  --speed-outer:      32s;
  --speed-inner:      18s;
  --speed-ticks:      48s;
  --speed-mid:        28s;
  --pulse-dur:        3.2s;
  --scan-dur:         6s;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: 'Share Tech Mono', 'Courier New', monospace;
  font-size: 13px;
  letter-spacing: 0.06em;
  -webkit-font-smoothing: antialiased;
}

/* ── BACKGROUND LAYER ─────────────────────────────────────────── */
.bg-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

#bg-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.6;
}

.bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(0,212,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,212,255,0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  animation: grid-drift 80s linear infinite;
}

@keyframes grid-drift {
  0%   { background-position: 0 0; }
  100% { background-position: 60px 60px; }
}

.bg-scanline {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(0,0,0,0.10) 3px,
    rgba(0,0,0,0.10) 4px
  );
  pointer-events: none;
}

/* ── JARVIS OS WRAPPER ────────────────────────────────────────── */
.jarvis-os,
.desktop-control-center {
  display: grid;
  grid-template-rows: var(--header-h) 1fr var(--footer-h);
  grid-template-columns: 1fr;
  width: 100vw;
  height: 100vh;
  min-width: 320px;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

/* ── HEADER ───────────────────────────────────────────────────── */
.header {
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--bg-panel-border);
  background: rgba(0, 12, 24, 0.88);
  backdrop-filter: blur(8px);
  position: relative;
  z-index: 10;
}

.header::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%, var(--cyan) 30%, var(--cyan) 70%, transparent 100%);
  opacity: 0.25;
}

.header-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.header-logo {
  font-family: 'Orbitron', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--cyan);
  letter-spacing: 0.18em;
  text-shadow: 0 0 12px rgba(0,212,255,0.6);
}

.header-version {
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.12em;
}

.header-center {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-status-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 14px;
  border: 1px solid rgba(0,255,136,0.25);
  border-radius: 2px;
  background: rgba(0,255,136,0.04);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ready);
  box-shadow: 0 0 8px var(--ready);
  animation: dot-blink 2.4s ease-in-out infinite;
}

@keyframes dot-blink {
  0%,100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

.status-label {
  font-size: 11px;
  color: var(--ready);
  letter-spacing: 0.10em;
  font-weight: 600;
}

.header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.header-clock {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}

#clock-time {
  font-family: 'Orbitron', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--cyan);
  letter-spacing: 0.12em;
}

#clock-date {
  font-size: 10px;
  color: var(--text-dim);
}

/* ── MAIN CONTENT ─────────────────────────────────────────────── */
.main-content {
  grid-row: 2;
  display: grid;
  grid-template-columns: var(--panel-w) 1fr var(--panel-w);
  overflow: hidden;
  position: relative;
}

/* ── SIDE PANELS ──────────────────────────────────────────────── */
.panel {
  padding: 18px 16px;
  background: var(--bg-panel);
  border-color: var(--bg-panel-border);
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--cyan-faint) transparent;
}

.panel-left  { border-right: 1px solid var(--bg-panel-border); }
.panel-right { border-left:  1px solid var(--bg-panel-border); }

.panel-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.panel-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--cyan);
  text-shadow: 0 0 8px rgba(0,212,255,0.4);
}

.panel-line {
  display: block;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, var(--cyan-dim), transparent);
}

/* ── SYSTEM ITEMS (Left Panel) ────────────────────────────────── */
.system-items {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.system-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 8px 10px;
  border: 1px solid rgba(0,212,255,0.10);
  border-radius: 3px;
  background: rgba(0,212,255,0.02);
  transition: border-color 0.3s, background 0.3s;
}

.system-item:hover {
  border-color: rgba(0,212,255,0.25);
  background: rgba(0,212,255,0.05);
}

.system-item-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
}

.system-item-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.item-name {
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.10em;
}

.item-status {
  font-size: 9px;
  letter-spacing: 0.10em;
  font-weight: 600;
}

.item-status.active  { color: var(--cyan); }
.item-status.ready   { color: var(--ready); }
.item-status.online  { color: var(--online); }
.item-status.standby { color: var(--standby); }

/* Indicator dots */
.indicator {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}
.indicator.active  { background: var(--cyan);    box-shadow: 0 0 6px var(--cyan); }
.indicator.ready   { background: var(--ready);   box-shadow: 0 0 6px var(--ready); }
.indicator.online  { background: var(--online);  box-shadow: 0 0 6px var(--online); }
.indicator.standby { background: var(--standby); box-shadow: 0 0 6px var(--standby); }

.pulse-dot {
  animation: pulse-dot-anim 2s ease-in-out infinite;
}

@keyframes pulse-dot-anim {
  0%,100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.3); opacity: 0.65; }
}

/* Progress bars */
.item-bar {
  width: 100%;
  height: 2px;
  background: rgba(0,212,255,0.08);
  border-radius: 1px;
  overflow: hidden;
}

.item-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), rgba(0,212,255,0.4));
  border-radius: 1px;
  transition: width 1s ease;
}

.item-bar-fill.ready-bar   { background: linear-gradient(90deg, var(--ready),   rgba(0,255,136,0.4)); }
.item-bar-fill.online-bar  { background: linear-gradient(90deg, var(--online),  rgba(0,255,204,0.4)); }
.item-bar-fill.standby-bar { background: linear-gradient(90deg, var(--standby), rgba(255,170,0,0.4)); }

/* ── DIAGNOSTICS ──────────────────────────────────────────────── */
.panel-diagnostics {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid rgba(0,212,255,0.08);
}

.diag-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 9px;
  color: var(--text-faint);
  letter-spacing: 0.14em;
  margin-bottom: 8px;
}

.diag-line {
  font-size: 10px;
  color: var(--text-dim);
  line-height: 1.9;
  letter-spacing: 0.04em;
}

.diag-line span {
  color: var(--cyan);
  float: right;
}

.panel-corner-deco {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0.4;
  pointer-events: none;
}

/* ── CENTER PANEL ─────────────────────────────────────────────── */
.center-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  position: relative;
  overflow: hidden;
}

/* ── AI CORE WRAPPER ──────────────────────────────────────────── */
.ai-core-wrapper {
  position: relative;
  width: var(--core-size);
  height: var(--core-size);
  flex-shrink: 0;
  margin-top: -5px;
}

.ai-core-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.particle-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ── SVG RING ANIMATIONS ──────────────────────────────────────── */
.ring-outer {
  transform-origin: 0 0;
  animation: rotate-cw var(--speed-outer) linear infinite;
}

.ring-inner {
  transform-origin: 0 0;
  animation: rotate-ccw var(--speed-inner) linear infinite;
}

.ring-ticks {
  transform-origin: 0 0;
  animation: rotate-cw var(--speed-ticks) linear infinite;
}

.ring-mid {
  transform-origin: 0 0;
  animation: rotate-ccw var(--speed-mid) linear infinite;
}

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

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

.core-pulse-group {
  transform-origin: 0 0;
  animation: core-pulse var(--pulse-dur) ease-in-out infinite;
}

@keyframes core-pulse {
  0%,100% { transform: scale(1); }
  50%      { transform: scale(1.04); }
}

.core-energy-orb {
  animation: orb-flicker 2.8s ease-in-out infinite;
}

@keyframes orb-flicker {
  0%,100% { opacity: 0.9; r: 10; }
  30%      { opacity: 1.0; r: 11; }
  60%      { opacity: 0.75; r: 9; }
  80%      { opacity: 0.95; r: 10.5; }
}

.core-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 13px;
  font-weight: 700;
  fill: rgba(0, 212, 255, 0.95);
  letter-spacing: 0.20em;
  filter: drop-shadow(0 0 4px rgba(0,212,255,0.7));
}

.core-subtitle {
  font-family: 'Share Tech Mono', monospace;
  font-size: 5.5px;
  fill: rgba(0, 180, 220, 0.60);
  letter-spacing: 0.10em;
}

.core-status-text {
  font-family: 'Share Tech Mono', monospace;
  font-size: 6px;
  fill: rgba(0, 212, 255, 0.50);
  letter-spacing: 0.14em;
  animation: status-text-blink 4s ease-in-out infinite;
}

@keyframes status-text-blink {
  0%,100% { opacity: 0.5; }
  50%      { opacity: 0.9; }
}

/* ── STATE INDICATOR ──────────────────────────────────────────── */
.state-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 14px;
  border: 1px solid rgba(0,212,255,0.15);
  border-radius: 2px;
  background: rgba(0,212,255,0.04);
  margin-top: -6px;
}

.state-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
  animation: dot-blink 1.8s ease-in-out infinite;
}

.state-text {
  font-family: 'Orbitron', sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--cyan);
}

/* ── CONVERSATION RESPONSE AREA ───────────────────────────────── */
.response-area {
  text-align: center;
  width: 100%;
  max-width: 580px;
  min-height: 52px;
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: rgba(0, 20, 40, 0.35);
  border: 1px solid rgba(0, 212, 255, 0.08);
  border-radius: 3px;
}

.response-sender {
  font-family: 'Orbitron', sans-serif;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.response-sender.sender-you {
  color: var(--ready);
  text-shadow: 0 0 6px rgba(0, 255, 136, 0.4);
}

.response-sender.sender-jarvis {
  color: var(--cyan);
  text-shadow: 0 0 6px rgba(0, 212, 255, 0.4);
}

.response-text {
  font-family: 'Share Tech Mono', monospace;
  font-size: 13.5px;
  color: rgba(220, 245, 255, 0.88);
  letter-spacing: 0.04em;
  line-height: 1.5;
  word-break: break-word;
}

.response-subtitle {
  font-size: 8.5px;
  color: var(--text-faint);
  letter-spacing: 0.12em;
}

/* ── CONTROLS SECTION ─────────────────────────────────────────── */
.controls-section {
  width: 100%;
  max-width: 580px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

/* ── COMMAND TEXT INPUT ───────────────────────────────────────── */
.cmd-form {
  width: 100%;
}

.cmd-input-wrapper {
  display: flex;
  align-items: center;
  width: 100%;
  height: 38px;
  background: rgba(0, 16, 32, 0.75);
  border: 1px solid rgba(0, 212, 255, 0.20);
  border-radius: 3px;
  padding: 0 8px 0 12px;
  gap: 8px;
  box-shadow: inset 0 0 10px rgba(0, 212, 255, 0.03);
  transition: all 0.25s ease;
}

.cmd-input-wrapper:focus-within {
  border-color: var(--cyan);
  background: rgba(0, 20, 42, 0.90);
  box-shadow: 0 0 15px rgba(0, 212, 255, 0.20), inset 0 0 10px rgba(0, 212, 255, 0.06);
}

.cmd-prompt {
  font-family: 'Orbitron', sans-serif;
  font-size: 13px;
  color: var(--cyan);
  font-weight: 700;
  user-select: none;
}

.cmd-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: 'Share Tech Mono', monospace;
  font-size: 13px;
  color: rgba(230, 250, 255, 0.95);
  letter-spacing: 0.05em;
}

.cmd-input::placeholder {
  color: var(--text-faint);
  font-size: 11.5px;
}

.cmd-send-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: rgba(0, 212, 255, 0.08);
  border: 1px solid rgba(0, 212, 255, 0.30);
  border-radius: 2px;
  color: var(--cyan);
  font-family: 'Orbitron', sans-serif;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.12em;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
}

.cmd-send-btn:hover {
  background: rgba(0, 212, 255, 0.22);
  border-color: var(--cyan);
  box-shadow: 0 0 8px rgba(0, 212, 255, 0.4);
  transform: translateY(-1px);
}

.cmd-send-btn:active {
  transform: translateY(0);
}

/* ── MICROPHONE BUTTON ────────────────────────────────────────── */
.mic-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.mic-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  outline: none;
  padding: 0;
}

.mic-btn-rings {
  position: absolute;
  width: 90px;
  height: 90px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.mic-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid var(--cyan-dim);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.mic-ring-1 { width: 100%; height: 100%; opacity: 0.3; }
.mic-ring-2 { width: 80%;  height: 80%;  opacity: 0.2; }
.mic-ring-3 { width: 60%;  height: 60%;  opacity: 0.15; }

.mic-btn:hover .mic-ring-1 {
  animation: mic-ring-expand 1.5s ease-out infinite;
}
.mic-btn:hover .mic-ring-2 {
  animation: mic-ring-expand 1.5s ease-out 0.3s infinite;
}
.mic-btn:hover .mic-ring-3 {
  animation: mic-ring-expand 1.5s ease-out 0.6s infinite;
}

@keyframes mic-ring-expand {
  0%   { transform: translate(-50%,-50%) scale(1);   opacity: 0.4; }
  100% { transform: translate(-50%,-50%) scale(1.5); opacity: 0; }
}

.mic-btn-inner {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0,212,255,0.18) 0%, rgba(0,50,80,0.6) 100%);
  border: 1.5px solid var(--cyan-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cyan);
  transition: all 0.3s ease;
  box-shadow: 0 0 16px rgba(0,212,255,0.12), inset 0 0 10px rgba(0,212,255,0.05);
}

.mic-btn:hover .mic-btn-inner {
  border-color: var(--cyan);
  background: radial-gradient(circle, rgba(0,212,255,0.28) 0%, rgba(0,50,80,0.8) 100%);
  box-shadow: 0 0 25px rgba(0,212,255,0.35), inset 0 0 12px rgba(0,212,255,0.12);
  transform: scale(1.06);
}

.mic-btn:active .mic-btn-inner {
  transform: scale(0.96);
}

.mic-icon {
  filter: drop-shadow(0 0 4px rgba(0,212,255,0.6));
}

.mic-label {
  font-family: 'Share Tech Mono', monospace;
  font-size: 8.5px;
  letter-spacing: 0.14em;
  color: var(--text-faint);
  margin-top: 30px;
  white-space: nowrap;
  transition: color 0.3s;
}

.mic-btn:hover .mic-label {
  color: var(--text-dim);
}

/* ── MODULE ITEMS (Right Panel) ───────────────────────────────── */
.module-items {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.module-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid rgba(0,212,255,0.08);
  border-radius: 3px;
  background: rgba(0,212,255,0.02);
  cursor: pointer;
  transition: all 0.3s ease;
}

.module-item:hover {
  border-color: rgba(0,212,255,0.25);
  background: rgba(0,212,255,0.06);
  transform: translateX(2px);
}

.module-item.active {
  border-color: rgba(0,212,255,0.30);
  background: rgba(0,212,255,0.06);
}

.module-icon {
  color: var(--text-dim);
  flex-shrink: 0;
  transition: color 0.3s;
}

.module-item:hover .module-icon,
.module-item.active .module-icon {
  color: var(--cyan);
}

.module-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.module-name {
  font-family: 'Orbitron', sans-serif;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--text-primary);
}

.module-status {
  font-size: 9px;
  color: var(--standby);
  letter-spacing: 0.08em;
}

.module-status.active-s { color: var(--cyan); }

.module-indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.module-indicator.standby    { background: var(--standby); box-shadow: 0 0 5px var(--standby); }
.module-indicator.active-ind { background: var(--cyan);    box-shadow: 0 0 8px var(--cyan); }

/* ── ACTIVITY LOG ─────────────────────────────────────────────── */
.activity-log {
  flex: 1;
  margin-top: 4px;
  border-top: 1px solid rgba(0,212,255,0.08);
  padding-top: 12px;
  overflow: hidden;
}

.log-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 9px;
  color: var(--text-faint);
  letter-spacing: 0.14em;
  margin-bottom: 8px;
}

.log-entries {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 150px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--cyan-faint) transparent;
}

.log-entry {
  display: flex;
  gap: 8px;
  font-size: 9px;
  line-height: 1.5;
  animation: log-fade-in 0.3s ease;
}

@keyframes log-fade-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.log-time {
  color: var(--text-faint);
  flex-shrink: 0;
  font-size: 8px;
}

.log-msg {
  color: var(--text-dim);
}

.log-entry.log-voice .log-msg { color: var(--ready); }
.log-entry.log-ai    .log-msg { color: #ffbb33; }
.log-entry.log-error .log-msg { color: var(--error); }
.log-entry.log-warn  .log-msg { color: var(--standby); }

/* ── FOOTER ───────────────────────────────────────────────────── */
.footer {
  grid-row: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-top: 1px solid var(--bg-panel-border);
  background: rgba(0, 8, 20, 0.90);
  font-size: 10px;
  color: var(--text-faint);
  letter-spacing: 0.08em;
  position: relative;
  z-index: 10;
}

.footer::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%, var(--cyan) 30%, var(--cyan) 70%, transparent 100%);
  opacity: 0.15;
}

.footer-left, .footer-center, .footer-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.footer-center { color: var(--text-dim); }
.footer-sep { opacity: 0.4; }
.online-text { color: var(--cyan); }

/* ── DYNAMIC STATE VARIANTS ───────────────────────────────────── */

/* 1. LISTENING STATE */
[data-state="listening"] {
  --speed-outer: 12s;
  --speed-inner: 7s;
  --pulse-dur:   1.4s;
  --scan-dur:    2.4s;
}

[data-state="listening"] .state-dot {
  background: var(--ready);
  box-shadow: 0 0 12px var(--ready);
}

[data-state="listening"] .state-text {
  color: var(--ready);
}

[data-state="listening"] .mic-btn-inner {
  border-color: var(--ready);
  color: var(--ready);
  background: radial-gradient(circle, rgba(0,255,136,0.3) 0%, rgba(0,60,40,0.8) 100%);
  box-shadow: 0 0 30px rgba(0,255,136,0.5), inset 0 0 15px rgba(0,255,136,0.2);
  animation: mic-listening-pulse 0.9s ease-in-out infinite;
}

@keyframes mic-listening-pulse {
  0%,100% { transform: scale(1); box-shadow: 0 0 20px rgba(0,255,136,0.4); }
  50%      { transform: scale(1.08); box-shadow: 0 0 40px rgba(0,255,136,0.8); }
}

[data-state="listening"] .mic-label {
  color: var(--ready);
  animation: text-blink 1s ease-in-out infinite;
}

@keyframes text-blink {
  0%,100% { opacity: 1; }
  50%      { opacity: 0.3; }
}

/* 2. THINKING STATE */
[data-state="thinking"] {
  --speed-outer: 7s;
  --speed-inner: 4.5s;
  --speed-ticks: 16s;
  --speed-mid:   10s;
  --pulse-dur:   1.0s;
  --scan-dur:    1.5s;
}

[data-state="thinking"] .state-dot {
  background: #ffaa00;
  box-shadow: 0 0 14px #ffaa00;
  animation: dot-blink 0.4s ease-in-out infinite;
}

[data-state="thinking"] .state-text {
  color: #ffaa00;
}

[data-state="thinking"] .core-title {
  fill: #ffaa00;
  filter: drop-shadow(0 0 6px rgba(255,170,0,0.8));
}

[data-state="thinking"] .core-status-text {
  fill: #ffaa00;
}

/* 3. SPEAKING STATE */
[data-state="speaking"] {
  --speed-outer: 16s;
  --speed-inner: 9s;
  --pulse-dur:   0.85s;
  --scan-dur:    2.2s;
}

[data-state="speaking"] .state-dot {
  background: var(--speaking-color);
  box-shadow: 0 0 14px var(--speaking-color);
  animation: dot-blink 1.0s ease-in-out infinite;
}

[data-state="speaking"] .state-text {
  color: var(--speaking-color);
}

[data-state="speaking"] .core-title {
  fill: #d899ff;
  filter: drop-shadow(0 0 6px rgba(216,153,255,0.8));
}

[data-state="speaking"] .core-energy-orb {
  fill: rgba(216, 153, 255, 0.95);
  filter: drop-shadow(0 0 10px rgba(216,153,255,0.9));
}

/* 4. ERROR STATE */
[data-state="error"] .state-dot {
  background: var(--error);
  box-shadow: 0 0 12px var(--error);
  animation: dot-blink 0.3s ease-in-out infinite;
}

[data-state="error"] .state-text {
  color: var(--error);
}

[data-state="error"] .status-dot {
  background: var(--error);
  box-shadow: 0 0 8px var(--error);
}

/* ── DEV CONTROLS ─────────────────────────────────────────────── */
.dev-controls {
  position: fixed;
  bottom: 48px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: rgba(0,8,20,0.94);
  border: 1px solid rgba(0,212,255,0.20);
  border-radius: 3px;
  z-index: 999;
  font-size: 10px;
}

.dev-label {
  color: var(--text-faint);
  letter-spacing: 0.10em;
  margin-right: 4px;
}

.dev-btn {
  padding: 3px 10px;
  background: rgba(0,212,255,0.05);
  border: 1px solid rgba(0,212,255,0.20);
  border-radius: 2px;
  color: var(--text-dim);
  font-family: 'Share Tech Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all 0.2s;
}

.dev-btn:hover,
.dev-btn.active-dev {
  background: rgba(0,212,255,0.18);
  border-color: var(--cyan);
  color: var(--cyan);
}

/* ── RESPONSIVE DESIGN ────────────────────────────────────────── */
@media (max-width: 1100px) {
  :root {
    --panel-w: 200px;
    --core-size: min(38vw, 340px);
  }
}

@media (max-width: 860px) {
  .main-content {
    grid-template-columns: 0 1fr 0;
  }
  .panel-left, .panel-right {
    display: none;
  }
  :root {
    --core-size: min(65vw, 340px);
  }
}

@media (max-width: 560px) {
  :root {
    --core-size: min(78vw, 290px);
    --header-h: 48px;
  }
  .header-version { display: none; }
  .header-right   { display: none; }
  #clock-time { font-size: 13px; }
  .controls-section { gap: 6px; }
  .cmd-input-wrapper { height: 34px; font-size: 11px; }
}

/* ── FADE IN ──────────────────────────────────────────────────── */
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.jarvis-os {
  animation: fade-in 1.0s ease;
}

/* ────────────────────────────────────────────────────────────
   CALENDAR AGENT UI COMPONENTS v3.0
──────────────────────────────────────────────────────────── */

/* ── CALENDAR RESULT PANEL ─────────────────────────────────── */
.calendar-result-panel {
  position: absolute;
  bottom: 80px;
  width: 90%;
  max-width: 580px;
  max-height: 260px;
  background: rgba(0, 16, 32, 0.94);
  border: 1px solid rgba(0, 212, 255, 0.35);
  border-radius: 4px;
  box-shadow: 0 0 25px rgba(0, 212, 255, 0.15), inset 0 0 15px rgba(0, 212, 255, 0.05);
  backdrop-filter: blur(10px);
  z-index: 40;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modal-slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modal-slide-up {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.cal-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  background: rgba(0, 28, 56, 0.6);
  border-bottom: 1px solid rgba(0, 212, 255, 0.20);
}

.cal-panel-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--cyan);
}

.cal-panel-close {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
  transition: color 0.2s;
}

.cal-panel-close:hover {
  color: var(--cyan);
}

.cal-result-list {
  padding: 10px 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--cyan-faint) transparent;
}

.cal-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 20px 0;
  color: var(--text-dim);
  font-size: 12px;
}

.cal-event-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 10px;
  background: rgba(0, 212, 255, 0.03);
  border: 1px solid rgba(0, 212, 255, 0.12);
  border-radius: 3px;
  transition: all 0.2s ease;
}

.cal-event-card:hover {
  background: rgba(0, 212, 255, 0.08);
  border-color: rgba(0, 212, 255, 0.35);
  transform: translateX(2px);
}

.cal-card-time {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 62px;
  padding: 4px 6px;
  background: rgba(0, 212, 255, 0.08);
  border-radius: 2px;
  border: 1px solid rgba(0, 212, 255, 0.20);
}

.cal-time-start {
  font-family: 'Orbitron', sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: var(--cyan);
}

.cal-time-end {
  font-size: 8.5px;
  color: var(--text-dim);
}

.cal-card-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cal-card-title {
  font-family: 'Share Tech Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  color: rgba(230, 250, 255, 0.95);
  letter-spacing: 0.05em;
}

.cal-card-date {
  font-size: 9px;
  color: var(--text-dim);
}

.cal-card-desc {
  font-size: 8.5px;
  color: var(--text-faint);
  margin-top: 2px;
}

/* ── CONFIRMATION CARD (MODAL / OVERLAY) ───────────────────── */
.cal-confirm-card {
  position: absolute;
  bottom: 80px;
  width: 90%;
  max-width: 460px;
  background: rgba(12, 2, 4, 0.95);
  border: 1px solid rgba(255, 80, 80, 0.45);
  border-radius: 4px;
  box-shadow: 0 0 30px rgba(255, 50, 50, 0.25), inset 0 0 15px rgba(255, 50, 50, 0.08);
  backdrop-filter: blur(10px);
  z-index: 50;
  display: flex;
  flex-direction: column;
  padding: 14px 16px;
  gap: 10px;
  animation: modal-slide-up 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.confirm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 80, 80, 0.25);
  padding-bottom: 6px;
}

.confirm-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.confirm-title.title-danger  { color: var(--error); text-shadow: 0 0 8px rgba(255, 50, 50, 0.5); }
.confirm-title.title-warning { color: #ffbb00; text-shadow: 0 0 8px rgba(255, 187, 0, 0.5); }

.confirm-content {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.confirm-event-box {
  padding: 8px 10px;
  background: rgba(255, 50, 50, 0.06);
  border: 1px solid rgba(255, 80, 80, 0.20);
  border-radius: 3px;
}

.confirm-event-name {
  font-size: 13px;
  font-weight: bold;
  color: #fff;
}

.confirm-event-time {
  font-size: 10px;
  color: #ff9999;
}

.confirm-note {
  font-size: 10px;
  color: var(--text-dim);
}

.confirm-diff-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
  background: rgba(255, 187, 0, 0.05);
  border: 1px solid rgba(255, 187, 0, 0.20);
  border-radius: 3px;
}

.diff-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
}

.diff-row.highlight .diff-val {
  color: #ffdd44;
  font-weight: bold;
}

.diff-label {
  font-family: 'Orbitron', sans-serif;
  font-size: 9px;
  color: var(--text-faint);
  min-width: 60px;
}

.diff-val {
  color: var(--text-primary);
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.btn-confirm {
  padding: 6px 16px;
  font-family: 'Orbitron', sans-serif;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  border-radius: 2px;
  cursor: pointer;
  outline: none;
  transition: all 0.2s;
}

.btn-action-confirm {
  background: rgba(255, 51, 68, 0.20);
  border: 1px solid rgba(255, 51, 68, 0.5);
  color: #ff4455;
}

.btn-action-confirm:hover {
  background: rgba(255, 51, 68, 0.40);
  box-shadow: 0 0 10px rgba(255, 51, 68, 0.5);
}

.btn-action-cancel {
  background: rgba(0, 212, 255, 0.08);
  border: 1px solid rgba(0, 212, 255, 0.3);
  color: var(--text-dim);
}

.btn-action-cancel:hover {
  background: rgba(0, 212, 255, 0.20);
  color: var(--cyan);
}

/* ── CONFIRMING STATE COLOR VARIANTS ──────────────────────── */
[data-state="confirming"] {
  --speed-outer: 10s;
  --speed-inner: 6s;
  --pulse-dur:   1.1s;
}

[data-state="confirming"] .state-dot {
  background: #ffdd00;
  box-shadow: 0 0 14px #ffdd00;
  animation: dot-blink 0.5s ease-in-out infinite;
}

[data-state="confirming"] .state-text {
  color: #ffdd00;
}

[data-state="confirming"] .core-title {
  fill: #ffdd00;
  filter: drop-shadow(0 0 6px rgba(255, 221, 0, 0.8));
}

/* Module indicator error state */
.module-indicator.error-ind {
  background: var(--error);
  box-shadow: 0 0 6px var(--error);
}
