/* structure.css - Чистая структурная разметка */
.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

.chats-panel {
  width: 25%;
  min-width: 320px;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}

.messages-panel {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 5;
}

/* СТРУКТУРА СООБЩЕНИЙ */
.message {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    max-width: 70%;
    position: relative;
    margin-bottom: 16px;
}

.message.incoming {
    align-self: flex-start;
    flex-direction: row;
}

.message.outgoing {
    align-self: flex-end;
    flex-direction: row-reverse;
}

/*.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
}*/

/*.message-avatar-image {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}
*/
.message-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.message-bubble {
    display: flex;
    flex-direction: column;
    padding: 14px 18px;
    border-radius: var(--radius-lg);
    position: relative;
    word-wrap: break-word;
    min-width: 120px;
    max-width: 100%;
}

.message-header {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
}

.message-sender {
    font-weight: 650;
    color: var(--text-primary);
    font-size: 14px;
}

.message-text {
    line-height: 1.5;
    font-size: 15px;
    font-weight: 450;
    word-wrap: break-word;
    margin-bottom: 4px;
}

.message-time {
    font-size: 12px;
    opacity: 0.7;
    align-self: flex-end;
    font-weight: 500;
}

.info-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 17%;
  min-width: 280px;
  height: 100%;
  z-index: 2000;
  transform: translateX(100%);
}

.info-panel.active {
  transform: translateX(0);
}

.side-menu {
  position: fixed;
  top: 0;
  left: 0;
  width: 17%;
  min-width: 280px;
  height: 100%;
  z-index: 1000;
  transform: translateX(-100%);
}

.side-menu.active {
  transform: translateX(0);
}

.messages-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  width: 100%;
}

.messages-container {
  flex: 1;
  display: flex;
  flex-direction: column-reverse;
  padding: 20px;
  overflow-y: auto;
  width: 100%;
}

.messages-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  margin: 0 auto;
  justify-content: flex-end;
  min-height: min-content;
}

.message-input-area {
  padding: 20px;
  position: relative;
  z-index: 20;
  flex-shrink: 0;
  width: 100%;
}

.input-container {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  width: 100%;
  margin: 0 auto;
}

.message {
  max-width: 75%;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  position: relative;
}

.message.incoming {
  align-self: flex-start;
  flex-direction: row;
}

.message.outgoing {
  align-self: flex-end;
  flex-direction: row-reverse;
}



/* Ограничиваем показ 100 сообщений */
.messages-list::before {
  content: "";
  flex: 1;
  min-height: 0;
}

/* Мобильная адаптация */
@media (max-width: 767px) {
  .app-container {
    position: fixed;
    height: 100%;
    width: 100%;
  }
  
  .chats-panel {
    position: fixed;
    width: 100% !important;
    height: 100%;
    z-index: 100;
    transform: translateX(-100%);
  }
  
  .chats-panel.active {
    transform: translateX(0);
  }
  
  .messages-panel {
    width: 100%;
    transform: translateX(0);
    position: fixed !important;
    top: 0;
    left: 0;
    height: 100%;
    z-index: 99;
  }

  .back-button {
    display: flex !important;
  }
  
  .info-panel {
    width: 100%;
    transform: translateX(100%);
  }
  
  .info-panel.active {
    transform: translateX(0);
  }
  
  .side-menu {
    width: 100%;
  }
  
  .message {
    max-width: 85%;
  }

}

/* СКРОЛЛБАРЫ ДЛЯ ВСЕХ ПАНЕЛЕЙ */
.chats-list,
.messages-container,
.info-content {
    scrollbar-width: thin;
    scrollbar-color: var(--neu-shadow-dark) transparent;
}

/* Webkit скроллбары (Chrome, Safari, Edge) */
.chats-list::-webkit-scrollbar,
.messages-container::-webkit-scrollbar,
.info-content::-webkit-scrollbar {
    width: 6px;
}

.chats-list::-webkit-scrollbar-track,
.messages-container::-webkit-scrollbar-track,
.info-content::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 3px;
}

.chats-list::-webkit-scrollbar-thumb,
.messages-container::-webkit-scrollbar-thumb,
.info-content::-webkit-scrollbar-thumb {
    background: var(--neu-shadow-dark);
    border-radius: 3px;
}

.chats-list::-webkit-scrollbar-thumb:hover,
.messages-container::-webkit-scrollbar-thumb:hover,
.info-content::-webkit-scrollbar-thumb:hover {
    background: var(--neu-shadow-light);
}

/* Для тёмной темы */
[data-theme="dark"] .chats-list::-webkit-scrollbar-thumb,
[data-theme="dark"] .messages-container::-webkit-scrollbar-thumb,
[data-theme="dark"] .info-content::-webkit-scrollbar-thumb {
    background: var(--neu-shadow-light);
}

[data-theme="dark"] .chats-list::-webkit-scrollbar-thumb:hover,
[data-theme="dark"] .messages-container::-webkit-scrollbar-thumb:hover,
[data-theme="dark"] .info-content::-webkit-scrollbar-thumb:hover {
    background: var(--neu-shadow-dark);
}

/* Планшетная адаптация */
@media (min-width: 768px) and (max-width: 1024px) {
  .chats-panel {
    width: 35%;
  }
  
  .info-panel {
    width: 25%;
  }
}

/* Десктопная адаптация */
@media (min-width: 1025px) {
  .chats-panel {
    width: 25%;
  }
  
  .info-panel {
    width: 17%;
  }
}




/* PWA specific styles */
.pwa-mode .app-container {
  height: 100vh;
  height: -webkit-fill-available; /* Для iOS */
}

/* Убираем адресную строку на мобильных в PWA */
@media (display-mode: standalone) {
  body {
    overscroll-behavior: none; /* Убирает pull-to-refresh */
  }
  
  .app-container {
    height: 100vh;
  }
}

/* Для iOS в standalone режиме */
@supports (-webkit-touch-callout: none) {
  .pwa-mode .app-container {
    height: -webkit-fill-available;
  }
}