* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: Arial, Helvetica, sans-serif;
  user-select: none;
}

.spinner{
  font-size: 24px;
}

body, html {
  height: 100%;
}

body {
  background-color: #1f1f1f;
  color: #e5e5e5;
}

/* Ширина всего скроллбара */
::-webkit-scrollbar {
  width: 0px; 
}

/* AUTH PAGE */
.auth-container {
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column; /* уже колонка */
  gap: 15px;
  padding: 20px;
}

.auth-container h1 {
  font-size: 60px;
  font-weight: 600;
  text-align: start; /* для заголовка */
}

.auth-container div{
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  gap: 10px;
}

.auth-container input,
.auth-container button {
  display: block; /* важное исправление */
  width: 50%;
  align-items: center;
  justify-content: center;
  padding: 12px;
  border-radius: 8px;
  border: none;
  background: #292929;
  color: white;
  font-size: 24px;
  margin-top: 5px;
  height: 60px;
}

.auth-container button {
  background: #2c2c2c;
  cursor: pointer;
  transition: 0.2s;
  font-size: 24px;
}

.auth-container button:hover {
  background: #3a3a3a;
}

.switch-text {
  font-size: 20px;
  opacity: 0.7;
  cursor: pointer;
  text-align: center;
  width: 100%;
  margin-top: 10px;
}

/* message-menu */
.message-menu {
  position: fixed;
  background: #1e1e1e;
  border-radius: 8px;
  padding: 6px;
  display: none;
  flex-direction: column;
  z-index: 1000;
}

.message-menu div {
  padding: 6px;
  cursor: pointer;
  border-radius: 10px;
  font-size: 24px;
}

.message-menu div:hover {
  background: #333;
}

/* CHAT PAGE */
.chat-wrapper {
  display: flex;
  height: 100vh;
  width: 100%;
}

/* LEFT SIDEBAR */
.sidebar {
  width: 35%;
  max-width: 300px;
  background: #222222;
  display: flex;
  flex-direction: column;
  padding: 20px;
  border-right: #161616 solid 1px;
  flex-shrink: 0;
  gap: 10px;
}

#myProfileBtn {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  cursor: pointer;
  margin-bottom: 10px;
}

.search-bar {
  display: flex;
  align-items: center;
  min-width: none;
  height: 36px;
  max-height: 46px;
  margin-bottom: 50px;
}

.search-bar input {
  flex: 1;
  padding: 6px 10px;
  border-radius: 10px;
  border: none;
  background: #333;
  color: white;
  font-size: 14px;
  height: 100%;
  outline: none;
}

.search-bar button {
  background: #444;
  color: white;
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  margin-left: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar h2 {
  height: 100%;
  font-size: 30px;
  display: flex;
  justify-content: left;
  align-items: center;
  margin-left: 5px;
}

.chat-item {
  padding: 10px;
  border-radius: 10px 20px 20px 10px;
  margin-bottom: 8px;
  background: #1f1f1f;
  cursor: pointer;
  transition: 0.2s;
  min-height: 50px;
  height: 100%;
  display: flex;
  justify-content: left;
  align-items: center;
  font-size: 24px;
}

.chat-item:hover {
  background: #2a2a2a;
}

/* RIGHT CHAT AREA */
#chatArea {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #121212;
}

.chat-container{
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* Navbar */
.chat-navbar {
  height: 60px;
  background: #1e1e1e;
  display: flex;
  flex-direction: row;
  width: 100%;
  justify-content: space-between;
  align-items: center;
  padding: 0 15px;
  border-bottom: 1px solid #2a2a2a;
}

.chat-title {
  font-weight: bold;
  font-size: 24px;
}

.chat-info{
  font-size: 30px;
  cursor: pointer;
  background: none;
  border: none;
  outline: none;
  color: white;
}

.chat-menu {
  display: none;
  position: absolute;
  background: #222222;
  border: #333 solid 1px;
  border-radius: 8px;
  padding: 8px;
  font-size: 14px;
  top: 50px;
  right: 10px;
  height: 150px;
  width: 230px;
  text-align: center;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  gap: 5px;
  z-index: 1;
}

.chat-menu div {
  padding: 10 px;
  cursor: pointer;
  font-size: 24px;
  border-radius: 10px;
  border-bottom: #444444 solid 1px;
  width: 100%;
  height: 40%;
  background: #2c2c2c;
  display: flex;
  justify-content: center;
  align-items: center ;
  transition: all 300ms;
}
.chat-menu div:hover{
  transform: scale(1.05);
}

.chat-menu div:hover {
  background: #333;
}

/* Messages */
.messages {
  flex: 1;
  padding: 20px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  transition: all 300ms;
}

.message {
  max-width: 60%;
  padding: 10px 14px;
  margin-bottom: 8px;
  border-radius: 16px;
  word-wrap: break-word;
  font-size: 30px;
  transition: all 500ms;
}

.sent {
  align-self: flex-end;
  background: #0247c7;
}

.sent img{
  border-radius: 10px;
  cursor: pointer;
}

.received {
  align-self: flex-start;
  background: #1f1f1f;
}
.received img{
  border-radius: 10px;
}

.edited {
  font-size: 10px;
  opacity: 0.6;
}

/* Bio */
.bio-input{
  border: none;
  outline: none;
  background-color: #222222;
  color: white;
  height: 20%;
  width: 100%;
  border-radius: 10px;
  padding: 10px;
  font-size: 24px;
  resize: none;
}

.bio-btn{
  border: none;
  outline: none;
  padding: 10px;
  border-radius: 10px;
  background-color: #222222;
  color: white;
  font-size: 24px;
  cursor: pointer;
}

/* Input */
.input-area {
  display: flex;
  background: #151515;
  height: 7%;
}

.input-area-input{
  flex: 1;
  font-size: 26px;
  padding: 15px 10px 10px 10px;
  border: none;
  background: #1e1e1e;
  color: white;
  outline: none;
  resize: none;
  border-top-right-radius: 10px;
  border-bottom-right-radius: 10px;
}

.send-btn {
  padding: 10px 20px;
  font-size: 26px;
  border-top-right-radius: 20px;
  border-bottom-right-radius: 20px;
  border: none;
  background: #2c2c2c;
  color: white;
  cursor: pointer;
}
.file{
  padding: 10px 20px;
  font-size: 26px;
  border-top-left-radius: 20px;
  border-bottom-left-radius: 20px;
  border: none;
  background: #2c2c2c;
  color: white;
  cursor: pointer;
  transition: all 300ms;
}
.input-area button:hover{
  border-radius: 20px;
  background: #333;
}
/* reply */
.reply{
  background: #2c2c2c;
  border: #2a2a2a solid 1px;
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
  font-size: 24px;
  position: fixed;
  width: auto;
  height: 5%;
  bottom: 7%;
  display: flex;
  padding: 10px;
  transition: all 300ms;
  cursor: pointer;
}
.highlight {
  background: rgba(220, 220, 220, 0.3);
  border-radius: 10px;
  width: 100%;
  transition: all 300ms;
}

.reply-box {
  background: rgba(200,200,200,0.15);
  border-left: 3px solid #ccc;
  padding: 6px;
  border-radius: 8px;
  margin-bottom: 4px;
  cursor: pointer;
  transition: all 300ms;
}

.reply-user {
  font-weight: bold;
  font-size: 13px;
  margin-bottom: 2px;
}

.reply-text {
  font-size: 13px;
  opacity: 0.8;
}

/* No chat */
#noChat {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 24px;
  color: #888;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.7);
  display: none;
  justify-content: center;
  align-items: center;
}

.modal-content {
  background: #1e1e1e;
  width: 400px;
  height: 500px;
  border-radius: 15px;
  padding: 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
}

.modal-header{
  display: flex;
  align-items: center;
  justify-content: right;
  gap: 10px;
}

.profile-body{
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-direction: column; 
  height: 90%;
  padding: 10px;
}

.close {
  cursor: pointer;
  background: none;
  border: none;
  outline: none;
  color: white;
}

.h2{
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  height: 100px;
  width: 100%;
  margin-bottom: 20px;
  border-bottom: #121212 solid 1px;
}
.avatar-large {
  width: 80px;
  height: 80%;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
}
.avatar-large img{
  width: 100%;
  height: 100%;
}

.logout-btn {
  margin-top: 15px;
  padding: 10px;
  width: 100%;
  border: none;
  border-radius: 8px;
  background: #ff4d4d;
  color: white;
  cursor: pointer;
  font-size: 22px;
}

.text{
  font-size: 24px;
}
.choose{
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
}
.da{
  border: none;
  outline: none;
  background: #333;
  color: white;
  padding: 10px 15px;
  border-radius: 10px;
  font-size: 24px;
  cursor: pointer;
  transition: all 300ms;
}
.da:hover{
  transform: scale(1.05);
  background: #444;
}

/* modal-prof */
.modal-prof{
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.7);
  display: none;
  justify-content: center;
  align-items: center;
}

.modal-prof-content{
  background: #1e1e1e;
  width: 400px;
  height: 500px;
  border-radius: 15px;
  padding: 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
}
.modal-prof-content h3{
  font-size: 30px;
  height: 20%;
  text-align: center;
}
.modal-prof-content p{
  font-size: 24px;
  height: 20%;
  text-align: center;
  display: flex;
  justify-content: center;
  align-items: center;
  padding-bottom: 50px;
}
.describe{
  background: #2c2c2c;
  border-radius: 20px;
}
.modal-prof-header{
  display: flex;
  align-items: center;
  justify-content: right;
  gap: 10px;
}
.prof-text{
  font-size: 24px;
  max-height: 20px;
}
.contact-box{
  border-top: #161616 solid 1px;
  padding: 20px;
}
.contact-box input{
  background: #333;
  color: white;
  border: none;
  outline: none;
  font-size: 24px;
  padding: 15px;
  border-radius: 10px;
  margin-bottom: 20px;
}
.contact-box button{
  background: #333;
  color: white;
  border: none;
  outline: none;
  padding: 15px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 20px;
  transition: all 300ms;
}
.contact-box button:hover{
  transform: scale(1.05);
}

.time {
  font-size: 12px;
  opacity: 0.6;
  margin-left: 8px;
}

.label{
  font-size: 22px;
}
.box{
  outline: none;
  border: none;
  color: white;
  width: 20px;
  height: 20px;
  cursor: pointer;
}

#avatar-friend {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}
.change-ava{
  border: none;
  outline: none;
  padding: 10px;
  border-radius: 10px;
  background: #2c2c2c;
  font-size: 24px;
  color: white;
  cursor: pointer;
  transition: all 300ms;
}
.change-ava:hover{
  transform: scale(1.05);
  background-color: #444;
}

/*media*/
.video-note {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #0088cc;
  background: #000;
}

.voice-msg {
  max-width: 100%;
  height: 35px;
}

/* Эффект пульсации кнопки при записи */
.recording {
  color: red !important;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
} 
.send-btn.recording-active {
  background-color: #ff4b4b !important; /* Красная кнопка во время записи */
  color: white !important;
  transform: scale(1.2);
  box-shadow: 0 0 15px rgba(255, 75, 75, 0.5);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.7; }
  100% { opacity: 1; }
}

/* Стили для кружка-видео */
.video-note {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #0088cc;
  display: block;
  margin: 10px 0;
}

#videoRecordPreview {
  position: fixed;
  /* Центрирование */
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scaleX(-1); /* Центр + зеркальное отображение */
  
  width: 350px;  /* Оптимальный размер для мобилок */
  height: 350px;
  
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid #0088cc;
  background-color: #000; /* Черный фон, чтобы не было прозрачности до старта */
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
  z-index: 10000; /* Поверх всех модалок и чата */
  pointer-events: none; /* Чтобы превью не мешало кликать по кнопке "Стоп" */
}

.send-btn {
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  touch-action: none; /* Запрещает браузеру самому обрабатывать жесты */
}

.chat-status {
  font-size: 16px;
  color: #888;
  text-align: center;
}
.chat-status.online {
  color: #0088cc; /* Синий как в ТГ */
}
.msg-status {
  font-size: 10px;
  margin-left: 5px;
  opacity: 0.7;
}
.online-label {
  color: #0088cc;
  font-size: 10px;
  margin-left: 5px;
}
.chat-info-container {
  display: flex;
  flex-direction: column;
}

/* Mobile adaptive */
@media (max-width: 800px) {
  .sidebar {
    width: 40%;
  }
  .sidebar h2{
    height: 100%;
    width: 100%;
  }

  .chat-item {
    font-size: 12px;
    padding: 8px;
  }

  .messages .message {
    max-width: 80%;
  }

  .search-bar {
    flex-direction: column;
  }
}