:root {
  --bg: #0b1220;
  --panel: #121a2c;
  --text: #e5ecff;
  --muted: #8aa2d0;
  --accent: #4f7cff;
  --accent-2: #8b5cf6;
  --ai: #19233b;
  --user: #1c2a4a;
}

* { 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: radial-gradient(1200px 800px at 20% -10%, #1e293b, transparent 60%),
              radial-gradient(1000px 600px at 120% 10%, #0f172a, transparent 60%),
              var(--bg);
  color: var(--text);
}

.container {
  max-width: 840px;
  margin: 0 auto;
  padding: 24px 16px 16px;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

h1 {
  font-size: 20px;
  margin: 0;
}

.header-info {
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.status {
  font-size: 12px;
  color: var(--muted);
}

.info-line {
    font-family: monospace;
    font-size: 11px;
    color: var(--muted);
    background-color: rgba(0,0,0,0.2);
    padding: 3px 6px;
    border-radius: 4px;
}

.header-buttons {
    margin-top: 8px;
    display: flex;
    gap: 8px;
}

.header-button {
    background: none;
    border: 1px solid var(--muted);
    color: var(--muted);
    padding: 2px 8px;
    font-size: 11px;
    border-radius: 6px;
    cursor: pointer;
}

.header-button:hover {
    background: var(--user);
    color: var(--text);
}

.chat {
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.00));
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 60vh;
}

.message {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.bubble {
  padding: 10px 12px;
  border-radius: 12px;
  line-height: 1.4;
  white-space: pre-wrap;
}

.bubble.user { background: var(--user); }
.bubble.ai { background: var(--ai); }

.role {
  font-size: 12px;
  color: var(--muted);
  width: 60px;
  flex-shrink: 0;
  text-align: right;
  padding-top: 4px;
}

.input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end; /* Aligns button to the bottom of the textarea */
}

input[type="text"],
input[type="password"],
textarea {
  flex: 1;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.08);
  background: var(--panel);
  color: var(--text);
  font-family: inherit;
  font-size: 16px; /* Explicitly set font size */
  line-height: 1.5; /* Set line-height for consistent resizing */
}

textarea {
    resize: none; /* Disable manual resizing by the user */
    overflow-y: auto; /* Add a scrollbar if content exceeds max-height */
}

button {
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.1);
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  color: white;
  cursor: pointer;
}

button:disabled { opacity: 0.6; cursor: not-allowed; }

/* Login Form */
#login-form {
    background: var(--panel);
    padding: 24px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.08);
    max-width: 400px;
    width: 100%;
    margin: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

label {
    font-size: 14px;
    color: var(--muted);
}

.error-message {
    color: #ff8a8a;
    font-size: 14px;
    min-height: 20px;
    text-align: center;
}

.hidden {
    display: none;
}


/* Typing indicator */
.typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 12px;
}

.dot {
  width: 6px;
  height: 6px;
  background: rgba(255,255,255,0.7);
  border-radius: 50%;
  animation: typingBlink 1s infinite ease-in-out;
}

@keyframes typingBlink {
  0%, 80%, 100% { opacity: 0.2; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-2px); }
}
