frontend/src/App.css
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: #0f172a;
  color: #e2e8f0;
}

.app {
  display: flex;
  height: 100vh;
  width: 100vw;
}

.chat-area {
  flex: 1;
  width: 50%;
  padding: 24px 24px 0;
  border-right: 1px solid #334155;
  background: linear-gradient(to bottom, #1e293b 0%, #0f172a 100%);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.memory-area {
  flex: 1;
  width: 50%;
  padding: 24px;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  overflow-y: auto;
  height: 100vh;
}

.chat-area h2,
.memory-area h2 {
  margin-bottom: 16px;
  color: #f1f5f9;
  font-size: 18px;
  font-weight: 600;
}

/* Memory header with toggle */
.memory-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.memory-header h2 {
  margin-bottom: 0;
}

/* Memory toggle styles */
.memory-toggle-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.memory-toggle {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 28px;
  cursor: pointer;
}

.memory-toggle-input {
  opacity: 0;
  width: 0;
  height: 0;
}

.memory-toggle-slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #475569;
  border: 1px solid #64748b;
  border-radius: 14px;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.memory-toggle-slider:before {
  content: "";
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  background-color: #e2e8f0;
  border-radius: 50%;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.memory-toggle-input:checked + .memory-toggle-slider {
  background-color: #3b82f6;
  border-color: #2563eb;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1), 0 0 8px rgba(59, 130, 246, 0.3);
}

.memory-toggle-input:checked + .memory-toggle-slider:before {
  transform: translateX(32px);
  background-color: #ffffff;
}

.memory-toggle-label {
  font-size: 10px;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all 0.3s ease;
  position: absolute;
  width: 30px;
  text-align: center;
  z-index: 1;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
}

.memory-toggle-input:checked + .memory-toggle-slider .memory-toggle-label {
  color: #dbeafe;
  left: 6px;
  right: auto;
}

.memory-toggle:hover .memory-toggle-slider {
  border-color: #94a3b8;
}

.memory-toggle-input:checked:hover + .memory-toggle-slider {
  background-color: #2563eb;
  border-color: #1d4ed8;
}

/* Clear button styles */
.clear-button {
  padding: 4px 8px;
  font-size: 12px;
  background: transparent;
  border: 1px solid #dc2626;
  border-radius: 4px;
  cursor: pointer;
  color: #dc2626;
  transition: all 0.2s ease;
  font-weight: 500;
}

.clear-button:hover:not(:disabled) {
  background-color: #dc2626;
  color: white;
  box-shadow: 0 2px 4px rgba(220, 38, 38, 0.3);
}

.clear-button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  color: #666;
  border-color: #666;
}

.clear-button:disabled:hover {
  background: transparent;
  color: #666;
  box-shadow: none;
}

/* Error state for clear button */
.clear-button.error-state {
  border-color: #f59e0b;
  color: #f59e0b;
  animation: errorPulse 2s ease-in-out infinite;
}

.clear-button.error-state:hover:not(:disabled) {
  background-color: #f59e0b;
  color: white;
  box-shadow: 0 2px 4px rgba(245, 158, 11, 0.3);
}

@keyframes errorPulse {
  0%, 100% {
    border-color: #f59e0b;
    color: #f59e0b;
  }
  50% {
    border-color: #dc2626;
    color: #dc2626;
  }
}

.chat-area p,
.memory-area p {
  color: #94a3b8;
}

/* Chat Interface Styles */
.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 10px 0;
  margin-bottom: 16px;
  scroll-behavior: smooth;
}

.message {
  margin-bottom: 16px;
  display: flex;
}

.message.user {
  justify-content: flex-end;
}

.message.bot {
  justify-content: flex-start;
}

.message-text {
  max-width: 70%;
  padding: 12px 16px;
  border-radius: 20px;
  word-wrap: break-word;
  font-weight: 400;
  font-size: 18px;
  line-height: 1.5;
}

.message.user .message-text {
  background-color: #6366f1;
  color: white;
  margin-left: auto;
  border-bottom-right-radius: 6px;
}

.message.bot .message-text {
  background-color: #374151;
  color: #e2e8f0;
  border-bottom-left-radius: 6px;
}

.message.loading .message-text {
  background-color: #1e293b;
  color: #94a3b8;
  font-style: italic;
}

.chat-input-form {
  display: flex;
  gap: 10px;
  align-items: center;
  position: sticky;
  bottom: 0;
  background: linear-gradient(to bottom, #1e293b 0%, #0f172a 100%);
  padding: 16px 0 24px;
  margin: 0 -24px;
  padding-left: 24px;
  padding-right: 24px;
  border-top: 1px solid rgba(51, 65, 85, 0.5);
}

.chat-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid #475569;
  border-radius: 20px;
  outline: none;
  font-size: 18px;
  line-height: 1.5;
  background-color: #334155;
  color: #e2e8f0;
}

.chat-input:focus {
  border-color: #3b82f6;
}

.chat-input:disabled {
  background-color: #1e293b;
  cursor: not-allowed;
}

.send-button {
  padding: 12px 20px;
  background-color: #3b82f6;
  color: white;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
}

.send-button:hover:not(:disabled) {
  background-color: #2563eb;
}

.send-button:disabled {
  background-color: #475569;
  cursor: not-allowed;
}

/* Memory Panel Styles */
.memory-section {
  margin-bottom: 28px;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
}

/* Disabled memory state styles */
.memory-area.disabled .memory-section {
  opacity: 0.4;
  filter: grayscale(0.6);
  pointer-events: none;
}

.memory-disabled-message {
  text-align: center;
  padding: 40px 24px;
  background: #1e293b;
  border-radius: 16px;
  margin-bottom: 28px;
  border: 1px solid #475569;
  opacity: 0.7;
}

.memory-disabled-message h3 {
  margin: 0 0 8px 0;
  color: #94a3b8;
  font-size: 18px;
  font-weight: 600;
}

.memory-disabled-message p {
  margin: 0;
  font-size: 14px;
  color: #64748b;
  font-style: italic;
}

.memory-section:last-child {
  margin-bottom: 0;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 20px;
  font-weight: 600;
  margin: 0;
  padding: 16px 20px;
  border-radius: 16px 16px 0 0;
}

.section-icon {
  font-size: 20px;
  background: rgba(15, 23, 42, 0.9);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.section-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.section-title {
  color: #f1f5f9;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.5;
}

.section-subtitle {
  color: rgba(241, 245, 249, 0.7);
  font-size: 12px;
  font-weight: 400;
  font-style: italic;
  line-height: 1.3;
}

.section-count {
  font-size: 11px;
  font-weight: 500;
  color: #94a3b8;
  background: rgba(15, 23, 42, 0.7);
  padding: 2px 8px;
  border-radius: 20px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Section-specific colors */
.memory-section.identity .section-header {
  background: linear-gradient(135deg, #1e3a8a 0%, #3730a3 100%);
  color: #93c5fd;
}

.memory-section.principles .section-header {
  background: linear-gradient(135deg, #14532d 0%, #166534 100%);
  color: #86efac;
}

.memory-section.focus .section-header {
  background: linear-gradient(135deg, #9a3412 0%, #c2410c 100%);
  color: #fed7aa;
}

.memory-section.signals .section-header {
  background: linear-gradient(135deg, #581c87 0%, #7c3aed 100%);
  color: #c084fc;
}



.memory-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 20px 20px;
  background: #1e293b;
}

/* Smooth entrance for new memory items */
.memory-item {
  animation: memoryEnter 300ms ease-out;
}

@keyframes memoryEnter {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.memory-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  background: #334155;
  padding: 16px 20px;
  border-radius: 16px;
  font-size: 14px;
  border: 1px solid #475569;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  transition: all 0.15s ease-in-out;
  position: relative;
  opacity: 1;
  transform: scale(1);
}

.memory-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
  border-color: #64748b;
  background: #475569;
}

.memory-item:focus-within {
  outline: 2px solid #a5b4fc;
  outline-offset: 2px;
}

.memory-item:hover .memory-actions {
  opacity: 1;
  transform: translateX(0);
}

.memory-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-right: 12px;
}

.memory-key {
  font-weight: 500;
  color: #f1f5f9;
  font-size: 18px;
  line-height: 1.5;
  text-transform: capitalize;
  letter-spacing: 0.025em;
}

.memory-text {
  color: #cbd5e1;
  word-wrap: break-word;
  font-size: 16px;
  line-height: 1.5;
  font-weight: 400;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.memory-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
  opacity: 0;
  transition: all 0.25s ease;
  transform: translateX(8px);
}

.edit-button {
  background: #1e293b;
  color: #94a3b8;
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease-in-out;
  stroke-width: 2px;
}

.edit-button:hover {
  background: #334155;
  color: #cbd5e1;
  transform: scale(1.1);
}

.edit-button:focus {
  outline: 2px solid #a5b4fc;
  outline-offset: 1px;
}

.delete-button {
  background: #1e293b;
  color: #94a3b8;
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease-in-out;
  stroke-width: 2px;
}

.delete-button:hover {
  background: #450a0a;
  color: #f87171;
  transform: scale(1.1);
}

.delete-button:focus {
  outline: 2px solid #fca5a5;
  outline-offset: 1px;
}



/* Feedback styles */
.feedback {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 16px;
  border-radius: 8px;
  color: white;
  font-weight: 500;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  animation: slideIn 0.3s ease-out;
}

.feedback.success {
  background-color: #059669;
}

.feedback.error {
  background-color: #dc2626;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }

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

/* Loading states */
.memory-loading {
  text-align: center;
  color: #94a3b8;
  font-style: italic;
  padding: 40px 24px;
  background: #1e293b;
  border-radius: 16px;
  margin-bottom: 16px;
  border: 1px solid #475569;
}

.memory-loading h3 {
  margin: 16px 0 8px 0;
  color: #f1f5f9;
  font-size: 18px;
  font-weight: 600;
}

.memory-loading p {
  margin: 0;
  font-size: 14px;
  color: #94a3b8;
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #334155;
  border-top: 3px solid #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.memory-item.loading {
  opacity: 0.6;
  pointer-events: none;
}

.memory-item.loading .memory-actions {
  opacity: 0.3;
}

/* Memory highlight animations for real-time changes */
.memory-item.highlighted {
  border-color: #3b82f6 !important;
}

/* Created memory animation - bright entrance */
.memory-item.highlighted.created {
  animation: memoryCreated 800ms ease-out;
}

@keyframes memoryCreated {
  0% {
    opacity: 0;
    transform: scale(0.9) translateY(-10px);
    background: #065f46;
    border-color: #10b981;
    box-shadow: 0 0 32px rgba(16, 185, 129, 0.6);
  }

  50% {
    opacity: 1;
    transform: scale(1.05) translateY(0);
    background: #047857;
    border-color: #10b981;
    box-shadow: 0 0 24px rgba(16, 185, 129, 0.4);
  }

  100% {
    opacity: 1;
    transform: scale(1);
    background: #334155;
    border-color: #475569;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  }
}

/* Updated memory animation - blue pulse */
.memory-item.highlighted.updated {
  animation: memoryUpdated 700ms ease-out;
}

@keyframes memoryUpdated {
  0% {
    background: #1e3a8a;
    transform: scale(1.02);
    border-color: #3b82f6;
    box-shadow: 0 0 24px rgba(59, 130, 246, 0.5);
  }

  40% {
    background: #1e40af;
    transform: scale(1.01);
    border-color: #3b82f6;
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
  }

  100% {
    background: #334155;
    transform: scale(1);
    border-color: #475569;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  }
}

/* Deleted memory animation - fade out with red tint */
.memory-item.highlighted.deleted {
  animation: memoryDeleted 600ms ease-out forwards;
  pointer-events: none; /* Prevent interaction during deletion */
}

@keyframes memoryDeleted {
  0% {
    opacity: 1;
    transform: scale(1);
    background: #7f1d1d;
    border-color: #ef4444;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
  }

  50% {
    opacity: 0.7;
    transform: scale(0.98);
    background: #991b1b;
    border-color: #ef4444;
    box-shadow: 0 0 16px rgba(239, 68, 68, 0.3);
  }

  100% {
    opacity: 0;
    transform: scale(0.95) translateY(-5px);
    background: #450a0a;
    border-color: #dc2626;
    box-shadow: 0 0 8px rgba(220, 38, 38, 0.2);
  }
}

/* Prevent hover effects during animations */
.memory-item.highlighted:hover {
  transform: none !important;
  box-shadow: inherit !important;
  border-color: inherit !important;
  background: inherit !important;
}

.memory-item.highlighted .memory-actions {
  opacity: 0 !important;
  pointer-events: none;
}

.memory-item button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.edit-input:disabled {
  background-color: #1e293b;
  cursor: not-allowed;
}

/* Edit form - consistent with action buttons */
.edit-form {
  display: flex;
  gap: 4px;
  width: 100%;
  align-items: center;
}

.edit-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #475569;
  border-radius: 6px;
  outline: none;
  font-size: 13px;
  background: #1e293b;
  color: #e2e8f0;
  transition: border-color 0.2s ease;
}

.edit-input:focus {
  border-color: #3b82f6;
}

/* Consistent icon button styling for save/cancel */
.save-button {
  background: #1e293b;
  color: #94a3b8;
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease-in-out;
  stroke-width: 2px;
}

.save-button:hover {
  background: #064e3b;
  color: #34d399;
  transform: scale(1.1);
}

.save-button:focus {
  outline: 2px solid #86efac;
  outline-offset: 1px;
}

.cancel-button {
  background: #1e293b;
  color: #94a3b8;
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease-in-out;
  stroke-width: 2px;
}

.cancel-button:hover {
  background: #334155;
  color: #cbd5e1;
  transform: scale(1.1);
}

.cancel-button:focus {
  outline: 2px solid #a5b4fc;
  outline-offset: 1px;
}