:root {
  /* Primary Colors */
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #dbeafe;
  
  /* Secondary Colors */
  --secondary-color: #10b981;
  --secondary-hover: #059669;
  
  /* Neutral Colors */
  --background: #0f172a;
  --surface: #1e293b;
  --surface-light: #334155;
  
  /* Text Colors */
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  /* Status Colors */
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --info: #3b82f6;
  
  /* UI Elements */
  --border-color: #334155;
  --shadow: rgba(0, 0, 0, 0.5);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: linear-gradient(135deg, #0e7490 0%, #06b6d4 100%);
  color: var(--text-primary);
}

/* Clean Card Style */
.card {
  background: var(--surface);
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--surface);
}

::-webkit-scrollbar-thumb {
  background: var(--surface-light);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-color);
}

/* Video Grid Responsive Layouts */
#video-grid {
  display: grid;
  width: 100%;
  height: 100%;
}

/* 1 participant */
#video-grid[data-count="1"] {
  grid-template-columns: 1fr;
  max-width: 800px;
  margin: 0 auto;
}

/* 2 participants */
#video-grid[data-count="2"] {
  grid-template-columns: repeat(2, 1fr);
  max-width: 1200px;
  margin: 0 auto;
}

/* Mobile: Stack vertically for 2 participants */
@media (max-width: 768px) {
  #video-grid[data-count="2"] {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
}

/* 3-4 participants */
#video-grid[data-count="3"],
#video-grid[data-count="4"] {
  grid-template-columns: repeat(2, 1fr);
  max-width: 1200px;
  margin: 0 auto;
}

/* Mobile: Stack to 2 columns */
@media (max-width: 768px) {
  #video-grid[data-count="3"],
  #video-grid[data-count="4"] {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* 5-6 participants */
#video-grid[data-count="5"],
#video-grid[data-count="6"] {
  grid-template-columns: repeat(3, 1fr);
  max-width: 1400px;
  margin: 0 auto;
}

/* 7-9 participants */
#video-grid[data-count="7"],
#video-grid[data-count="8"],
#video-grid[data-count="9"] {
  grid-template-columns: repeat(3, 1fr);
  max-width: 1400px;
  margin: 0 auto;
}

/* 10+ participants */
#video-grid[data-count="10"],
#video-grid[data-count="11"],
#video-grid[data-count="12"] {
  grid-template-columns: repeat(4, 1fr);
  max-width: 1600px;
  margin: 0 auto;
}

/* Video Overlay Info */
.video-info {
  position: absolute;
  bottom: 12px;
  left: 12px;
  background: rgba(0, 0, 0, 0.85);
  padding: 6px 12px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.video-name {
  font-size: 14px;
  font-weight: 600;
  color: white;
  display: flex;
  align-items: center;
  gap: 6px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.video-status {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 6px;
}

.status-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  color: white;
  transition: all 0.2s ease;
}

.status-icon.video-off,
.status-icon.audio-off {
  background: rgba(239, 68, 68, 0.9);
}

.status-icon.screen-sharing {
  background: rgba(1, 193, 242, 0.9);
}

.video-container {
  position: relative;
  background: #000000;
  border-radius: 16px;
  overflow: hidden;
  aspect-ratio: 16/9;
  border: 2px solid transparent;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.video-container.speaking {
  border-color: var(--secondary-color);
  border-width: 3px;
  box-shadow: 0 0 0 3px rgba(80, 184, 89, 0.2);
}

.video-container video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Video Avatar - shown when camera is off */
.video-avatar {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: linear-gradient(135deg, #01c1f2 0%, #0ea5e9 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  font-weight: 700;
  color: white;
  text-transform: uppercase;
  letter-spacing: 2px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  z-index: 1;
}

.video-avatar.hidden {
  display: none;
}

/* Video Overlay Info */
.video-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(15, 23, 42, 0.9), transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.video-name {
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.video-status {
  display: flex;
  gap: 6px;
}

.status-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  background: rgba(51, 65, 85, 0.8);
  color: white;
  transition: background 0.2s ease;
}

.status-icon.video-off,
.status-icon.audio-off {
  background: rgba(239, 68, 68, 0.9);
}

.status-icon.screen-sharing {
  background: rgba(59, 130, 246, 0.9);
}

/* Control Buttons */
.control-btn {
  color: var(--text-primary);
  position: relative;
}

.control-btn.active {
  background: var(--error) !important;
  color: white;
}

.control-btn.screen-sharing {
  background: var(--info) !important;
  color: white;
}

/* Conference Room Controls */
.control-btn-room {
  background: #f1f5f9;
  color: #475569;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
  min-width: 80px;
}

.control-btn-room:hover {
  background: #e2e8f0;
  transform: translateY(-2px);
}

.control-btn-room.active {
  background: #fee2e2;
  color: #ef4444;
}

.control-btn-room.active i {
  color: #ef4444;
}

.control-btn-room.screen-sharing {
  background: #dbeafe;
  color: #01c1f2;
}

/* Header Buttons */
header button:hover {
  transform: scale(1.05);
}

#leave-btn-header:hover {
  background-color: #fecaca !important;
}

/* Host Badge */
.host-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  background: #f59e0b;
  color: white;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Participant List Item */
.participant-item {
  background: #334155;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}



.participant-item {
  padding: 14px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.participant-item:hover {
  background: #334155;
  border-color: #475569;
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.participant-details {
  display: flex;
  flex-direction: column;
}

.participant-name {
  font-weight: 600;
  font-size: 14px;
}

.participant-role {
  font-size: 12px;
  color: var(--text-secondary);
}

.participant-actions {
  display: flex;
  gap: 8px;
}

.action-btn {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  color: white;
  font-weight: 500;
}

.action-btn.admit {
  background: var(--success);
}

.action-btn.admit:hover {
  background: var(--secondary-hover);
}

.action-btn.reject {
  background: var(--error);
}

.action-btn.reject:hover {
  background: #dc2626;
}

.action-btn.kick {
  background: var(--error);
}

.action-btn.kick:hover {
  background: #dc2626;
}

/* Responsive Design */
@media (max-width: 768px) {
  #video-grid {
    grid-template-columns: 1fr !important;
    max-width: 100% !important;
  }
  
  .video-container {
    aspect-ratio: 4/3;
    max-height: 400px;
  }
  
  header {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }
  
  .control-btn {
    padding: 12px !important;
  }
  
  .control-btn i {
    font-size: 16px !important;
  }
}

@media (max-width: 640px) {
  .video-info {
    padding: 8px;
  }
  
  .video-name {
    font-size: 12px;
  }
  
  .status-icon {
    width: 24px;
    height: 24px;
    font-size: 12px;
  }
  
  .participant-avatar {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }
  
  .action-btn {
    padding: 4px 8px;
    font-size: 11px;
  }
}

/* Loading Animation */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading {
  animation: spin 1s linear infinite;
}

/* Smooth Transitions */
.transition-all {
  transition: all 0.3s ease;
}

/* SweetAlert2 Custom Styling */
.swal2-popup {
  background: var(--surface) !important;
  color: var(--text-primary) !important;
}

.swal2-title {
  color: var(--text-primary) !important;
}

.swal2-content {
  color: var(--text-secondary) !important;
}

.swal2-confirm {
  background: var(--primary-color) !important;
}

.swal2-cancel {
  background: var(--surface-light) !important;
}

/* Smooth transitions for all interactive elements */
button, .control-btn-room, .video-container {
  transition: all 0.3s ease;
}

button:active {
  transform: scale(0.95);
}

/* Host Badge */
.host-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  background: #f59e0b;
  color: white;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 24px;
  color: var(--text-secondary);
}

.empty-state i {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

/* Utility Classes */
.hidden {
  display: none !important;
}

.opacity-0 {
  opacity: 0;
}

.opacity-100 {
  opacity: 1;
}

/* Focus States */
button:focus,
input:focus,
select:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Disabled States */
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Screen Share Layout */
#screen-share-layout {
  display: flex;
  flex-direction: row;
}

#screen-share-main video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

#screen-share-sidebar {
  min-width: 240px;
  max-width: 300px;
}

#screen-sharer-camera video,
#other-participants .video-container video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Mobile: Stack screen share layout vertically */
@media (max-width: 768px) {
  #screen-share-layout {
    flex-direction: column;
  }
  
  #screen-share-sidebar {
    width: 100%;
    max-width: 100%;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    min-width: auto;
  }
  
  #screen-sharer-camera {
    min-width: 150px;
    max-width: 150px;
  }
  
  #other-participants {
    flex-direction: row !important;
    gap: 0.5rem;
  }
  
  #other-participants .video-container {
    min-width: 150px;
    max-width: 150px;
  }
}

/* ================================ */
/* MOBILE RESPONSIVE STYLES */
/* ================================ */

@media (max-width: 768px) {
  /* Join Screen - Stack cards vertically on mobile */
  #join-screen .flex.gap-6 {
    flex-direction: column !important;
    gap: 1.5rem !important;
  }

  #join-screen h2 {
    font-size: 2rem !important;
  }

  #join-screen p {
    font-size: 1rem !important;
  }

  /* Preview Screen - Adjust spacing */
  #preview-screen {
    padding: 1rem !important;
  }

  #preview-screen > div {
    max-width: 100% !important;
    padding: 1.5rem !important;
  }

  #preview-screen h2 {
    font-size: 1.5rem !important;
  }

  /* Conference Room Header - Make compact */
  #conference-room header {
    padding: 0.5rem 0.75rem !important;
    flex-wrap: wrap;
  }

  #conference-room header .flex.items-center.gap-4 {
    gap: 0.5rem !important;
    flex-wrap: wrap;
  }

  #conference-room header img {
    height: 1.5rem !important;
  }

  #header-room-id {
    font-size: 0.75rem !important;
  }

  #meeting-timer {
    font-size: 0.7rem !important;
  }

  /* Header buttons - Make smaller on mobile */
  #conference-room header button {
    padding: 0.4rem !important;
  }

  #conference-room header button i {
    font-size: 0.9rem !important;
  }

  #conference-room header button span {
    display: none; /* Hide text, show only icons */
  }

  #host-controls-btn span {
    display: inline !important; /* Keep host text */
  }

  /* Video Grid - Reduce padding */
  #video-grid-container {
    padding: 0.5rem !important;
  }

  /* Video Container - Adjust sizing */
  .video-container {
    border-radius: 12px !important;
  }

  .video-avatar {
    width: 80px !important;
    height: 80px !important;
    font-size: 2rem !important;
  }

  .video-info {
    padding: 0.5rem !important;
  }

  .video-info .name {
    font-size: 0.8rem !important;
  }

  /* Controls Bar - Make compact and wrap properly */
  #conference-room > div:last-child {
    padding: 0.5rem !important;
  }

  #conference-room > div:last-child > div {
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 0.5rem !important;
  }

  .control-btn-room {
    padding: 0.6rem 0.8rem !important;
    gap: 0.4rem !important;
    min-width: auto !important;
    flex: 0 1 auto !important;
  }

  .control-btn-room i {
    font-size: 1.1rem !important;
  }

  .control-btn-room span {
    font-size: 0.7rem !important;
    white-space: nowrap !important;
  }

  #leave-btn {
    padding: 0.6rem 1.2rem !important;
    font-size: 0.85rem !important;
    flex: 0 1 auto !important;
  }

  /* Modals - Full screen on mobile */
  #settings-modal > div,
  #participants-modal > div,
  #host-controls-modal > div {
    max-width: 100% !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    margin: 0 !important;
  }

  /* Settings Modal - Adjust layout */
  #settings-modal video {
    max-height: 200px !important;
  }

  #settings-modal select,
  #settings-modal input {
    font-size: 0.9rem !important;
    padding: 0.6rem !important;
  }

  /* Waiting Screen - Adjust spacing */
  #waiting-screen > div {
    padding: 2rem 1.5rem !important;
    max-width: 100% !important;
  }

  #waiting-screen h2 {
    font-size: 1.5rem !important;
  }

  /* SweetAlert2 - Make mobile friendly */
  .swal2-popup {
    width: 90% !important;
    padding: 1.5rem !important;
  }

  .swal2-title {
    font-size: 1.5rem !important;
  }

  .swal2-html-container {
    font-size: 0.9rem !important;
  }

  /* Video Grid - Stack 2 participants vertically on mobile */
  #video-grid[data-count="2"] {
    grid-template-columns: 1fr !important;
  }

  /* 2 columns for 3-6 participants on mobile */
  #video-grid[data-count="3"],
  #video-grid[data-count="4"],
  #video-grid[data-count="5"],
  #video-grid[data-count="6"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* 2 columns for 7-9 participants on mobile */
  #video-grid[data-count="7"],
  #video-grid[data-count="8"],
  #video-grid[data-count="9"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* 3 columns for 10+ participants on mobile */
  #video-grid[data-count="10"],
  #video-grid[data-count="11"],
  #video-grid[data-count="12"] {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}

@media (max-width: 480px) {
  /* Extra small screens - Further adjustments */
  body {
    font-size: 14px;
  }

  #join-screen {
    padding: 1rem !important;
  }

  #join-screen h2 {
    font-size: 1.75rem !important;
  }

  #join-screen .mb-12 {
    margin-bottom: 2rem !important;
  }

  /* Control buttons - Icon only on very small screens */
  .control-btn-room {
    padding: 0.6rem !important;
    min-width: 48px !important;
    justify-content: center !important;
  }

  .control-btn-room span {
    display: none !important; /* Hide labels on very small screens */
  }

  .control-btn-room i {
    font-size: 1.2rem !important;
    margin: 0 !important;
  }

  #leave-btn {
    padding: 0.6rem 1rem !important;
  }

  /* Video grid - Use Tailwind gap classes instead */
  #video-grid {
    /* Gap controlled by Tailwind classes in HTML */
  }

  /* Smaller avatars on tiny screens */
  .video-avatar {
    width: 60px !important;
    height: 60px !important;
    font-size: 1.5rem !important;
  }

  /* Header - Ultra compact */
  #conference-room header {
    padding: 0.4rem 0.5rem !important;
  }

  #conference-room header button {
    padding: 0.3rem !important;
  }

  #conference-room header button i {
    font-size: 0.8rem !important;
  }

  /* Hide participant count badge text on tiny screens */
  #participant-count-header,
  #chat-badge {
    font-size: 0.6rem !important;
    padding: 0.15rem 0.3rem !important;
  }
}

/* Landscape mode on mobile */
@media (max-width: 768px) and (orientation: landscape) {
  /* Optimize for landscape viewing */
  #conference-room header {
    padding: 0.4rem 0.75rem !important;
  }

  #video-grid-container {
    padding: 0.5rem !important;
  }

  #conference-room > div:last-child {
    padding: 0.5rem !important;
  }

  .control-btn-room span {
    display: none !important;
  }

  /* Use horizontal layout for participants in landscape */
  #video-grid[data-count="2"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  #video-grid[data-count="3"],
  #video-grid[data-count="4"],
  #video-grid[data-count="5"],
  #video-grid[data-count="6"] {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 0.4rem !important;
  }

  #video-grid[data-count="7"],
  #video-grid[data-count="8"],
  #video-grid[data-count="9"] {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 0.3rem !important;
  }
}

/* Tablet specific adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
  #join-screen .flex.gap-6 {
    max-width: 700px;
    margin: 0 auto;
  }

  #video-grid[data-count="2"] {
    gap: 0.75rem;
  }

  .control-btn-room {
    padding: 0.6rem 0.9rem !important;
  }
}
/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.3s ease;
}
