/* ========== ЧЕТКОЕ РАЗДЕЛЕНИЕ ДЛЯ 4 СЛУЧАЕВ ========== */

/* 1. ХОСТ - remoteVideo: всегда только белый фон */
body:has(.user-info) #mainBox,
body:has(.user-info) .main-video {
  background-color: white !important;
  background-image: none !important;
}

/* 2. ХОСТ - localVideo: всегда только белый фон */
body:has(.user-info) #previewBox,
body:has(.user-info) .preview {
  background-color: white !important;
  background-image: none !important;
}

/* 3. ГОСТЬ - remoteVideo: изображение когда нет видео, белый фон когда есть видео */
body:has(.guest-info) #mainBox.guest-remote-video-off,
body:has(.guest-info) .main-video.guest-remote-video-off {
  background-color: white !important;
  background-image: var(--video-bg-guest) !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  background-size: contain !important;
}

body:has(.guest-info) #mainBox.guest-remote-video-on,
body:has(.guest-info) .main-video.guest-remote-video-on {
  background-color: white !important;
  background-image: none !important;
}

/* 4. ГОСТЬ - localVideo: изображение когда кнопка не активна, белый фон когда активна */
body:has(.guest-info) #previewBox.guest-local-video-off,
body:has(.guest-info) .preview.guest-local-video-off {
  background-color: white !important;
  background-image: var(--video-bg-guest) !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  background-size: contain !important;
}

body:has(.guest-info) #previewBox.guest-local-video-on,
body:has(.guest-info) .preview.guest-local-video-on {
  background-color: white !important;
  background-image: none !important;
}

/* Анимация для GPS уведомления */
@keyframes slideDown {
  from {
    transform: translateX(-50%) translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
  }
}

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

@font-face {
  font-family: 'PT Russia Text';
  src: url('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('fonts/PT_Russia-Text.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root{
  --bg:#f5f5f5; --fg:#1a1a1a;
  --card:#d0d0d0; --line:#b0b0b0;
  --pri:#2353e6;
  --video-bg: url('../images/card_background.jpg'); /* Фоновое изображение для видео превью */
  --video-bg-color: white; /* Белый фон для видео превью */
  --video-bg-guest: url('../images/card_background.jpg'); /* Фоновое изображение только для гостей */
  --video-bg-test: url('/images/card_background.jpg'); /* Альтернативный путь для тестирования */
  --input-bg:#ffffff; /* Белый фон для полей ввода и чата */
  --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:1300px; 
  margin:0 auto;
  position: relative;
  min-height: 100vh;
}

/* Убираем полупрозрачный оверлей чтобы фон был виден */
.page::before {
  display: 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;
}

/* Переопределяем шрифты для специфических элементов */
.topbar .room-actions,
.topbar .room-actions button,
.rooms-header,
.rooms-header button,
#myRoomsModal .rooms-header,
#myRoomsModal .rooms-header button {
  font-family: inherit !important;
}

/* Стили для кнопок с иконками */
.btn-with-icon {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}

.btn-icon {
  width: 20px;
  height: 20px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  flex-shrink: 0;
}

/* Иконки для конкретных кнопок */
#btnCreate .btn-icon {
  background-image: url('../images/create_room.png');
}

#btnJoin .btn-icon,
#btnJoinRoom .btn-icon {
  background-image: url('../images/join_room.png');
}

#btnMyRooms .btn-icon {
  background-image: url('../images/my_rooms.png');
}

#btnRequestGeolocation .btn-icon,
#btnRequestGeolocationAlt .btn-icon {
  background-image: url('../images/geolocation.png');
}

.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: var(--fg);
  font-weight: 500;
  transition: color 0.3s ease;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 280px;
  background: var(--card);
  padding: 12px 16px;
  border-radius: 6px;
  height: 44px;
  display: flex;
  align-items: center;
  box-sizing: border-box;
}

.status-container #status.connected {
  color: #28a745;
  background: var(--card);
  border: 1px solid #28a745;
}

.status-container #status.error {
  color: #dc3545;
  background: var(--card);
  border: 1px solid #dc3545;
}

.status-container #status.warning {
  color: #ffc107;
  background: var(--card);
  border: 1px solid #ffc107;
}

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

/* Для гостей на ПК - размещаем 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;
}

/* Увеличиваем логотип для гостей на ПК */
body:has(.guest-info) .home-logo {
  height: 48px; /* Максимальный размер для topbar с padding 12px */
}

/* Базовые стили для поля ввода и кнопки */
#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: #5a6c7d; /* Более тёмный цвет */
    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:var(--input-bg); color:var(--fg);
}
button{
  padding:10px 12px; border:0; border-radius:10px; background:#a0a0a0; color:var(--fg); cursor:pointer;
}
button.primary{ background:var(--pri); color:white; }
#status{opacity:.8}

/* layout */
.layout{
  display:grid; grid-template-columns: 1fr 0.8fr; gap:12px; /* 1fr + 0.8fr = полная ширина */
  padding:12px; /* Равномерные отступы */
  height:calc(100vh - 70px);
  align-items: start; /* Карточки прижимаются к верху */
}

/* Специальный layout для страницы гостя - 60% левая колонка, 40% правая */
@media (min-width: 1025px) {
  .guest-page .layout {
    grid-template-columns: 1.5fr 1fr; /* 60%/40% через fr units */
    padding: 12px; /* Равномерные отступы */
  }
}

/* Левая колонка с видео и картой */
.left-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: auto;
  width: 100%; /* Полная ширина внутри своей части layout */
}
.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; /* Не растягивается по высоте */
}

/* Специальные стили для карточек */
.cardCompanion {
  /* Карточка собеседника - основное видео */
  align-self: start;
  width: 100%; /* Полная ширина внутри левой колонки */
}

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

/* Показываем изображение только гостям */
body:has(.guest-info) .cardCompanion .main-video {
  background-image: var(--video-bg-guest);
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
}

/* Синхронизируем размеры cardCompanion с mainBox на ПК */
@media (min-width: 769px) {
  .cardCompanion {
    display: flex;
    flex-direction: column;
    align-self: start; /* Не растягивается по высоте */
  }
  
  .cardCompanion .main-video {
    width: 100%;
    aspect-ratio: 16/9; /* Фиксированное соотношение как у mainBox */
    max-height: 50vh; /* Такая же максимальная высота как у mainBox */
    min-height: 200px; /* Такая же минимальная высота как у mainBox */
    border: 1px solid var(--line);
    border-radius: 12px;
    background-color: white;
    overflow: hidden;
    position: relative; /* Для позиционирования кнопки fullscreen */
  }
  
  /* Показываем изображение только гостям в медиа-запросе */
  body:has(.guest-info) .cardCompanion .main-video {
    background-image: var(--video-bg-guest);
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
  }
  
  .cardCompanion .main-video video {
    width: 100%; 
    height: 100%;
    object-fit: var(--fit-main); /* JS ставит 'contain' - как у mainBox */
    border-radius: 12px;
  }
}

.cardMy {
  /* Карточка моего видео - превью */
  align-self: start;
  flex-shrink: 0;
  width: 100%; /* Полная ширина sidebar */
  max-width: 100%; /* Не превышаем ширину sidebar */
  box-sizing: border-box; /* Включаем padding в ширину */
}

.cardMy .preview {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.cardMy .media-actions {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
h4{ margin:0 0 6px 0; color:var(--fg); 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-color: white;
  overflow:hidden;
  position: relative; /* Для позиционирования кнопки fullscreen */
}

/* Показываем изображение только гостям */
body:has(.guest-info) .main-video {
  background-image: var(--video-bg-guest);
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
}
.main-video video{
  width:100%; height:100%;
  object-fit: var(--fit-main);   /* JS ставит 'contain' */
  border-radius:12px;
}

/* Показываем фоновое изображение только гостям когда камера выключена */
body:has(.guest-info) .main-video.camera-off {
  background-image: var(--video-bg-guest);
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
}





body:has(.guest-info) .preview.camera-off {
  background-image: var(--video-bg-guest);
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
}

.preview.camera-on {
  background-image: none !important;
}



body:has(.guest-info) .cardCompanion .main-video.camera-off {
  background-image: var(--video-bg-guest);
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
}

/* Кнопка полноэкранного режима */
/* Унифицированные стили для кнопки fullscreen */
.fullscreen-btn {
  box-sizing: border-box;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  border: none;
  border-radius: 8px;
  
  /* Стандартные размеры */
  width: 44px;
  height: 44px;
  font-size: 18px;
  padding: 0;
  
  /* Стандартное позиционирование */
  top: 10px;
  right: 10px;
  
  /* Отступ от соседних кнопок */
  margin-left: 8px;
}

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

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

/* Кнопка театрального режима */
.theater-btn {
  position: absolute;
  top: 10px;
  right: 62px; /* 8px от кнопки fullscreen (10px + 44px + 8px) */
  background: rgba(0, 0, 0, 0.8);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 0;
  font-size: 18px;
  cursor: pointer;
  z-index: 10;
  transition: all 0.3s ease;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Кнопка управления мини окном */
.mini-window-btn {
  position: absolute;
  top: 10px;
  right: 116px; /* 8px от theater кнопки (10px + 44px + 8px + 44px + 8px) */
  background: rgba(0, 0, 0, 0.8);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 0;
  font-size: 18px;
  cursor: pointer;
  z-index: 1000;
  transition: all 0.3s ease;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

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

.mini-window-btn.active {
  background: rgba(35, 83, 230, 0.9) !important;
}

.mini-window-btn:not(.active) {
  background: rgba(0, 0, 0, 0.8) !important;
}

/* Кнопка скрыта по умолчанию */
.mini-window-btn.hidden {
  display: none !important;
}

/* Скрываем кнопку театрального режима в fullscreen */
.fullscreen-active .theater-btn {
  display: none !important;
}

/* Убеждаемся, что кнопка мини-окна видна в полноэкранном режиме */
.fullscreen-active .mini-window-btn:not(.hidden) {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Стили для театрального режима */
.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;
  aspect-ratio: 16/9 !important; /* Сохраняем пропорции 16:9 */
}

/* Синхронизируем cardCompanion .main-video с mainBox в театральном режиме */
.theater-mode .cardCompanion .main-video {
  max-height: 80vh !important; /* Такая же высота как у mainBox */
  min-height: 500px !important; /* Такая же минимальная высота как у mainBox */
  aspect-ratio: 16/9 !important; /* Сохраняем пропорции 16:9 */
}

.theater-mode .cardCompanion .main-video video {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important; /* Сохраняем пропорции без обрезки - как у mainBox */
  aspect-ratio: 16/9 !important; /* Принудительно 16:9 */
  border-radius: 12px !important;
}

.theater-mode .sidebar {
  max-height: none !important; /* Убираем ограничение высоты */
  height: auto !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; /* Еще меньше мета информация */
}

/* Исправляем проблему с chatForm в театральном режиме */
.theater-mode .chat {
  display: flex !important;
  flex-direction: column !important;
  height: 100% !important;
  max-height: 300px !important;
  width: 100% !important; /* Полная ширина */
  max-width: 100% !important; /* Не выходим за границы */
  box-sizing: border-box !important; /* Включаем padding в ширину */
  overflow: hidden !important; /* Предотвращаем переполнение */
}

.theater-mode .chat-log {
  flex: 1 !important;
  min-height: 150px !important;
}

.theater-mode #chatForm {
  flex-shrink: 0 !important;
  margin-top: 8px !important;
  width: 100% !important; /* Полная ширина */
  max-width: 100% !important; /* Не выходим за границы */
  box-sizing: border-box !important; /* Включаем padding в ширину */
}

.theater-mode .chat-input-row {
  gap: 4px !important;
  display: flex !important;
  align-items: center !important;
  width: 100% !important; /* Полная ширина */
  max-width: 100% !important; /* Не выходим за границы */
  box-sizing: border-box !important; /* Включаем padding в ширину */
}

.theater-mode #chatForm button,
.theater-mode #chatForm .file-btn {
  padding: 4px 6px !important;
  font-size: 12px !important;
  min-width: 28px !important;
  max-width: 28px !important; /* Фиксированная максимальная ширина */
  height: 28px !important;
  flex-shrink: 0 !important;
  box-sizing: border-box !important; /* Включаем padding в размеры */
}

.theater-mode #chatForm input[type="text"] {
  height: 28px !important;
  font-size: 12px !important;
  padding: 4px 6px !important;
  flex: 1 !important;
  min-width: 0 !important; /* Позволяет сжиматься */
  max-width: 100% !important; /* Не выходит за границы */
  box-sizing: border-box !important; /* Включаем padding в размеры */
}

/* Мобильная адаптация театрального режима */
@media (max-width: 768px) {
  /* Скрываем театральную кнопку на мобильных */
  .theater-btn {
    display: none !important;
  }
  
  /* Мобильные стили для fullscreen кнопки у хостов */
  body:has(.user-info) .fullscreen-btn {
    width: 44px !important;
    height: 44px !important;
    font-size: 18px !important;
    top: 10px !important;
    right: 10px !important;
    margin-left: 8px !important;
  }
  
  /* Обеспечиваем видимость кнопки мини-окна на мобильных для всех пользователей */
  .fullscreen-active .mini-window-btn:not(.hidden) {
    display: flex !important;
    position: absolute !important;
    top: 15px !important;
    right: 75px !important;
    z-index: 1000 !important;
    background: rgba(0, 0, 0, 0.8) !important;
    color: white !important;
    border: none !important;
    border-radius: 8px !important;
    font-size: 18px !important;
    cursor: pointer !important;
    opacity: 0.9 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
    width: 50px !important;
    height: 50px !important;
    align-items: center !important;
    justify-content: center !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: none !important; /* Убираем ограничение высоты и в мобильной */
    height: auto !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: 4px !important;
  width: 100% !important; /* Полная ширина */
  max-width: 100% !important; /* Не выходим за границы */
  box-sizing: border-box !important; /* Включаем padding в ширину */
}

.theater-mode #chatForm button,
.theater-mode #chatForm .file-btn {
  padding: 4px 6px !important;
  font-size: 11px !important;
  min-width: 24px !important;
  max-width: 24px !important; /* Фиксированная максимальная ширина */
  height: 24px !important;
  box-sizing: border-box !important; /* Включаем padding в размеры */
}

.theater-mode #chatForm input[type="text"] {
  height: 24px !important;
  font-size: 11px !important;
  min-width: 0 !important; /* Позволяет сжиматься */
  max-width: 100% !important; /* Не выходит за границы */
  box-sizing: border-box !important; /* Включаем padding в размеры */
  padding: 3px 5px !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: #c0c0c0 !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 кнопки в полноэкранном режиме */
.fullscreen-active .fullscreen-btn {
  width: 44px !important;
  height: 44px !important;
  font-size: 18px !important;
  top: 15px !important;
  right: 15px !important;
  margin-left: 8px !important;
}

/* Стили кнопки мини окна в fullscreen режиме */
.fullscreen-active .mini-window-btn {
  width: 44px !important;
  height: 44px !important;
  font-size: 18px !important;
  top: 15px !important;
  right: 67px !important; /* 8px от fullscreen кнопки (15px + 44px + 8px) */
}

.fullscreen-active .cam-overlay {
  position: absolute !important;
  bottom: 20px !important;
  right: 20px !important;
  width: 200px !important;
  height: 150px !important;
  border: 4px solid #000000 !important; /* Черная граница для контраста */
  border-radius: 8px !important;
  z-index: 10000 !important;
  background: #606060 !important; /* Еще более темный фон для моего видео */
}

/* Перетаскиваемое окно камеры в полноэкранном режиме */
.fullscreen-active .draggable-camera {
  position: absolute !important;
  bottom: 20px !important;
  right: 20px !important;
  width: 300px !important; /* Ширина */
  height: 280px !important; /* Увеличенная высота для прямоугольной формы */
  border: 4px solid #000000 !important; /* Черная граница для контраста */
  border-radius: 8px !important;
  z-index: 10001 !important;
  cursor: move !important;
  overflow: hidden !important;
  background: #606060 !important; /* Еще более темный фон для моего видео */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5) !important;
  user-select: none !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;
}

/* Скрытое состояние перетаскиваемого окна */
.fullscreen-active .draggable-camera.hidden {
  display: none !important;
}

/* Мобильная адаптация для перетаскиваемого окна */
@media (max-width: 768px) {
  .fullscreen-active .draggable-camera {
    width: 180px !important; /* Ширина для мобильных */
    height: 168px !important; /* Увеличенная высота для прямоугольной формы */
    bottom: 15px !important;
    right: 15px !important;
  }
  
  /* Скрытое состояние перетаскиваемого окна */
  .fullscreen-active .draggable-camera.hidden {
    display: none !important;
  }
  
  /* Мобильные стили fullscreen кнопки в полноэкранном режиме */
  .fullscreen-active .fullscreen-btn {
    width: 44px !important;
    height: 44px !important;
    font-size: 18px !important;
    top: 15px !important;
    right: 15px !important;
    margin-left: 8px !important;
  }
  
  .fullscreen-active .mini-window-btn {
    top: 15px !important;
    width: 44px !important;
    height: 44px !important;
    font-size: 18px !important;
    top: 15px !important;
    right: 67px !important; /* 8px от fullscreen кнопки (15px + 44px + 8px) */
  }
}

/* 2) Sidebar */
.sidebar{
  display:flex; flex-direction:column; gap:12px; 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-color: white;
  overflow:hidden;
}

/* Показываем изображение только гостям */
body:has(.guest-info) .preview {
  background-image: var(--video-bg-guest);
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
}
.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: 380px;
  transition: height 0.3s ease; /* Плавное изменение высоты */
  width: 100%; /* Полная ширина контейнера */
  max-width: 100%; /* Не выходим за границы */
  box-sizing: border-box; /* Включаем padding в ширину */
  overflow: hidden; /* Предотвращаем переполнение */
}

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

.chat .chat-log{
  height: 250px;
  flex-shrink: 0;
  overflow: auto; 
  background: var(--input-bg); 
  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;
  width: 100%; /* Принудительно устанавливаем ширину */
  max-width: 100%; /* Не позволяем выходить за границы */
  box-sizing: border-box; /* Включаем padding в ширину */
}
.chat-input-row{ 
  display: flex; 
  gap: 8px; 
  align-items: stretch; /* Выравниваем элементы по высоте */
  width: 100%; /* Полная ширина контейнера */
  max-width: 100%; /* Не выходим за границы */
  box-sizing: border-box; /* Включаем padding в ширину */
}

/* СТИЛИ ДЛЯ КАРТЫ ГЕОЛОКАЦИИ */
.map-card {
  display: flex;
  flex-direction: column;
  min-height: 300px;
  width: 100%; /* Полная ширина внутри левой колонки */
}

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

.geo-map {
  height: 305px; /* Уменьшена на 35px (было 340px) */
  flex-shrink: 0;
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  position: relative;
  overflow: hidden;
}

.map-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--fg);
  opacity: 0.6;
  text-align: center;
}

.map-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.7;
}

.map-placeholder p {
  margin: 0;
  font-size: 14px;
  color: var(--fg);
  opacity: 0.8;
}

.geo-info {
  margin-top: 12px;
  flex-shrink: 0;
}

.geo-status {
  font-size: 13px;
  color: var(--fg);
  opacity: 0.7;
  text-align: center;
  padding: 6px;
  background: rgba(160, 160, 160, 0.3);
  border-radius: 6px;
  margin-bottom: 8px;
}

/* Блок адреса гостя */
.geo-address {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.geo-controls-row {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  gap: 8px;
}

.maps-link {
  display: inline-block;
  padding: 8px 16px;
  background: var(--pri);
  color: white;
  text-decoration: none;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.maps-link.center {
  flex: 0 0 auto;
}

.maps-link:hover {
  background: #1a44c2;
  text-decoration: none;
}

.geo-btn-right {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--fg);
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.geo-btn-right:hover {
  background: var(--line);
  transform: translateY(-50%) scale(1.05);
}

.geo-btn-right:active {
  transform: translateY(-50%) scale(0.95);
}

/* Адаптивные стили для geo-controls-row */
@media (max-width: 768px) {
  .geo-controls-row {
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
  }
  
  .geo-btn-right {
    position: relative;
    right: auto;
    top: auto;
    transform: none;
    width: 100%;
    height: 44px;
    font-size: 14px;
  }
  
  .geo-btn-right:hover {
    transform: scale(1.02);
  }
  
  .geo-btn-right:active {
    transform: scale(0.98);
  }
  
  .maps-link.center {
    width: 100%;
    padding: 12px 16px;
    font-size: 14px;
  }
}

/* Стили для модального окна Google Maps */
.modal-address {
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 15px;
  margin-bottom: 20px;
  font-size: 16px;
  line-height: 1.5;
  color: var(--fg);
  text-align: center;
}

.modal-address.selectable {
  user-select: text;
  cursor: text;
  transition: background 0.2s;
  white-space: pre-line; /* Поддержка переносов строк */
  border: 2px dashed transparent;
}

.modal-address.selectable:hover {
  background: var(--card);
  border-color: var(--pri);
}

.modal-address.selectable:focus {
  outline: none;
  border-color: var(--pri);
  background: var(--card);
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 10px;
}

.maps-group {
  text-align: center;
  padding: 15px;
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.maps-group h4 {
  margin: 0 0 12px 0;
  color: var(--fg);
  font-size: 15px;
  font-weight: 600;
}

.maps-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.maps-buttons button {
  width: 100%;
  font-size: 13px;
  padding: 10px 12px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
}

/* Адаптивность для мобильных */
@media (max-width: 768px) {
  .modal-actions {
    grid-template-columns: 1fr;
    gap: 15px;
  }
  
  .maps-group {
    padding: 12px;
  }
  
  .maps-buttons {
    flex-direction: row;
    gap: 8px;
  }
  
  .maps-buttons button {
    font-size: 12px;
    padding: 8px 10px;
  }
}

.geo-controls {
  display: flex;
  gap: 8px;
  margin: 8px 0;
  justify-content: center;
}

.geo-btn {
  background: var(--pri);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.2s;
  flex: 1;
}

.geo-btn:hover {
  background: #1a3db8;
}

.geo-btn:disabled {
  background: #666;
  cursor: not-allowed;
}

.geo-btn.hidden {
  display: none;
}

/* Интерактивная карта */
#geoMap.map-active {
  padding: 0;
}

#geoMap.map-active .map-placeholder {
  display: none;
}

/* Стили для Mapbox карты */
.mapboxgl-map {
  border-radius: 10px;
  overflow: hidden;
}

.mapboxgl-canvas {
  border-radius: 10px;
}

/* Стили для контролов Mapbox */
.mapboxgl-ctrl-group {
  background: var(--card) !important;
  border: 1px solid var(--line) !important;
  border-radius: 6px !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
}

.mapboxgl-ctrl-group button {
  background: var(--card) !important;
  color: var(--fg) !important;
  border: none !important;
  width: 32px !important;
  height: 32px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: background-color 0.2s !important;
}

.mapboxgl-ctrl-group button:hover {
  background: var(--line) !important;
}

.mapboxgl-ctrl-group button:not(:last-child) {
  border-bottom: 1px solid var(--line) !important;
}

/* Стили для popup */
.mapboxgl-popup {
  z-index: 1000;
}

.mapboxgl-popup-content {
  background: var(--card) !important;
  color: var(--fg) !important;
  border: 1px solid var(--line) !important;
  border-radius: 8px !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
  font-family: 'PT Russia Text', 'PT Root UI', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif !important;
  max-width: 300px !important;
  padding: 0 !important;
}

.mapboxgl-popup-close-button {
  background: none !important;
  border: none !important;
  color: var(--fg) !important;
  font-size: 18px !important;
  padding: 8px !important;
  right: 8px !important;
  top: 8px !important;
  cursor: pointer !important;
  transition: opacity 0.2s !important;
}

.mapboxgl-popup-close-button:hover {
  opacity: 0.7 !important;
}

.mapboxgl-popup-tip {
  border-top-color: var(--card) !important;
  border-bottom-color: var(--card) !important;
}

/* Кастомный маркер геолокации */
.geo-marker-custom {
  cursor: pointer;
  transition: transform 0.2s ease;
  user-select: none;
}

.geo-marker-custom:hover {
  transform: scale(1.1);
}

.geo-marker-custom:active {
  transform: scale(0.95);
}

/* Анимация пульсации для маркера */
@keyframes geo-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 68, 68, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(255, 68, 68, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 68, 68, 0);
  }
}

.geo-marker-custom.pulsing {
  animation: geo-pulse 2s infinite;
}

/* Fallback стили для простой карты */
.geo-marker {
  position: absolute;
  width: 20px;
  height: 20px;
  background: #ff4444;
  border: 2px solid white;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.2); }
  100% { transform: translate(-50%, -50%) scale(1); }
}

/* Индикатор загрузки карты */
.map-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  z-index: 100;
}

.map-loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--line);
  border-top: 3px solid var(--pri);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.map-loading-text {
  color: var(--fg);
  font-size: 14px;
  opacity: 0.8;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Ошибка загрузки карты */
.map-error {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: #dc3545;
  font-size: 14px;
  max-width: 80%;
}

.map-error-icon {
  font-size: 24px;
  margin-bottom: 8px;
}

/* Адаптивные стили для карты на мобильных */
@media (max-width: 768px) {
  .mapboxgl-ctrl-group {
    margin: 8px !important;
  }
  
  .mapboxgl-ctrl-group button {
    width: 28px !important;
    height: 28px !important;
  }
  
  .mapboxgl-popup-content {
    max-width: 250px !important;
    font-size: 13px !important;
  }
  
  .geo-marker-custom {
    font-size: 18px;
  }
  
  .map-loading-text {
    font-size: 12px;
  }
  
  .map-error {
    font-size: 12px;
  }
}

/* Область прикрепленных файлов */
.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;
  min-width: 0; /* Позволяет сжиматься при необходимости */
  max-width: 100%; /* Не выходит за границы контейнера */
}



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

#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;
  max-width: 44px; /* Фиксированная максимальная ширина */
  height: 44px; /* Фиксированная высота */
  transition: all 0.2s ease;
  flex-shrink: 0;
  box-sizing: border-box; /* Включаем padding в размеры */
}

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

/* Прикрепленные файлы */
.file-item{
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: var(--input-bg);
  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; }

/* ========== МОБИЛЬНЫЕ УСТРОЙСТВА (до 768px) ========== */
@media (max-width: 768px) {
  /* Убираем закрепление для мобильных */
  html, body {
    height: auto !important;
    overflow-x: hidden;
    overflow-y: auto;
  }
  
  .page{ 
    max-width: 100%; 
    min-height: auto !important;
    height: auto !important;
    display: flex;
    flex-direction: column;
    align-items: center; /* Центрируем весь контент */
  }
  
  /* Компактный top bar */
  .topbar{
    flex-direction: column; gap: 8px; padding: 8px;
    position: relative !important;
    top: auto !important;
    width: 100%;
    max-width: 400px; /* Максимальная ширина для центрирования */
  }
  .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: 0; /* Убираем padding, используем margin для центрирования */
    min-height: auto; /* Убираем фиксированную высоту */
    height: auto !important; /* Убираем calc(100vh - 70px) */
    overflow: visible; /* Убираем ограничение overflow */
    align-items: center; /* Центрируем контент */
    width: 100%;
  }
  
  /* Делаем все карточки прямыми детьми layout для работы order */
  .left-column,
  .sidebar {
    display: contents !important; /* Убираем контейнеры, оставляем только содержимое */
  }
  
  /* Левая колонка в мобильной версии */
  .left-column {
    gap: 4px;
    width: 100% !important; /* На мобильных полная ширина */
    max-width: 100% !important;
    height: auto !important; /* Убираем ограничения высоты */
    overflow: visible !important;
  }
  
  /* Компактные карточки с одинаковой шириной и отступами 10px */
  .card{
    padding: 0; /* Убираем padding */
    border-radius: 10px; gap: 6px;
    width: calc(100% - 20px); /* Ширина с отступами по 10px слева и справа */
    margin: 4px 10px; /* Отступы по 10px слева и справа */
    box-sizing: border-box; /* Включаем padding в ширину */
    height: auto !important; /* Убираем ограничения высоты */
    min-height: auto !important;
    max-height: none !important;
    display: flex;
    flex-direction: column;
    align-items: center; /* Центрируем содержимое */
  }
  
  /* Компактные отступы для содержимого карточек */
  .card > * {
    margin: 4px 8px; /* Уменьшенные отступы */
    width: calc(100% - 16px);
    text-align: center;
  }
  
  .card > h4 {
    margin-top: 8px; /* Уменьшенный отступ сверху */
    margin-bottom: 6px;
  }
  
  /* Особые отступы для разных элементов */
  .card > .main-video,
  .card > .preview,
  .card > .geo-map {
    margin: 6px 4px; /* Минимальные отступы для видео и карт */
    width: calc(100% - 8px);
  }
  
  /* Компактные отступы для кнопок и элементов управления */
  .card > .media-actions,
  .card > .geo-controls-row,
  .card > .theater-controls {
    margin: 4px 6px; /* Еще меньше для элементов управления */
    width: calc(100% - 12px);
  }
  
  /* Минимальные отступы для кнопок внутри карточек */
  .card .media-btn,
  .card .geo-btn-right {
    margin: 2px !important;
  }
  
  /* Возвращаем левое выравнивание для chat-log */
  .card > .chat-log,
  .card .chat-log,
  .card .chat-log .msg,
  .card .chat-log .meta {
    text-align: left !important;
  }
  
  /* Sidebar на всю ширину */
  .sidebar{
    width: 100%;
    max-height: none; /* Убираем ограничение высоты */
    overflow: visible; /* Убираем скролл */
  }
  
  /* Убираем gap для карточки с главным видео */
  .card:has(.main-video) {
    gap: 0;
  }
  
  /* Мобильные стили для новых классов */
  .cardCompanion {
    gap: 0;
    width: calc(100% - 20px) !important; /* Одинаковая ширина с отступами 10px */
    margin: 4px 10px !important; /* Отступы по 10px */
    order: 2; /* Собеседник второй */
  }
  
  .cardCompanion .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; /* Такой же радиус как у mainBox */
    background-color: var(--video-bg-color) !important;
    overflow: hidden !important; /* Как у mainBox */
    position: relative !important; /* Для позиционирования кнопки fullscreen */
  }
  
  .cardCompanion .main-video video {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important; /* Как у mainBox */
    border-radius: 12px !important;
  }
  
  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-color: var(--video-bg-color) !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; /* Уменьшаем высоту */
    background-color: var(--video-bg-color) !important;
  }
  .preview video{ border-radius: 8px; }
  
  /* Показываем фоновое изображение только гостям когда камера выключена - мобильная версия */
  body:has(.guest-info) .main-video.camera-off {
    background-image: var(--video-bg-guest) !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    background-size: contain !important;
  }
  
  body:has(.guest-info) .preview.camera-off {
    background-image: var(--video-bg-guest) !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    background-size: contain !important;
  }
  
  body:has(.guest-info) .cardCompanion .main-video.camera-off {
    background-image: var(--video-bg-guest) !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    background-size: contain !important;
  }
  
  /* Компактный чат */
  .chat{ height: auto; min-height: 200px; }
  .chat .chat-log{
    height: 160px;
    padding: 6px; border-radius: 8px;
    font-size: 13px;
    text-align: left !important; /* Принудительно левое выравнивание */
  }

  /* Компактная карта геолокации */
  .map-card { 
    height: auto; 
    min-height: 200px;
    order: 4 !important; /* Геолокация четвертая */
    width: calc(100% - 20px) !important; /* Одинаковая ширина с отступами 10px */
    margin: 4px 10px !important; /* Отступы по 10px */
  }
  .map-card .geo-map {
    height: 140px;
    border-radius: 8px;
  }
  .map-card .geo-info {
    margin-top: 8px;
  }
  .map-card .geo-status {
    font-size: 12px;
    padding: 4px;
  }
  .map-card .geo-item {
    font-size: 11px;
    padding: 3px 6px;
  }
  .map-card .map-icon {
    font-size: 32px;
    margin-bottom: 8px;
  }
  .map-card .map-placeholder p {
    font-size: 12px;
  }
  
  /* Порядок карточек в мобильной версии: 1. Моё видео, 2. Собеседник, 3. Чат, 4. Геолокация */
  .cardMy {
    order: 1 !important; /* Моё видео первое */
    width: calc(100% - 20px) !important; /* Одинаковая ширина с отступами 10px */
    margin: 4px 10px !important; /* Отступы по 10px */
  }
  
  .cardCompanion {
    order: 2 !important; /* Собеседник второй */
    width: calc(100% - 20px) !important; /* Одинаковая ширина с отступами 10px */
    margin: 4px 10px !important; /* Отступы по 10px */
  }
  
  /* Чат третий в мобильной версии */
  .chat { 
    order: 3 !important;
    width: calc(100% - 20px) !important; /* Одинаковая ширина с отступами 10px */
    margin: 4px 10px !important; /* Отступы по 10px */
  }
  
  /* Геолокация четвертая в мобильной версии */
  .map-card { 
    order: 4 !important;
    width: calc(100% - 20px) !important; /* Одинаковая ширина с отступами 10px */
    margin: 4px 10px !important; /* Отступы по 10px */
  }
  
  /* Для гостей сохраняем тот же порядок: 1. Моё видео, 2. Собеседник, 3. Чат, 4. Геолокация */
  .guest-page .cardMy {
    order: 1 !important; /* Моё видео первое для гостя */
  }
  
  .guest-page .cardCompanion {
    order: 2 !important; /* Собеседник второй для гостя */
  }
  
  .guest-page .chat {
    order: 3 !important; /* Чат третий для гостя */
  }
  
  .guest-page .map-card {
    order: 4 !important; /* Геолокация четвертая для гостя */
  }
  .msg{ margin: 7px 0; }
  .msg .meta{ font-size: 11px; }
  
  #chatForm{ 
    gap: 6px; 
    display: flex;
    align-items: center;
    width: 100%; /* Полная ширина */
    max-width: 100%; /* Не выходим за границы */
    box-sizing: border-box; /* Включаем padding в ширину */
  }
  #chatForm .chat-input-row{
    display: flex;
    gap: 6px;
    width: 100%;
    max-width: 100%; /* Не выходим за границы */
    align-items: center;
    box-sizing: border-box; /* Включаем padding в ширину */
  }
  #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; /* Минимальная ширина для одинакового размера */
    max-width: 44px; /* Максимальная ширина для предотвращения переполнения */
    height: 44px; /* Одинаковая высота */
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box; /* Включаем padding в размеры */
  }

  /* Дополнительные стили для очень маленьких экранов (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; /* Прокрутка если нужно */
  }
  
  /* Левая колонка в планшетной версии */
  .left-column {
    gap: 2px;
    width: 100% !important; /* На планшетах полная ширина */
    max-width: 100% !important;
  }
  
  .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;
    font-family: inherit; /* Убираем специальный шрифт */
  }
  
  .rooms-header button {
    width: 100% !important;
    font-size: 14px !important;
    font-family: inherit; /* Убираем специальный шрифт */
  }
  
  .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;
  }
  
  /* Планшетные стили для новых классов */
  .cardCompanion {
    gap: 0;
    width: calc(100% - 20px) !important;
    margin: 4px 10px !important;
  }
  
  .cardCompanion .main-video {
    width: 100% !important;
    height: 180px !important;
    aspect-ratio: unset !important;
    max-height: unset !important;
    min-height: unset !important;
    border: 1px solid var(--line) !important;
    border-radius: 8px !important;
  }
  
  /* Показываем фоновое изображение только гостям когда камера выключена - очень маленькие экраны */
  body:has(.guest-info) .main-video.camera-off {
    background-image: var(--video-bg-guest) !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    background-size: contain !important;
  }
  
  body:has(.guest-info) .preview.camera-off {
    background-image: var(--video-bg-guest) !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    background-size: contain !important;
  }
  
  body:has(.guest-info) .cardCompanion .main-video.camera-off {
    background-image: var(--video-bg-guest) !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    background-size: contain !important;
  }

  .preview{
    max-height: 12vh; /* Еще меньше для маленьких экранов */
  }
  
  /* Миниатюрный чат */
  .chat{ height: auto; min-height: 180px; }
  .chat .chat-log{
    height: 120px;
    padding: 4px; font-size: 12px;
  }

  /* Миниатюрная карта геолокации */
  .map-card { 
    height: auto; 
    min-height: 160px;
    order: 2; /* Карта после чата в планшетной версии */
    width: calc(100% - 20px) !important;
    margin: 4px 10px !important;
  }
  .map-card .geo-map {
    height: 100px;
  }
  .map-card .geo-info {
    margin-top: 6px;
  }
  .map-card .geo-status {
    font-size: 11px;
    padding: 3px;
  }
  .map-card .geo-item {
    font-size: 10px;
    padding: 2px 4px;
  }
  .map-card .map-icon {
    font-size: 24px;
    margin-bottom: 6px;
  }
  .map-card .map-placeholder p {
    font-size: 11px;
  }
  
  /* Чат первый в планшетной версии */
  .chat { 
    order: 1; 
  }
  #chatForm .chat-input-row{
    display: flex;
    gap: 4px;
    width: 100%;
    max-width: 100%; /* Не выходим за границы */
    align-items: center;
    box-sizing: border-box; /* Включаем padding в ширину */
  }
  #chatForm input[type="text"]{ 
    font-size: 13px; 
    padding: 6px;
    flex: 1; /* Максимальная ширина */
    min-width: 0; /* Позволяет сжиматься */
    max-width: 100%; /* Не выходит за границы */
    height: 40px; /* Одинаковая высота с кнопками */
    box-sizing: border-box;
  }
  #chatForm button, #chatForm .file-btn{
    padding: 6px 8px;
    flex-shrink: 0; /* Не сжимаются */
    font-size: 12px;
    min-width: 40px; /* Минимальная ширина для одинакового размера */
    max-width: 40px; /* Максимальная ширина для предотвращения переполнения */
    height: 40px; /* Одинаковая высота */
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box; /* Включаем padding в размеры */
  }
  
  /* Еще более компактный 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;
  font-family: inherit; /* Убираем специальный шрифт */
}

.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 input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

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

/* Строка с названием и чекбоксом */
.room-title-row {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  gap: 12px !important;
  margin-bottom: 5px !important;
  width: 100% !important;
}

#myRoomsModal .room-title-row {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  gap: 12px !important;
}

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

  .room-title-row h4 {
    margin: 0 !important;
    flex: 1 !important;
    color: #333 !important;
    font-size: 16px !important;
  }

  .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-title-row .room-checkbox {
  flex-shrink: 0;
  margin: 0;
  }

.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;
  font-family: inherit; /* Убираем специальный шрифт */
}

#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);
}

/* Интерактивность для ПК версии */
@media (min-width: 769px) {
  .room-item {
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
  }
  
  .room-item:hover {
    background-color: rgba(35, 83, 230, 0.05);
    border-color: rgba(35, 83, 230, 0.3);
  }
  
  /* Убираем курсор pointer с интерактивных элементов чтобы они имели свой курсор */
  .room-item button,
  .room-item input,
  .room-item .room-name-editable {
    cursor: pointer;
  }
}

.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;
}

/* ===== ПЛАНШЕТНЫЕ УСТРОЙСТВА (769px - 1024px) ===== */
@media (min-width: 769px) and (max-width: 1024px) {
  /* Унифицированная ширина карточек с отступами 10px */
  .card {
    width: calc(100% - 20px) !important;
    margin: 8px 10px !important;
  }
  
  .cardCompanion {
    width: calc(100% - 20px) !important;
    margin: 8px 10px !important;
  }
  
  .map-card {
    width: calc(100% - 20px) !important;
    margin: 8px 10px !important;
  }
  
  .cardMy {
    width: calc(100% - 20px) !important;
    margin: 8px 10px !important;
  }
  
  /* Порядок карточек: 1. Моё видео, 2. Собеседник, 3. Чат, 4. Геолокация */
  .layout {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 0 !important;
    height: auto !important;
  }
  
  .left-column,
  .sidebar {
    display: contents !important;
  }
  
  /* Порядок для всех */
  .cardMy {
    order: 1 !important; /* Моё видео первое */
  }
  
  .cardCompanion {
    order: 2 !important; /* Собеседник второй */
  }
  
  .chat {
    order: 3 !important; /* Чат третий */
  }
  
  .map-card {
    order: 4 !important; /* Геолокация четвертая */
  }
  
  /* Для гостей тот же порядок */
  .guest-page .cardMy {
    order: 1 !important; /* Моё видео первое для гостя */
  }
  
  .guest-page .cardCompanion {
    order: 2 !important; /* Собеседник второй для гостя */
  }
  
  .guest-page .chat {
    order: 3 !important; /* Чат третий для гостя */
  }
  
  .guest-page .map-card {
    order: 4 !important; /* Геолокация четвертая для гостя */
  }
  
  /* Стили fullscreen кнопки для планшетов - унифицированные размеры */
  .fullscreen-btn {
    width: 44px !important;
    height: 44px !important;
    font-size: 18px !important;
    margin-left: 8px !important;
  }
  
  /* Стили fullscreen кнопки для планшетов - полноэкранный режим */
  .fullscreen-active .fullscreen-btn {
    width: 44px !important;
    height: 44px !important;
    font-size: 18px !important;
    top: 15px !important;
    right: 15px !important;
    margin-left: 8px !important;
  }
  
  /* Показываем фоновое изображение только гостям когда камера выключена - планшеты */
  body:has(.guest-info) .main-video.camera-off {
    background-image: var(--video-bg-guest) !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    background-size: contain !important;
  }
  
  body:has(.guest-info) .preview.camera-off {
    background-image: var(--video-bg-guest) !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    background-size: contain !important;
  }
  
  body:has(.guest-info) .cardCompanion .main-video.camera-off {
    background-image: var(--video-bg-guest) !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    background-size: contain !important;
  }
  
  /* Адаптивные стили для myRoomsModal на планшетах */
  #myRoomsModal .modal-content {
    width: 80vw !important;
    max-width: 80vw !important;
    height: 80vh !important;
    max-height: 80vh !important;
  }
  
  #myRoomsModal .rooms-header {
    flex-direction: row !important;
    flex-wrap: wrap !important;
    gap: 10px !important;
  }
  
  #myRoomsModal .rooms-header button {
    flex: 1 !important;
    min-width: calc(33.333% - 7px) !important;
    padding: 10px 14px !important;
    font-size: 13px !important;
  }
  
  #myRoomsModal .room-item {
    flex-direction: row !important;
    align-items: center !important;
    padding: 15px !important;
  }
  
  #myRoomsModal .room-actions {
    flex-direction: row !important;
    width: auto !important;
    flex-wrap: nowrap !important;
  }
  
  #myRoomsModal .room-actions button {
    flex: 0 0 auto !important;
    min-width: auto !important;
    padding: 8px 12px !important;
    font-size: 13px !important;
  }
}

/* ===== АДМИН ПАНЕЛЬ ===== */
.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;
    }
    
    /* Дополнительные стили для myRoomsModal на очень маленьких экранах */
    #myRoomsModal .modal-content {
        width: 98vw !important;
        max-width: 98vw !important;
        height: 90vh !important;
        max-height: 90vh !important;
        padding: 10px !important;
    }
    
    #myRoomsModal .rooms-header button {
        padding: 10px 12px !important;
        font-size: 13px !important;
    }
    
    #myRoomsModal .room-actions button {
        padding: 6px 8px !important;
        font-size: 12px !important;
        min-width: calc(50% - 4px) !important;
    }
    
    #myRoomsModal .room-info h4 {
        font-size: 15px !important;
    }
    
    #myRoomsModal .room-info p {
        font-size: 13px !important;
    }
    
    /* Дополнительные стили для чекбокса на маленьких экранах */
    #myRoomsModal .room-checkbox input[type="checkbox"] {
        width: 18px !important;
        height: 18px !important;
    }
}

/* ===== СТРАНИЦА ЛОГИНА ===== */
.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;
}

/* Мобильный индикатор геолокации */
.mobile-geo-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(35, 83, 230, 0.95);
    color: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    z-index: 10000;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    max-width: 90%;
    font-family: 'PT Russia Text', Arial, sans-serif;
}

.mobile-geo-indicator h3 {
    margin: 0 0 12px 0;
    font-size: 18px;
}

.mobile-geo-indicator p {
    margin: 8px 0;
    font-size: 14px;
    line-height: 1.4;
}

.mobile-geo-indicator .geo-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 12px auto;
}

.mobile-geo-indicator .geo-steps {
    text-align: left;
    background: rgba(255, 255, 255, 0.1);
    padding: 12px;
    border-radius: 8px;
    margin-top: 12px;
}

.mobile-geo-indicator .geo-steps li {
    margin: 4px 0;
    font-size: 13px;
}

/* Мобильные уведомления о геолокации */
.mobile-geo-notification {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: #28a745;
    color: white;
    padding: 16px;
    border-radius: 8px;
    text-align: center;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
    animation: slideUpMobile 0.3s ease;
}

.mobile-geo-notification.error {
    background: #dc3545;
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

.mobile-geo-notification.warning {
    background: #ffc107;
    color: #212529;
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.3);
}

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

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

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* Дополнительные стили для мобильных устройств */
@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;
    }
    
    /* Возвращаем стандартный размер логотипа для мобильных гостей */
    body:has(.guest-info) .home-logo {
        height: 37px; /* Стандартный мобильный размер */
    }
    
    /* Адаптивные стили для области прикрепленных файлов */
    .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 {
        width: 44px !important;
        height: 44px !important;
        font-size: 18px !important;
        top: 15px !important;
        right: 15px !important;
        margin-left: 8px !important;
    }
    
    .theater-btn {
        padding: 12px 14px;
        font-size: 18px;
        top: 15px;
        right: 65px;
        border-radius: 8px;
    }
    
    /* Адаптивные иконки для мобильных */
    .btn-icon {
        width: 16px !important;
        height: 16px !important;
    }
    
    .btn-with-icon {
        gap: 6px !important;
        justify-content: center !important;
    }
    
    /* Увеличиваем высоту блока "Моё видео" для мобильных */
    .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;
        padding: 15px !important;
    }
    
    /* Адаптивные стили для заголовка комнат */
    #myRoomsModal .rooms-header {
        flex-direction: column !important;
        gap: 8px !important;
        margin-bottom: 15px !important;
        padding-bottom: 15px !important;
    }
    
    /* Адаптивные кнопки в заголовке */
    #myRoomsModal .rooms-header button {
        width: 100% !important;
        padding: 12px 16px !important;
        font-size: 14px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        box-sizing: border-box !important;
    }
    
    /* Адаптивные элементы комнат */
    #myRoomsModal .room-item {
        flex-direction: column !important;
        align-items: flex-start !important;
        padding: 12px !important;
        gap: 12px !important;
    }
    
    /* Мобильные стили для room-info уже настроены в базовых стилях */
    #myRoomsModal .room-checkbox input[type="checkbox"] {
        width: 20px !important;
        height: 20px !important;
        margin: 0 !important;
    }
    
    /* Адаптивные действия с комнатами */
    #myRoomsModal .room-actions {
        width: 100% !important;
        justify-content: space-between !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
    }
    
    #myRoomsModal .room-actions button {
        flex: 1 !important;
        min-width: calc(50% - 4px) !important;
        padding: 8px 12px !important;
        font-size: 13px !important;
    }
    
    /* Адаптивная информация о комнате */
    #myRoomsModal .room-info {
        width: 100% !important;
    }
    
    #myRoomsModal .room-info h4 {
        font-size: 16px !important;
        margin-bottom: 8px !important;
        word-wrap: break-word !important;
    }
    
    #myRoomsModal .room-info p {
        font-size: 14px !important;
        margin: 2px 0 !important;
        word-wrap: break-word !important;
    }
}

/* Стили для мобильных уведомлений iOS */
.ios-camera-notification {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 12px;
  padding: 15px;
  margin: 10px 0;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.ios-camera-notification button {
  background: #007AFF;
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease;
  margin-top: 10px;
}

.ios-camera-notification button:hover {
  background: #0056CC;
}

.ios-camera-notification button:active {
  background: #004499;
  transform: translateY(1px);
}

/* Стили для статусных сообщений */
.ios-status-loading {
  background: #fff3cd;
  border-color: #ffeaa7;
  color: #856404;
}

.ios-status-success {
  background: #d4edda;
  border-color: #c3e6cb;
  color: #155724;
}

.ios-status-error {
  background: #f8d7da;
  border-color: #f5c6cb;
  color: #721c24;
}

/* Адаптация для очень маленьких экранов iPhone */
@media (max-width: 375px) {
  .ios-camera-notification {
    padding: 12px;
    margin: 8px 0;
    font-size: 13px;
  }
  
  .ios-camera-notification button {
    padding: 10px 16px;
    font-size: 13px;
    width: 100%;
  }
}

/* Анимации для iOS уведомлений */
@keyframes iosSlideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ios-camera-notification {
  animation: iosSlideIn 0.3s ease-out;
}

/* Убеждаемся что video элементы прозрачные */
#remoteVideo,
#localVideo {
  background: transparent !important;
}

/* Зеркалирование всех видео с камерами */
#localVideo,
#localCameraVideo,
#remoteVideo,
#remoteCameraVideo,
.draggable-camera video {
  transform: scaleX(-1) !important;
}

/* Отключаем зеркалирование для демонстрации экрана */
#localVideo.screen-sharing,
#localVideo[data-screen-sharing="true"],
#remoteVideo.screen-sharing,
#remoteVideo[data-screen-sharing="true"] {
  transform: none !important;
}

/* Убираем черный фон у video элементов для всех */
#remoteVideo,
#localVideo,
video {
  background: transparent !important;
}

/* Управление фоновым изображением для гостей */
/* Когда камера включена - только белый фон контейнера */
body:has(.guest-info) .main-video.video-bg-hidden,
body:has(.guest-info) .preview.video-bg-hidden,
body:has(.guest-info) #mainBox.video-bg-hidden,
body:has(.guest-info) #previewBox.video-bg-hidden {
  background-color: white !important;
  background-image: none !important;
}

/* Когда камера выключена - белый фон с изображением */
body:has(.guest-info) .main-video.video-bg-visible,
body:has(.guest-info) .preview.video-bg-visible,
body:has(.guest-info) #mainBox.video-bg-visible,
body:has(.guest-info) #previewBox.video-bg-visible {
  background-color: white !important;
  background-image: var(--video-bg-guest) !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  background-size: contain !important;
}
