/* Main Layout */
body {
  margin: 0;
  padding: 0;
  font-family: Arial, sans-serif;
  background-color: #f5f5f5;
  overflow-x: hidden;
}

.main-container {
  display: grid;
  grid-template-columns: minmax(280px, 300px) 1fr minmax(280px, 300px);
  grid-template-rows: auto 1fr;
  min-height: 100vh;
  gap: 5px;
  padding: 5px;
  box-sizing: border-box;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
  .main-container {
    grid-template-columns: 250px 1fr 250px;
    gap: 8px;
    padding: 8px;
  }
}

@media (max-width: 768px) {
  .main-container {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr auto;
    gap: 10px;
  }

  .video-area {
    grid-row: 3;
    min-height: 400px;
  }

  .left-panel {
    order: 1;
  }

  .right-panel {
    order: 4;
  }
}

@media (max-width: 480px) {
  .main-container {
    padding: 5px;
    gap: 5px;
  }

  .header {
    padding: 8px 12px;
    flex-direction: column;
    text-align: center;
  }

  .header h1 {
    font-size: 18px;
    margin: 0;
  }

  .video-container {
    padding: 10px;
    grid-auto-rows: 200px;
  }

  .controls {
    padding: 10px;
  }

  .controls button {
    padding: 8px 12px;
    font-size: 12px;
    margin: 3px;
  }

  .panel-content {
    padding: 10px;
  }

  .user-item,
  .invitation-item,
  .recording-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

.header {
  grid-column: 1 / -1;
  background: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  box-sizing: border-box;
}

.left-panel {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  overflow-y: auto;
}

.video-area {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
}

.right-panel {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  overflow-y: auto;
}

/* Video Styling */
.video-container {
  flex: 1;
  display: grid;
  gap: 10px;
  padding: 20px;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  grid-auto-rows: 300px;
}

.video-stream {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  background-color: #000;
  position: relative;
  overflow: hidden;
}

.video-label {
  position: absolute;
  bottom: 10px;
  left: 10px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 12px;
  z-index: 10;
}

/* Responsive Video Grid */
.video-container.participants-1 {
  grid-template-columns: 1fr;
  justify-items: center;
}

.video-container.participants-1 .video-stream {
  max-width: 600px;
}

.video-container.participants-2 {
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.video-container.participants-2 .video-stream {
  min-height: 250px;
}

.video-container.participants-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: 1fr;
  gap: 15px;
  align-items: center;
  justify-items: center;
}

.video-container.participants-3 .video-stream {
  width: 100%;
  height: 100%;
  min-height: 250px;
}

.video-container.participants-4 {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
}

.video-container.participants-5,
.video-container.participants-6 {
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: 1fr 1fr;
}

.video-container.participants-many {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

/* Controls */
.controls {
  padding: 20px;
  background: #f8f9fa;
  border-top: 1px solid #dee2e6;
  border-radius: 0 0 8px 8px;
}

.controls button {
  margin: 5px;
  padding: 12px 20px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s ease;
}

/* Button Styles */
.btn-primary {
  background-color: #007bff;
  color: white;
}

.btn-primary:hover {
  background-color: #0056b3;
}

.btn-success {
  background-color: #28a745;
  color: white;
}

.btn-success:hover {
  background-color: #1e7e34;
}

.btn-danger {
  background-color: #dc3545;
  color: white;
}

.btn-danger:hover {
  background-color: #c82333;
}

/* Panel Styles */
.panel-header {
  padding: 15px 20px;
  background: #f8f9fa;
  border-bottom: 1px solid #dee2e6;
  font-weight: bold;
  color: #495057;
}

.panel-content {
  padding: 15px;
}

.connected-users,
.invitations-panel,
.recordings-panel {
  margin-bottom: 20px;
}

.user-item,
.invitation-item,
.recording-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #dee2e6;
}

.user-item:last-child,
.invitation-item:last-child,
.recording-item:last-child {
  border-bottom: none;
}

.user-name,
.recording-name {
  font-weight: bold;
  color: #495057;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
}

.user-status {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: #28a745;
}

.user-time,
.recording-date {
  font-size: 12px;
  color: #6c757d;
}

.invite-btn,
.download-btn,
.play-btn {
  background: #007bff;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  margin-left: 5px;
  text-decoration: none;
  display: inline-block;
}

.invite-btn:hover,
.download-btn:hover,
.play-btn:hover {
  background: #0056b3;
}

.download-btn {
  background: #28a745;
}

.download-btn:hover {
  background: #1e7e34;
}

/* Invitations */
.invitations-container {
  background: #fff3cd;
  border: 1px solid #ffeaa7;
  border-radius: 8px;
  margin-bottom: 20px;
}

.invitation-buttons {
  margin-top: 8px;
}

.accept-btn {
  background: #28a745;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  margin-right: 5px;
}

.decline-btn {
  background: #dc3545;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
}

/* Room Info */
.room-info {
  background: #d4edda;
  border: 1px solid #c3e6cb;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 15px;
}

.room-info h4 {
  margin: 0 0 10px 0;
  color: #155724;
}

/* Logout Button */
.logout-btn {
  background: #dc3545;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
}

.logout-btn:hover {
  background: #c82333;
}

/* Loading States */
.loading {
  text-align: center;
  color: #6c757d;
  padding: 20px;
  font-style: italic;
}

/* Ensure video elements don't overflow */
.video-container video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Better scrollbar styling */
.left-panel::-webkit-scrollbar,
.right-panel::-webkit-scrollbar {
  width: 6px;
}

.left-panel::-webkit-scrollbar-track,
.right-panel::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

.left-panel::-webkit-scrollbar-thumb,
.right-panel::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 10px;
}

.left-panel::-webkit-scrollbar-thumb:hover,
.right-panel::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* Better button spacing */
.invitation-buttons,
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

/* Ensure panels have minimum height */
.left-panel,
.right-panel {
  min-height: 200px;
  max-height: calc(100vh - 100px);
}

/* Recording Styles */
.recording-status {
  padding: 10px 20px;
  background: #f8f9fa;
  border-bottom: 1px solid #dee2e6;
  text-align: center;
}

.recording-active {
  color: #dc3545;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.recording-timer {
  background: #000;
  color: #fff;
  padding: 2px 8px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 14px;
}

.recording-item {
  display: flex;
  flex-direction: column;
  padding: 15px;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  margin-bottom: 10px;
  background: #fff;
  transition: box-shadow 0.3s ease;
}

.recording-item:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.recording-info {
  margin-bottom: 10px;
}

.recording-info h4 {
  margin: 0 0 8px 0;
  color: #495057;
  font-size: 16px;
}

.recording-info p {
  margin: 4px 0;
  font-size: 13px;
  color: #6c757d;
}

.recording-status.available {
  color: #28a745;
}

.recording-status.started,
.recording-status.stopped {
  color: #ffc107;
}

.recording-status.failed {
  color: #dc3545;
}

.recording-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.recording-actions button {
  padding: 6px 12px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: bold;
  transition: all 0.3s ease;
}

.download-btn {
  background: #28a745;
  color: white;
}

.download-btn:hover {
  background: #1e7e34;
}

.play-btn {
  background: #007bff;
  color: white;
}

.play-btn:hover {
  background: #0056b3;
}

.rename-btn {
  background: #ffc107;
  color: #212529;
}

.rename-btn:hover {
  background: #e0a800;
}

.delete-btn {
  background: #dc3545;
  color: white;
}

.delete-btn:hover {
  background: #c82333;
}

.processing {
  color: #6c757d;
  font-style: italic;
  font-size: 12px;
}

.no-recordings {
  text-align: center;
  padding: 30px 20px;
  color: #6c757d;
}

.no-recordings p:first-child {
  font-size: 16px;
  margin-bottom: 8px;
}

.no-recordings p:last-child {
  font-size: 14px;
  color: #adb5bd;
}

/* Recording Player Modal */
.recording-player-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;
}

.player-modal-content {
  background: #fff;
  border-radius: 12px;
  width: 90%;
  max-width: 800px;
  max-height: 90%;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.player-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background: #f8f9fa;
  border-bottom: 1px solid #dee2e6;
}

.player-header h3 {
  margin: 0;
  color: #495057;
  font-size: 18px;
}

.close-player {
  font-size: 24px;
  font-weight: bold;
  color: #adb5bd;
  cursor: pointer;
  line-height: 1;
  padding: 5px;
  border-radius: 4px;
  transition: all 0.3s ease;
}

.close-player:hover {
  color: #495057;
  background: #e9ecef;
}

.player-body {
  padding: 0;
}

.player-body video {
  width: 100%;
  height: auto;
  display: block;
}

/* Responsive adjustments for recordings */
@media (max-width: 768px) {
  .recording-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .recording-actions button {
    width: 100%;
    margin: 2px 0;
  }

  .player-modal-content {
    width: 95%;
    max-height: 95%;
  }

  .player-header {
    padding: 10px 15px;
  }

  .player-header h3 {
    font-size: 16px;
  }
}

/* Button variants */
.btn-secondary {
  background-color: #6c757d;
  color: white;
}

.btn-secondary:hover {
  background-color: #545b62;
}

/* Controls enhancements */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  align-items: center;
}

.controls button {
  min-width: 120px;
  font-size: 14px;
}

/* Invitation styles based on call type */
.invitation-item.private-invitation {
  border-left: 4px solid #007bff;
  background: linear-gradient(135deg, #f8f9ff 0%, #ffffff 100%);
}

.invitation-item.group-invitation {
  border-left: 4px solid #28a745;
  background: linear-gradient(135deg, #f8fff8 0%, #ffffff 100%);
}

.invitation-item.room-invitation {
  border-left: 4px solid #ffc107;
  background: linear-gradient(135deg, #fffdf8 0%, #ffffff 100%);
}

.invitation-header {
  font-weight: bold;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.invitation-details {
  margin: 8px 0;
}

.room-name {
  font-weight: 600;
  color: #333;
  margin-bottom: 4px;
}

.time-left {
  font-size: 12px;
  color: #666;
  margin-bottom: 4px;
}

.call-info {
  font-size: 11px;
  color: #888;
  font-style: italic;
}

/* User management improvements */
.user-item {
  padding: 12px;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color 0.2s;
}

.user-item:hover {
  background-color: #f8f9fa;
}

.invite-btn {
  background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.invite-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
}

/* Multi-invite button */
#multiInviteBtn {
  background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 25px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
}

#multiInviteBtn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

/* Call type indicators */
.private-call-indicator {
  color: #007bff;
  font-weight: bold;
}

.group-call-indicator {
  color: #28a745;
  font-weight: bold;
}

.room-call-indicator {
  color: #ffc107;
  font-weight: bold;
}

/* Screen sharing styles */
.screen-share-indicator {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  z-index: 10;
}

.video-stream[data-screen-share='true'] {
  border: 2px solid #007bff;
  box-shadow: 0 0 10px rgba(0, 123, 255, 0.3);
}

.video-stream[data-screen-share='true'] .video-label {
  background: rgba(0, 123, 255, 0.8);
  color: white;
}

/* Screen share button styles */
#start-screen-share {
  background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
  color: white;
}

#start-screen-share:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(23, 162, 184, 0.3);
}

#stop-screen-share {
  background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
  color: white;
}

#stop-screen-share:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}

/* Video controls overlay */
.video-controls {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 8px;
  z-index: 20;
}

.control-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(5px);
}

.control-btn:hover {
  background: rgba(0, 0, 0, 0.9);
  transform: scale(1.1);
}

.control-btn:active {
  transform: scale(0.95);
}

.video-btn.active {
  background: rgba(40, 167, 69, 0.8);
}

.audio-btn.active {
  background: rgba(40, 167, 69, 0.8);
}

.video-btn:not(.active) {
  opacity: 0.6;
}

.audio-btn:not(.active) {
  opacity: 0.6;
}

/* אנימציה עבור כפתורים כשהם כבויים */
.control-btn[style*='opacity: 0.6'] {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    opacity: 0.6;
  }
  50% {
    opacity: 0.8;
  }
  100% {
    opacity: 0.6;
  }
}

/* Login Page Styles */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 20px;
  box-sizing: border-box;
}

.login-form {
  background: white;
  padding: 40px;
  border-radius: 12px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 420px;
  text-align: center;
}

.login-form h1 {
  color: #333;
  margin-bottom: 10px;
  font-size: 28px;
  font-weight: 600;
}

.login-form h2 {
  color: #666;
  margin-bottom: 30px;
  font-size: 22px;
  font-weight: 400;
}

.form-group {
  margin-bottom: 20px;
  text-align: left;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: #333;
  font-weight: 500;
  font-size: 14px;
}

.form-group input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e1e5e9;
  border-radius: 8px;
  font-size: 16px;
  transition: all 0.3s ease;
  box-sizing: border-box;
  background: #f8f9fa;
}

.form-group input:focus {
  outline: none;
  border-color: #667eea;
  background: white;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group input::placeholder {
  color: #adb5bd;
}

.btn-primary {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-bottom: 20px;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
  width: 100%;
  padding: 12px;
  background: #6c757d;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 10px;
}

.btn-secondary:hover {
  background: #545b62;
  transform: translateY(-1px);
}

.register-link {
  margin-top: 20px;
}

.register-link p {
  color: #6c757d;
  font-size: 14px;
  margin: 0;
}

.register-link a {
  color: #667eea;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s ease;
}

.register-link a:hover {
  color: #764ba2;
  text-decoration: underline;
}

/* Message Styles */
.message {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  border: 1px solid transparent;
  display: none;
}

.message.success {
  background-color: #d4edda;
  color: #155724;
  border-color: #c3e6cb;
}

.message.error {
  background-color: #f8d7da;
  color: #721c24;
  border-color: #f5c6cb;
}

.message.warning {
  background-color: #fff3cd;
  color: #856404;
  border-color: #ffeaa7;
}

.message.info {
  background-color: #d1ecf1;
  color: #0c5460;
  border-color: #bee5eb;
}

/* Registration Form Styles */
#registerForm {
  animation: slideIn 0.3s ease-out;
}

#loginForm {
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive Design for Login */
@media (max-width: 480px) {
  .login-container {
    padding: 15px;
  }

  .login-form {
    padding: 30px 25px;
  }

  .login-form h1 {
    font-size: 24px;
  }

  .login-form h2 {
    font-size: 18px;
    margin-bottom: 25px;
  }

  .form-group input {
    padding: 10px 14px;
    font-size: 14px;
  }

  .btn-primary {
    padding: 12px;
    font-size: 14px;
  }
}
