:root {
    /* Dark mode variables (default) */
    --bg-color: #1a1a1a;
    --sidebar-bg: #2d2d2d;
    --sidebar-border: #444;
    --text-color: #7ee787;
    --text-muted: #9e9e9e;
    --content-bg: #1a1a1a;
    --topbar-bg: #212121;
    --link-hover: #fff;
    --assistant-msg-bg: #262b26;
    --assistant-msg-color: #9ef1a0;
    --user-msg-bg: #15354f;
    --user-msg-color: #a0f1f1;
    --btn-newchat-bg: #0d6efd;
  }
  body.light-mode {
    /* Light mode overrides */
    --bg-color: #9db7d1;
    --sidebar-bg: #9db7d1;
    --sidebar-border: #7d848b;
    --text-color: #031631;
    --text-muted: #6c757d;
    --content-bg: #f8f9fa;
    --topbar-bg: #e9ecef;
    --link-hover: #000;
    --assistant-msg-bg: #e2ffe2;
    --assistant-msg-color: #198754;
    --user-msg-bg: #cce5ff;
    --user-msg-color: #0d6efd;
    --btn-newchat-bg: #0d6efd;
  }
  html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s ease, color 0.3s ease;
  }
  #sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 340px;
    height: 100%;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    padding: 15px;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    transform: translateX(0);
    overflow: hidden;
    z-index: 999;
  }
  #sidebar.collapsed {
    transform: translateX(-340px);
  }
  .sidebar-header {
    margin-bottom: 20px;
  }
  .sidebar-header h4 {
    margin: 0;
    font-size: 1.3rem;
    color: var(--text-color);
  }
  .sidebar-menu {
    flex: 1;
    display: flex;
    flex-direction: column;
  }
  .btn-newchat {
    background-color: var(--btn-newchat-bg);
    color: #fff;
    border: none;
    width: 100%;
    text-align: left;
    padding: 10px;
    margin-bottom: 10px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.2s ease;
  }
  .btn-newchat:hover {
    background-color: #0b5ed7;
  }
  .sidebar-menu ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
  }
  .sidebar-menu ul li {
    margin: 10px 0;
  }
  .sidebar-menu ul li a {
    color: var(--text-muted);
    text-decoration: none;
    cursor: pointer;
    font-size: 1rem;
  }
  .sidebar-menu ul li a:hover {
    color: var(--link-hover);
  }
  .sidebar-footer {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid var(--sidebar-border);
  }
  .sidebar-footer ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
  }
  .sidebar-footer li {
    margin: 10px 0;
  }
  .sidebar-footer li a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 1rem;
  }
  .sidebar-footer li a:hover {
    color: var(--link-hover);
  }
  #mainContent {
    margin-left: 340px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
  }
  #mainContent.expanded {
    margin-left: 0;
  }
  .topbar {
    background-color: var(--topbar-bg);
    padding: 10px 20px;
    border-bottom: 1px solid var(--sidebar-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--text-color);
    transition: background-color 0.3s ease, color 0.3s ease;
  }
  .toggle-btn {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 22px;
    cursor: pointer;
    margin-right: 20px;
  }
  .theme-toggle-btn {
    background: none;
    border: 1px solid var(--text-color);
    color: var(--text-color);
    border-radius: 20px;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background-color 0.3s ease, color 0.3s ease;
  }
  .theme-toggle-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
  }
  .chat-container {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background-color: var(--content-bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    transition: background-color 0.3s ease;
  }
  .message-area {
    width: 100%;
    max-width: 1300px;
    position: relative;
  }
  .message {
    margin: 10px 0;
    padding: 10px;
    border-radius: 6px;
    max-width: 70%;
  }
  .assistant-msg {
    background-color: var(--assistant-msg-bg);
    color: var(--assistant-msg-color);
    align-self: flex-start;
  }
  .user-msg {
    background-color: var(--user-msg-bg);
    color: var(--user-msg-color);
    margin-left: auto;
    align-self: flex-end;
  }
  .system-msg {
    display: none;
  }
  pre {
    position: relative;
    background-color: var(--assistant-msg-bg) !important;
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 1rem 0;
  }
  pre code {
    color: var(--assistant-msg-color) !important;
    font-family: "Consolas", "Courier New", monospace;
    font-size: 0.95rem;
    line-height: 1.4;
  }
  #emptyState {
    position: absolute;
    top: 35%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #bbb;
    font-size: 2rem;
    pointer-events: none;
    text-align: center;
  }
  #emptyState h1 {
    color: #fff;
    margin-bottom: 1rem;
    font-size: 2.2rem;
  }
  .input-area {
    background-color: var(--topbar-bg);
    padding: 10px;
    border-top: 1px solid var(--sidebar-border);
    display: flex;
    align-items: flex-start;
    width: 100%;
    max-width: 1300px;
    margin: 0 auto;
    transition: background-color 0.3s ease;
  }
  #message {
    flex: 1;
    background-color: #333;
    color: #a8f1a8;
    border: 1px solid #555;
    resize: vertical;
    min-height: 100px;
  }
  .btn-send {
    background-color: var(--btn-newchat-bg);
    color: #fff;
    border: none;
    margin-left: 10px;
    padding: 10px 15px;
  }
  .btn-send:hover {
    background-color: #0b5ed7;
  }
  .btn-clear {
    background-color: #dc3545;
    color: #fff;
    border: none;
    margin-left: 10px;
    padding: 10px 15px;
  }
  .btn-clear:hover {
    background-color: #c82333;
  }
  .btn-mic {
    background-color: #4fc3f7;
    color: #fff;
    border: none;
    margin-left: 10px;
    border-radius: 50%;
    width: 40px;
    height: 40px;
  }
  .btn-mic:hover {
    background-color: #29b6f6;
  }
  .typing-indicator {
    font-style: italic;
    color: #6aff6a;
  }
  .modal-content {
    background: #212121;
    color: #fff;
  }
 /* copy button styling, matching your example */
.copy-btn {
    position: absolute;
    top: 8px;
    right: 10px;
    background-color: #444;           /* dark gray */
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 0.8rem;
    cursor: pointer;
    z-index: 10;
    opacity: 0.7;
    transition: opacity 0.2s ease;
  }
  .copy-btn:hover {
    opacity: 1;
  }
  