/* Главная структура */
.app {
  display: none;
  height: 100vh;
  flex-direction: row;
  background: var(--color-chat);
}

.app--visible {
  display: flex;
}

/* Сайдбар */
.sidebar {
  width: var(--sidebar-width);
  background: var(--color-sidebar);
  border-right: 1px solid var(--color-bg);
  display: flex;
  flex-direction: column;
  position: relative;
  flex-shrink: 0;
}

.sidebar__header {
  padding: var(--space-xl);
  border-bottom: 1px solid var(--color-bg);
}

.dialogs {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-sm);
}

/* Чат */
.chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--color-chat);
  min-width: 0;
}

.chat__header {
  padding: var(--space-md) var(--space-xl);
  border-bottom: 1px solid var(--color-bg);
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.chat__partner {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex: 1;
}

.chat__partner-info {
  flex: 1;
  min-width: 0;
}

.chat__partner-name {
  font-weight: 600;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat__partner-status {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  font-style: normal;
}

.chat__partner-status--typing {
  font-style: italic;
  color: var(--color-accent);
}

.chat__actions {
  display: flex;
  gap: var(--space-sm);
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-xl);
}

.chat__input-area {
  padding: var(--space-xl);
  border-top: 1px solid var(--color-border);
}

/* Модальное окно */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.8);
  z-index: 2000;
  display: none;
  justify-content: center;
  align-items: center;
  border: none;
  padding: 0;
}

.modal[open] {
  display: flex;
}

.modal__content {
  width: 90vw;
  max-width: 450px;
  max-height: 80vh;
  background: var(--color-primary-dark);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-2xl);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal__header {
  padding: var(--space-xl);
  text-align: center;
  background: var(--color-message-own);
  color: white;
  font-size: var(--font-size-2xl);
  font-weight: 600;
  position: relative;
  flex-shrink: 0;
}

/* Адаптивность */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: -100%;
    transition: left var(--transition-normal);
    z-index: 100;
  }
  
  .sidebar--open {
    left: 0;
  }
  
  .chat__header {
    padding-left: 50px;
  }
}