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

:root {
  --bg-dark: #0a0a0f;
  --bg-panel: #12121a;
  --accent-cyan: #00d4ff;
  --accent-orange: #ff6b00;
  --accent-green: #00ff88;
  --accent-red: #ff4444;
  --text-primary: #e0e0e0;
  --text-secondary: #a0a0a0;
  --border-glow: rgba(0, 212, 255, 0.2);
  --online: #00ff88;
  --offline: #ff4444;
  --recording: #ff6b00;
  --streaming: #00d4ff;
  --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  background-color: var(--bg-dark);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'JetBrains Mono', 'Fira Code', monospace;
  line-height: 1.6;
  overflow: hidden;
  height: 100vh;
}

/* LAYOUT */
#dashboard {
  display: grid;
  grid-template-columns: 280px 1fr;
  grid-template-rows: 80px 1fr 60px;
  height: 100vh;
  gap: 0;
}

#header {
  grid-column: 1 / -1;
  grid-row: 1;
  background: linear-gradient(135deg, #0f0f18 0%, #1a1a2e 100%);
  border-bottom: 2px solid var(--border-glow);
  padding: 15px 25px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 0 30px rgba(0, 212, 255, 0.1);
}

.header-title {
  display: flex;
  align-items: center;
  gap: 15px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-orange));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-logo {
  width: 40px;
  height: 40px;
  background: var(--accent-cyan);
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  color: var(--bg-dark);
  font-size: 18px;
  box-shadow: 0 0 15px rgba(0, 212, 255, 0.5);
}

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

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent-cyan);
  font-family: 'JetBrains Mono', monospace;
}

.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 1px;
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(0, 212, 255, 0.1);
  border: 1px solid var(--border-glow);
  border-radius: 3px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
}

.status-dot.offline {
  background: var(--accent-red);
  box-shadow: 0 0 8px var(--accent-red);
}

/* SIDEBAR */
#sidebar {
  grid-column: 1;
  grid-row: 2;
  background: var(--bg-panel);
  border-right: 1px solid var(--border-glow);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.sidebar-tabs {
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid var(--border-glow);
}

.sidebar-tab {
  padding: 15px 20px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all var(--transition);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
}

.sidebar-tab:hover {
  background: rgba(0, 212, 255, 0.05);
  color: var(--accent-cyan);
  border-left-color: var(--accent-cyan);
}

.sidebar-tab.active {
  background: rgba(0, 212, 255, 0.1);
  color: var(--accent-cyan);
  border-left-color: var(--accent-cyan);
  box-shadow: inset 0 0 15px rgba(0, 212, 255, 0.05);
}

.sidebar-content {
  padding: 20px;
  flex: 1;
  overflow-y: auto;
}

.sidebar-content > div {
  display: none;
}

.sidebar-content > div.active {
  display: block;
}

.recording-item {
  background: rgba(0, 212, 255, 0.05);
  border: 1px solid var(--border-glow);
  padding: 10px;
  margin-bottom: 10px;
  border-radius: 3px;
  cursor: pointer;
  transition: all var(--transition);
  font-size: 12px;
}

.recording-item:hover {
  background: rgba(0, 212, 255, 0.1);
  box-shadow: 0 0 10px rgba(0, 212, 255, 0.2);
}

.recording-title {
  font-weight: 600;
  color: var(--accent-cyan);
  margin-bottom: 4px;
}

.recording-time {
  color: var(--text-secondary);
  font-size: 11px;
}

/* MAIN CONTENT */
#main-content {
  grid-column: 2;
  grid-row: 2;
  overflow-y: auto;
  padding: 25px;
  background: linear-gradient(135deg, var(--bg-dark) 0%, #0f0f18 100%);
}

.command-search {
  display: flex;
  gap: 10px;
  margin-bottom: 30px;
}

#command-input {
  flex: 1;
  background: var(--bg-panel);
  border: 1px solid var(--border-glow);
  color: var(--text-primary);
  padding: 12px 16px;
  border-radius: 3px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  transition: all var(--transition);
}

#command-input:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 15px rgba(0, 212, 255, 0.3), inset 0 0 10px rgba(0, 212, 255, 0.05);
}

.btn {
  padding: 10px 20px;
  background: var(--accent-cyan);
  color: var(--bg-dark);
  border: none;
  border-radius: 3px;
  cursor: pointer;
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: all var(--transition);
  box-shadow: 0 0 10px rgba(0, 212, 255, 0.3);
}

.btn:hover {
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.6), 0 4px 12px rgba(0, 212, 255, 0.4);
  transform: translateY(-2px);
}

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

.btn-secondary {
  background: var(--accent-orange);
  box-shadow: 0 0 10px rgba(255, 107, 0, 0.3);
}

.btn-secondary:hover {
  box-shadow: 0 0 20px rgba(255, 107, 0, 0.6), 0 4px 12px rgba(255, 107, 0, 0.4);
}

.btn-small {
  padding: 6px 12px;
  font-size: 11px;
}

.btn-danger {
  background: var(--accent-red);
  box-shadow: 0 0 10px rgba(255, 68, 68, 0.3);
}

.btn-danger:hover {
  box-shadow: 0 0 20px rgba(255, 68, 68, 0.6), 0 4px 12px rgba(255, 68, 68, 0.4);
}

/* NODE GRID */
#node-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  margin-top: 30px;
}

.node-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-glow);
  border-radius: 3px;
  padding: 20px;
  transition: all var(--transition);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.node-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(0, 212, 255, 0.1), transparent);
  transition: left 500ms;
}

.node-card:hover {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.3), inset 0 0 20px rgba(0, 212, 255, 0.02);
  transform: translateY(-4px);
}

.node-card:hover::before {
  left: 100%;
}

.node-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 15px;
  position: relative;
  z-index: 1;
}

.node-title {
  flex: 1;
}

.node-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 3px;
  word-break: break-word;
}

.node-id {
  font-size: 11px;
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.5px;
}

.node-status-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(0, 255, 136, 0.1);
  border: 1px solid rgba(0, 255, 136, 0.3);
  border-radius: 2px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--online);
}

.node-status-badge.offline {
  background: rgba(255, 68, 68, 0.1);
  border-color: rgba(255, 68, 68, 0.3);
  color: var(--accent-red);
}

.node-status-badge.recording {
  background: rgba(255, 107, 0, 0.1);
  border-color: rgba(255, 107, 0, 0.3);
  color: var(--accent-orange);
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--online);
  box-shadow: 0 0 6px var(--online);
  display: inline-block;
}

.status-indicator.offline {
  background: var(--accent-red);
  box-shadow: 0 0 6px var(--accent-red);
}

.status-indicator.recording {
  background: var(--accent-orange);
  box-shadow: 0 0 6px var(--accent-orange);
  animation: pulse 1s infinite;
}

.node-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin: 15px 0;
  font-size: 12px;
  position: relative;
  z-index: 1;
}

.info-block {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.info-label {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
  font-weight: 600;
}

.info-value {
  color: var(--accent-cyan);
  font-family: 'JetBrains Mono', monospace;
  word-break: break-all;
}

.node-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 15px;
  position: relative;
  z-index: 1;
}

.node-actions .btn {
  padding: 8px 12px;
  font-size: 11px;
  width: 100%;
}

.node-actions .btn-secondary {
  background: rgba(255, 107, 0, 0.7);
}

/* MODAL */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: var(--bg-panel);
  border: 1px solid var(--border-glow);
  border-radius: 3px;
  padding: 30px;
  max-width: 90vh;
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 0 50px rgba(0, 212, 255, 0.3);
  position: relative;
}

.modal-close {
  position: absolute;
  top: 15px;
  right: 15px;
  background: var(--accent-red);
  color: white;
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 2px;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.modal-close:hover {
  background: var(--accent-orange);
  box-shadow: 0 0 15px rgba(255, 107, 0, 0.5);
}

.modal-image {
  max-width: 100%;
  max-height: 70vh;
  border: 1px solid var(--border-glow);
  border-radius: 3px;
  display: block;
}

/* TOAST */
.toast-container {
  position: fixed;
  top: 100px;
  right: 20px;
  z-index: 1001;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--bg-panel);
  border: 1px solid var(--border-glow);
  border-left: 4px solid var(--accent-cyan);
  padding: 15px 20px;
  border-radius: 3px;
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.2);
  font-size: 13px;
  font-weight: 500;
  animation: slideIn 300ms ease-out;
  min-width: 280px;
}

@keyframes slideIn {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.toast.success {
  border-left-color: var(--online);
}

.toast.warning {
  border-left-color: var(--accent-orange);
}

.toast.error {
  border-left-color: var(--accent-red);
}

/* FOOTER */
#footer {
  grid-column: 1 / -1;
  grid-row: 3;
  background: linear-gradient(135deg, #0f0f18 0%, #1a1a2e 100%);
  border-top: 1px solid var(--border-glow);
  padding: 15px 25px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-secondary);
}

.footer-info {
  display: flex;
  gap: 30px;
}

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

.footer-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: 0 0 4px var(--accent-cyan);
}

.footer-branding {
  color: var(--accent-cyan);
  font-weight: 600;
  letter-spacing: 1px;
}

/* SCROLLBAR */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 212, 255, 0.2);
  border-radius: 4px;
  transition: all var(--transition);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 212, 255, 0.4);
}

/* RESPONSIVE */
@media (max-width: 1200px) {
  #node-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
}

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

  #sidebar {
    grid-column: 1;
    grid-row: 3;
    max-height: 200px;
    border-right: none;
    border-top: 1px solid var(--border-glow);
  }

  #main-content {
    grid-column: 1;
    grid-row: 2;
  }

  #header {
    flex-direction: column;
    gap: 10px;
  }

  .header-stats {
    width: 100%;
    justify-content: space-around;
  }

  #node-grid {
    grid-template-columns: 1fr;
  }
}
