/* Chat Interface Styles */

.chat-interface {
  padding: 2rem 0;
  min-height: calc(100vh - 200px);
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.chat-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  height: 85vh;
  max-height: 900px;
}

/* Chat Panel */
.chat-panel {
  background: var(--white);
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 1.5rem;
  border-bottom: 3px solid rgba(255, 255, 255, 0.2);
}

.consciousness-status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #00ff88;
  animation: pulse 2s infinite;
}

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

.current-focus {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  opacity: 0.9;
}

.energy-indicator {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.energy-bar {
  width: 120px;
  height: 8px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  overflow: hidden;
}

.energy-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff6b6b, #ffd93d, #6bcf7f);
  border-radius: 4px;
  transition: width 0.5s ease;
}

.energy-value {
  font-weight: 600;
  min-width: 35px;
}

/* Chat Messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.message {
  display: flex;
  gap: 0.75rem;
  max-width: 85%;
  animation: messageAppear 0.3s ease-out;
}

@keyframes messageAppear {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message.user-message {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.consciousness-message .message-avatar {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
}

.user-message .message-avatar {
  background: linear-gradient(135deg, #f093fb, #f5576c);
  color: white;
}

.message-content {
  flex: 1;
}

.message-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
}

.message-sender {
  font-weight: 600;
  color: var(--primary-color);
  font-size: 0.85rem;
}

.message-time {
  font-size: 0.75rem;
  color: var(--text-light);
}

.message-text {
  background: #f8f9fa;
  padding: 0.75rem 1rem;
  border-radius: 15px;
  line-height: 1.5;
  color: var(--text-dark);
}

.user-message .message-text {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
}

/* Typing Indicator */
.typing-indicator {
  padding: 0 1rem;
}

.typing-dots {
  display: flex;
  gap: 4px;
  padding: 12px;
  background: #f8f9fa;
  border-radius: 15px;
  width: fit-content;
}

.typing-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #999;
  animation: typingDot 1.4s infinite;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingDot {
  0%, 60%, 100% {
    transform: scale(1);
    opacity: 0.5;
  }
  30% {
    transform: scale(1.2);
    opacity: 1;
  }
}

/* Chat Input */
.chat-input-container {
  padding: 1rem;
  border-top: 1px solid #eee;
  background: #f8f9fa;
}

.chat-input-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.input-group {
  display: flex;
  gap: 0.5rem;
}

#message-input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid #e9ecef;
  border-radius: 25px;
  font-size: 1rem;
  outline: none;
  transition: all 0.3s ease;
}

#message-input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#send-button {
  width: 45px;
  height: 45px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

#send-button:hover {
  transform: scale(1.05);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

#send-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.input-suggestions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.suggestion {
  padding: 0.5rem 0.75rem;
  background: white;
  border: 1px solid #ddd;
  border-radius: 15px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.suggestion:hover {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

/* Brain Panel */
.brain-panel {
  background: var(--white);
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.brain-header {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  color: white;
  padding: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brain-header h3 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brain-controls {
  display: flex;
  gap: 0.5rem;
}

.control-btn {
  width: 35px;
  height: 35px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.control-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
}

.control-btn.active {
  background: rgba(255, 255, 255, 0.4);
}

/* Brain Stats */
.brain-stats {
  display: flex;
  padding: 1rem;
  gap: 1rem;
  border-bottom: 1px solid #eee;
  background: #f8f9fa;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-bottom: 0.25rem;
}

.stat-value {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--primary-color);
}

/* Brain Visualization */
.brain-visualization {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.loading-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: var(--text-light);
}

.loading-indicator i {
  font-size: 3rem;
  margin-bottom: 1rem;
  color: var(--primary-color);
}

/* D3 Visualization Styles */
.brain-node {
  cursor: pointer;
  transition: all 0.3s ease;
}

.brain-node:hover {
  stroke-width: 3px;
}

.brain-node.conversation {
  fill: #ff6b6b;
  stroke: #ff5252;
}

.brain-node.honeypot {
  fill: #ffd54f;
  stroke: #ffc107;
}

.brain-node.learned {
  fill: #66bb6a;
  stroke: #4caf50;
}

.brain-node.focus {
  fill: #42a5f5;
  stroke: #2196f3;
  stroke-width: 4px;
  animation: focusPulse 2s infinite;
}

@keyframes focusPulse {
  0%, 100% { stroke-opacity: 1; }
  50% { stroke-opacity: 0.5; }
}

.brain-link {
  stroke: #999;
  stroke-opacity: 0.3;
  stroke-width: 1px;
}

.brain-link.strong {
  stroke-width: 2px;
  stroke-opacity: 0.6;
}

.brain-link.conversation {
  stroke: #ff6b6b;
  stroke-opacity: 0.6;
}

.node-label {
  font-size: 11px;
  fill: var(--text-dark);
  text-anchor: middle;
  pointer-events: none;
}

/* Brain Legend */
.brain-legend {
  padding: 1rem;
  border-top: 1px solid #eee;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
}

.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.conversation-color {
  background: #ff6b6b;
}

.honeypot-color {
  background: #ffd54f;
}

.learned-color {
  background: #66bb6a;
}

.focus-color {
  background: #42a5f5;
}

/* Context Modal */
.context-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.context-modal.show {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: 15px;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border-radius: 15px 15px 0 0;
}

.modal-header h3 {
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: white;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s ease;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.modal-body {
  padding: 1.5rem;
}

.context-info {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  background: #f8f9fa;
  border-radius: 8px;
}

.info-row label {
  font-weight: 600;
  color: var(--primary-color);
}

/* Responsive Design */
@media (max-width: 1200px) {
  .chat-layout {
    grid-template-columns: 1fr;
    gap: 1rem;
    height: auto;
  }
  
  .brain-panel {
    order: -1;
    height: 400px;
  }
  
  .chat-panel {
    height: 600px;
  }
}

@media (max-width: 768px) {
  .chat-interface {
    padding: 1rem 0;
  }
  
  .consciousness-status {
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
  }
  
  .energy-indicator {
    gap: 0.5rem;
  }
  
  .energy-bar {
    width: 80px;
  }
  
  .brain-stats {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .stat-item {
    flex-direction: row;
    justify-content: space-between;
  }
  
  .brain-legend {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .input-suggestions {
    display: none;
  }
}

@media (max-width: 576px) {
  .chat-layout {
    gap: 0.5rem;
  }
  
  .chat-header,
  .brain-header {
    padding: 1rem;
  }
  
  .chat-messages {
    padding: 0.5rem;
  }
  
  .message {
    max-width: 95%;
  }
  
  .message-avatar {
    width: 35px;
    height: 35px;
  }
  
  .modal-content {
    width: 95%;
    margin: 1rem;
  }
}

/* Additional animations */
.brain-node {
  animation: nodeAppear 0.5s ease-out;
}

@keyframes nodeAppear {
  from {
    opacity: 0;
    transform: scale(0);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.brain-link {
  animation: linkAppear 0.7s ease-out;
}

@keyframes linkAppear {
  from {
    stroke-opacity: 0;
  }
  to {
    stroke-opacity: 0.3;
  }
} 