/* Project list */
#projects div {
  padding: 0.5rem;
  cursor: pointer;
  border-radius: 6px;
}

#projects div:hover {
  background: var(--hover-bg);
}

#projects .active {
  font-weight: 600;
  background: var(--active-bg);
}

/* Loading spinner */
#loading {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.8);
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.spinner {
  border: 8px solid #f3f3f3;
  border-top: 8px solid var(--primary-color);
  border-radius: 50%;
  width: 60px;
  height: 60px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Chat messages */
.user-message {
  margin-bottom: 1rem;
}

.assistant-message {
  color: var(--primary-color);
  margin-bottom: 1rem;
}

.error-message {
  color: var(--error-color);
}

.citation-link {
  color: var(--primary-color);
  text-decoration: none;
}

#sidebar-tabs {
  display: flex;
  gap: 0.5rem;
}

.sidebar-tab {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--primary-dark);
  padding: 0.25rem 0.6rem;
  border-radius: 10px;
  cursor: pointer;
  background: transparent;
  box-shadow: none;
}

.sidebar-tab.active {
  background: var(--gradient);
  color: #fff;
  box-shadow: 0 2px 6px rgba(163, 22, 33, 0.25);
}

#model-dropdown {
  position: absolute;
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 0.4rem;
  box-shadow: 0 8px 20px rgba(0,0,0,0.12);
  z-index: 1200;
  min-width: 160px;
}

#model-dropdown .item {
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  cursor: pointer;
}

#model-dropdown .item:hover {
  background: var(--hover-bg);
}

#modal-overlay,
#confirm-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  justify-content: center;
  align-items: center;
  z-index: 1300;
}

#modal-overlay.visible,
#confirm-modal-overlay.visible {
  display: flex;
}

#modal {
  width: min(720px, 92vw);
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  box-shadow: 0 16px 40px rgba(0,0,0,0.18);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

#modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

#modal-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--primary-dark);
}

#instructions-text {
  width: 100%;
  box-sizing: border-box;
  height: 220px;
  padding: 0.7rem;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  font-size: 0.95rem;
  resize: vertical;
}

#modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
}

#cancel-instructions-btn {
  background: #f1eaea;
  color: #4b2b2b;
  border: 1px solid var(--border-color);
  box-shadow: none;
}

#model-btn {
  min-width: 100px;
  text-align: center;
}

/* History list items */
.history-item {
  padding: 0.5rem;
  border-radius: 6px;
  cursor: default;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.history-item:hover {
  background: var(--hover-bg);
}

.history-date {
  font-size: 0.75rem;
  opacity: 0.7;
  margin-bottom: 2px;
}

.history-question {
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-left {
  flex: 1;
  min-width: 0;
}

.history-delete {
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 999px;
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--primary-dark);
  box-shadow: none;
  display: none;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.history-item:hover .history-delete {
  display: inline-flex;
}

.history-delete:hover {
  background: #fbe8e8;
  color: var(--error-color);
  border-color: #f3caca;
}
