*{
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  text-decoration: none;
  font-family: Arial, Helvetica, sans-serif;
}
body{
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: #f7f7f7;
  padding: 0 10px;
}
.wrapper{
  background: #fff;
  max-width: 450px;
  width: 100%;
  border-radius: 16px;
  box-shadow: 0 0 128px 0 rgba(0,0,0,0.1),
              0 32px 64px -48px rgba(0,0,0,0.5);
}

/* Login & Signup Form CSS Start */
.form{
  padding: 25px 30px;
}
.form header{
  font-size: 25px;
  font-weight: 600;
  padding-bottom: 10px;
  border-bottom: 1px solid #e6e6e6;
}
.form form{
  margin: 20px 0;
}
.form form .error-text{
  color: #721c24;
  padding: 8px 10px;
  text-align: center;
  border-radius: 5px;
  background: #f8d7da;
  border: 1px solid #f5c6cb;
  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;
}
.form form .input input{
  height: 40px;
  width: 100%;
  font-size: 16px;
  padding: 0 10px;
  border-radius: 5px;
  border: 1px solid #ccc;
}
.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;
  margin-top: 13px;
}
.form form .field i{
  position: absolute;
  right: 15px;
  top: 70%;
  color: #ccc;
  cursor: pointer;
  transform: translateY(-50%);
}
.form form .field i.active::before{
  color: #333;
  content: "\f070";
}
.form .link{
  text-align: center;
  margin: 10px 0;
  font-size: 17px;
}
.form .link a{
  color: #333;
}
.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 #e6e6e6;
  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: #000;
  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;
}
.users .search input{
  position: absolute;
  height: 42px;
  width: calc(100% - 50px);
  font-size: 16px;
  padding: 0 13px;
  border: 1px solid #e6e6e6;
  outline: none;
  border-radius: 5px 0 0 5px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s ease;
}
.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: #fff;
  color: #333;
  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: #f1f1f1;
}
.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: #67676a;
}
.users-list a .status-dot{
  font-size: 12px;
  color: #468669;
  padding-left: 10px;
}
.users-list a .status-dot.offline{
  color: #ccc;
}

/* Chat Area CSS Start */
.chat-area header{
  display: flex;
  align-items: center;
  padding: 18px 30px;
}
.chat-area header .back-icon{
  color: #333;
  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;
}
.chat-box{
  position: relative;
  min-height: 500px;
  max-height: 500px;
  overflow-y: auto;
  padding: 10px 30px 20px 30px;
  background: #f7f7f7;
  box-shadow: inset 0 32px 32px -32px rgb(0 0 0 / 5%),
              inset 0 -32px 32px -32px rgb(0 0 0 / 5%);
}
.chat-box .text{
  position: absolute;
  top: 45%;
  left: 50%;
  width: calc(100% - 50px);
  text-align: center;
  transform: translate(-50%, -50%);
}
.chat-box .chat{
  margin: 15px 0;
}
.chat-box .chat p{
  word-wrap: break-word;
  padding: 8px 16px;
  box-shadow: 0 0 32px rgb(0 0 0 / 8%),
              0rem 16px 16px -16px rgb(0 0 0 / 10%);
}
.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{
    max-width: 220px;
    border-radius: 10px;
    cursor: pointer;
}
.chat-box .incoming .details{
  margin-right: auto;
  margin-left: 10px;
  max-width: calc(100% - 130px);
}
.incoming .details p{
  background: #fff;
  color: #333;
  border-radius: 18px 18px 18px 0;
}
.typing-area{
  padding: 18px 30px;
  display: flex;
  justify-content: space-between;
}
.typing-area input{
  height: 45px;
  width: calc(100% - 58px);
  font-size: 16px;
  padding: 0 13px;
  border: 1px solid #e6e6e6;
  outline: none;
  border-radius: 5px 0 0 5px;
}
.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;
}
.typing-area button.active{
  opacity: 1;
  pointer-events: auto;
}

/* Responive 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 .outogoing .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;
  }
}

/* .attach{cursor:pointer;padding:6px}
.chat img,.chat video{max-width:220px;border-radius:12px}
.chat audio{width:220px}
.file{background:#eee;padding:10px;border-radius:10px}
.msg-status{font-size:12px;margin-top:4px;display:block} */
/* 
.attach-menu{
  position:fixed;
  bottom:80px;
  left:20px;
  background:#fff;
  border-radius:10px;
  box-shadow:0 10px 30px rgba(0,0,0,.2);
  overflow:hidden;
}
.attach-menu div{
  padding:12px 20px;
  cursor:pointer;
}
.attach-menu div:hover{
  background:#f1f1f1;
}

.media-box{
  max-width:220px;
  border-radius:12px;
  overflow:hidden;
}
.media-box img{ width:100%; }

.media-box.video{
  height:140px;
  background:#000;
  color:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:40px;
}

.media-modal{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.85);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:9999;
}
.media-modal img,
.media-modal video{
  max-width:90%;
  max-height:90%;
}
 */




.chat.outgoing{
    justify-content:flex-end;
}

.chat.outgoing .details{
    background:#dcf8c600;
}

.chat.incoming{
    justify-content:flex-start;
}

.chat.incoming .details{
    background:#ffffff00;
}

.details{
    padding:10px 14px;
    border-radius:7px;
    max-width:75%;
    position:relative;
}

.tick{
    display:block;
    font-size:11px;
    text-align:right;
    color:#555;
}



.chat-img, .chat-video {
  max-width: 220px;
  border-radius: 10px;
  margin-top: 5px;
}

.chat-audio {
  width: 220px;
}

.chat-file {
  background:#eee;
  padding:8px;
  border-radius:8px;
  font-size:14px;
}


.upload-wrapper{
  position: relative;
}

.upload-wrapper button{
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  margin-right: 5px;
}



.upload-menu{
  position: absolute;
  bottom: 50px;
  left: 0;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.15);
  display: none;
  flex-direction: column;
  width: 160px;
  z-index: 10;
}

.upload-menu.show{
  display: flex;
}

.upload-menu label{
  padding: 10px;
  cursor: pointer;
}

.upload-menu label:hover{
  background: #f1f1f1;
}




.icon-btn{
  background:none;
  border:none;
  font-size:22px;
  cursor:pointer;
}

.upload-wrapper{
  position:relative;
}

.upload-menu{
  position:absolute;
  bottom:55px;
  left:0;
  width:200px;
  background:#fff;
  border-radius:14px;
  box-shadow:0 15px 40px rgba(0,0,0,.15);
  display:none;
  flex-direction:column;
  z-index:20;
  animation:fadeUp .2s ease;
}

.upload-menu.show{
  display:flex;
}

.upload-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:12px 14px;
  border-bottom:1px solid #eee;
  font-weight:500;
}

.upload-header button{
  background:none;
  border:none;
  font-size:16px;
  cursor:pointer;
}

.upload-item{
  display:flex;
  align-items:center;
  gap:10px;
  padding:14px;
  cursor:pointer;
  font-size:15px;
}

.upload-item:hover{
  background:#f5f5f5;
}

@keyframes fadeUp{
  from{opacity:0; transform:translateY(10px);}
  to{opacity:1; transform:translateY(0);}
}






.chat-input {
  display:flex;
  align-items:center;
  padding:10px;
  gap:10px;
  background:#fff;
  border-top:1px solid #eee;
}

.chat-input input[type=text]{
  flex:1;
  padding:12px 15px;
  border-radius:22px;
  border:1px solid #ddd;
  outline:none;
  font-size:14px;
}

.send-btn{
  width:44px;
  height:44px;
  border-radius:50%;
  border:none;
  background:#4fa3ff;
  color:#fff;
  font-size:18px;
  cursor:pointer;
}

.attach-area{
  position:relative;
}

.attach-btn{
  background:none;
  border:none;
  font-size:22px;
  cursor:pointer;
}

/* MENU */
.attach-wrapper {
  position: relative;
}

.attach-menu {
  position: absolute;
  bottom: 50px;
  left: 0;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.15);
  display: none;
}

.attach-menu div {
  padding: 10px 15px;
  cursor: pointer;
}

.attach-menu div:hover {
  background: #f1f1f1;
}

.attach-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:12px 14px;
  background:#f7f7f7;
  font-weight:600;
}

.attach-item{
  display:flex;
  gap:12px;
  align-items:center;
  padding:14px;
  cursor:pointer;
  font-size:14px;
}

.attach-item:hover{
  background:#f1f1f1;
}












/* ==== CHAT FIX ==== */
.chat.outgoing .details {
  margin-left: auto;
}
.chat.incoming .details {
  margin-right: auto;
}

.chat.outgoing p {
  background: #1f1f1f;
  color: #fff;
  border-radius: 18px 18px 4px 18px;
}

.chat.incoming p {
  background: #ffffff;
  color: #333;
  border-radius: 18px 18px 18px 4px;
}

/* ==== INPUT AREA ==== */
.typing-area {
  display: flex;
  align-items: center;
  gap: 8px;
}

.upload-btn,
.send-btn {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  background: #e5e5e5;
  font-size: 18px;
}

.send-btn {
  background: #4caf50;
  color: #fff;
}

/* ==== UPLOAD MENU ==== */
.upload-menu {
  position: absolute;
  bottom: 90px;
  left: 30px;
  width: 220px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 20px 40px rgba(0,0,0,.2);
  display: none;
  z-index: 999;
}

.upload-menu.show {
  display: block;
}

.upload-header {
  display: flex;
  justify-content: space-between;
  padding: 12px;
  border-bottom: 1px solid #eee;
  font-weight: bold;
}

.upload-option {
  display: block;
  padding: 12px;
  cursor: pointer;
  transition: background .2s;
}

.upload-option:hover {
  background: #f5f5f5;
}








.upload-wrapper {
  position: relative;
}

.upload-wrapper button {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  margin-right: 5px;
}

.upload-menu {
  position: absolute;
  bottom: 55px;
  left: 0;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.15);
  padding: 10px;
  display: none;
  width: 180px;
  z-index: 100;
}

.upload-menu label {
  display: block;
  padding: 10px;
  cursor: pointer;
  border-radius: 8px;
  font-size: 14px;
}

.upload-menu label:hover {
  background: #f1f1f1;
}

/* FILE BOX */
.file-box {
  display: flex;
  align-items: center;
  background: #fff;
  padding: 10px;
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0,0,0,.1);
  max-width: 250px;
}

.file-box span {
  margin-left: 10px;
  font-size: 14px;
  word-break: break-word;
}

/* MEDIA */
.chat img.media-img {
  max-width: 200px;
  border-radius: 12px;
  cursor: pointer;
}

.chat video,
.chat audio {
  max-width: 220px;
}




/* ATTACH MENU */
.attach-wrapper {
  position: relative;
}

#attachBtn {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
}

.attach-menu {
  position: absolute;
  bottom: 55px;
  left: 0;
  width: 220px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.15);
  display: none;
  overflow: hidden;
}

.attach-menu.active {
  display: block;
}

.menu-header {
  display: flex;
  justify-content: space-between;
  padding: 10px;
  font-weight: 600;
  border-bottom: 1px solid #eee;
}

.menu-item {
  padding: 12px;
  cursor: pointer;
  transition: background .2s;
}

.menu-item:hover {
  background: #f5f5f5;
}

/* AUDIO (Telegram style) */
.audio-box {
  background: #e9f3ff;
  padding: 10px;
  border-radius: 10px;
  width: 220px;
}

.audio-title {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 5px;
}

.audio-box audio {
  width: 100%;
}

/* UPLOAD PROGRESS */
.upload-status {
  font-size: 12px;
  color: #888;
  margin-top: 4px;
}

.progress {
  height: 4px;
  background: #ddd;
  border-radius: 5px;
  overflow: hidden;
  margin-top: 4px;
}

.progress span {
  display: block;
  height: 100%;
  width: 0;
  background: #4facfe;
}





/* Upload */

.attach-menu {
    display: none;
}

.attach-menu.show {
    display: block;
}



#sendBtn, #attachBtn {
    background: #333 !important;
    z-index: 999999 !important;
    pointer-events: auto !important;
}




.typing-area {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 10;
}

.icon-btn {
    width: 42px;
    height: 42px;
    border: none;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    z-index: 20;
    pointer-events: auto;
}

.attach-wrapper {
    position: relative;
    z-index: 30;
}

.attach-menu {
    position: absolute;
    bottom: 55px;
    left: 0;
    width: 180px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,.15);
    display: none;
    z-index: 999;
}

.attach-menu.show {
    display: block;
}







/* 

.file-preview-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.file-preview-box {
  background: #fff;
  width: 90%;
  max-width: 400px;
  border-radius: 12px;
  padding: 15px;
}

.preview-content img,
.preview-content video {
  width: 100%;
  border-radius: 10px;
}

.preview-actions {
  display: flex;
  gap: 10px;
  margin-top: 15px;
}

.preview-actions button {
  flex: 1;
  padding: 10px;
  border: none;
  cursor: pointer;
  border-radius: 8px;
}

#cancelFile {
  background: #ddd;
}

#confirmFile {
  background: #ff3b3b;
  color: #fff;
} */







.chat img.chat-image {
    max-width: 220px;
    border-radius: 10px;
    cursor: pointer;
}

.chat video.chat-video {
    max-width: 240px;
    border-radius: 8px;
}

.audio-msg {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.file-msg {
    display: inline-block;
    padding: 10px 14px;
    background: #eee;
    border-radius: 8px;
    text-decoration: none;
    color: #333;
    max-width: 220px;
    word-break: break-all;
}





.file-preview {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.file-preview .preview-box {
  background: #fff;
  width: 320px;
  max-width: 90%;
  border-radius: 12px;
  padding: 15px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

#previewContent {
  display: flex;
  justify-content: center;
  align-items: center;
  max-height: 250px;
  overflow: hidden;
}

#previewContent img,
#previewContent video {
  max-width: 100%;
  max-height: 230px;
  border-radius: 8px;
}

#previewContent audio {
  width: 100%;
}

.file-preview .actions {
  display: flex;
  justify-content: space-between;
  margin-top: 15px;
}

.file-preview button {
  flex: 1;
  border: none;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
}

#cancelFile {
  background: #eee;
  margin-right: 8px;
}

#confirmFile {
  background: #0088cc;
  color: #fff;
}







.upload-progress {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  width: 260px;
  background: #222;
  border-radius: 10px;
  padding: 10px;
  display: none;
  z-index: 9999;
}

.upload-bar {
  width: 0%;
  height: 4px;
  background: #4ea4ff;
  border-radius: 10px;
  transition: width .2s;
}

.upload-text {
  font-size: 12px;
  color: #aaa;
  margin-top: 6px;
  display: block;
  text-align: center;
}





.image-viewer {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.95);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 10000;
}

.image-viewer img {
  max-width: 95%;
  max-height: 90%;
  object-fit: contain;
}

.viewer-actions {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  gap: 10px;
}

.viewer-actions button,
.viewer-actions a {
  background: rgba(255,255,255,.1);
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
}










/* 🎵 Telegram Audio UI */
.tg-audio {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #e9f0ff;
  padding: 8px 12px;
  border-radius: 12px;
  max-width: 260px;
}

.outgoing .tg-audio {
  background: #2f80ff;
  color: #fff;
}

.tg-audio-play {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: #fff;
  color: #2f80ff;
  font-size: 14px;
}

.outgoing .tg-audio-play {
  background: #fff;
  color: #2f80ff;
}

.tg-audio-wave {
  display: flex;
  align-items: center;
  gap: 3px;
  flex: 1;
}

.wave-bar {
  width: 3px;
  height: 16px;
  background: #b0c4ff;
  border-radius: 2px;
  opacity: 0.6;
}

.outgoing .wave-bar {
  background: rgba(255,255,255,0.7);
}

.tg-audio.playing .wave-bar {
  animation: waveMove 1s infinite ease-in-out;
}

.tg-audio-time {
  font-size: 12px;
  min-width: 40px;
  text-align: right;
}

@keyframes waveMove {
  0% { height: 8px; }
  50% { height: 18px; }
  100% { height: 8px; }
}





.seen, .sent {
  display: block;
  font-size: 11px;
  margin-top: 4px;
  text-align: right;
  opacity: 0.6;
}

.outgoing .seen {
  color: #2f80ff;
}

.outgoing .sent {
  color: #999;
}

#scrollBottomBtn {
  position: absolute;
  bottom: 80px;
  right: 16px;
  background: #333;
  color: #fff;
  border: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  display: none;
}