/* Reset and Base Styles */
* {
  border: 0;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: rgb(50, 50, 50);
  font-family: Lato, Helvetica, Arial, sans-serif;
  color: azure;
}

a {
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  text-decoration: none;
}

/* ================= Navbar ================= */
#navbar {
  background: #0a0531;
  color: rgb(13, 26, 38);
  position: fixed;
  top: 0;
  height: 60px;
  line-height: 60px;
  width: 100vw;
  z-index: 10;
}

.nav-wrapper {
  margin: auto;
  text-align: center;
  width: 70%;
}

@media (max-width: 768px) {
  .nav-wrapper {
    width: 90%;
  }
}

@media (max-width: 638px) {
  .nav-wrapper {
    width: 100%;
  }
}

.logo {
  float: left;
  margin-left: 28px;
  font-size: 1.5em;
  height: 60px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

#navbar ul {
  display: inline-block;
  float: right;
  list-style: none;
  margin-top: -2px;
  text-align: right;
  transition: transform 0.5s ease-out;
}

@media (max-width: 640px) {
  #navbar ul {
    display: none;
  }
}

@media (orientation: landscape) {
  #navbar ul {
    display: inline-block;
  }
}

#navbar li {
  display: inline-block;
}

#navbar li a {
  color: azure;
  display: block;
  font-size: 0.7em;
  height: 50px;
  letter-spacing: 1px;
  margin: 0 20px;
  padding: 0 4px;
  position: relative;
  text-decoration: none;
  text-transform: uppercase;
  transition: all 0.5s ease;
}

#navbar li a:hover {
  color: rgb(193, 110, 58);
  transition: all 1s ease;
}

#navbar li a:before,
#navbar li a:after {
  content: '';
  position: absolute;
  width: 0%;
  height: 1px;
  bottom: -1px;
  background: azure;
}

#navbar li a:before {
  left: 0;
  transition: 0.5s;
}

#navbar li a:after {
  right: 0;
}

#navbar li a:hover:before {
  width: 100%;
  transition: width 0.5s cubic-bezier(0.22, 0.61, 0.36, 1);
}

#navbar li a:hover:after {
  background: transparent;
  width: 100%;
}

/* ================= Mobile Menu Icon ================= */
@media (max-width: 640px) {
  .menuIcon {
    cursor: pointer;
    display: block;
    position: fixed;
    right: 15px;
    top: 20px;
    height: 23px;
    width: 27px;
    z-index: 12;
  }

  .icon-bars,
  .icon-bars::before,
  .icon-bars::after {
    background: rgb(13, 26, 38);
    content: '';
    position: absolute;
    height: 2px;
    width: 20px;
    transition: 0.4s;
  }

  .icon-bars {
    top: 45%;
    left: 1px;
  }

  .icon-bars::before {
    top: -8px;
  }

  .icon-bars::after {
    bottom: -8px;
  }

  .icon-bars.overlay {
    background: rgb(183, 199, 211);
    animation: middleBar 3s infinite 0.5s;
  }

  .icon-bars.overlay::before {
    background: rgb(183, 199, 211);
    animation: topBar 3s infinite 0s;
    width: 10px;
  }

  .icon-bars.overlay::after {
    background: rgb(183, 199, 211);
    animation: bottomBar 3s infinite 1s;
    width: 15px;
  }

  .menuIcon.toggle .icon-bars {
    top: 5px;
    transform: translate3d(0, 5px, 0) rotate(135deg);
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  }

  .menuIcon.toggle .icon-bars::before {
    top: 0;
    opacity: 0;
  }

  .menuIcon.toggle .icon-bars::after {
    top: 10px;
    transform: translate3d(0, -10px, 0) rotate(-270deg);
  }

  .menuIcon.toggle .icon-bars.overlay {
    width: 20px;
    opacity: 0;
    transition: all 0s ease;
  }
}

@keyframes middleBar {
  0%, 100% { width: 0px; }
  50% { width: 20px; }
}

@keyframes topBar {
  0%, 100% { width: 0px; }
  50% { width: 10px; }
}

@keyframes bottomBar {
  0%, 100% { width: 0px; }
  50% { width: 15px; }
}

/* ================= Overlay Menu ================= */
.overlay-menu {
  background: lightblue;
  color: rgb(13, 26, 38);
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 0;
  right: 0;
  padding-right: 15px;
  transform: translateX(-100%);
  width: 100vw;
  height: 100vh;
  transition: transform 0.2s ease-out;
}

.overlay-menu ul,
.overlay-menu li {
  display: block;
  position: relative;
}

.overlay-menu li a {
  display: block;
  font-size: 1.8em;
  letter-spacing: 4px;
  padding: 10px 0;
  text-align: right;
  text-transform: uppercase;
  transition: color 0.3s ease;
}

.overlay-menu li a:hover,
.overlay-menu li a:active {
  color: rgb(193, 110, 58);
}

/* ================= Utility & Layout ================= */
.here {
  background: #BBCCDD;
}

.top-menu {
  position: relative;
  display: inline-block;
}

.top-menu-content {
  display: none;
  position: absolute;
  background-color: lightslategray;
  max-width: 150px;
  box-shadow: 0px 8px 16px rgba(0,0,0,0.2);
  z-index: 1;
  text-align: center;
  margin-top: 1px;
  border-radius: 5px;
}

.top-menu-content a {
  color: black;
  padding: 12px 16px;
  display: block;
  text-decoration: none;
}

.top-menu:hover .top-menu-content {
  display: block;
}

#calendar,
#top {
  margin-top: 75px;
}

#bottomitem {
  margin-bottom: 5px !important;
}

.mainbody {
  max-width: 85%;
  margin: 25px auto 0;
  text-align: center;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
  background-color: #696969;
}

input[type="text"],
input[type="email"],
input[type="password"],
select,
textarea {
  display: inline-block;
  padding: 10px;
  margin: 10px 0;
  text-align: left;
  border: 1px solid #ccc;
  border-radius: 5px;
  max-width: 100%;
}

button {
  background-color: #007BFF;
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
}

.user,
.ai {
  max-width: 60%;
  background-color: #303030;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  margin-bottom: 10px;
  border-radius: 5px;
  padding: 10px;
}

.user {
  float: right;
  margin-right: 10%;
}

.ai {
  float: left;
  margin-left: 10%;
  text-align: left;
}

#msghs {
  display: block;
}

.msg {
  width: 100%;
  overflow: hidden;
}

#thinking {
  margin-left: auto;
  margin-right: auto;
}

/* ================= Sidebar ================= */
.sidebar {
  position: fixed;
  left: 0;
  top: 60px;
  height: calc(100vh - 60px);
  width: 220px;
  background-color: #777777;
  padding: 10px;
  overflow-y: auto;
  border-right: 1px solid #333;
}

#historylist {
  list-style: none;
  padding: 0;
  margin: 0;
}

.chat-history-item {
  padding: 10px;
  margin-bottom: 5px;
  border-radius: 5px;
  background-color: #222;
  color: #ddd;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.chat-history-item:hover {
  background-color: #333;
}

.chat-history-item.active {
  background-color: #007bff;
  color: white;
}

.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-thumb {
  background: #444;
  border-radius: 3px;
}

.sidebar::-webkit-scrollbar-track {
  background: #111;
}

.messages {
  padding: 10px;
  margin-left: 240px;
  width: calc(100% - 240px);
  text-align: center;
}