:root {
  --bg: #0b0b0d;
  --panel: #0f1720;
  --muted: #9aa4b2;
  --accent: #8b5cf6;
  --highlight: #a78bfa;
  --chat-bg: linear-gradient(135deg, #9b2c60, #3b82f6);
}

* {
  box-sizing: border-box;
}

html, body, #chatArea {
  height: 100%;
}

body, html {
  height: 100%;
  margin: 0;
  padding-top: 56px; /* same as .topbar height */
  background: var(--bg);
}

/* Ensure the body takes the full screen and centers everything */
body {
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: Inter, ui-sans-serif, system-ui, Segoe UI, Roboto, "Helvetica Neue", Arial;
  background: var(--bg);
  color: #e6eef8;
  height: 100%;
  margin: 0;
  padding: 0;
}

/* Welcome message background */
.welcome-message-wrapper {
  background: var(--chat-bg); /* Maroon-blueish gradient behind the welcome message */
  padding: 40px 50px;
  border-radius: 15px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
  position: relative;
  z-index: 10;
  transition: opacity 0.5s ease-in-out; /* Fade out */
}

/* Welcome message text styling */
.welcome-message {
  text-align: center;
  font-size: 30px;
  font-weight: bold;
  line-height: 1.4;
}

.welcome-message span {
  display: block;
  font-size: 18px;
  font-weight: normal; /* Second line text smaller */
  margin-top: 8px;
}

/* Hide the welcome message after the user starts chatting */
.welcome-message.hidden {
  opacity: 0;
}

.welcome-message-wrapper.hidden {
  opacity: 0;
  pointer-events: none; /* optionally disable interaction */
  transition: opacity 0.5s ease-in-out;
}

/* Chat Area Styling */
.chatArea {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  background: var(--bg); /* Normal background */
  max-height: calc(100vh - 120px); /* adjust based on your header/footer height */
  scroll-behavior: smooth;
  position: relative;
  z-index: 5;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden; /* hide browser scroll bar */
}


/* Message box styling */
.msg {
  max-width: 80%;
  padding: 14px 20px;
  margin-bottom: 14px;
  border-radius: 18px;
  line-height: 1.6;
  font-size: 16px;
  font-weight: 400;
  color: #e6eef8;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  word-wrap: break-word;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
  background-color: rgba(30, 34, 44, 0.8);
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

/* User messages aligned right with subtle gradient background */
.msg.user,
.msg.assistant {
  /* Common styling */
  max-width: 80%;
  width: fit-content;    /* box fits text width */
  padding: 14px 20px;
  margin-bottom: 14px;
  border-radius: 18px;
  line-height: 1.6;
  font-size: 16px;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  word-wrap: break-word;
  word-break: break-word;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

/* User specific */
.msg.user {
  margin-left: auto;
  font-weight: 600;
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: white;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.6);
}

.msg.user:hover {
  background: linear-gradient(135deg, #6366f1, #818cf8);
  box-shadow: 0 6px 15px rgba(130, 140, 248, 0.7);
}


.msg.assistant {
  margin-right: auto;
  max-width: 80%;
  padding: 14px 20px;
  margin-bottom: 14px;
  border-radius: 18px;
  line-height: 1.6;
  font-size: 16px;
  font-weight: 400;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  word-wrap: break-word;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
  background: linear-gradient(135deg, #1e40af, #2563eb); /* blue gradient */
  color: #dbeafe; /* lighter text */
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.msg.assistant:hover {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  box-shadow: 0 6px 15px rgba(59, 130, 246, 0.5);
}

/* Code blocks inside assistant messages */
.msg.assistant pre,
.msg.assistant code {
  background-color: #1e1e2f;
  color: #d4d4dc;
  font-family: 'Source Code Pro', monospace;
  font-size: 14px;
  line-height: 1.5;
  padding: 16px;
  border-radius: 12px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 12px 0;
  border: 1px solid #44475a;
  box-shadow: inset 0 0 12px #000000c0;
}

/* Hover effect for messages (optional) */
.msg:hover {
  background-color: rgba(139, 92, 246, 0.2);
  transition: background-color 0.2s ease-in-out;
}

/* Links styling inside messages */
.msg a {
  color: #a78bfa;
  text-decoration: underline;
  cursor: pointer;
}

/* Composer section for sending messages */
.composer {
  display: flex;
  gap: 12px;
  padding: 10px 12px;
  align-items: center;
  background: var(--panel);
  position: relative;
}

textarea#prompt {
  flex: 1;
  resize: none;
  padding: 14px 16px;
  font-size: 15px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: linear-gradient(to right, #101828, #131c2b);
  color: #e6eef8;
  box-shadow: inset 0 0 8px rgba(255, 255, 255, 0.03);
  transition: all 0.3s ease;
  font-family: 'Source Code Pro', monospace;
}

textarea#prompt::placeholder {
  color: var(--muted);
  font-style: italic;
}

textarea#prompt:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.5);
}

/* Microphone button styling */
#micBtn {
  font-size: 24px;
  background-color: #0084ff;
  color: white;
  padding: 12px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.2s ease;
  font-family: 'Source Code Pro', monospace;
  margin-left: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#micBtn:hover {
  background-color: #005bb5;
  transform: scale(1.05);
}

#micBtn:focus {
  outline: none;
  box-shadow: 0 0 5px rgba(139, 92, 246, 0.5);
}

/* Buttons Styling */
button {
  background: var(--highlight);
  color: white;
  border: none;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.3s ease, transform 0.2s ease;
  font-family: 'Source Code Pro', monospace;
}

button:hover {
  background: linear-gradient(to right, #8b5cf6, #a78bfa);
  transform: scale(1.05);
}

button#clearBtn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

button#clearBtn:hover {
  border-color: var(--accent);
  color: #e6eef8;
}

#sendBtn, #clearBtn {
  display: none;
}

/* GPT Model Selection Dropdown */
#modelSelect {
  background-color: #1c1f2b;
  color: #e6eef8;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  font-family: 'Source Code Pro', monospace;
  padding: 12px 16px;
  appearance: none;
  cursor: pointer;
  box-shadow: inset 0 0 6px rgba(255, 255, 255, 0.05);
  transition: all 0.3s ease;
  width: 200px;
}

#modelSelect {
  appearance: none; /* Remove default arrow */
  -webkit-appearance: none;
  -moz-appearance: none;
  
  background-color: #1c1f2b;
  color: #e6eef8;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  font-family: 'Source Code Pro', monospace;
  font-size: 15px;
  padding: 10px 40px 10px 16px; /* right padding for arrow */
  width: 200px;
  cursor: pointer;
  box-shadow: inset 0 0 8px rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
  position: relative;
  outline: none;
}

/* Hover and focus states */
#modelSelect:hover,
#modelSelect:focus {
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--highlight);
  background: linear-gradient(135deg, #232a3c, #2a3248);
  color: #e6eef8;
}

/* Custom arrow icon using a pseudo-element */
#modelSelect::after {
  content: "";
  position: absolute;
  pointer-events: none;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  border-style: solid;
  border-width: 6px 5px 0 5px;
  border-color: #e6eef8 transparent transparent transparent;
  z-index: 10;
}
/* 
/* To enable the arrow, we need to wrap select in a relative container */
.controls {
  position: relative;
  display: inline-block;
} */

/* Links */
a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Fixed position for the scrollbar in the top-right corner */
::-webkit-scrollbar {
  width: 8px;
  position: fixed;
  top: 0;
  right: 10px;
}

::-webkit-scrollbar-track {
  background: var(--panel);
}

::-webkit-scrollbar-thumb {
  background-color: var(--accent);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background-color: #a78bfa;
}

.msg.assistant pre,
.msg.assistant code {
  background-color: #282c34;
  color: #abb2bf;
  font-family: 'Source Code Pro', monospace;
  font-size: 14px;
  line-height: 1.4;
  padding: 12px;
  border-radius: 8px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 8px 0;
  border: 1px solid #3a3f4b;
  box-shadow: inset 0 0 10px #00000060;
}

/* Buttons Styling */
button {
  background: var(--highlight);
  color: white;
  border: none;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.3s ease, transform 0.2s ease;
  font-family: 'Source Code Pro', monospace;
}

button:hover {
  background: linear-gradient(to right, #8b5cf6, #a78bfa);
  transform: scale(1.05);
}

button#clearBtn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

button#clearBtn:hover {
  border-color: var(--accent);
  color: #e6eef8;
}

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 56px;  /* adjust as needed */
  background-color: var(--panel);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  z-index: 10000;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: var(--accent);
  user-select: none;
}

#title {
  font-size: 1.5rem;
  font-weight: bold;
}

.controls select#modelSelect {
  background-color: #1c1f2b;
  color: #e6eef8;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  font-family: 'Source Code Pro', monospace;
  padding: 10px;
  cursor: pointer;
  box-shadow: inset 0 0 6px rgba(255, 255, 255, 0.05);
  transition: all 0.3s ease;
  position: relative;
  display: flex;
  justify-content: center; /* horizontal center */
  align-items: center;     /* vertical center */
  height: 100%;
  width: 100px; /* match select width */
  text-align: center; /* center text inside the box */
  text-align-last: center; /* for most browsers */
}

.controls select#modelSelect:hover,
.controls select#modelSelect:focus {
  border-color: var(--accent);
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.4);
  outline: none;
}