/* ========================================
   RESET
======================================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: Arial, sans-serif;
  height: 100vh;
  overflow: hidden;
}

/* ========================================
   APP LAYOUT (MOBILE FIRST)
======================================== */

#app {
  display: flex;
  height: 100vh;
  width: 100%;
  overflow: hidden;
}

/* ========================================
   SIDEBAR (Hidden by default on mobile)
======================================== */

#sidebar {
  position: fixed;
  top: 0;
  left: -260px; /* hidden */
  width: 250px;
  height: 100%;
  background: #0e0e43;
  color: white;
  padding: 25px 15px 15px;
  transition: left 0.3s ease;
  z-index: 1000;
  overflow-y: auto;
}

#sidebar.active {
  left: 0;
}

/* Hide scrollbar but allow scrolling */

/* For Chrome, Edge, Safari */
#sidebar::-webkit-scrollbar {
  width: 0px;
  background: transparent;
}

/* For Firefox */
#sidebar {
  scrollbar-width: none; /* Firefox */
}

/* For IE & old Edge */
#sidebar {
  -ms-overflow-style: none;
}

#newChat {
  width: 100%;
  padding: 10px;
  margin-bottom: 15px;
  background: #2563eb;
  border: none;
  color: white;
  cursor: pointer;
  border-radius: 5px;
}

#chatList {
  font-size: 14px;
}

.chat-item {
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition:
    background-color 0.25s ease,
    color 0.25s ease,
    transform 0.35s ease;
}

.chat-item:hover {
  background-color: #353566b4;
  color: #fff;
  transform: translateX(3px);
}

.chat-item.active {
  background-color: #88a4e050;
  color: #fff;
}

/* ========================================
   CHAT AREA
======================================== */

#chatArea {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #dfe3ec;
  width: 100%;
}

/* ========================================
   TOP BAR
======================================== */

#topBar {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  padding: 15px;
  background: white;
  box-shadow: 5px 6px 12px 1px rgb(0 0 0 / 14%);
  position: relative;
  z-index: 5;
}

#menuToggle {
  background: none;
  border: none;
  font-size: 25px;
  cursor: pointer;
}
#menuToggle i {
  color: #0e0e43;
}
.logo---basket {
  display: flex;
  align-items: center;
  gap: 3px;
}
.logo---basket img {
  width: 45px;
}
.logo---basket h3 {
  font-size: 20px;
  color: #0026b9;
}
.logo---basket span {
  font-size: 11px;
}

/* ========================================
   MESSAGES AREA
======================================== */

.welcome--msg {
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  transform: translateY(-50%);
  text-align: center;
  color: #555;
  padding: 0 20px;
}
.welcome--msg h3 {
  font-size: 24px;
  margin-bottom: 10px;
}
.welcome--msg p {
  font-size: 17px;
}

#messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* USER MESSAGE */

.msg-user {
  align-self: flex-end;
  background: #0e0e43;
  color: #cccce8;
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  max-width: 75%;
  word-wrap: break-word;
}

/* BOT MESSAGE */

.msg-bot {
  align-self: flex-start;
  background: white;
  padding: 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  width: 94%;
  word-wrap: break-word;
}
.msg-bot.msg-loading {
  max-width: 80px;
}

/* ========================================
   INPUT AREA
======================================== */

#inputArea {
  position: relative;
  padding: 15px 10px;
  background: #31315f42;
  border-top: 1px solid #ddd;
}

.inputAreaInner {
  position: relative;
  width: 100%;
  margin: 0 auto;
}

#message {
  padding: 14px;
  border: 1px solid #ccc;
  border-radius: 5px;
  outline: none;
  resize: none; /* prevents manual resize */
  overflow-y: auto; /* enable vertical scroll */
  overflow-x: hidden; /* prevent horizontal scroll */
  width: 100%;
  min-height: 55px;
  max-height: 160px; /* optional limit */
  line-height: 1.4;
  font-size: 18px;
}

#sendBtn {
  position: absolute;
  right: 4px;
  bottom: 8px;
  background: #0e0e43;
  color: white;
  border: none;
  padding: 10px;
  margin-left: 10px;
  border-radius: 5px;
  cursor: pointer;
}

/* ========================================
   MARKDOWN STYLING (BOT CONTENT)
======================================== */

.msg-bot strong {
  font-weight: bold;
}

.msg-bot ul,
.msg-bot ol {
  padding-left: 20px;
  margin-top: 5px;
}

.msg-bot li {
  margin-bottom: 5px;
}
.msg-bot ul li:last-child,
.msg-bot ol li:last-child,
.msg-bot p:last-child {
  margin-bottom: 0;
}

.msg-bot h1,
.msg-bot h2,
.msg-bot h3 {
  margin: 10px 0;
}

.msg-bot p {
  margin-bottom: 8px;
}

/* ========================================
   TYPING INDICATOR (3 DOTS ANIMATION)
======================================== */
.msg-loading {
  align-self: flex-start;
  background: #f0f0f0;
  color: #555;
  padding: 14px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  max-width: 80%;
  font-style: italic;
  display: flex;
  gap: 4px;
}

.msg-loading .dot {
  width: 8px;
  height: 8px;
  background: #555;
  border-radius: 50%;
  opacity: 0;
  animation: blinkDots 1.4s infinite;
}

.msg-loading .dot:nth-child(1) {
  animation-delay: 0s;
}
.msg-loading .dot:nth-child(2) {
  animation-delay: 0.2s;
}
.msg-loading .dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes blinkDots {
  0%,
  20% {
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@media (min-width: 600px) {
  .inputAreaInner {
    width: 88%;
  }
}

/* ========================================
   DESKTOP STYLES (≥ 768px)
======================================== */

@media (min-width: 768px) {
  #sidebar {
    position: relative;
    left: 0;
    width: 250px;
  }

  #menuToggle {
    display: none;
  }
  .msg-user {
    padding: 20px;
  }

  #messages {
    padding: 20px 20px 30px 35px;
  }

  /* BOT MESSAGE */

  .msg-bot {
    padding: 30px 25px;
  }

  .inputAreaInner {
    width: 95%;
  }
}
@media (min-width: 1024px) {
  .inputAreaInner {
    width: 90%;
  }
}
