* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: linear-gradient(135deg, #f0f7ff 0%, #e9f0fa 100%);
  min-height: 100vh;
  color: #1a2c3e;
  
}

.app-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 32px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  margin-bottom: 32px;
  padding-bottom: 16px;
  border-bottom: 2px solid rgba(59, 130, 246, 0.2);
}

.logo-area h1 {
  font-size: 28px;
  font-weight: 700;
  background: linear-gradient(135deg, #1e6ef0, #3b82f6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -0.3px;
}

.logo-area p {
  font-size: 14px;
  color: #5b6e8c;
  margin-top: 4px;
}

.room-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ========== МОДАЛЬНОЕ ОКНО ========== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: all 0.3s ease;
}

.modal-container {
  background: white;
  border-radius: 32px;
  width: 90%;
  max-width: 460px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  padding: 28px 24px;
  text-align: center;
  color: white;
}

.modal-icon {
  font-size: 48px;
  display: block;
  margin-bottom: 12px;
}

.modal-header h2 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
}

.modal-header p {
  font-size: 14px;
  opacity: 0.9;
}

.modal-body {
  padding: 28px 24px;
  background: #ffffff;
}

.hidden {
  display: none !important;
}

.modal-choice {
  display: grid;
  gap: 14px;
}

.modal-action-btn {
  width: 100%;
  border: none;
  border-radius: 18px;
  padding: 16px;
  font-size: 16px;
  font-weight: 700;
  color: white;
  background: #3b82f6;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.modal-action-btn:hover {
  background: #2563eb;
  transform: translateY(-1px);
}

.modal-action-btn.secondary {
  color: #1e293b;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  box-shadow: none;
}

.modal-action-btn.secondary:hover {
  background: #eef2ff;
  border-color: #93c5fd;
}

.input-group {
  margin-bottom: 20px;
}

.input-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  padding-left: 10px;
  margin-bottom: 8px;
}

.modal-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 16px;
  font-size: 15px;
  transition: all 0.2s ease;
  outline: none;
  font-family: inherit;
}

.modal-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.invite-link-box {
  border: 1px solid #dbeafe;
  border-radius: 16px;
  background: #f8fafc;
  padding: 12px 16px;
}

.invite-link-box span {
  display: block;
  font-size: 12px;
  color: #5b6e8c;
  margin-bottom: 4px;
}

.invite-link-box strong {
  display: block;
  color: #1e40af;
  font-size: 13px;
  word-break: break-all;
}

.modal-footer {
  padding: 0 24px 28px 24px;
  display: flex;
  gap: 12px;
}

.modal-join-btn {
  flex: 1;
  background: #3b82f6;
  border: none;
  border-radius: 40px;
  padding: 14px;
  font-size: 16px;
  font-weight: 700;
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.modal-join-btn:hover:not(:disabled) {
  background: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.4);
}

.modal-join-btn:active:not(:disabled) {
  transform: translateY(1px);
}

.modal-join-btn:disabled {
  background: #cbd5e1;
  cursor: not-allowed;
  box-shadow: none;
}

.modal-back-btn {
  background: white;
  border: 1px solid #cbd5e1;
  border-radius: 40px;
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 700;
  color: #1e293b;
  cursor: pointer;
  transition: all 0.2s ease;
}

.modal-back-btn:hover {
  background: #f1f5f9;
}



/* ========== ОСТАЛЬНЫЕ СТИЛИ (сохраняем) ========== */

.video-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 24px;
  margin-bottom: 20px;
  align-items: start;
}

.video-grid.many-users {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.video-card {
  background: #ffffff;
  border-radius: 28px;
  box-shadow: 0 20px 35px -12px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border: 1px solid rgba(59, 130, 246, 0.2);
  display: flex;
  flex-direction: column;
}

.video-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 25px 40px -12px rgba(0, 0, 0, 0.15);
}

.card-header {
  background: #f8fafc;
  padding: 14px 20px;
  font-weight: 600;
  font-size: 16px;
  border-bottom: 1px solid #e2edff;
  color: #1e40af;
  display: flex;
  align-items: center;
  gap: 8px;
}

.video-wrapper {
  position: relative;
  background: #0b1120;
  aspect-ratio: 16 / 9;
  width: 100%;
  min-height: 280px;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

video {
  width: 100%;
  height: 100%;
  min-height: 280px;
  object-fit: cover;
  display: block;
}

.video-label {
  position: absolute;
  bottom: 12px;
  left: 12px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  padding: 6px 14px;
  border-radius: 30px;
  font-size: 13px;
  font-weight: 600;
  color: white;
  pointer-events: none;
  z-index: 2;
  letter-spacing: 0.3px;
}

.video-controls {
  padding: 12px 16px;
  background: #fefefe;
  border-top: 1px solid #eef2f8;
  display: flex;
  gap: 12px;
  justify-content: center;
}

.ctrl-btn {
  background: #3b82f6;
  border: none;
  border-radius: 40px;
  padding: 8px 20px;
  font-size: 13px;
  font-weight: 600;
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.ctrl-btn:hover {
  background: #2563eb;
  transform: scale(1.02);
}

.ctrl-btn.icon-only {
  width: 42px;
  min-width: 42px;
  height: 38px;
  padding: 8px;
  justify-content: center;
  font-size: 16px;
}

.ctrl-btn.off {
  background: #64748b;
}

.ctrl-btn.off:hover {
  background: #475569;
}

.ctrl-btn.active {
  background: #16a34a;
}

.ctrl-btn.active:hover {
  background: #15803d;
}

.ctrl-btn.mute-remote {
  background: #f1f5f9;
  color: #1e293b;
  border: 1px solid #cbd5e1;
}

.ctrl-btn.mute-remote:hover {
  background: #e2e8f0;
}

.ctrl-btn.mute-remote.muted {
  background: #fcdcdc;
  color: #8b231c;
  border-color: #ec2727;
}


/* Стили чата */
.chat-container {
  background: white;
  border-radius: 24px;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.05);
  border: 1px solid #dce7fc;
  overflow: hidden;
  margin: 0 0 1px 0;
  display: flex;
  flex-direction: column;
  max-height: 300px;
}

.chat-header {
  background: #f8fafc;
  padding: 12px 20px;
  font-weight: 600;
  font-size: 14px;
  color: #1e40af;
  border-bottom: 1px solid #e2edff;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-room-name {
  font-size: 12px;
  font-weight: normal;
  color: #5b6e8c;
  background: #eef2ff;
  padding: 4px 12px;
  border-radius: 20px;
}

.chat-messages {
  height: 200px;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #ffffff;
}

.chat-message {
  max-width: 80%;
  padding: 8px 14px;
  border-radius: 18px;
  font-size: 13px;
  line-height: 1.4;
  word-wrap: break-word;
}

.chat-message.own {
  align-self: flex-end;
  background: #3b82f6;
  color: white;
  border-bottom-right-radius: 4px;
}

.chat-message.other {
  align-self: flex-start;
  background: #f1f5f9;
  color: #1e293b;
  border-bottom-left-radius: 4px;
}

.chat-message.system {
  align-self: center;
  background: #eef2ff;
  color: #5b6e8c;
  font-size: 11px;
  font-style: italic;
  max-width: 90%;
}

.chat-message .sender {
  font-weight: 600;
  font-size: 11px;
  margin-bottom: 4px;
  opacity: 0.8;
}

.chat-message.own .sender {
  color: #bfdbfe;
}

.chat-message.other .sender {
  color: #3b82f6;
}

.chat-message .time {
  font-size: 10px;
  opacity: 0.7;
  margin-left: 8px;
}

.chat-input-area {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  background: #fefefe;
  border-top: 1px solid #eef2f8;
}

.chat-input {
  flex: 1;
  border: 1px solid #cbd5e1;
  border-radius: 40px;
  padding: 10px 18px;
  font-size: 14px;
  outline: none;
  transition: all 0.2s ease;
  font-family: inherit;
}

.chat-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.chat-input:disabled {
  background: #f1f5f9;
  color: #94a3b8;
}

.chat-send-btn {
  background: #3b82f6;
  border: none;
  border-radius: 40px;
  padding: 10px 24px;
  font-size: 13px;
  font-weight: 600;
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chat-send-btn:hover:not(:disabled) {
  background: #2563eb;
  transform: scale(1.02);
}

.chat-send-btn:disabled {
  background: #cbd5e1;
  cursor: not-allowed;
}

.btn-secondary {
  background: white;
  border: 1px solid #cbd5e1;
  border-radius: 40px;
  padding: 10px 24px;
  font-weight: 600;
  font-size: 14px;
  color: #1e293b;
  cursor: pointer;
  transition: 0.2s;
}

.btn-secondary:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

@media (max-width: 780px) {
  .app-container {
    padding: 16px;
  }
  .video-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }
  .header {
    flex-direction: column;
    gap: 12px;
  }
  .room-controls {
    width: 100%;
  }
  .room-controls .btn-secondary {
    flex: 1;
  }
  .video-controls {
    flex-wrap: wrap;
  }
  .video-wrapper {
    min-height: 220px;
  }
  video {
    min-height: 220px;
  }
  .chat-messages {
    height: 160px;
  }
  .chat-message {
    max-width: 90%;
  }
  .modal-container {
    width: 95%;
  }
}
