/* ===== Root Variables for Light/Dark Themes ===== */
:root {
  --bg: #ffffff;
  --text: #2f3640;
  --sidebar-bg: #202123;
  --sidebar-text: #ececec;
  --accent: #0078ff;
  --border: #ddd;
  --bubble-user: #0078ff;
  --bubble-bot: #e9ecef;
}
[data-theme="dark"] {
  --bg: #18191a;
  --text: #e4e6eb;
  --sidebar-bg: #1b1c1d;
  --sidebar-text: #cfcfcf;
  --accent: #10a37f;
  --border: #333;
  --bubble-user: #10a37f;
  --bubble-bot: #2b2c2f;
}

body {
  margin: 0;
  font-family: "Inter", sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background 0.3s, color 0.3s;
}

/* ===== LOGIN SCREEN ===== */
.login-wrapper {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-box {
  background: var(--bg);
  color: var(--text);
  padding: 30px;
  border-radius: 12px;
  width: 90%;
  max-width: 340px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  text-align: center;
}
.login-box input,
.login-box button {
  width: 100%;
  padding: 10px;
  margin-top: 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.login-box button {
  background: var(--accent);
  color: white;
  font-weight: 600;
  cursor: pointer;
}
.error-msg {
  color: #e74c3c;
  margin-top: 10px;
}

/* ===== APP LAYOUT ===== */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: 260px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
}
.sidebar.show {
  transform: translateX(0);
}
.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px;
  border-bottom: 1px solid var(--border);
}
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}
.sidebar-actions button {
  background: none;
  border: none;
  color: var(--sidebar-text);
  font-size: 16px;
  cursor: pointer;
}
.menu-close {
  display: none;
}
.new-chat-btn {
  margin: 14px;
  padding: 10px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-weight: 600;
  cursor: pointer;
}
.new-chat-btn:hover {
  opacity: 0.9;
}
.chat-history {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}
.chat-history-item {
  background: transparent;
  padding: 8px 10px;
  border-radius: 6px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: background 0.2s;
}
.chat-history-item:hover {
  background: rgba(255, 255, 255, 0.1);
}
.chat-history-item strong {
  display: block;
  font-size: 15px;
}
.chat-history-item span {
  font-size: 12px;
  opacity: 0.7;
}
.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  border-top: 1px solid var(--border);
}
.sidebar-footer a {
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 14px;
  opacity: 0.8;
}
.sidebar-footer a:hover {
  opacity: 1;
}
.logout-btn {
  margin-top: 8px;
  padding: 8px;
  border: none;
  background: #ff5c5c;
  color: white;
  border-radius: 8px;
  cursor: pointer;
}
.logout-btn:hover {
  background: #e04a4a;
}

/* ===== CHAT PANEL ===== */
.chat-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.chat-header {
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.menu-toggle {
  position: absolute;
  left: 12px;
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text);
  display: none;
}
.chat-area {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}
.message {
  margin: 10px 0;
  padding: 10px 14px;
  border-radius: 10px;
  max-width: 80%;
  line-height: 1.5;
  word-wrap: break-word;
}
.message.user {
  background: var(--bubble-user);
  color: #fff;
  margin-left: auto;
}
.message.bot {
  background: var(--bubble-bot);
  color: var(--text);
  margin-right: auto;
}
.chat-input {
  display: flex;
  padding: 12px;
  border-top: 1px solid var(--border);
}
.chat-input input {
  flex: 1;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.chat-input button {
  margin-left: 10px;
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  font-weight: 600;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
    z-index: 999;
  }
  .menu-close {
    display: inline;
  }
  .menu-toggle {
    display: inline;
  }
}
