/* === Base / layout (keeps your Lab 6 vibe) === */
:root {
  --bg1: #0f172a;
  --bg2: #111827;
  --panel: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --blue: #3b82f6;
  --blue-600: #2563eb;
  --gray: #f1f5f9;
  --danger: #ef4444;
}

* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial,
    sans-serif;
  background: linear-gradient(160deg, #847fdc 0%, #7b31c1 100%);
  display: grid;
  place-items: center;
  padding: 24px;
  color: var(--text);
}

.chat-interface {
  width: min(900px, 92vw);
  background: var(--panel);
  border-radius: 12px;

  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto auto 1fr auto auto;
}

/* Header Styling*/
.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(to right, var(--blue-600), var(--blue));
  color: #fff;
  padding: 16px 20px;
}
.chat-header h1 {
  margin: 0;
  font-size: 1.25rem;
}
.chat-header p {
  margin: 2px 0 0 0;
  font-size: 0.9rem;
  opacity: 0.9;
}
.message-count {
  background: rgba(255, 255, 255, 0.2);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

/* Tool Bar styling*/
.toolbar {
  display: flex;
  gap: 12px;
  justify-content: flex-start;
  align-items: center;
  background: #f8fafc;
  border-bottom: 1px solid #e5e7eb;
  padding: 10px 12px;
}
.toolbar .btn,
.toolbar .import-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 110px;
  height: 40px;
  padding: 8px 12px;
  font-size: 0.95rem;
  box-sizing: border-box;
  text-align: center;
}
.toolbar .import-label {
  background: #6b7280;
  color: #fff;
  border-radius: 8px;
  cursor: pointer;
}
.btn {
  padding: 8px 12px;
  border-radius: 8px;
  border: 0;
  cursor: pointer;
  background: #6b7280;
  color: #fff;
  font-weight: 600;
}
.btn:hover {
  background: #4b5563;
}
.btn.primary {
  background: var(--blue);
}
.btn.primary:hover {
  background: var(--blue-600);
}
.btn.danger {
  background: var(--danger);
}
.btn.danger:hover {
  background: #dc2626;
}

.messages {
  padding: 12px 14px 4px 14px;
  min-height: 320px;
  display: flex;
  flex-direction: column;
}
.message-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: auto;
  max-height: 48vh;
}
.empty {
  text-align: center;
  opacity: 0.7;
  margin: 12vh 0;
}

.message .bubble {
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  max-width: 70ch;
}

.message-bot {
  align-self: flex-start;
  display: flex;
}
.message-bot .bubble {
  background: var(--gray);
  color: var(--text);
}

.user {
  align-self: flex-end;
  display: flex;
  justify-content: flex-end;
}
.user .bubble {
  background: var(--blue);
  color: #fff;
}

.bubble-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}
.sender {
  font-weight: 600;
  opacity: 0.85;
}
.timestamp {
  opacity: 0.8;
  font-size: 0.85rem;
}
.text {
  margin: 6px 0;
  line-height: 1.45;
}

.actions {
  margin-top: 4px;
  display: flex;
  gap: 6px;
}
.actions button {
  font-size: 0.8rem;
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #374151;
  cursor: pointer;
}
.message.edited .text::after {
  content: " (edited)";
  font-size: 0.8rem;
  opacity: 0.7;
}


.input {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  border-top: 1px solid #e5e7eb;
}
.input input {
  flex: 1;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 1rem;
}

/* Footer Styling  */
.info {
  padding: 8px 12px;
  font-size: 0.9rem;
  color: #475569;
  text-align: center;
}

@media (max-width: 720px) {
  .chat-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .message-list {
    max-height: 50vh;
  }
}
