body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    'Helvetica Neue', Arial, sans-serif;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0.5rem;
  line-height: 1.5;
  color: #333;
  display: block;
  min-height: initial;
}

h1 {
  text-align: center;
  margin-bottom: 1rem;
  color: #1890ff;
}

#output {
  background: #f9f9f9;
  padding: 1rem;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  white-space: pre-wrap;
  overflow-y: auto;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  margin-bottom: 0.75rem;
  height: 500px;
  flex-grow: 0;
  min-height: 0;
}

/* Chat conversation styles */
.user-message,
.assistant-message {
  margin-bottom: 1.25rem;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  animation: fade-in 0.3s ease-in-out;
}

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

.user-message {
  background-color: #e6f7ff;
  border-left: 4px solid #1890ff;
  margin-left: 2rem;
  margin-right: 0.5rem;
}

.assistant-message {
  background-color: #f6ffed;
  border-left: 4px solid #52c41a;
  margin-right: 2rem;
  margin-left: 0.5rem;
}

.system-message {
  text-align: center;
  padding: 0.75rem;
  margin: 1rem auto;
  font-style: italic;
  color: #666;
  background-color: #fafafa;
  border-radius: 8px;
  max-width: 90%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.error-message {
  text-align: center;
  padding: 0.75rem;
  margin: 1rem auto;
  color: #f5222d;
  background-color: #fff1f0;
  border: 1px solid #ffa39e;
  border-radius: 8px;
  max-width: 90%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.role-label {
  font-weight: bold;
  margin-bottom: 0.5rem;
  color: #333;
}

.user-content,
.assistant-response,
.assistant-content {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.6;
}

form {
  margin-top: 1.5rem;
  display: flex;
  gap: 0.5rem;
}

input {
  flex: 1;
  font-size: 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  transition: border-color 0.3s;
}

input:focus {
  outline: none;
  border-color: #1890ff;
  box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
}

button {
  font-size: 1rem;
  padding: 0.75rem 1.25rem;
  background-color: #1890ff;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s;
}

button:hover:not(:disabled) {
  background-color: #096dd9;
}

button:disabled {
  background-color: #d9d9d9;
  cursor: not-allowed;
}

select {
  font-size: 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  background-color: white;
}

/* Full-width select dropdown that matches chat window width */
.full-width-select {
  width: 100%;
  margin-bottom: 1rem;
}

/* Button container for the Clear Chat button */
.button-container {
  text-align: left;
  margin-top: 1rem;
  margin-bottom: 1.5rem;
}

.error {
  color: #f5222d;
  font-weight: bold;
}

.status {
  margin-top: 1rem;
  font-style: italic;
  color: #666;
}

.debug {
  margin-top: 1rem;
  font-family: monospace;
  font-size: 0.8rem;
  background: #f5f5f5;
  padding: 0.75rem;
  border: 1px solid #e8e8e8;
  border-radius: 4px;
  max-height: 150px;
  overflow-y: auto;
}

.controls {
  grid-column: 1 / -1;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.controls select {
  flex: 3;
  min-width: 200px;
}

.controls button {
  flex: 1;
  min-width: 100px;
}

button.secondary-button {
  background-color: #f5f5f5;
  color: #333;
  border: 1px solid #d9d9d9;
}

button.secondary-button:hover:not(:disabled) {
  background-color: #e6e6e6;
  border-color: #bfbfbf;
}

.progress-bar {
  width: 100%;
  height: 10px;
  background-color: #f5f5f5;
  border-radius: 5px;
  margin-top: 12px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background-color: #52c41a;
  width: 0%;
  transition: width 0.3s ease, margin-left 0.3s ease;
  position: relative;
}

.progress-fill.indeterminate {
  width: 30%;
  animation: indeterminate-progress 1.5s infinite ease-in-out;
}

@keyframes indeterminate-progress {
  0% {
    margin-left: -30%;
  }
  100% {
    margin-left: 100%;
  }
}

.progress-text {
  text-align: center;
  margin-top: 5px;
  font-size: 0.9rem;
  color: #666;
  display: none; /* Hide by default */
}

.resource-warning {
  margin-top: 12px;
  font-size: 0.9rem;
  color: #fa8c16;
  padding: 0.5rem;
  background-color: #fff7e6;
  border: 1px solid #ffd591;
  border-radius: 4px;
  display: none;
}

.model-info {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #e8e8e8;
  border-radius: 4px;
  background-color: #fafafa;
  display: none;
  box-sizing: border-box;
}

.model-details {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.model-detail {
  display: flex;
  align-items: center;
  background-color: white;
  padding: 0.5rem;
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.model-detail-icon {
  margin-right: 5px;
  font-size: 1.2rem;
}

.model-detail-label {
  font-size: 0.8rem;
  color: #666;
  margin-right: 5px;
}

.model-detail-value {
  font-weight: bold;
  font-size: 0.9rem;
}

/* Base layout container */
.layout-container {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 1.5rem;
  min-height: 0;
  width: 100%;
}

/* Sidebar column with logger */
.sidebar-column {
  margin-top: 5rem;
}

/* Mobile styles */
@media (max-width: 1024px) {
  body {
    padding: 0.5rem 1.3rem;
    margin: 0;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
  }

  .layout-container {
    display: block;
    width: 100%;
    padding: 0;
    box-sizing: border-box;
  }

  .main-column {
    width: 100%;
    margin-bottom: 1rem;
  }

  .sidebar-column {
    width: 100%;
    margin-top: 2rem; /* Maintain some spacing but less than desktop */
  }

  #output {
    height: 50vh;
    max-height: none;
    margin-bottom: 1rem;
  }

  .sidebar-column .debug {
    height: 30vh;
    max-height: none;
  }

  .controls {
    flex-direction: column;
    width: 100%;
    gap: 0.5rem;
  }

  .controls select,
  .controls button {
    width: 100%;
    margin: 0;
  }

  form {
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
  }

  input,
  button {
    width: 100%;
    margin: 0;
    box-sizing: border-box;
  }

  .model-info {
    width: 100%;
    margin: 1rem 0;
    padding: 1rem;
    border: 1px solid #e8e8e8;
    border-radius: 4px;
    box-sizing: border-box;
  }

  .model-details {
    flex-direction: column;
    gap: 0.5rem;
  }

  .model-detail {
    width: 100%;
  }

  .top-status-container {
    width: 100%;
    margin: 0.5rem 0;
  }
}

/* AI typing indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0.5rem;
  margin-top: 0.5rem;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background: #1890ff;
  border-radius: 50%;
  opacity: 0.3;
  animation: typing-dot 1.4s infinite;
}

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

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

@keyframes typing-dot {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.3;
  }
  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

.top-status-container {
  margin: 0.5rem 0;
  padding: 0.5rem 0;
}

/* Style the status and debug areas in the sidebar */
.sidebar-column h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  color: #1890ff;
}

.sidebar-column .status {
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
  flex-shrink: 0;
}

.sidebar-column .debug {
  height: 500px;
  overflow-y: auto;
  min-height: 0;
  flex-grow: 0;
}
