/* Casserole Chat Testing UI */

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

body {
  font-family:
    -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f5f5f5;
  height: 100vh;
}

.hidden {
  display: none !important;
}

#app {
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* Header */
#header {
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: white;
  border-bottom: 1px solid #e0e0e0;
}

#header h1 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #333;
}

#auth-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Loading */
#loading {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
}

/* Main Layout */
#main-content {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* Sidebar */
#sidebar {
  width: 280px;
  background: white;
  border-right: 1px solid #e0e0e0;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 1rem;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar-header h2 {
  font-size: 1rem;
  font-weight: 600;
}

#session-list {
  list-style: none;
  flex: 1;
  overflow-y: auto;
}

.session-item {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  position: relative;
}

.session-item:hover {
  background: #f8f8f8;
}

.session-item.active {
  background: #e3f2fd;
}

.session-title {
  font-weight: 500;
  margin-bottom: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 1.5rem;
}

.session-date {
  font-size: 0.75rem;
  color: #666;
}

.delete-session-btn {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 1.2rem;
  color: #999;
  cursor: pointer;
  opacity: 0;
  padding: 0.25rem;
  line-height: 1;
}

.session-item:hover .delete-session-btn {
  opacity: 1;
}

.delete-session-btn:hover {
  color: #d32f2f;
}

/* Chat Area */
#chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #fafafa;
}

#no-session-message {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
}

#chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

.message {
  max-width: 80%;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.message-user {
  align-self: flex-end;
  background: #1976d2;
  color: white;
}

.message-assistant {
  align-self: flex-start;
  background: white;
  border: 1px solid #e0e0e0;
}

.message-content {
  line-height: 1.5;
}

.message-content.error {
  color: #d32f2f;
}

.message-content.streaming {
  border-right: 2px solid #1976d2;
  animation: blink 1s infinite;
}

@keyframes blink {
  50% {
    border-color: transparent;
  }
}

/* Sources */
.message-sources {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  font-size: 0.85rem;
}

.message-sources strong {
  display: block;
  margin-bottom: 0.5rem;
  color: #666;
}

.source-citation {
  margin: 0.5rem 0;
  padding: 0.5rem;
  background: rgba(0, 0, 0, 0.03);
  border-radius: 6px;
  border-left: 3px solid #1976d2;
}

.source-title {
  font-weight: 500;
  display: block;
  color: #333;
}

.source-snippet {
  color: #666;
  font-size: 0.8rem;
  display: block;
  margin-top: 0.25rem;
  line-height: 1.4;
}

/* Input Area */
#input-area {
  padding: 1rem;
  background: white;
  border-top: 1px solid #e0e0e0;
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

#content-type-filter {
  padding: 0.5rem;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  min-width: 140px;
  background: white;
  font-size: 0.875rem;
}

#message-input {
  flex: 1;
  padding: 0.75rem;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  resize: none;
  min-height: 44px;
  max-height: 200px;
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.4;
}

#message-input:focus {
  outline: none;
  border-color: #1976d2;
}

/* Buttons */
.btn-primary {
  padding: 0.5rem 1rem;
  background: #1976d2;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.875rem;
}

.btn-primary:hover {
  background: #1565c0;
}

.btn-primary:disabled {
  background: #bdbdbd;
  cursor: not-allowed;
}

/* Empty state */
.empty-sessions {
  padding: 2rem 1rem;
  text-align: center;
  color: #666;
}

/* Responsive */
@media (max-width: 768px) {
  #main-content {
    flex-direction: column;
  }

  #sidebar {
    width: 100%;
    max-height: 200px;
    border-right: none;
    border-bottom: 1px solid #e0e0e0;
  }

  .message {
    max-width: 95%;
  }

  #input-area {
    flex-wrap: wrap;
  }

  #content-type-filter {
    width: 100%;
    margin-bottom: 0.5rem;
  }
}
