@font-face {
  font-family: "Vazir";
  src: url("Vazir-Regular.ttf");
  /* IE */
  font-weight: normal;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  text-decoration: none;
  font-family: "Vazir";
  text-align: right;
  direction: rtl;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: #121212;
  padding: 0 10px;
}

.wrapper {
  background: #1e1e1e;
  max-width: 450px;
  width: 100%;
  border-radius: 16px;
  box-shadow: 0 0 128px 0 rgba(255, 255, 255, 0.1),
    0 32px 64px -48px rgba(255, 255, 255, 0.2);
}

/* Login & Signup Form CSS Start */
.form {
  padding: 25px 30px;
}

.form header {
  font-size: 25px;
  font-weight: 600;
  padding-bottom: 10px;
  border-bottom: 1px solid #333;
  color: #fff;
}

.form form {
  margin: 20px 0;
}

.form form .error-text {
  color: #d32f2f;
  padding: 8px 10px;
  text-align: center;
  border-radius: 5px;
  background: #ffebee;
  border: 1px solid #ffcdd2;
  margin-bottom: 10px;
  display: none;
}

.form form .name-details {
  display: flex;
}

.form .name-details .field:first-child {
  margin-right: 10px;
}

.form .name-details .field:last-child {
  margin-left: 10px;
}

.form form .field {
  display: flex;
  margin-bottom: 10px;
  flex-direction: column;
  position: relative;
}

.form form .field label {
  margin-bottom: 2px;
  color: #ddd;
}

.form form .input input {
  height: 40px;
  width: 100%;
  font-size: 16px;
  padding: 0 10px;
  border-radius: 5px;
  border: 1px solid #333;
  background: #1e1e1e;
  color: #fff;
}

.form form .field input {
  outline: none;
}

.form form .image input {
  font-size: 17px;
}

.form form .button input {
  height: 45px;
  border: none;
  color: #fff;
  font-size: 17px;
  background: #333;
  border-radius: 5px;
  cursor: pointer;
  text-align: center;
  margin-top: 13px;
}

.form form .field i {
  position: absolute;
  left: 15px;
  top: 70%;
  color: #777;
  cursor: pointer;
  transform: translateY(-50%);
}

.form form .field i.active::before {
  color: #fff;
  content: "\f070";
}

.form .link {
  text-align: center;
  margin: 10px 0;
  font-size: 17px;
}

.form .link a {
  color: #bbb;
}

.form .link a:hover {
  text-decoration: underline;
}

/* Users List CSS Start */
.users {
  padding: 25px 30px;
}

.users header,
.users-list a {
  display: flex;
  align-items: center;
  padding-bottom: 20px;
  border-bottom: 1px solid #333;
  justify-content: space-between;
}

.wrapper img {
  object-fit: cover;
  border-radius: 50%;
}

.users header img {
  height: 50px;
  width: 50px;
}

:is(.users, .users-list) .content {
  display: flex;
  align-items: center;
}

:is(.users, .users-list) .content .details {
  color: #fff;
  margin-left: 20px;
}

:is(.users, .users-list) .details span {
  font-size: 18px;
  font-weight: 500;
}

.users header .logout {
  display: block;
  background: #333;
  color: #fff;
  outline: none;
  border: none;
  padding: 7px 15px;
  text-decoration: none;
  border-radius: 5px;
  font-size: 17px;
}

.users .search {
  margin: 20px 0;
  display: flex;
  position: relative;
  align-items: center;
  justify-content: space-between;
}

.users .search .text {
  font-size: 18px;
  color: #ddd;
}

.users .search input {
  position: absolute;
  height: 42px;
  width: calc(100% - 50px);
  font-size: 16px;
  padding: 0 13px;
  border: 1px solid #333;
  outline: none;
  border-radius: 5px 0 0 5px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s ease;
  background: #1e1e1e;
  color: #fff;
}

.users .search input.show {
  opacity: 1;
  pointer-events: auto;
}

.users .search button {
  position: relative;
  z-index: 1;
  width: 47px;
  height: 42px;
  font-size: 17px;
  cursor: pointer;
  border: none;
  background: #1e1e1e;
  text-align: center;
  color: #fff;
  outline: none;
  border-radius: 0 5px 5px 0;
  transition: all 0.2s ease;
}

.users .search button.active {
  background: #333;
  color: #fff;
}

.search button.active i::before {
  content: '\f00d';
}

.users-list {
  max-height: 350px;
  overflow-y: auto;
}

:is(.users-list, .chat-box)::-webkit-scrollbar {
  width: 0px;
}

.users-list a {
  padding-bottom: 10px;
  margin-bottom: 15px;
  padding-right: 15px;
  border-bottom-color: #333;
}

.users-list a:last-child {
  margin-bottom: 0px;
  border-bottom: none;
}

.users-list a img {
  height: 40px;
  width: 40px;
}

.users-list a .details p {
  color: #aaa;
}

.users-list a .status-dot {
  font-size: 12px;
  color: #468669;
  padding-left: 10px;
}

.users-list a .status-dot.offline {
  color: #555;
}

/* Chat Area CSS Start */
.chat-area header {
  display: flex;
  align-items: center;
  padding: 18px 30px;
  background: #1e1e1e;
  border-bottom: 1px solid #333;
}

.chat-area header .back-icon {
  color: #fff;
  font-size: 18px;
}

.chat-area header img {
  height: 45px;
  width: 45px;
  margin: 0 15px;
}

.chat-area header .details span {
  font-size: 17px;
  font-weight: 500;
  color: #fff;
}

.chat-box {
  position: relative;
  min-height: 500px;
  max-height: 500px;
  overflow-y: auto;
  padding: 10px 30px 20px 30px;
  background: #1e1e1e;
  box-shadow: inset 0 32px 32px -32px rgb(255 255 255 / 5%),
    inset 0 -32px 32px -32px rgb(255 255 255 / 5%);
}

.chat-box .text {
  position: absolute;
  top: 45%;
  left: 50%;
  width: calc(100% - 50px);
  text-align: center;
  transform: translate(-50%, -50%);
  color: #666;
}

.chat-box .chat {
  margin: 15px 0;
}

.chat-box .chat p {
  word-wrap: break-word;
  padding: 8px 16px;
  box-shadow: 0 0 32px rgb(255 255 255 / 8%),
    0rem 16px 16px -16px rgb(255 255 255 / 10%);
  background: #1e1e1e;
  color: #fff;
  border-radius: 10px;
}

.chat-box .outgoing {
  display: flex;
}

.chat-box .outgoing .details {
  margin-left: auto;
  max-width: calc(100% - 130px);
}

.outgoing .details p {
  background: #333;
  color: #fff;
  border-radius: 18px 18px 0 18px;
}

.chat-box .incoming {
  display: flex;
  align-items: flex-end;
}

.chat-box .incoming img {
  height: 35px;
  width: 35px;
}

.chat-box .incoming .details {
  margin-right: auto;
  margin-left: 10px;
  max-width: calc(100% - 130px);
}

.incoming .details p {
  background: #2d2d2d;
  color: #fff;
  border-radius: 18px 18px 18px 0;
}

.typing-area {
  padding: 18px 30px;
  display: flex;
  justify-content: space-between;
  background: #1e1e1e;
  border-top: 1px solid #333;
}

.typing-area input {
  height: 45px;
  width: calc(100% - 58px);
  font-size: 16px;
  padding: 0 13px;
  border: 1px solid #333;
  outline: none;
  border-radius: 5px 0 0 5px;
  background: #1e1e1e;
  color: #fff;
}

.typing-area button {
  color: #fff;
  width: 55px;
  border: none;
  outline: none;
  background: #333;
  font-size: 19px;
  cursor: pointer;
  opacity: 0.7;
  pointer-events: none;
  border-radius: 0 5px 5px 0;
  transition: all 0.3s ease;
  text-align: center;
}

.typing-area button.active {
  opacity: 1;
  pointer-events: auto;
}

/* Responsive media query */
@media screen and (max-width: 450px) {

  .form,
  .users {
    padding: 20px;
  }

  .form header {
    text-align: center;
  }

  .form form .name-details {
    flex-direction: column;
  }

  .form .name-details .field:first-child {
    margin-right: 0px;
  }

  .form .name-details .field:last-child {
    margin-left: 0px;
  }

  .users header img {
    height: 45px;
    width: 45px;
  }

  .users header .logout {
    padding: 6px 10px;
    font-size: 16px;
  }

  :is(.users, .users-list) .content .details {
    margin-left: 15px;
  }

  .users-list a {
    padding-right: 10px;
  }

  .chat-area header {
    padding: 15px 20px;
  }

  .chat-box {
    min-height: 400px;
    padding: 10px 15px 15px 20px;
  }

  .chat-box .chat p {
    font-size: 15px;
  }

  .chat-box .outgoing .details {
    max-width: 230px;
  }

  .chat-box .incoming .details {
    max-width: 265px;
  }

  .incoming .details img {
    height: 30px;
    width: 30px;
  }

  .chat-area form {
    padding: 20px;
  }

  .chat-area form input {
    height: 40px;
    width: calc(100% - 48px);
  }

  .chat-area form button {
    width: 45px;
  }
}

.chat-area header {
  display: flex;
  align-items: center;
  padding: 18px 30px;
  background: #1e1e1e;
  border-bottom: 1px solid #333;
  position: relative;
}

/* Left: chat count */
.chat-area header .chat-count-show {
  font-size: 16px;
  color: #aaa;
  margin-right: auto;
  /* Pushes profile to right */
  white-space: nowrap;
}

/* Profile and details (right side) */
.chat-area header .profile {
  display: flex;
  align-items: center;
}

.chat-area header .profile img {
  height: 45px;
  width: 45px;
  margin: 0 15px;
}

.chat-area header .profile .details span {
  font-size: 17px;
  font-weight: 500;
  color: #fff;
}

/* Add this inside your existing CSS */
.chat-box .time {
  font-size: 12px;
  color: #888;
  margin-top: 4px;
  display: block;
  text-align: right;
  margin-right: 10px;
}

.chat-box .outgoing .time {
  text-align: left;
  margin-left: 10px;
}

.chat-box .incoming .time {
  text-align: right;
  margin-right: 10px;
}