/* Dark Mode Toggle Position Fix - Bottom Left */

/* Override all existing dark mode toggle positions */
.dark-mode-toggle,
.mobile-dark-mode-toggle,
body .dark-mode-toggle,
body .mobile-dark-mode-toggle,
.dashboard-page .dark-mode-toggle,
.dashboard-page .mobile-dark-mode-toggle {
  position: fixed !important;
  bottom: 20px !important;
  left: 20px !important;
  right: auto !important;
  top: auto !important;
  transform: none !important;
  z-index: 10000 !important; /* High z-index but below messaging */
  background: linear-gradient(135deg, #5D5FEF, #45B7D1) !important;
  color: white !important;
  border: none !important;
  border-radius: 50% !important;
  width: 50px !important;
  height: 50px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  box-shadow: 0 4px 15px rgba(93, 95, 239, 0.4) !important;
  transition: all 0.3s ease !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Hover effect */
.dark-mode-toggle:hover,
.mobile-dark-mode-toggle:hover {
  transform: translateY(-3px) !important;
  box-shadow: 0 6px 20px rgba(93, 95, 239, 0.5) !important;
}

/* Active/pressed state */
.dark-mode-toggle:active,
.mobile-dark-mode-toggle:active {
  transform: translateY(-1px) !important;
}

/* Icon styling */
.dark-mode-toggle i,
.mobile-dark-mode-toggle i {
  font-size: 1.5rem !important;
  display: block !important;
  line-height: 1 !important;
}

/* Dark theme specific styling */
[data-theme="dark"] .dark-mode-toggle,
[data-theme="dark"] .mobile-dark-mode-toggle {
  background: linear-gradient(135deg, #667eea, #764ba2) !important;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4) !important;
}

[data-theme="dark"] .dark-mode-toggle:hover,
[data-theme="dark"] .mobile-dark-mode-toggle:hover {
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5) !important;
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .dark-mode-toggle,
  .mobile-dark-mode-toggle {
    bottom: 15px !important;
    left: 15px !important;
    width: 45px !important;
    height: 45px !important;
  }
  
  .dark-mode-toggle i,
  .mobile-dark-mode-toggle i {
    font-size: 1.25rem !important;
  }
}

/* Small mobile adjustments */
@media (max-width: 480px) {
  .dark-mode-toggle,
  .mobile-dark-mode-toggle {
    bottom: 10px !important;
    left: 10px !important;
    width: 40px !important;
    height: 40px !important;
  }
  
  .dark-mode-toggle i,
  .mobile-dark-mode-toggle i {
    font-size: 1.1rem !important;
  }
}

/* Ensure toggle is always visible and not hidden by mobile menu */
.mobile-menu.active .dark-mode-toggle,
.mobile-menu.active .mobile-dark-mode-toggle {
  display: flex !important;
  visibility: visible !important;
}

/* Remove any desktop-specific hiding */
@media (max-width: 768px) {
  .desktop-nav .dark-mode-toggle {
    display: flex !important;
  }
}

/* Ensure proper layering with messaging app */
/* Messaging is on the right, dark mode on the left, so no overlap should occur */
/* But ensure dark mode toggle is below messaging z-index wise */
.dark-mode-toggle {
  z-index: 9999 !important; /* Below messaging which is at 10000+ */
}

/* Animation for theme switching */
.dark-mode-toggle i {
  transition: transform 0.3s ease !important;
}

.dark-mode-toggle:hover i {
  transform: rotate(180deg) !important;
}

/* Tooltip on hover (optional) */
.dark-mode-toggle::after {
  content: attr(title);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  margin-bottom: 5px;
}

.dark-mode-toggle:hover::after {
  opacity: 1;
}

/* Ensure toggle doesn't interfere with page content */
body {
  padding-bottom: 80px; /* Space for both toggle and messaging */
}

/* Special handling for video coach and other fullscreen modes */
.fullscreen-mode .dark-mode-toggle,
.video-coach-active .dark-mode-toggle {
  z-index: 99999 !important; /* Ensure visibility in fullscreen */
}