/* Подключение шрифтов */
@font-face {
  font-family: 'PT Root UI';
  src: url('https://www.cbr.ru/common/fonts/PT%20Root%20UI_Bold.woff2') format('woff2');
  font-weight: bold;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'PT Russia Text';
  src: url('https://www.cbr.ru/common/fonts/PT_Russia-Text-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'PT Russia Text';
  src: url('https://www.cbr.ru/common/fonts/PT_Russia-Text.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root{
  --bg:#0b0f1a; --fg:#e6edf3;
  --card:#0e1624; --line:#263041;
  --pri:#2353e6;
  --ar-main: 16/9;        /* динамически меняем из JS */
  --fit-main: contain;    /* contain для камеры, cover для экрана */
  --ar-prev: 16/9;        /* превью локальной камеры */
}

/* базовое */
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0; 
  background-color: var(--bg);
  background-image: url('../images/background.jpg');
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
  background-attachment: fixed;
  color:var(--fg); 
  font-family: 'PT Russia Text', 'PT Root UI', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  min-height: 100vh;
}
.page{
  max-width:1000px; 
  margin:0 auto;
  position: relative;
  min-height: 100vh;
}

/* Полупрозрачный оверлей для лучшей читаемости */
.page::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(11, 15, 26, 0.4); /* Уменьшаем прозрачность чтобы фон был виден */
  z-index: -1;
  pointer-events: none; /* Не блокируем взаимодействие */
}

/* Применение шрифтов к различным элементам */
h1, h2, h3, h4, h5, h6, .modal-header h3 {
  font-family: 'PT Root UI', 'PT Russia Text', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-weight: bold;
}

button, input, select, textarea, .msg, .chat-log, .meta {
  font-family: 'PT Russia Text', 'PT Root UI', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

.attached-files-title, .room-name-link, .form-hint {
  font-family: 'PT Russia Text', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-weight: 500;
}

/* top bar */
.topbar{
  display:flex; flex-direction: row; align-items: center; gap:12px;
  padding:12px; border-bottom:1px solid var(--line);
  flex-wrap: wrap;
}

/* Верхняя строка: логотип/пользователь слева, статус справа */
.top-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
}

.status-container {
  display: flex;
  align-items: center;
  flex: 1; /* Занимает оставшееся место */
  justify-content: flex-end;
  min-width: 0;
}

.status-container #status {
  font-size: 14px;
  color: #93a0b4;
  font-weight: 500;
  transition: color 0.3s ease;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 280px;
  background: rgba(0, 0, 0, 0.2);
  padding: 12px 16px;
  border-radius: 6px;
  height: 44px;
  display: flex;
  align-items: center;
  box-sizing: border-box;
}

.status-container #status.connected {
  color: #28a745;
  background: rgba(40, 167, 69, 0.1);
}

.status-container #status.error {
  color: #dc3545;
  background: rgba(220, 53, 69, 0.1);
}

.status-container #status.warning {
  color: #ffc107;
  background: rgba(255, 193, 7, 0.1);
}

.topbar .room-actions{
  display:flex; gap:8px; align-items:center;
  flex-wrap: nowrap; /* Запрещаем перенос строки */
  flex: 0 0 auto;
  order: 2; /* Размещаем в конце */
  margin-left: auto; /* Прижимаем к правому краю */
}

/* Для гостей на ПК - размещаем room-actions справа на том же уровне */
body:has(.guest-info) .topbar {
  align-items: center;
}

body:has(.guest-info) .top-row {
  flex: 1;
  justify-content: space-between;
}

body:has(.guest-info) .room-actions {
  order: 0; /* Сбрасываем order для гостей */
  flex: 0 0 auto;
}

/* Базовые стили для поля ввода и кнопки */
#roomId {
  font-size: 16px; 
  padding: 12px; 
  text-align: center;
  box-sizing: border-box;
  width: 120px; /* Фиксированная ширина как у кнопки */
  height: 44px; /* Высота как у кнопки */
}

#roomId::placeholder {
  font-size: 10px;
  color: #93a0b4;
}

#btnJoin {
  white-space: nowrap;
  box-sizing: border-box;
  height: 44px;
  padding: 12px 16px;
}

/* Статус для мобильных гостей */
.mobile-guest-status {
  margin-top: 12px;
  padding: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: center;
  font-size: 16px;
  font-weight: 500;
}

.mobile-guest-status.waiting {
  border-color: #ffa500;
  background: rgba(255, 165, 0, 0.1);
  color: #ffa500;
}

.mobile-guest-status.connecting {
  border-color: #2353e6;
  background: rgba(35, 83, 230, 0.1);
  color: #2353e6;
}

.mobile-guest-status.connected {
  border-color: #28a745;
  background: rgba(40, 167, 69, 0.1);
  color: #28a745;
}

.hidden {
  display: none !important;
}

/* Кнопки управления медиа в карточке видео */
  .media-actions{
    display: flex; 
    gap: 10px; 
    align-items: center; 
    justify-content: flex-end;
    margin-top: 10px;
    padding: 8px;
    border-radius: 8px;
  }

  /* Стили для медиа кнопок с иконками */
  .media-btn {
    padding: 8px;
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--fg);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.3s;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .media-btn:hover {
    background: var(--line);
  }

  .media-btn.active {
    background: var(--pri);
    color: white;
  }

  .media-btn.active.blinking {
    animation: blink 1.5s infinite;
  }

  .btn-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
  }

  /* Анимация мигания для активных состояний */
  @keyframes blink {
    0%, 50% {
      opacity: 1;
    }
    51%, 100% {
      opacity: 0.3;
    }
  }

  /* Стили для кнопок чата */
  .file-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.3s;
    width: 40px;
    height: 40px;
  }

  .file-btn:hover {
    background: var(--line);
  }

  .send-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    background: var(--pri);
    border: 1px solid var(--pri);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.3s;
    width: 40px;
    height: 40px;
  }

  .send-btn:hover {
    background: #1a44c2;
  }

/* Фейковая кнопка "Прекратить демонстрацию" для гостя */
.fake-stop-screen-btn {
  background: #dc3545 !important;
  color: white !important;
  border: none !important;
  padding: 8px 12px !important;
  border-radius: 6px !important;
  font-size: 14px !important;
  cursor: pointer !important;
  transition: all 0.3s ease !important;
}

.fake-stop-screen-btn:hover {
  background: #c82333 !important;
  transform: scale(1.05) !important;
}

.fake-stop-screen-btn:active {
  transform: scale(0.95) !important;
}

.topbar .user-info{
  display:flex; 
  gap:8px; 
  align-items:center;
  flex: 0 0 auto; /* Не растягиваем */
  max-width: 50%; /* Ограничиваем ширину */
}

.topbar .user-info #currentUser {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
  color: #1a252f; /* Более темный цвет */
  font-weight: 600;
}

.topbar .guest-info{
  display:flex; 
  gap:8px; 
  align-items:center;
  flex: 0 0 auto;
}

/* Стили для логотипа */
.home-logo {
  height: 32px;
  width: auto;
  object-fit: contain;
}

/* Стили для отображения ID текущей комнаты */
.current-room-info {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
  background: rgba(35, 83, 230, 0.1);
  border: 1px solid var(--pri);
  border-radius: 8px;
  flex: 0 0 auto; /* Не растягиваем */
  order: 1; /* Размещаем между user-info и room-actions */
}

  .room-details {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
  }

  .room-name-link {
    color: var(--fg);
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .room-name-link:hover {
    background: rgba(255, 255, 255, 0.1);
    text-decoration: underline;
  }

  .room-id-label {
    color: #93a0b4;
    font-size: 14px;
  }

.room-id-link {
  color: var(--pri);
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.room-id-link:hover {
  background: rgba(35, 83, 230, 0.2);
}

.btn-logout{
  background:#dc3545; color:white; font-size:12px; padding:8px 12px;
}
input{
  padding:10px 12px; border-radius:10px;
  border:1px solid var(--line); background:#101826; color:var(--fg);
}
button{
  padding:10px 12px; border:0; border-radius:10px; background:#22314f; color:var(--fg); cursor:pointer;
}
button.primary{ background:var(--pri); color:white; }
#status{opacity:.8}

/* layout */
.layout{
  display:grid; grid-template-columns: auto 340px; gap:12px;
  padding:12px; height:calc(100vh - 70px);
  align-items: start; /* Карточки прижимаются к верху */
}
.card{
  background:var(--card); border:1px solid var(--line);
  border-radius:10px; padding:10px; display:flex; flex-direction:column; gap:8px;
}

/* Карточка с главным видео не растягивается */
.card:has(.main-video) {
  align-self: start; /* Не растягивается по высоте */
}
h4{ margin:0 0 6px 0; color:#cbd5e1; font-weight:600; }

/* 1) Главное видео — компактное и аккуратное */
.main-video{
  width:100%;
  aspect-ratio: 16/9; /* Фиксированное соотношение вместо переменной */
  max-height: 50vh; /* Меньше максимальная высота */
  min-height: 200px; /* Меньше минимальная высота */
  border:1px solid var(--line);
  border-radius:12px;
  background:#000;
  overflow:hidden;
  position: relative; /* Для позиционирования кнопки fullscreen */
}
.main-video video{
  width:100%; height:100%;
  object-fit: var(--fit-main);   /* JS ставит 'contain' */
  border-radius:12px;
}

/* Кнопка полноэкранного режима */
.fullscreen-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 16px;
  cursor: pointer;
  z-index: 10;
  transition: all 0.3s ease;
  opacity: 0.8;
}

.fullscreen-btn:hover {
  background: rgba(0, 0, 0, 0.9);
  opacity: 1;
  transform: scale(1.1);
}

.fullscreen-btn:active {
  transform: scale(0.95);
}

/* Кнопка театрального режима */
.theater-btn {
  position: absolute;
  top: 10px;
  right: 50px; /* Слева от кнопки fullscreen */
  background: rgba(0, 0, 0, 0.7);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 16px;
  cursor: pointer;
  z-index: 10;
  transition: all 0.3s ease;
  opacity: 0.8;
}

.theater-btn:hover {
  background: rgba(0, 0, 0, 0.9);
  opacity: 1;
  transform: scale(1.1);
}

.theater-btn:active {
  transform: scale(0.95);
}

/* Стили для театрального режима */
.theater-mode {
  max-width: 100% !important; /* Растягиваем страницу на всю ширину экрана */
  margin: 0 !important;
  padding: 0 8px !important; /* Небольшие отступы от краев */
}

.theater-mode .layout {
  grid-template-columns: 1fr 280px !important; /* Видео еще шире, sidebar еще уже */
  gap: 8px !important;
}

.theater-mode .main-video {
  max-height: 80vh !important; /* Увеличиваем высоту до 80% экрана */
  min-height: 500px !important;
}

.theater-mode .sidebar {
  max-height: 70vh !important;
}

.theater-mode .sidebar .card {
  padding: 8px !important; /* Компактнее */
}

.theater-mode .sidebar .card h4 {
  font-size: 14px !important;
  margin: 0 0 8px 0 !important;
}

.theater-mode .preview {
  max-height: 15vh !important; /* Уменьшаем превью */
}

.theater-mode .chat {
  flex: 1 !important;
}

.theater-mode .chat-log {
  max-height: 250px !important; /* Ограничиваем высоту чата */
  font-size: 13px !important; /* Компактный текст */
}

.theater-mode .chat-log .msg {
  margin: 4px 0 !important; /* Компактные отступы */
}

.theater-mode .chat-log .meta {
  font-size: 11px !important; /* Еще меньше мета информация */
}

/* Мобильная адаптация театрального режима */
@media (max-width: 768px) {
  /* Скрываем театральную кнопку на мобильных */
  .theater-btn {
    display: none !important;
  }
  
  /* Обеспечиваем видимость fullscreen кнопки на мобильных для хостов */
  body:has(.user-info) .fullscreen-btn {
    display: block !important;
    position: absolute !important;
    top: 10px !important;
    right: 10px !important;
    z-index: 1000 !important;
    background: rgba(0, 0, 0, 0.8) !important;
    color: white !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 12px 14px !important;
    font-size: 20px !important;
    cursor: pointer !important;
    opacity: 0.9 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
  }
  
  .fullscreen-btn:hover,
  .fullscreen-btn:active {
    background: rgba(0, 0, 0, 0.95) !important;
    opacity: 1 !important;
    transform: scale(1.05) !important;
  }
  
  .theater-mode .layout {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }
  
  .theater-mode .main-video {
    max-height: 50vh !important;
    min-height: 250px !important;
  }
  
  .theater-mode .sidebar {
    max-height: 40vh !important;
  }
  
  .theater-mode .preview {
  max-height: 12vh !important;
}

/* Адаптация кнопок для театрального режима */
.theater-mode .media-actions {
  gap: 6px !important;
  padding: 6px !important;
}

.theater-mode .media-actions button {
  padding: 6px 8px !important;
  font-size: 12px !important;
  min-width: 32px !important;
  height: 32px !important;
}

.theater-mode .chat-input-row {
  gap: 6px !important;
}

.theater-mode #chatForm button,
.theater-mode #chatForm .file-btn {
  padding: 6px 8px !important;
  font-size: 13px !important;
  min-width: 36px !important;
  height: 36px !important;
}

.theater-mode #chatForm input[type="text"] {
  height: 36px !important;
  font-size: 13px !important;
  padding: 6px 8px !important;
}
}

/* Стили для полноэкранного режима */
.fullscreen-active {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  max-height: none !important;
  min-height: none !important;
  z-index: 9999 !important;
  background: #000 !important;
  border: none !important;
  border-radius: 0 !important;
}

.fullscreen-active video {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  border-radius: 0 !important;
}

.fullscreen-active .fullscreen-btn {
  top: 20px !important;
  right: 20px !important;
  font-size: 20px !important;
  padding: 12px 15px !important;
  background: rgba(0, 0, 0, 0.8) !important;
}

.fullscreen-active .cam-overlay {
  position: absolute !important;
  bottom: 20px !important;
  right: 20px !important;
  width: 200px !important;
  height: 150px !important;
  border: 2px solid white !important;
  border-radius: 8px !important;
  z-index: 10000 !important;
}

/* Перетаскиваемое окно камеры в полноэкранном режиме */
.fullscreen-active .draggable-camera {
  position: absolute !important;
  bottom: 20px !important;
  right: 20px !important;
  width: 200px !important;
  height: 150px !important;
  border: 2px solid white !important;
  border-radius: 8px !important;
  z-index: 10001 !important;
  cursor: move !important;
  overflow: hidden !important;
  background: #000 !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5) !important;
}

.fullscreen-active .draggable-camera video {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  border-radius: 6px !important;
}

.fullscreen-active .draggable-camera.dragging {
  transition: none !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7) !important;
}

/* Мобильная адаптация для перетаскиваемого окна */
@media (max-width: 768px) {
  .fullscreen-active .draggable-camera {
    width: 120px !important;
    height: 90px !important;
    bottom: 15px !important;
    right: 15px !important;
  }
  
  .fullscreen-active .fullscreen-btn {
    top: 15px !important;
    right: 15px !important;
    font-size: 18px !important;
    padding: 10px 12px !important;
  }
}

/* 2) Sidebar */
.sidebar{
  display:flex; flex-direction:column; gap:12px;
  overflow:auto; max-height:calc(100vh - 20px);
}

/* превью локальной камеры */
.preview{
  width:100%;
  aspect-ratio: var(--ar-prev);
  max-height: 22vh;
  border:1px solid var(--line);
  border-radius:12px; background:#000; overflow:hidden;
}
.preview video{ width:100%; height:100%; object-fit:contain; border-radius:12px }

/* Для ПК версии: фиксированная высота previewBox */
@media (min-width: 769px) {
  .sidebar .card:has(.preview) {
    display: flex;
    flex-direction: column;
  }
  
  .sidebar .card:has(.preview) .preview {
    height: 281px;
    max-height: 281px;
    min-height: 281px;
    aspect-ratio: 16/9;
  }
  
  .sidebar .card:has(.preview) .media-actions {
    flex: 0 0 auto;
  }
}

/* карточка «Камера собеседника» с заглушкой */
.empty{
  border:1px dashed var(--line);
  border-radius:10px;
  padding:16px;
  text-align:center;
  color:#93a0b4;
}

/* чат */
.chat{ 
  display: flex; 
  flex-direction: column; 
  height: auto;
  min-height: 310px;
  transition: height 0.3s ease; /* Плавное изменение высоты */
}

.chat h4 {
  flex-shrink: 0;
  margin: 0 0 8px 0;
}

.chat .chat-log{
  height: 250px;
  flex-shrink: 0;
  overflow: auto; 
  background: #0b1422; 
  border: 1px solid var(--line);
  border-radius: 10px; 
  padding: 8px;
}
.msg{ margin:9px 0; }
.msg .meta{ font-size:12px; opacity:.7; }
.msg a{ color:#6ab0ff; text-decoration:none; }
#chatForm{ display:flex; gap:8px; flex-direction: column; flex-shrink: 0; }
.chat-input-row{ 
  display: flex; 
  gap: 8px; 
  align-items: stretch; /* Выравниваем элементы по высоте */
}

/* Область прикрепленных файлов */
.attached-files {
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--card);
  transition: all 0.3s ease;
}

.attached-files-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(35, 83, 230, 0.1);
}

.attached-files-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
}

.clear-all-btn {
  background: #dc3545;
  color: white;
  border: none;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.2s;
}

.clear-all-btn:hover {
  background: #c82333;
}

.attached-files-list {
  padding: 8px;
  max-height: 150px;
  overflow-y: auto;
}

.attached-file-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 8px;
  margin-bottom: 4px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  transition: background 0.2s;
}

.attached-file-item:last-child {
  margin-bottom: 0;
}

.attached-file-item:hover {
  background: var(--line);
}

.attached-file-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.attached-file-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.attached-file-details {
  flex: 1;
  min-width: 0;
}

.attached-file-name {
  font-size: 14px;
  color: var(--fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 2px;
}

.attached-file-size {
  font-size: 12px;
  color: #93a0b4;
}

.remove-file-btn {
  background: #dc3545;
  color: white;
  border: none;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 11px;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}

.remove-file-btn:hover {
  background: #c82333;
}
#chatForm input[type="text"]{ 
  flex: 1; 
  height: 44px; /* Одинаковая высота с кнопками */
  box-sizing: border-box;
}



/* Стилизация кнопки файла как кнопки submit */
#chatForm .file-btn{
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: #22314f;
  color: var(--fg);
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 44px; /* Фиксированная высота */
  transition: all 0.2s ease;
  flex-shrink: 0;
}

#chatForm .file-btn:hover{
  background: #2a3f5f;
  transform: translateY(-1px);
}

#chatForm button[type="submit"]{
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: var(--pri);
  color: white;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 44px; /* Фиксированная высота */
  transition: all 0.2s ease;
  flex-shrink: 0;
}

#chatForm button[type="submit"]:hover{
  background: #4a90e2;
  transform: translateY(-1px);
}

/* Прикрепленные файлы */
.file-item{
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: #0b1422;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 8px;
  flex-shrink: 0;
  width: 100%;
  box-sizing: border-box;
}

.file-info{
  flex: 1;
  min-width: 0;
}

.file-name{
  font-size: 14px;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-size{
  font-size: 12px;
  color: #93a0b4;
}

.hidden{ display:none; }

/* ========== МОБИЛЬНЫЕ УСТРОЙСТВА ========== */
@media (max-width: 768px) {
  .page{ max-width: 100%; }
  
  /* Компактный top bar */
  .topbar{
    flex-direction: column; gap: 8px; padding: 8px;
  }
  .topbar .room-actions{
    display: flex !important;
    flex-direction: row !important;
    gap: 6px !important;
    align-items: stretch !important;
    width: 100% !important;
    justify-content: stretch !important;
  }
  
  /* Компактные кнопки и поля */
  button{
    padding: 8px 10px; font-size: 13px;
    min-width: auto; white-space: nowrap;
  }
  input{
    padding: 8px 10px; font-size: 14px;
    min-width: 120px;
  }
  
  /* Стили для поля ввода комнаты */
  #roomId {
    flex: 1 1 65% !important;
    height: 40px !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 8px 12px !important;
    font-size: 14px !important;
    box-sizing: border-box !important;
    text-align: center !important;
  }
  
  /* Стили для кнопки входа */
  #btnJoin {
    flex: 0 0 35% !important;
    height: 40px !important;
    padding: 8px 10px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
    white-space: nowrap !important;
    font-size: 12px !important;
    min-width: 0 !important;
  }
  
  /* Status для мобильных */
  #status{
    font-size: 13px; text-align: center;
    order: 1; margin-top: 8px;
    width: 100%; /* На всю ширину */
    padding: 6px;
    background: rgba(34, 49, 79, 0.2);
    border-radius: 6px;
  }
  
  /* Уменьшенные отступы для card блоков в мобильной версии */
  .card{
    padding: 5px 10px !important;
  }
  
  /* Мобильные стили для отображения ID комнаты */
  .current-room-info {
    order: -1;
    margin-bottom: 8px;
    width: 100%;
    justify-content: center;
  }
  
  .room-id-link {
    font-size: 18px !important;
    padding: 6px 12px !important;
  }
  
  /* Мобильные стили для блока входа в комнату */
  .join-room-section {
    width: 100%;
    justify-content: center;
    margin-bottom: 8px;
  }
  
  #joinRoomId {
    width: 100%;
    max-width: 300px;
    font-size: 14px;
    padding: 8px 12px;
  }
  
  /* Адаптивные модальные окна для планшетов */
  .modal-content {
    width: 90% !important;
    max-width: 450px !important;
    padding: 18px !important;
  }
  
  .form-actions {
    flex-direction: row !important;
    gap: 10px !important;
  }
  
  .btn-primary, .btn-secondary {
    flex: 1 !important;
    min-width: 100px !important;
  }
  
  /* Скрываем status только на странице ГОСТЯ */
  body:has(input#roomId[placeholder*="ID комнаты"]) .topbar .room-actions #status {
    display: none !important;
  }
  
  /* Адаптивный ID комнаты */
  .room-id-display{
    font-size: 16px !important;
    padding: 10px 16px !important;
    letter-spacing: 1px !important;
  }
  
  /* Мобильный layout - flex вместо grid */
  .layout{
    display: flex;
    flex-direction: column;
    gap: 4px; /* Уменьшаем gap между карточками */
    padding: 5px; /* Отступы 5px со всех сторон */
    height: calc(100vh - 100px);
    overflow-y: auto; /* Прокрутка если нужно */
  }
  
  /* Компактные карточки */
  .card{
    padding: 15px; border-radius: 10px; gap: 6px;
    width: 100%; /* Карточки на всю ширину */
    box-sizing: border-box; /* Включаем padding в ширину */
  }
  
  /* Sidebar на всю ширину */
  .sidebar{
    width: 100%;
    max-height: none; /* Убираем ограничение высоты */
    overflow: visible; /* Убираем скролл */
  }
  
  /* Убираем gap для карточки с главным видео */
  .card:has(.main-video) {
    gap: 0;
  }
  h4{ font-size: 14px; margin: 0 0 5px 0; } /* Ровно 5px отступ */
  
  /* Главное видео - точно как preview */
  .main-video{
    width: 100% !important;
    height: 220px !important;
    aspect-ratio: unset !important;
    max-height: unset !important;
    min-height: unset !important;
    border: 1px solid var(--line) !important;
    border-radius: 12px !important;
    background: #000 !important;
    overflow: hidden !important;
  }
  .main-video video{
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    border-radius: 12px !important;
  }
  
  /* Убираем все лишние элементы внутри main-video кроме видео */
  .main-video > *:not(video):not(.cam-overlay) {
    display: none;
  }
  
  /* Скрываем кнопки управления видео на мобильных */
  .video-controls{
    display: none;
  }
  
  /* Скрываем overlay камеры на мобильных */
  .cam-overlay, #remoteCamOverlay, #localCamOverlay{
    display: none !important;
  }
  
  /* Превью камеры - компактнее */
  .preview{
    max-height: 15vh; border-radius: 8px; /* Уменьшаем высоту */
  }
  .preview video{ border-radius: 8px; }
  
  /* Компактный чат */
  .chat{ height: auto; min-height: 200px; }
  .chat .chat-log{
    height: 160px;
    padding: 6px; border-radius: 8px;
    font-size: 13px;
  }
  .msg{ margin: 7px 0; }
  .msg .meta{ font-size: 11px; }
  
  #chatForm{ 
    gap: 6px; 
    display: flex;
    align-items: center;
  }
  #chatForm .chat-input-row{
    display: flex;
    gap: 6px;
    width: 100%;
    align-items: center;
  }
  #chatForm input[type="text"]{ 
    font-size: 14px; 
    padding: 8px;
    flex: 1; /* Максимальная ширина */
    min-width: 0; /* Позволяет сжиматься */
    height: 44px; /* Одинаковая высота с кнопками */
    box-sizing: border-box;
  }
  #chatForm button, #chatForm .file-btn{
    padding: 8px 10px;
    flex-shrink: 0; /* Не сжимаются */
    white-space: nowrap;
    min-width: 44px; /* Минимальная ширина для одинакового размера */
    height: 44px; /* Одинаковая высота */
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* Мобильное переопределение для маленьких экранов */
@media (max-width: 480px) {
  /* Главное видео еще компактнее */
  .main-video{
    height: 180px !important;
  }
  
  /* Скрываем overlay камеры на маленьких экранах */
  .cam-overlay, #remoteCamOverlay, #localCamOverlay{
    display: none !important;
  }
  .topbar{
    padding: 6px;
  }
  
  /* Еще более компактные кнопки */
  button{
    padding: 6px 8px; font-size: 12px;
  }
  input{
    padding: 6px 8px; font-size: 13px;
    min-width: 100px;
  }
  
  /* Компоновка для маленьких экранов */
  .topbar .room-actions {
    gap: 4px !important;
  }
  
  #roomId {
    flex: 1 1 65% !important;
    height: 36px !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 6px 8px !important;
    font-size: 13px !important;
  }
  
  #btnJoin {
    flex: 0 0 35% !important;
    height: 36px !important;
    padding: 6px 8px !important;
    font-size: 11px !important;
    min-width: 0 !important;
  }
  
  /* Status для очень маленьких экранов */
  #status{
    font-size: 12px; text-align: center;
    order: 2; margin-top: 10px;
    width: 100%;
    padding: 8px;
    background: rgba(34, 49, 79, 0.3);
    border-radius: 6px;
  }

  .layout{
    display: flex;
    flex-direction: column;
    gap: 2px; /* Минимальный gap */
    padding: 5px; /* Отступы 5px со всех сторон */
    height: calc(100vh - 90px);
    overflow-y: auto; /* Прокрутка если нужно */
  }
  
  .card{
    padding: 5px 15px; /* Уменьшенные отступы сверху/снизу для мобильной */
    width: 100%; /* Карточки на всю ширину */
    box-sizing: border-box; /* Включаем padding в ширину */
  }
  
  /* Стили для блока входа в комнату на маленьких экранах */
  #joinRoomId {
    font-size: 13px;
    padding: 6px 8px;
  }
  
  /* Адаптивные модальные окна для маленьких экранов */
  .modal-content {
    width: 95% !important;
    max-width: none !important;
    max-height: 90vh !important;
    padding: 15px !important;
    margin: 10px !important;
  }
  
  .modal-header {
    margin-bottom: 15px !important;
    padding-bottom: 10px !important;
  }
  
  .modal-header h3 {
    font-size: 18px !important;
  }
  
  .form-group input {
    font-size: 16px !important;
    padding: 10px !important;
  }
  
  .form-actions {
    flex-direction: column !important;
    gap: 8px !important;
    margin-top: 15px !important;
  }
  
  .btn-primary, .btn-secondary {
    width: 100% !important;
    padding: 12px !important;
    font-size: 16px !important;
  }
  
  .rooms-list {
    max-height: 300px !important;
  }
  
  .room-item {
    padding: 12px !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 10px !important;
  }
  
  .room-actions {
    width: 100% !important;
    justify-content: space-between !important;
  }
  
  /* Дополнительные стили для очень маленьких экранов */
  .rooms-header {
    flex-direction: column !important;
    gap: 8px !important;
    margin-bottom: 15px !important;
  }
  
  .rooms-header button {
    width: 100% !important;
    font-size: 14px !important;
  }
  
  .loading {
    text-align: center !important;
    padding: 20px !important;
    font-size: 14px !important;
  }
  
  /* Sidebar на всю ширину */
  .sidebar{
    width: 100%;
    max-height: none; /* Убираем ограничение высоты */
    overflow: visible; /* Убираем скролл */
  }
  
  /* Убираем gap для карточки с главным видео */
  .card:has(.main-video) {
    gap: 0;
  }

  .preview{
    max-height: 12vh; /* Еще меньше для маленьких экранов */
  }
  
  /* Миниатюрный чат */
  .chat{ height: auto; min-height: 180px; }
  .chat .chat-log{
    height: 120px;
    padding: 4px; font-size: 12px;
  }
  #chatForm .chat-input-row{
    display: flex;
    gap: 4px;
    width: 100%;
    align-items: center;
  }
  #chatForm input[type="text"]{ 
    font-size: 13px; 
    padding: 6px;
    flex: 1; /* Максимальная ширина */
    min-width: 0; /* Позволяет сжиматься */
    height: 40px; /* Одинаковая высота с кнопками */
    box-sizing: border-box;
  }
  #chatForm button, #chatForm .file-btn{
    padding: 6px 8px;
    flex-shrink: 0; /* Не сжимаются */
    font-size: 12px;
    min-width: 40px; /* Минимальная ширина для одинакового размера */
    height: 40px; /* Одинаковая высота */
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  /* Еще более компактный ID комнаты */
  .room-id-display{
    font-size: 14px !important;
    padding: 8px 12px !important;
    letter-spacing: 1px !important;
  }
}

/* Уведомление о копировании */
.copy-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: #10b981;
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
  z-index: 10000;
  animation: slideInRight 0.3s ease, fadeOut 0.3s ease 2.7s forwards;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes fadeOut {
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

/* Список комнат */
.rooms-header {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e0e0e0;
}

.room-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  margin-bottom: 10px;
  background-color: #f9f9f9;
}

.room-checkbox {
  flex-shrink: 0;
}

.room-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.room-info {
  flex-grow: 1;
}

  .room-info h4 {
    margin: 0 0 5px 0;
    color: #333;
    font-size: 16px;
  }

  .room-name-editable {
    cursor: pointer;
    transition: background-color 0.2s;
    padding: 4px;
    border-radius: 4px;
  }

  .room-name-editable:hover {
    background-color: rgba(255, 255, 255, 0.1);
    text-decoration: underline;
  }

.room-info p {
  margin: 2px 0;
  color: #666;
  font-size: 14px;
}

.room-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.room-actions .btn {
  padding: 6px 12px;
  font-size: 14px;
}

/* Модальные окна */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-sizing: border-box;
  position: relative;
}

/* Специальные размеры для модального окна списка комнат */
#myRoomsModal .modal-content {
  max-width: 50vw;
  width: 50vw;
  max-height: 90vh;
  height: 90vh;
  display: flex;
  flex-direction: column;
}

#myRoomsModal .modal-header {
  flex: 0 0 auto; /* Фиксированная высота заголовка */
}

#myRoomsModal .modal-body {
  flex: 1; /* Занимает всё оставшееся место */
  overflow-y: auto; /* Прокрутка если контент не помещается */
  display: flex;
  flex-direction: column;
}

#myRoomsModal .rooms-header {
  flex: 0 0 auto; /* Фиксированная высота заголовка списка */
  margin-bottom: 10px;
}

#myRoomsModal .rooms-list {
  flex: 1 !important; /* Список занимает всё оставшееся место */
  overflow-y: auto !important; /* Прокрутка для списка комнат */
  min-height: 0 !important; /* Позволяет flex элементу сжиматься */
  height: auto !important; /* Автоматическая высота по flex */
  max-height: none !important; /* Убираем ограничение 400px */
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--line);
}

.modal-header h3 {
  margin: 0;
  color: var(--fg);
}

.modal-close {
  background: none;
  border: none;
  color: var(--fg);
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: var(--line);
  border-radius: 50%;
}

.form-group {
  margin-bottom: 15px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  color: var(--fg);
  font-weight: 600;
}

.form-group input {
  width: 100%;
  padding: 12px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--fg);
  font-size: 16px;
}

  .form-group input:focus {
    outline: none;
    border-color: var(--pri);
  }

  .form-hint {
    font-size: 12px;
    color: #93a0b4;
    margin-top: 4px;
    display: block;
  }

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

.btn-primary, .btn-secondary {
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.3s;
}

.btn-primary {
  background: var(--pri);
  color: white;
}

.btn-primary:hover {
  background: #1a4fd8;
}

.btn-secondary {
  background: var(--line);
  color: var(--fg);
}

.btn-secondary:hover {
  background: #3a4a5a;
}

.rooms-list {
  max-height: 400px;
  overflow-y: auto;
}

.room-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 10px;
  background: var(--bg);
}

.room-info h4 {
  margin: 0 0 5px 0;
  color: var(--fg);
}

.room-info p {
  margin: 0;
  color: #93a0b4;
  font-size: 14px;
}

.room-actions {
  display: flex;
  gap: 8px;
}

.loading {
  text-align: center;
  padding: 20px;
  color: #93a0b4;
}

.secondary {
  background: var(--line);
  color: var(--fg);
}

.secondary:hover {
  background: #3a4a5a;
}

/* ===== АДМИН ПАНЕЛЬ ===== */
.admin-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e1e5e9;
}

.admin-title h1 {
    color: #3ba331;
    margin: 0;
}

.admin-title p {
    color: #2c3e50; /* Более темный цвет */
    margin: 5px 0 0 0;
    font-weight: 500;
}

.admin-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: #007bff;
    color: white;
}

.btn-primary:hover {
    background: #0056b3;
}

.btn-danger {
  background: #dc3545;
  color: white;
}

.btn-danger:hover {
  background: #c82333;
}

/* Стили для модального окна подтверждения */
.confirmation-message {
  display: flex;
  gap: 15px;
  align-items: flex-start;
  margin-bottom: 20px;
  padding: 20px;
  background: rgba(220, 53, 69, 0.1);
  border: 1px solid rgba(220, 53, 69, 0.3);
  border-radius: 8px;
}

.warning-icon, .success-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.confirmation-text {
  flex: 1;
}

.confirmation-text p {
  margin: 0 0 8px 0;
  font-size: 16px;
  font-weight: 500;
  color: var(--fg);
}

.confirmation-text .form-hint {
  color: #dc3545;
  font-weight: 500;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

.btn-warning {
    background: #ffc107;
    color: #212529;
}

.btn-warning:hover {
    background: #e0a800;
}

.admin-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    flex: 1;
    overflow: hidden;
}

.admin-section {
    background: white;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
}

.admin-section.users-section {
    height: 100%;
    min-height: 0;
}

.admin-section.create-user-section {
    height: fit-content;
}

.section-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e1e5e9;
}

.section-header h2 {
    color: #333;
    margin: 0;
}

.header-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.user-group {
    border: 1px solid #e1e5e9;
    border-radius: 6px;
    margin-bottom: 10px;
    background: #f8f9fa;
}

.user-group-header {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    background: #e9ecef;
    border-bottom: 1px solid #e1e5e9;
    cursor: pointer;
}

.user-group-header:hover {
    background: #dee2e6;
}

.user-group-checkbox {
    margin-right: 10px;
}

.user-group-name {
    font-weight: 600;
    color: #333;
    flex-grow: 1;
}

.user-group-count {
    background: #007bff;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
}

.user-group-content {
    display: none;
    padding: 10px;
}

.user-group-content.expanded {
    display: block;
}

.user-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 15px;
    border: 1px solid #e1e5e9;
    border-radius: 6px;
    margin-bottom: 10px;
    background: #f8f9fa;
}

.user-item:last-child {
    margin-bottom: 0;
}

.user-checkbox {
    margin: 5px 0 0 0;
    cursor: pointer;
}

.user-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.user-info h4 {
    margin: 0 0 5px 0;
    color: #333;
}

.user-info p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

.user-details {
    flex-grow: 1;
}

.user-actions {
    margin-left: auto;
    display: flex;
    gap: 8px;
}

.user-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-group label {
    font-weight: 600;
    color: #555;
    font-size: 14px;
}

.form-group input, .form-group select {
    padding: 10px;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: #007bff;
}

.users-list {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 10px;
    background: #f8f9fa;
}

.status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-active {
    background: #d4edda;
    color: #155724;
}

.status-inactive {
    background: #f8d7da;
    color: #721c24;
}

.role-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    background: #e2e3e5;
    color: #495057;
}

.error-message {
    color: #dc3545;
    margin-top: 10px;
    font-size: 14px;
}

.success-message {
    color: #28a745;
    margin-top: 10px;
    font-size: 14px;
}

.loading {
    text-align: center;
    padding: 20px;
    color: #666;
}

.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007bff;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px auto;
}

/* Мобильные устройства для админки */
@media (max-width: 768px) {
    .admin-container {
        padding: 10px;
        height: 100vh;
    }
    
    .admin-content {
        grid-template-columns: 1fr;
        gap: 20px;
        overflow-y: auto;
    }
    
    .admin-section.create-user-section {
        order: 1;
        height: auto;
        flex-shrink: 0;
    }
    
    .admin-section.users-section {
        order: 2;
        height: 60vh;
        min-height: 400px;
    }
    
    .users-list {
        max-height: none;
        height: 100%;
    }
    
    .header-actions {
        flex-wrap: wrap;
        gap: 5px;
    }
    
    .header-actions .btn {
        padding: 8px 12px;
        font-size: 12px;
        flex: 1;
        min-width: calc(50% - 2.5px);
    }
    
    .user-form {
        gap: 10px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}

/* Очень маленькие экраны для админки */
@media (max-width: 480px) {
    .admin-container {
        padding: 5px;
    }
    
    .admin-section {
        padding: 15px;
    }
    
    .admin-section.users-section {
        height: 55vh;
        min-height: 350px;
    }
    
    .header-actions .btn {
        font-size: 11px;
        padding: 6px 8px;
    }
    
    .user-item {
        padding: 10px;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .user-actions {
        margin-left: 0;
        align-self: flex-end;
    }
}

/* ===== СТРАНИЦА ЛОГИНА ===== */
.login-container {
    max-width: 400px;
    margin: 100px auto;
    padding: 30px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    color: #333;
    margin-bottom: 10px;
}

.login-header p {
    color: #93a0b4;
    margin: 0;
    font-size: 14px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.login-btn {
    background: #007bff;
    color: white;
    padding: 14px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s;
}

.login-btn:hover {
    background: #0056b3;
}

.login-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* ===== ГЕОИНФОРМАЦИЯ ГОСТЕЙ ===== */

.geo-info-message {
    animation: geoSlideIn 0.5s ease-out;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease;
}

.geo-info-message:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

@keyframes geoSlideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.geo-info-message code {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    user-select: text;
}

/* Специальные стили для геоинформации в чате */
.msg.geo-info {
    margin: 12px 0;
}

.msg.geo-info .geo-info-message {
    max-width: 100%;
    word-wrap: break-word;
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
    .geo-info-message {
        padding: 10px;
        font-size: 13px;
    }
    
    .geo-info-message div {
        margin-bottom: 6px !important;
    }
    
    /* Выравнивание размеров кнопок чата для мобильных */
    .file-btn {
        width: 24px;
        height: 28px;
        padding: 4px;
    }
    
    .send-btn {
        width: 24px;
        height: 28px;
        padding: 4px;
    }
    
    .file-btn .btn-icon,
    .send-btn .btn-icon {
        width: 16px;
        height: 16px;
    }
    
    /* Адаптивный размер логотипа для мобильных - уменьшен на 15% */
    .home-logo {
        height: 37px;
    }
    
    /* Адаптивная компоновка для мобильных */
    .topbar {
        flex-direction: column;
        gap: 8px;
    }
    
    .top-row {
        width: 100%;
        justify-content: space-between;
    }
    
    .user-info, .guest-info {
        max-width: none;
        flex: 0 0 auto;
    }
    
    .status-container {
        flex: 0 0 auto;
        max-width: 60%;
    }
    
    .status-container #status {
        font-size: 13px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    .current-room-info {
        order: 0;
        width: 100%;
    }
    
    .room-actions {
        order: 1;
        justify-content: center;
        width: 100%;
    }
    
    /* Для гостей на мобильных - возвращаем обычную компоновку */
    body:has(.guest-info) .topbar {
        flex-direction: column;
    }
    
    body:has(.guest-info) .top-row {
        width: 100%;
        justify-content: space-between;
    }
    
    body:has(.guest-info) .room-actions {
        order: 1;
        width: 100%;
        justify-content: center;
    }
    
    /* Адаптивные стили для области прикрепленных файлов */
    .attached-files-header {
        padding: 6px 8px;
    }
    
    .attached-files-title {
        font-size: 13px;
    }
    
    .clear-all-btn {
        padding: 3px 6px;
        font-size: 11px;
    }
    
    .attached-file-item {
        padding: 4px 6px;
    }
    
    .attached-file-name {
        font-size: 13px;
    }
    
    .attached-file-size {
        font-size: 11px;
    }
    
    .attached-files-list {
        padding: 6px;
        max-height: 120px;
    }
    
    /* Адаптивный фон для мобильных */
    body {
        background-size: cover !important;
        background-attachment: scroll !important; /* Для лучшей производительности на мобильных */
        background-position: center center !important;
    }
    
    .page::before {
        background: rgba(11, 15, 26, 0.6) !important; /* Немного темнее для мобильных */
    }
    
    /* Увеличиваем кнопку fullscreen для мобильных хостов */
    .fullscreen-btn {
        padding: 12px 14px;
        font-size: 20px;
        top: 15px;
        right: 15px;
        border-radius: 8px;
    }
    
    .theater-btn {
        padding: 12px 14px;
        font-size: 18px;
        top: 15px;
        right: 65px;
        border-radius: 8px;
    }
    
    /* Увеличиваем высоту блока "Моё видео" для мобильных */
    .preview {
        max-height: calc(22vh + 180px) !important;
        min-height: 350px !important;
    }
    
    /* Адаптивные размеры для модального окна списка комнат на мобильных */
    #myRoomsModal .modal-content {
        width: 95vw !important;
        max-width: 95vw !important;
        height: 85vh !important;
        max-height: 85vh !important;
        display: flex !important;
        flex-direction: column !important;
    }
}
