/* ===============================================
   KEYFRAME ANIMATIONS
   =============================================== */

/* Biometric scanning animation */
@keyframes biometric-scan {
  0% {
    transform: translateX(-100%);
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  100% {
    transform: translateX(100%);
    opacity: 0;
  }
}

/* Status indicator blinking animation */
@keyframes status-blink {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.3;
    transform: scale(0.8);
  }
}

/* ===============================================
   LOBBY STYLING - TWO COLUMN LAYOUT
   =============================================== */
#lobby-container {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%),
    radial-gradient(
      circle at 50% 50%,
      rgba(0, 255, 255, 0.1) 0%,
      transparent 70%
    ) !important;
  border: 1px solid rgba(0, 255, 255, 0.3) !important;
  box-shadow: 0 0 30px rgba(0, 255, 255, 0.3), 0 0 60px rgba(0, 255, 255, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
  position: relative;
  overflow: hidden;
  /* Two-column layout optimization */
  width: 95vw !important;
  max-width: 1400px !important;
  min-height: 85vh !important;
  max-height: 85vh !important;
  /* Hidden by default - only show when active */
  display: none !important;
  flex-direction: column !important;
  padding: 2rem !important;
  margin: 2rem auto !important;
}

/* Two-column layout container */
.lobby-layout {
  display: flex !important;
  gap: 3rem !important;
  flex: 1 !important;
  min-height: 0 !important;
}

/* Left side - Players section */
.players-section {
  flex: 1 !important;
  display: flex !important;
  flex-direction: column !important;
  min-height: 0 !important;
}

/* Right side - Room info section */
.room-section {
  flex: 0 0 450px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 2rem !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Show lobby container when it's meant to be visible */
#lobby-container[style*="display: block"],
#lobby-container[style*="display: flex"],
#lobby-container[style*="display: grid"],
#lobby-container.show {
  display: flex !important;
}

/* Hide navbar when lobby is active and remove any top spacing */
body.lobby-active nav {
  display: none !important;
}

/* Remove any top margins/padding from body when lobby is active */
body.lobby-active {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

/* Ensure lobby container positions at very top */
body.lobby-active #lobby-container {
  position: fixed !important;
  top: 0 !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  z-index: 1000 !important;
}

/* Scanning line for lobby container */
#lobby-container::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(0, 255, 255, 0.8),
    rgba(0, 255, 255, 0.4),
    rgba(0, 255, 255, 0.8),
    transparent
  );

  z-index: 1;
}

/* Message Board Styling - Digital Display */
.message-board {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%) !important;
  border: 2px solid rgba(0, 255, 255, 0.4) !important;
  border-radius: 0.5rem !important;
  padding: 1.5rem !important;
  margin-bottom: 1.5rem !important;
  position: relative !important;
  overflow: hidden !important;
  width: 100% !important;
  max-width: 420px !important;
  max-height: 180px !important;
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.2) !important;
}

.message-board::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(0, 255, 255, 0.6),
    rgba(0, 255, 255, 0.3),
    rgba(0, 255, 255, 0.6),
    transparent
  );
  animation: biometric-scan 2s ease-in-out;
}

.message-board-header {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  margin-bottom: 0.8rem !important;
  padding-bottom: 0.5rem !important;
  border-bottom: 1px solid rgba(0, 255, 255, 0.3) !important;
}

.board-title {
  color: #00ffff !important;
  font-family: "Courier New", monospace !important;
  font-weight: 700 !important;
  font-size: 1.2rem !important;
  text-transform: uppercase !important;
  letter-spacing: 1px !important;
  text-shadow: 0 0 5px rgba(0, 255, 255, 0.5) !important;
}

.board-indicator {
  width: 8px !important;
  height: 8px !important;
  background: #00ff00 !important;
  border-radius: 50% !important;
  box-shadow: 0 0 8px #00ff00 !important;
  animation: status-blink 1.5s ease-in-out infinite !important;
}

.message-board-content {
  min-height: 80px !important;
  max-height: 150px !important;
  overflow-y: auto !important;
  position: relative !important;
}

.system-message {
  color: #94a3b8 !important;
  font-family: "Courier New", monospace !important;
  font-size: 1.3rem !important;
  line-height: 1.5 !important;
  margin-bottom: 0.7rem !important;
  padding: 0.4rem 0 !important;
  opacity: 0.95 !important;
  word-wrap: break-word !important;
  font-weight: 600 !important;
}

.system-message.success {
  color: #10b981 !important;
  text-shadow: 0 0 3px rgba(16, 185, 129, 0.3) !important;
}

.system-message.error {
  color: #ef4444 !important;
  text-shadow: 0 0 3px rgba(239, 68, 68, 0.3) !important;
}

.system-message.info {
  color: #3b82f6 !important;
  text-shadow: 0 0 3px rgba(59, 130, 246, 0.3) !important;
}

.system-message.warning {
  color: #f59e0b !important;
  text-shadow: 0 0 3px rgba(245, 158, 11, 0.3) !important;
}

/* Typing animation for new messages */
.system-message.typing {
  overflow: hidden !important;
  border-right: 2px solid rgba(0, 255, 255, 0.7) !important;
  white-space: nowrap !important;
  animation: typing 1.5s steps(40, end), blink-caret 0.75s step-end infinite !important;
}

@keyframes typing {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

@keyframes blink-caret {
  from,
  to {
    border-color: transparent;
  }
  50% {
    border-color: rgba(0, 255, 255, 0.7);
  }
}

/* Custom scrollbar for message board */
.message-board-content::-webkit-scrollbar {
  width: 4px;
}

.message-board-content::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 2px;
}

.message-board-content::-webkit-scrollbar-thumb {
  background: rgba(0, 255, 255, 0.3);
  border-radius: 2px;
}

.message-board-content::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 255, 255, 0.5);
}

/* Room info biometric styling - Right side layout */
.room-info {
  background: rgba(0, 0, 0, 0.3) !important;
  border: 1px solid rgba(0, 255, 255, 0.3) !important;
  position: relative;
  z-index: 2;
  /* Right side layout optimization */
  padding: 1rem !important;
  text-align: center !important;
  border-radius: 0.5rem !important;
  width: 100% !important;
  max-width: 380px !important;
}

.room-info::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  right: 2px;
  bottom: 2px;
  background: linear-gradient(
    45deg,
    transparent 30%,
    rgba(0, 255, 255, 0.05) 50%,
    transparent 70%
  );
  border-radius: inherit;
  pointer-events: none;
}

/* Room access container with QR code integration */
.room-access-container {
  display: flex !important;
  flex-direction: column !important;
  gap: 1rem !important;
  align-items: center !important;
}

/* Room code container */
.room-code-container {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
}

/* Room code biometric styling - Projector optimized */
.room-code {
  color: #00ffff !important;
  background: rgba(0, 0, 0, 0.5) !important;
  border: 2px solid rgba(0, 255, 255, 0.5) !important;
  text-shadow: 0 0 10px rgba(0, 255, 255, 0.5) !important;
  position: relative;
  overflow: hidden;
  /* Projector optimization: Much larger and more prominent */
  font-size: 1.5rem !important;
  font-weight: 700 !important;
  padding: 1rem 1rem !important;
  border-radius: 0.75rem !important;
  font-family: "Courier New", monospace !important;
  letter-spacing: 0.5rem !important;
  width: 50% !important;
}

.room-code::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(0, 255, 255, 0.2),
    transparent
  );
  transition: left 0.6s ease;
}

.room-code:hover::before {
  left: 100%;
}

/* QR Code Section */
.qr-code-section {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  gap: 0.5rem !important;
  padding: 1rem !important;
  background: rgba(0, 0, 0, 0.3) !important;
  border: 1px solid rgba(0, 255, 255, 0.3) !important;
  border-radius: 0.5rem !important;
  position: relative !important;
  overflow: hidden !important;
  width: 50% !important;
}

.qr-code-section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, #00ffff, transparent);
}

.qr-code-container {
  width: 130px !important;
  height: 130px !important;
  background: #fff !important;
  border-radius: 0.5rem !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.3) !important;
  padding: 8px !important;
}

.qr-code-container canvas {
  width: 134px !important;
  height: 134px !important;
  border-radius: 0.25rem !important;
}

.qr-instruction {
  color: #00ffff !important;
  font-family: "Courier New", monospace !important;
  font-size: 0.9rem !important;
  text-transform: uppercase !important;
  letter-spacing: 1px !important;
  opacity: 0.8 !important;
  text-shadow: 0 0 5px rgba(0, 255, 255, 0.5) !important;
}

/* Player list section - Left side layout */
.player-list-section {
  flex: 1 !important;
  display: flex !important;
  flex-direction: column !important;
  min-height: 0 !important;
  height: 100% !important;
}

.player-list-header {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  margin-bottom: 1.5rem !important;
  padding: 1rem !important;
  background: rgba(0, 0, 0, 0.4) !important;
  border: 1px solid rgba(0, 255, 255, 0.3) !important;
  border-radius: 0.5rem !important;
}

/* Player list biometric styling - Projector optimized */
.player-list-title {
  color: #00ffff !important;
  font-family: "Courier New", monospace !important;
  text-transform: uppercase !important;
  letter-spacing: 1px !important;
  text-shadow: 0 0 5px rgba(0, 255, 255, 0.5) !important;
  /* Projector optimization: Much larger text */
  font-size: 1.8rem !important;
  font-weight: 600 !important;
}

.player-count {
  background: rgba(0, 255, 255, 0.2) !important;
  color: #00ffff !important;
  border: 1px solid rgba(0, 255, 255, 0.5) !important;
  font-family: "Courier New", monospace !important;
  font-weight: 600 !important;
  /* Projector optimization: Larger and more prominent */
  font-size: 1.5rem !important;
  padding: 0.75rem 1.5rem !important;
  border-radius: 0.5rem !important;
  text-shadow: 0 0 5px rgba(0, 255, 255, 0.5) !important;
}

/* Player list container - Portrait ID Card Grid Layout */
.player-list {
  flex: 1 !important;
  display: grid !important;
  grid-template-columns: repeat(5, 1fr) !important;
  grid-template-rows: repeat(4, 1fr) !important;
  gap: 0.5rem !important;
  padding: 1rem !important;
  background: rgba(0, 0, 0, 0.2) !important;
  border: 1px solid rgba(0, 255, 255, 0.2) !important;
  border-radius: 0.5rem !important;
  height: 100% !important;
}

/* Player Slot Container */
.player-slot {
  width: 100% !important;
  transition: all 0.3s ease !important;
}

/* ID Card Styling - Portrait Layout */
.player-id-card {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%) !important;
  border: 2px solid rgba(0, 255, 255, 0.3) !important;
  border-radius: 0.5rem !important;
  padding: 0.5rem !important;
  position: relative !important;
  transition: all 0.3s ease !important;
  overflow: hidden !important;
  min-height: 140px !important;
  max-height: 160px !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: space-between !important;
}

.player-id-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(0, 255, 255, 0.1),
    transparent
  );
  transition: left 0.5s ease;
}

.player-id-card:hover::before {
  left: 100%;
}

/* Empty state styling */
.player-id-card.empty {
  border-color: rgba(100, 116, 139, 0.3) !important;
  background: linear-gradient(135deg, #334155 0%, #1e293b 100%) !important;
}

.player-id-card.empty::before {
  background: linear-gradient(
    90deg,
    transparent,
    rgba(100, 116, 139, 0.1),
    transparent
  );
}

/* Filled state styling */
.player-id-card.filled {
  border-color: rgba(0, 255, 255, 0.6) !important;
  box-shadow: 0 0 15px rgba(0, 255, 255, 0.2) !important;
}

/* ID Card Header - Compact */
.id-card-header {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  margin-bottom: 0.5rem !important;
}

.slot-number {
  color: #00ffff !important;
  font-family: "Courier New", monospace !important;
  font-weight: 700 !important;
  font-size: 0.8rem !important;
  background: rgba(0, 255, 255, 0.2) !important;
  padding: 0.2rem 0.4rem !important;
  border-radius: 0.2rem !important;
  border: 1px solid rgba(0, 255, 255, 0.4) !important;
  text-shadow: 0 0 5px rgba(0, 255, 255, 0.5) !important;
  min-width: 20px !important;
  text-align: center !important;
}

.id-status {
  font-family: "Courier New", monospace !important;
  font-weight: 600 !important;
  font-size: 0.6rem !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
  padding: 0.15rem 0.3rem !important;
  border-radius: 0.2rem !important;
}

.player-id-card.empty .id-status {
  color: #64748b !important;
  background: rgba(100, 116, 139, 0.2) !important;
  border: 1px solid rgba(100, 116, 139, 0.3) !important;
}

.player-id-card.filled .id-status {
  color: #10b981 !important;
  background: rgba(16, 185, 129, 0.2) !important;
  border: 1px solid rgba(16, 185, 129, 0.4) !important;
  text-shadow: 0 0 5px rgba(16, 185, 129, 0.5) !important;
}

/* ID Card Content - Portrait Layout */
.id-card-content {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  gap: 0.5rem !important;
  flex: 1 !important;
  justify-content: center !important;
}

/* Avatar Container - Portrait Layout */
.id-avatar-container {
  flex-shrink: 0 !important;
  position: relative !important;
  display: flex !important;
  justify-content: center !important;
}

/* Empty Avatar - Bigger for better visibility */
.empty-avatar {
  width: 60px !important;
  height: 60px !important;
  border-radius: 0.4rem !important;
  background: rgba(100, 116, 139, 0.3) !important;
  border: 2px dashed rgba(100, 116, 139, 0.5) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.empty-icon {
  font-size: 1.8rem !important;
  color: #64748b !important;
}

/* Filled Avatar - Bigger Portrait Style */
.id-avatar {
  width: 80px !important;
  height: 80px !important;
  border-radius: 0.4rem !important;
  border: 2px solid rgba(0, 255, 255, 0.6) !important;
  object-fit: cover !important;
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.3) !important;
}

.id-badge {
  position: absolute !important;
  bottom: -2px !important;
  right: -2px !important;
  background: rgba(0, 255, 255, 0.9) !important;
  color: #0f172a !important;
  font-family: "Courier New", monospace !important;
  font-weight: 700 !important;
  font-size: 0.6rem !important;
  width: 16px !important;
  height: 16px !important;
  border-radius: 50% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  border: 1px solid #0f172a !important;
  box-shadow: 0 0 8px rgba(0, 255, 255, 0.6) !important;
}

/* ID Info Section - Portrait Layout */
.id-info {
  flex: 1 !important;
  min-width: 0 !important;
  text-align: center !important;
  width: 100% !important;
}

.id-name {
  color: #00ffff !important;
  font-family: "Courier New", monospace !important;
  font-weight: 600 !important;
  font-size: 0.8rem !important;
  text-shadow: 0 0 5px rgba(0, 255, 255, 0.5) !important;
  margin-bottom: 0.2rem !important;
  word-wrap: break-word !important;
  text-transform: uppercase !important;
  letter-spacing: 0.2px !important;
  line-height: 1.1 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.player-id-card.empty .id-name {
  color: #64748b !important;
  text-shadow: none !important;
  text-transform: none !important;
  font-weight: 400 !important;
  font-size: 0.7rem !important;
}

.id-details {
  color: #94a3b8 !important;
  font-family: "Courier New", monospace !important;
  font-size: 0.6rem !important;
  font-weight: 400 !important;
  opacity: 0.8 !important;
  line-height: 1.1 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.player-id-card.empty .id-details {
  color: #64748b !important;
  font-style: italic !important;
}

/* Button container for right side layout */
.lobby-buttons {
  display: flex !important;
  flex-direction: column !important;
  gap: 1.5rem !important;
  justify-content: center !important;
  align-items: center !important;
  width: 100% !important;
  max-width: 380px !important;
}

/* Button biometric styling - Right side layout */
.start-btn,
.end-btn {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%) !important;
  border: 1px solid rgba(0, 255, 255, 0.5) !important;
  color: #00ffff !important;
  font-family: "Courier New", monospace !important;
  text-transform: uppercase !important;
  letter-spacing: 1px !important;
  text-shadow: 0 0 5px rgba(0, 255, 255, 0.5) !important;
  box-shadow: 0 4px 15px rgba(0, 255, 255, 0.2) !important;
  position: relative;
  overflow: hidden;
  /* Right side optimization: Full width buttons */
  padding: 1.2rem 2.5rem !important;
  font-size: 1.3rem !important;
  font-weight: 600 !important;
  border-radius: 0.75rem !important;
  cursor: pointer !important;
  transition: all 0.3s ease !important;
  width: 100% !important;
  max-width: 280px !important;
}

.start-btn::before,
.end-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(0, 255, 255, 0.3),
    transparent
  );
  transition: left 0.5s ease;
}

.start-btn:hover::before,
.end-btn:hover::before {
  left: 100%;
}

.start-btn:hover,
.end-btn:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 6px 20px rgba(0, 255, 255, 0.4) !important;
}

.start-btn:disabled {
  background: #475569 !important;
  border-color: #64748b !important;
  color: #64748b !important;
  text-shadow: none !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
  cursor: not-allowed !important;
}

.start-btn:disabled:hover {
  transform: none !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
}

.end-btn {
  border-color: rgba(255, 107, 107, 0.5) !important;
  color: #ff6b6b !important;
  text-shadow: 0 0 5px rgba(255, 107, 107, 0.5) !important;
}

.end-btn::before {
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 107, 107, 0.3),
    transparent
  ) !important;
}

/* ===============================================
   RESPONSIVE DESIGN FOR MOBILE
   =============================================== */
@media (max-width: 1200px) {
  .player-id-card {
    min-height: 120px !important;
    max-height: 140px !important;
    padding: 0.4rem !important;
  }
}

@media (max-width: 768px) {
  #lobby-container {
    width: 95vw !important;
    max-width: none !important;
    min-height: 90vh !important;
    padding: 1.5rem !important;
  }

  .lobby-layout {
    flex-direction: column !important;
    gap: 2rem !important;
  }

  .room-section {
    flex: none !important;
    order: -1 !important; /* Move room info to top on mobile */
  }

  .players-section {
    flex: 1 !important;
  }

  .room-info {
    max-width: none !important;
    width: 100% !important;
  }

  .lobby-buttons {
    flex-direction: row !important;
    max-width: none !important;
  }

  .start-btn,
  .end-btn {
    max-width: none !important;
    flex: 1 !important;
  }

  .room-code {
    font-size: 2.5rem !important;
    letter-spacing: 0.3rem !important;
  }

  .player-id-card {
    min-height: 100px !important;
    max-height: 120px !important;
    padding: 0.3rem !important;
  }

  .id-avatar,
  .empty-avatar {
    width: 45px !important;
    height: 45px !important;
  }

  .empty-icon {
    font-size: 1.5rem !important;
  }

  .id-name {
    font-size: 0.65rem !important;
  }

  .id-details {
    font-size: 0.5rem !important;
  }

  .slot-number {
    font-size: 0.6rem !important;
    padding: 0.1rem 0.2rem !important;
  }

  .id-status {
    font-size: 0.45rem !important;
    padding: 0.05rem 0.15rem !important;
  }

  .id-badge {
    width: 12px !important;
    height: 12px !important;
    font-size: 0.5rem !important;
    bottom: -2px !important;
    right: -2px !important;
  }

  .message-board {
    max-width: none !important;
    width: 100% !important;
    margin-bottom: 1rem !important;
    padding: 1.2rem !important;
    min-height: 120px !important;
  }

  .board-title {
    font-size: 1rem !important;
  }

  .system-message {
    font-size: 1.1rem !important;
  }

  .message-board-content {
    min-height: 70px !important;
    max-height: 130px !important;
  }
}

@media (max-width: 480px) {
  .player-id-card {
    min-height: 90px !important;
    max-height: 110px !important;
    padding: 0.25rem !important;
  }

  .id-avatar,
  .empty-avatar {
    width: 35px !important;
    height: 35px !important;
  }

  .empty-icon {
    font-size: 1.2rem !important;
  }

  .id-name {
    font-size: 0.6rem !important;
  }

  .id-details {
    font-size: 0.45rem !important;
  }

  .slot-number {
    font-size: 0.5rem !important;
  }

  .id-status {
    font-size: 0.4rem !important;
  }

  .id-badge {
    width: 10px !important;
    height: 10px !important;
    font-size: 0.4rem !important;
  }
}
