/* ================= VARIABLES ================= */
:root {
  --bg-dark: #0e0e0e;
  --bg-sidebar: #111111;
  --bg-panel: #161616;
  --bg-hover: #1f1f1f;

  --accent: #00ff7f;

  --text-main: #e5e5e5;
  --text-muted: #8a8a8a;
}

/* ================= RESET ================= */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Geo', sans-serif;
  background: var(--bg-dark);
  color: var(--text-main);
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ================= TOP NAV ================= */
.top-nav {
  height: 75px;
  background: linear-gradient(180deg, #0c0c0c, #080808);
  border-bottom: 1px solid #1f1f1f;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
}

.logo {
  font-size: 2.5rem;
  font-weight: 900;
  color: var(--accent);
}

.logo span {
  color: white;
}

#nav-actions ul {
  list-style: none;
  display: flex;
  gap: 1rem;
  margin: 0;
  padding: 0;
}

#nav-actions a {
  font-size: 1.5rem;
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.2s ease;
  color: var(--accent);
}

#nav-actions a[href*="signup"] {
  color: var(--text-main);
  font-size: 2.25rem;
}

#nav-actions a[href*="signup"]:hover {
  background: #1e1e1e;
}

#nav-actions a[href*="login"] {
  background: var(--accent);
  color: #0b0b0b;
  font-weight: 600;
}

#nav-actions a[href*="login"]:hover {
  filter: brightness(1.1);
}

/* ================= APP LAYOUT ================= */
.app-layout {
  flex: 1;
  display: flex;
  height: calc(100vh - 75px);
}

/* ================= SIDEBAR ================= */
/* ================= SIDEBAR ================= */
.sidebar {
  width: 280px;
  background: var(--bg-panel);
  border-right: 1px solid #222;
  display: flex;
  flex-direction: column;
  padding: 1rem;
  overflow-y: auto;
}

#newChatBtn {
  background: var(--accent);
  color: #0b0b0b;
  border: none;
  border-radius: 6px;
  padding: 0.75rem;
  font-weight: bold;
  margin-bottom: 1rem;
  cursor: pointer;
  transition: filter 0.2s ease, transform 0.2s ease;
}

#newChatBtn:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

#chatList {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.chat-item {
  background: #1a1a1a;
  color: var(--text-main);
  padding: 0.6rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-item:hover {
  background: #222;
}

.chat-item.active {
  background: var(--accent);
  color: #0b0b0b;
  font-weight: 600;
}

/* ================= CHAT AREA ================= */
.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
}

/* ================= CHAT MESSAGES ================= */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* User messages */
.message.user {
  align-self: flex-end;
  background-color: var(--accent);
  color: #0b0b0b;
  border-radius: 16px 16px 4px 16px;
  padding: 1rem 1.25rem;
  max-width: 70%;
  word-wrap: break-word;
  font-size: 1.125rem;
  /* bigger text */
  line-height: 1.6;
  /* spaced nicely */
  white-space: pre-wrap;
  /* preserves line breaks */
}

/* AI messages */
.message.bot {
  align-self: flex-start;
  background-color: var(--bg-panel);
  color: var(--text-main);
  border-radius: 16px 16px 16px 4px;
  padding: 1rem 1.25rem;
  max-width: 70%;
  word-wrap: break-word;
  font-size: 1.125rem;
  /* bigger text */
  line-height: 1.6;
  /* spaced nicely */
  white-space: pre-wrap;
  /* preserves line breaks */
}

/* Optional: smooth scrolling */
.chat-messages::-webkit-scrollbar {
  width: 8px;
}

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

/* ================= INPUT BAR ================= */

.chat-input {
  display: flex;
  gap: 0.75rem;
  padding: 1.25rem;
  background: #0b0b0b;
  border-top: 1px solid #222;
}

.chat-input input {
  flex: 1;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  border: none;
  background: #1a1a1a;
  color: var(--text-main);
  font-size: 1rem;
}

.chat-input input::placeholder {
  color: var(--text-muted);
}

.chat-input button {
  padding: 0.85rem 1.2rem;
  border-radius: 10px;
  border: none;
  background: var(--accent);
  color: #0b0b0b;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chat-input button:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

/* ================= ANIMATION ================= */

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Typing indicator */
.message.typing {
  font-style: italic;
  color: var(--text-muted);
  background: transparent;
  box-shadow: none;
}
/* ================= MEDIA QUERIES ================= */
@media screen and (max-width: 768px) {
  .app-layout {
    flex-direction: column; /* stack sidebar and chat vertically */
  }

  .sidebar {
    width: 100%;
    height: auto;
    order: 2; /* place sidebar below chat if needed */
  }

  .chat-container {
    width: 100%;
    order: 1; /* place chat above sidebar */
  }

  .sidebar button#newChatBtn {
    width: 100%;
    margin-bottom: 0.5rem;
  }

  #chatList li {
    font-size: 0.9rem; /* smaller font for mobile */
  }

  .chat-messages {
    max-height: 50vh; /* adjust chat height */
  }

  .chat-input {
    flex-direction: column;
  }

  .chat-input input,
  .chat-input button {
    width: 100%;
    margin: 0.25rem 0;
  }

  /* Nav bar adjustments */
  .top-nav {
    flex-direction: column;
    height: auto;
    padding: 0.5rem 1rem;
  }

  #nav-actions ul {
    flex-direction: column;
    gap: 0.5rem;
  }
}

/* ---------------- MOBILE ---------------- */
@media (max-width: 768px) {
    .hamburger {
        display: block;
        position: absolute;
        left: 1rem; /* Move to left side */
        top: 50%;
        transform: translateY(-50%);
        font-size: 1.8rem;
        background: var(--bg-dark);
        color: var(--accent);
        border: none;
        cursor: pointer;
        z-index: 1100;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100%;
        width: 70%; /* Open only 70% width */
        max-width: 300px;
        transform: translateX(-100%);
        z-index: 1050;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.5);
        transition: transform 0.3s ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .app-layout {
        flex-direction: column;
        position: relative;
    }

    /* Overlay clickable area to close sidebar */
    .overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.3);
        z-index: 1040;
    }

    .overlay.active {
        display: block;
    }

    .chat-container {
        padding: 1rem;
    }
}


