@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Space+Grotesk:wght@300;400;700&display=swap');

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

body {
  font-family: 'Space Grotesk', sans-serif;
  background: linear-gradient(135deg, #0a0e27 0%, #1a1f3a 50%, #0f1419 100%);
  color: #e0e0e0;
  min-height: 100vh;
  padding: 20px;
  position: relative;
  overflow-x: hidden;
}

/* Animated background particles */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image:
    radial-gradient(circle at 20% 50%, rgba(0, 255, 255, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(255, 0, 255, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 40% 20%, rgba(0, 200, 255, 0.08) 0%, transparent 40%);
  animation: pulse 15s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

/* Additional floating particles */
body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image:
    radial-gradient(circle at 60% 30%, rgba(255, 0, 255, 0.05) 0%, transparent 30%),
    radial-gradient(circle at 90% 60%, rgba(0, 255, 255, 0.05) 0%, transparent 30%),
    radial-gradient(circle at 10% 90%, rgba(0, 200, 255, 0.05) 0%, transparent 30%);
  animation: float-particles 20s ease-in-out infinite reverse;
  pointer-events: none;
  z-index: 0;
}

@keyframes float-particles {
  0%, 100% {
    opacity: 0.3;
    transform: scale(1) rotate(0deg);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.2) rotate(180deg);
  }
}

@keyframes pulse {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.1); }
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

h1 {
  font-family: 'Orbitron', sans-serif;
  font-size: 3.5rem;
  font-weight: 900;
  text-align: center;
  margin-bottom: 10px;
  background: linear-gradient(135deg, #00ffff 0%, #ff00ff 50%, #00ccff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 80px rgba(0, 255, 255, 0.5);
  animation: glow-title 3s ease-in-out infinite;
  letter-spacing: 3px;
}

@keyframes glow-title {
  0%, 100% { filter: drop-shadow(0 0 20px rgba(0, 255, 255, 0.8)); }
  50% { filter: drop-shadow(0 0 40px rgba(255, 0, 255, 0.8)); }
}

h1 span {
  font-size: 1.5rem;
  display: block;
  margin-top: 5px;
  background: linear-gradient(90deg, #00ffff, #ff00ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Username form */
#username-form {
  text-align: center;
  margin: 50px auto;
  padding: 40px;
  max-width: 500px;
  background: rgba(20, 25, 45, 0.8);
  border: 2px solid rgba(0, 255, 255, 0.3);
  border-radius: 20px;
  box-shadow: 0 10px 50px rgba(0, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  animation: floatIn 1s ease;
  position: relative;
  overflow: hidden;
}

#username-form::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    45deg,
    transparent,
    rgba(0, 255, 255, 0.1),
    transparent
  );
  animation: rotate-gradient 4s linear infinite;
  pointer-events: none;
}

@keyframes floatIn {
  0% {
    opacity: 0;
    transform: translateY(-30px) scale(0.9);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

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

#username {
  width: 100%;
  padding: 15px 20px;
  font-size: 1.1rem;
  background: rgba(30, 35, 55, 0.9);
  border: 2px solid rgba(0, 255, 255, 0.4);
  border-radius: 12px;
  color: #00ffff;
  font-family: 'Space Grotesk', sans-serif;
  transition: all 0.3s ease;
  margin-bottom: 20px;
}

#username:focus {
  outline: none;
  border-color: #00ffff;
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
  transform: translateY(-2px);
}

/* Chat section */
#chat-section {
  max-width: 1000px;
  margin: 0 auto;
}

#chat-box {
  background: rgba(15, 20, 35, 0.95);
  border: 2px solid rgba(0, 255, 255, 0.3);
  border-radius: 20px;
  padding: 25px;
  height: 500px;
  overflow-y: auto !important;
  overflow-x: hidden;
  margin-bottom: 20px;
  box-shadow:
    0 10px 50px rgba(0, 255, 255, 0.2),
    inset 0 0 50px rgba(0, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  scroll-behavior: smooth;
  position: relative;
  z-index: 1;
}

#chat-box::-webkit-scrollbar {
  width: 10px;
}

#chat-box::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 10px;
}

#chat-box::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #00ffff, #ff00ff);
  border-radius: 10px;
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

#chat-box p {
  margin: 12px 0;
  padding: 12px 18px;
  background: rgba(30, 35, 55, 0.6);
  border-left: 3px solid #00ffff;
  border-radius: 10px;
  animation: slideIn 0.3s ease, fadeInGlow 0.5s ease;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

#chat-box p::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;
}

#chat-box p:hover::before {
  left: 100%;
}

#chat-box p:hover {
  background: rgba(40, 45, 65, 0.8);
  transform: translateX(5px) scale(1.02);
  box-shadow: -3px 0 15px rgba(0, 255, 255, 0.3);
}

@keyframes fadeInGlow {
  0% {
    opacity: 0;
    box-shadow: 0 0 0 rgba(0, 255, 255, 0);
  }
  50% {
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.4);
  }
  100% {
    opacity: 1;
    box-shadow: none;
  }
}

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

#chat-box p strong {
  color: #00ffff;
  font-weight: 700;
  margin-right: 8px;
  text-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

/* Typing indicator */
#typing-indicator {
  color: #ff00ff !important;
  font-style: italic;
  padding: 8px 18px !important;
  background: rgba(255, 0, 255, 0.1) !important;
  border-left: 3px solid #ff00ff !important;
  animation: pulse-typing 1.5s ease-in-out infinite, glow-typing 2s ease-in-out infinite;
  border-radius: 8px;
  position: relative;
  overflow: hidden;
}

#typing-indicator::after {
  content: '...';
  position: absolute;
  right: 15px;
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes pulse-typing {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

@keyframes glow-typing {
  0%, 100% {
    box-shadow: 0 0 5px rgba(255, 0, 255, 0.3);
  }
  50% {
    box-shadow: 0 0 15px rgba(255, 0, 255, 0.6);
  }
}

@keyframes dots {
  0%, 20% { content: '.'; }
  40% { content: '..'; }
  60%, 100% { content: '...'; }
}

/* Chat form */
#chat-form {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
}

#message {
  flex: 1;
  min-width: 250px;
  padding: 15px 20px;
  font-size: 1rem;
  background: rgba(30, 35, 55, 0.9);
  border: 2px solid rgba(0, 255, 255, 0.4);
  border-radius: 12px;
  color: #e0e0e0;
  font-family: 'Space Grotesk', sans-serif;
  transition: all 0.3s ease;
}

#message:focus {
  outline: none;
  border-color: #00ffff;
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.4);
}

button {
  padding: 15px 30px;
  font-size: 1rem;
  font-weight: 700;
  font-family: 'Orbitron', sans-serif;
  background: linear-gradient(135deg, #00ffff, #0088ff);
  color: #fff;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 5px 20px rgba(0, 255, 255, 0.3);
  text-transform: uppercase;
  letter-spacing: 1px;
  position: relative;
  overflow: hidden;
}

button::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
}

button:hover::before {
  width: 300px;
  height: 300px;
}

button:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 10px 30px rgba(0, 255, 255, 0.5);
  background: linear-gradient(135deg, #00ffff, #00ccff);
}

button:active {
  transform: translateY(-1px) scale(0.98);
}

.neon-button {
  background: transparent !important;
  border: 2px solid #00ffff !important;
  color: #00ffff !important;
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.5) !important;
}

.neon-button:hover {
  background: rgba(0, 255, 255, 0.1) !important;
  box-shadow: 0 0 25px rgba(0, 255, 255, 0.8) !important;
}

/* File upload */
input[type="file"] {
  display: none;
}

.upload-btn {
  padding: 15px 25px;
  background: linear-gradient(135deg, #00ff88, #00cc66);
  color: #fff;
  font-weight: 700;
  font-family: 'Orbitron', sans-serif;
  border-radius: 12px;
  cursor: pointer;
  display: inline-block;
  transition: all 0.3s ease;
  box-shadow: 0 5px 20px rgba(0, 255, 136, 0.3);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.upload-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(0, 255, 136, 0.5);
  background: linear-gradient(135deg, #00ff88, #00dd77);
}

/* Online users */
#showOnline {
  margin: 20px auto;
  display: block;
  background: linear-gradient(135deg, #ff00ff, #cc00cc) !important;
}

#showOnline:hover {
  background: linear-gradient(135deg, #ff00ff, #dd00dd) !important;
}

#onlineUsers {
  background: rgba(20, 25, 45, 0.8);
  border: 2px solid rgba(255, 0, 255, 0.3);
  border-radius: 15px;
  padding: 20px;
  margin: 20px auto;
  max-width: 500px;
  box-shadow: 0 10px 40px rgba(255, 0, 255, 0.2);
  backdrop-filter: blur(10px);
  animation: slideIn 0.5s ease;
  position: relative;
  overflow: hidden;
}

#onlineUsers::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 0, 255, 0.1), transparent);
  animation: sweep 3s ease-in-out infinite;
}

@keyframes sweep {
  0%, 100% {
    left: -100%;
  }
  50% {
    left: 100%;
  }
}

#onlineUsers strong {
  color: #ff00ff;
  font-size: 1.2rem;
  text-shadow: 0 0 10px rgba(255, 0, 255, 0.6);
}

/* Admin panel */
#adminPanel {
  background: rgba(20, 15, 35, 0.95);
  border: 2px solid rgba(255, 0, 255, 0.5);
  border-radius: 20px;
  padding: 30px;
  margin: 30px auto;
  max-width: 600px;
  box-shadow: 0 10px 50px rgba(255, 0, 255, 0.3);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(15px);
  animation: slideIn 0.5s ease, pulse-admin 3s ease-in-out infinite;
}

@keyframes pulse-admin {
  0%, 100% {
    box-shadow: 0 10px 50px rgba(255, 0, 255, 0.3);
  }
  50% {
    box-shadow: 0 15px 60px rgba(255, 0, 255, 0.5);
  }
}

#adminPanel::before {
  content: '👑 AYAAN ADMIN PANEL 👑';
  display: block;
  font-size: 1.5rem;
  font-weight: 900;
  font-family: 'Orbitron', sans-serif;
  color: #ff00ff;
  text-align: center;
  margin-bottom: 20px;
  text-shadow: 0 0 20px rgba(255, 0, 255, 0.8);
  animation: glow-admin 2s ease-in-out infinite;
}

@keyframes glow-admin {
  0%, 100% { text-shadow: 0 0 20px rgba(255, 0, 255, 0.8); }
  50% { text-shadow: 0 0 40px rgba(255, 0, 255, 1); }
}

#adminCode, #kickUser, #adminCodeInput {
  width: 100%;
  padding: 12px 18px;
  margin: 10px 0;
  background: rgba(30, 35, 55, 0.9);
  border: 2px solid rgba(255, 0, 255, 0.4);
  border-radius: 10px;
  color: #e0e0e0;
  font-family: 'Space Grotesk', sans-serif;
  transition: all 0.3s ease;
}

#adminCode:focus, #kickUser:focus, #adminCodeInput:focus {
  outline: none;
  border-color: #ff00ff;
  box-shadow: 0 0 20px rgba(255, 0, 255, 0.5);
}

#adminCodeInput {
  height: 120px;
  font-family: 'Courier New', monospace;
  resize: vertical;
}

#kickBtn, #runAdminCode, #stopAdminCode {
  background: linear-gradient(135deg, #ff00ff, #cc00cc);
  margin: 5px;
}

#kickBtn:hover, #runAdminCode:hover, #stopAdminCode:hover {
  background: linear-gradient(135deg, #ff00ff, #dd00dd);
}

#forceStopAllCode {
  background: linear-gradient(135deg, #ff3333, #cc0000) !important;
  box-shadow: 0 5px 20px rgba(255, 0, 0, 0.5) !important;
  animation: pulse-danger 2s ease-in-out infinite;
}

@keyframes pulse-danger {
  0%, 100% { box-shadow: 0 5px 20px rgba(255, 0, 0, 0.5); }
  50% { box-shadow: 0 5px 40px rgba(255, 0, 0, 0.8); }
}

#forceStopAllCode:hover {
  background: linear-gradient(135deg, #ff0000, #990000) !important;
}

/* Dark mode toggle */
#darkToggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  background: linear-gradient(135deg, #333, #555);
  border: 2px solid #666;
}

#darkToggle:hover {
  background: linear-gradient(135deg, #444, #666);
  border-color: #00ffff;
}

/* Image preview before sending */
#imagePreviewContainer {
  margin-bottom: 10px;
  min-height: 0;
  display: block !important;
  width: 100%;
  visibility: visible !important;
  opacity: 1 !important;
  position: relative;
  z-index: 10;
}

.image-preview-wrapper {
  display: inline-block;
  position: relative;
  margin: 5px;
  background: #1a1a1a;
  border: 2px solid cyan;
  border-radius: 8px;
  padding: 8px;
  animation: fadeIn 0.3s ease-out;
}

.image-preview {
  position: relative;
  display: inline-block;
}

.image-preview img {
  max-width: 200px;
  max-height: 200px;
  border-radius: 6px;
  display: block;
  object-fit: contain;
}

.remove-image-btn {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #ff4444;
  color: white;
  border: 2px solid white;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(255, 68, 68, 0.5);
  z-index: 10;
}

.remove-image-btn:hover {
  background: #ff0000;
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(255, 68, 68, 0.8);
}

.image-preview-name {
  margin-top: 5px;
  font-size: 12px;
  color: #888;
  text-align: center;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Images in chat */
#chat-box img {
  max-width: 300px;
  border-radius: 12px;
  margin-top: 10px;
  box-shadow: 0 5px 20px rgba(0, 255, 255, 0.3);
  transition: all 0.3s ease;
}

#chat-box img:hover {
  transform: scale(1.05);
  box-shadow: 0 10px 40px rgba(0, 255, 255, 0.5);
}

/* Notifications */
#chat-box p[style*="gray"] {
  background: rgba(100, 100, 100, 0.2) !important;
  border-left: 3px solid #888 !important;
  font-style: italic;
  color: #aaa !important;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .image-preview img {
    max-width: 150px;
    max-height: 150px;
  }
  
  .image-preview-name {
    max-width: 150px;
  }
  
  .remove-image-btn {
    width: 24px;
    height: 24px;
    font-size: 14px;
  }
  h1 {
    font-size: 2rem;
  }

  #chat-box {
    height: 400px;
  }

  #chat-form {
    flex-direction: column;
  }

  #message {
    width: 100%;
  }

  button {
    width: 100%;
  }
}

/* Loading animation */
@keyframes shimmer {
  0% { background-position: -1000px 0; }
  100% { background-position: 1000px 0; }
}

/* ==================== ROOM SYSTEM STYLES ==================== */

/* Room Header */
#roomHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(20, 25, 45, 0.9);
  border: 2px solid rgba(0, 255, 255, 0.4);
  border-radius: 15px;
  padding: 15px 25px;
  margin-bottom: 20px;
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 40px rgba(0, 255, 255, 0.2);
  animation: slideIn 0.5s ease;
}

#currentRoomName {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.8rem;
  font-weight: 900;
  background: linear-gradient(135deg, #00ffff 0%, #ff00ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
  animation: glow-title 3s ease-in-out infinite;
}

#roomControls {
  display: flex;
  gap: 10px;
}

.room-btn {
  padding: 10px 20px !important;
  font-size: 0.9rem !important;
  background: linear-gradient(135deg, #00ffff, #0088ff) !important;
  box-shadow: 0 5px 15px rgba(0, 255, 255, 0.3) !important;
}

.room-btn:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 8px 25px rgba(0, 255, 255, 0.5) !important;
}

/* Rooms Panel */
#roomsPanel {
  background: rgba(15, 20, 35, 0.95);
  border: 2px solid rgba(255, 0, 255, 0.3);
  border-radius: 15px;
  padding: 20px;
  margin-bottom: 20px;
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 40px rgba(255, 0, 255, 0.2);
  max-height: 300px;
  overflow-y: auto;
}

#roomsPanel::-webkit-scrollbar {
  width: 8px;
}

#roomsPanel::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 10px;
}

#roomsPanel::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #ff00ff, #00ffff);
  border-radius: 10px;
  box-shadow: 0 0 10px rgba(255, 0, 255, 0.5);
}

/* Room List Items */
.room-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 18px;
  margin: 8px 0;
  background: rgba(30, 35, 55, 0.6);
  border: 2px solid rgba(0, 255, 255, 0.2);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.room-item::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.5s ease;
}

.room-item:hover::before {
  left: 100%;
}

.room-item:hover {
  background: rgba(40, 45, 65, 0.8);
  border-color: #00ffff;
  transform: translateX(5px);
  box-shadow: 0 5px 20px rgba(0, 255, 255, 0.3);
}

.room-item.active {
  background: rgba(0, 255, 255, 0.15);
  border-color: #00ffff;
  box-shadow: 0 5px 25px rgba(0, 255, 255, 0.4);
}

.room-item.active::after {
  content: '✓';
  position: absolute;
  right: 15px;
  color: #00ffff;
  font-size: 1.5rem;
  font-weight: 900;
  text-shadow: 0 0 10px rgba(0, 255, 255, 0.8);
}

.room-icon {
  font-size: 1.5rem;
  filter: drop-shadow(0 0 5px rgba(0, 255, 255, 0.5));
}

.room-name {
  flex: 1;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: #e0e0e0;
}

.room-count {
  background: rgba(0, 255, 255, 0.2);
  color: #00ffff;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 700;
  min-width: 30px;
  text-align: center;
}

/* Mobile responsive for rooms */
@media (max-width: 768px) {
  #roomHeader {
    flex-direction: column;
    gap: 15px;
    text-align: center;
  }

  #currentRoomName {
    font-size: 1.4rem;
  }

  #roomControls {
    width: 100%;
    flex-direction: column;
  }

  .room-btn {
    width: 100% !important;
  }
}
