/* Topbar */
.p-4.border-b {
  background-color: #ffffff;
}

/* Message bubbles */
.message {
  display: flex;
  margin-bottom: 1rem;
}

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

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

.message-content {
  max-width: 80%;
  padding: 0.75rem 1rem;
  border-radius: 1rem;
  word-wrap: break-word;
}

.user-message .message-content {
  background-color: #3b82f6;
  color: white;
  border-top-right-radius: 0.2rem;
}

#quick-actions-menu {
  left: 16rem;
}

.assistant-message .message-content {
  background-color: #fef3c7;
  color: #1f2937;
  border-top-left-radius: 0.2rem;
}

.message-content pre {
  background-color: rgba(255, 255, 255, 0.1);
  padding: 0.5rem;
  border-radius: 0.5rem;
  overflow-x: auto;
  margin: 0.5rem 0;
}

/* Modern thinking animation styles */
.thinking-message {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #1f2937;
}

.thinking-dots-container {
  width: 40px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid;
  border-radius: 50%;
  border-right-color: transparent;
  animation: spin 0.8s linear infinite;
}

/* Chat bubble spinner */
.message .spinner {
  border-color: #1f2937;
  border-right-color: transparent;
}

/* Send button spinner */
#send-spinner .spinner {
  border-color: #ffffff;
  border-right-color: transparent;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.assistant-message.thinking {
  animation: messageAppear 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes messageAppear {
  0% {
    transform: translateY(20px) scale(0.95);
    opacity: 0;
  }
  60% {
    transform: translateY(-2px) scale(1.01);
  }
  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.thinking-message:hover {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(37, 99, 235, 0.16));
  transform: translateY(-1px);
}

.step-item {
  display: flex;
  align-items: flex-start;
  margin: 0.5rem 0;
  gap: 0.75rem;
}

.step-number {
  background-color: #3b82f6;
  color: white;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  flex-shrink: 0;
}

.assistant-message .step-number {
  background-color: #1f2937;
}

.step-content {
  flex: 1;
  padding-top: 0.125rem;
}

/* Sub-bullet styling */
.sub-bullet {
  display: flex;
  align-items: flex-start;
  margin: 0.25rem 0 0.25rem 2.25rem;
  gap: 0.5rem;
}

.sub-bullet::before {
  content: "•";
  color: #6B7280;
  font-size: 1.2em;
  line-height: 1;
  margin-top: -0.1em;
}

.sub-bullet-content {
  flex: 1;
}

.assistant-message .message-content pre {
  background-color: rgba(0, 0, 0, 0.05);
}

body {
  background: linear-gradient(135deg, #f5f7fa 0%, #e4e8eb 100%);
  min-height: 100vh;
}

.container-fluid {
  width: 95%;
  max-width: none;
}

.chat-container {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
  background: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  transform: rotate(0deg);
}

.chat-header {
  background: linear-gradient(90deg, #2563eb 0%, #3b82f6 100%);
  border-radius: 12px 12px 0 0;
}

.message-input {
  border: 2px solid #e5e7eb;
  transition: all 0.3s ease;
}

.message-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.send-button {
  transition: all 0.3s ease;
}

.send-button:hover {
  transform: translateY(-1px);
}

/* Remove old spinner styles */

.hidden {
  display: none;
}

select {
  background-color: white;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  padding: 8px 12px;
  transition: all 0.3s ease;
}

select:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

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

/* Layout transitions */
.chat-section {
  transition: all 0.5s ease-in-out;
}

.viz-section {
  transition: all 0.5s ease-in-out;
}

/* When visualization is shown */
.viz-active .chat-section {
  width: 33.333% !important;
}

.viz-active .viz-section {
  transform: translateX(0) !important;
  opacity: 1;
}

#viz-section {
  opacity: 0;
  pointer-events: none;
}

#viz-section.hidden {
  display: none !important;
}

#viz-section:not(.hidden) {
  display: flex !important;
}

.viz-active #viz-section {
  opacity: 1;
  pointer-events: auto;
}

.mermaid-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 100%;
  transform-origin: center;
  transform: scale(1);
  transition: transform 0.3s ease;
}

.zoom-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.zoom-controls button {
  transition: all 0.2s ease;
}

.zoom-controls button:hover {
  background-color: #2563eb;
}

.mermaid {
  min-width: 100%;
  width: 100%;
  overflow: hidden;
  height: -webkit-fill-available;
}

.mermaid svg {
  width: 100% !important;
  height: 100%;
  transition: transform 0.3s ease-in-out;
  transform-origin: center center;
  cursor: grab;
}

.mermaid svg:active {
  cursor: grabbing;
}

#visualization {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  overflow: auto;
  background-color: #ffffff;
  width: 100%;
}

#visualization:fullscreen {
  background-color: white;
}

.mermaid-wrapper {
  overflow: auto;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Syntax popup styles */
.syntax-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  padding: 2rem;
  border-radius: 0.5rem;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  max-width: 480vw;
  max-height: 90vh;
  overflow: auto;
  display: none;
}

#session-name-popup {
  width: 600px;
  max-width: 90vw;
}

#cytoscape-popup.syntax-popup {
  max-width: 300vw;
  width: 90vw;
}

.syntax-popup.active {
  display: block;
}

.syntax-popup pre {
  background: #f8f9fa;
  padding: 1rem;
  border-radius: 0.25rem;
  overflow-x: auto;
}

.syntax-popup .close-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #666;
}

.syntax-popup .close-btn:hover {
  color: #000;
}

.overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  display: none;
}

.overlay.active {
  display: block;
}

/* Left Navigation Styles */
#left-navigation img {
  border-radius: 50%;
  border: 2px solid #3B82F6;
}

#left-navigation {
  box-shadow: 4px 0 6px -1px rgba(0, 0, 0, 0.1);
  z-index: 50;
  display: flex;
  flex-direction: column;
  min-width: 200px;
  max-width: 600px;
  width: 256px;
  resize: horizontal;
  transition: transform 0.3s ease-in-out;
}

/* Resize handle styles */
.nav-resize-handle {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background-color: transparent;
  cursor: col-resize;
  transition: background-color 0.2s ease;
}

.nav-resize-handle:hover,
.nav-resize-handle.active {
  background-color: rgba(59, 130, 246, 0.5);
}

/* Handle resize state */
body.resizing {
  cursor: col-resize;
  user-select: none;
}

body.resizing #left-navigation {
  transition: none;
}

body.resizing .leftnav-active {
  transition: none;
}

/* Scrollbar styling */
#left-navigation .overflow-y-auto::-webkit-scrollbar {
  width: 6px;
}

#left-navigation .overflow-y-auto::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

#left-navigation .overflow-y-auto::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

#left-navigation .overflow-y-auto::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

#left-navigation.open {
  transform: translateX(0);
}

#saved-diagrams-list li {
  transition: all 0.2s ease-in-out;
}

#saved-diagrams-list li:hover {
  transform: translateX(4px);
}

.delete-diagram,
.delete-session {
  opacity: 0;
  transition: opacity 0.2s ease-in-out;
}

#saved-diagrams-list li:hover .delete-diagram,
#saved-sessions-list li:hover .delete-session,
#shared-sessions-list li:hover .delete-session {
  opacity: 1;
}

#saved-sessions-list li:hover {
  background-color: #4B5563;
}

#saved-sessions-list li.active {
  background-color: #3B82F6;
  border: 2px solid #60A5FA;
}

#saved-sessions-list li.active:hover {
  background-color: #2563EB;
}

#shared-sessions-list {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: 1rem;
  padding-top: 1rem;
}

#shared-sessions-list li {
  border-left: 3px solid #3B82F6;
}

#shared-sessions-list li:hover {
  background-color: #4B5563;
}

#shared-sessions-list li.active {
  background-color: #3B82F6;
  border-left: 3px solid #60A5FA;
}

#shared-sessions-list li:hover .rename-session,
#shared-sessions-list li:hover .delete-session {
  opacity: 1;
}

#shared-sessions-list .session-controls {
  display: flex;
  align-items: center;
}

#shared-sessions-list .rename-session,
#shared-sessions-list .delete-session {
  opacity: 0;
  transition: opacity 0.2s ease-in-out;
}

#shared-sessions-list .rename-session {
  padding: 2px;
  margin-right: 4px;
}

.rename-session {
  opacity: 0;
  transition: opacity 0.2s ease-in-out;
  padding: 2px;
  margin-right: 4px;
}

#saved-sessions-list li:hover .rename-session {
  opacity: 1;
}

.session-controls {
  display: flex;
  align-items: center;
}

#nav-toggle-btn svg {
  transition: transform 0.3s ease;
}

#left-navigation.open #nav-toggle-btn svg {
  transform: rotate(180deg);
}

/* Adjust main content when leftnav is open */
.leftnav-active {
  padding-left: 16rem !important;
  transition: padding-left 0.3s ease-in-out;
}

.leftnav-active .chat-section {
  transition: margin-left 0.3s ease-in-out;
}
