/* =========================
   ROOT VARIABLES
========================= */
:root {
  --bg: #0f0f0f;
  --panel: #171717;
  --user: #10a38a;
  --bot: #202020;
  --text: #eaeaea;
  --muted: #9ca3af;
}

/* =========================
   GLOBAL RESET
========================= */
* {
  box-sizing: border-box;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
}

/* =========================
   LAYOUT
========================= */
.layout {
  display: flex;
  height: 100vh;
}

/* =========================
   SIDEBAR
========================= */
.sidebar {
  width: 260px;
  background: var(--panel);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sidebar h2 {
  font-size: 30px;
  margin-bottom: 6px;
}

.sidebar button,
.sidebar select,
.sidebar input,
.toggle {
  font-size: 20px;
  padding: 12px;
  border-radius: 12px;
  border: none;
  background: #202020;
  color: white;
  cursor: pointer;
  font-family: Georgia, "Times New Roman", Times, serif;
}

.toggle {
  text-align: center;
}

/* =========================
   MAIN AREA
========================= */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* =========================
   CHAT AREA
========================= */
#chat {
  flex: 1;
  padding: 22px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* =========================
   WELCOME
========================= */
.welcome {
  margin: auto;
  text-align: center;
  color: var(--muted);
}

.welcome h1 {
  font-size: 34px;
}

/* =========================
   MESSAGE BUBBLES
========================= */
.message {
  max-width: 72%;
  padding: 18px 20px;
  border-radius: 20px;
  margin: 8px 0;
  font-size: 20px;
  line-height: 1.7;
  position: relative;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

/* User message */
.user {
  background: linear-gradient(135deg, #10a38a, #7bdcb5);
  color: black;
  align-self: flex-end;
  border-bottom-right-radius: 6px;
}

/* Bot message */
.bot {
  background: var(--bot);
  align-self: flex-start;
  border-bottom-left-radius: 6px;
}

/* =========================
   MESSAGE META
========================= */
.time {
  font-size: 12px;
  opacity: 0.6;
  margin-top: 6px;
}

.copy-btn {
  position: absolute;
  top: 8px;
  right: 10px;
  opacity: 0;
  cursor: pointer;
}

.message:hover .copy-btn {
  opacity: 1;
}

/* =========================
   INPUT BAR
========================= */
footer {
  display: flex;
  gap: 12px;
  padding: 16px;
  background: var(--panel);
  border-top: 1px solid #262626;
}

textarea {
  flex: 1;
  resize: none;
  padding: 16px;
  border-radius: 16px;
  border: none;
  outline: none;
  background: #0b0b0b;
  color: white;
  font-size: 16px;
}

button.mic,
button.send {
  font-size: 18px;
  padding: 14px 18px;
  border-radius: 16px;
  border: none;
  cursor: pointer;
}

button.send {
  background: var(--user);
  color: black;
}

/* =========================
   LIGHT MODE (MODERN)
========================= */
.light {
  --bg: #f7f7f8;
  --panel: #ffffff;
  --user: #10a38a;
  --bot: #ffffff;
  --text: #0f172a;
  --muted: #6b7280;
}

/* Page */
body.light {
  background: var(--bg);
  color: var(--text);
}

/* Sidebar */
.light .sidebar {
  background: #ffffff;
  border-right: 1px solid #e5e7eb;
}

.light .sidebar button,
.light .sidebar select,
.light .sidebar input,
.light .toggle {
  background: #f3f4f6;
  color: #111827;
  border: 1px solid #e5e7eb;
}

/* Messages */
.light .message {
  background: #ffffff;
  color: #111827;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
}

/* User bubble */
.light .user {
  background: linear-gradient(135deg, #10a38a, #7bdcb5);
  color: #ffffff;
}

/* Bot bubble */
.light .bot {
  background: #ffffff;
  border: 1px solid #e5e7eb;
}

/* Input */
.light footer {
  background: #ffffff;
  border-top: 1px solid #e5e7eb;
}

.light textarea {
  background: #f9fafb;
  color: #111827;
  border: 1px solid #e5e7eb;
}

.light button.mic {
  background: #f3f4f6;
  color: #111827;
}

.light button.send {
  background: #10a38a;
  color: #ffffff;
}

/* =========================
   CHATGPT-STYLE CODE BLOCKS
========================= */
.message pre {
  background: #0d1117;
  padding: 42px 16px 16px;
  border-radius: 14px;
  overflow-x: auto;
  position: relative;
  font-family: Consolas, Monaco, "Courier New", monospace;
  font-size: 14px;
  line-height: 1.6;
  color: #e6edf3;
  margin-top: 12px;
}

.message pre code {
  color: #e6edf3;
  display: block;
  white-space: pre;
}

/* Code label */
/* .message pre::before {
  content: "code";
  position: absolute;
  top: 10px;
  left: 14px;
  font-size: 12px;
  color: #8b949e;
} */

/* Copy code button */
.copy-code-btn {
  position: absolute;
  top: 8px;
  right: 12px;
  background: #21262d;
  border: none;
  color: #e6edf3;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.copy-code-btn:hover {
  background: #30363d;
}

/* =========================
   MOBILE RESPONSIVE
========================= */
@media (max-width: 768px) {
  .sidebar {
    display: none;
  }

  .message {
    max-width: 88%;
    font-size: 16px;
  }

  .sidebar h2 {
    font-size: 24px;
  }
}
