/* ==========================================
   QUIZ SECTION PREMIUM SIDEBAR
   Dedicated sidebar styles for quiz pages
   ========================================== */

.premium-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: auto;
  background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
  color: #ffffff;
  z-index: 1000;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: 'Poppins', 'Montserrat', sans-serif;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-container i {
  font-size: 1.75rem;
  color: #4a6cf7;
}

.logo-container h2 {
  font-size: 1.25rem;
  font-weight: 700;
  font-family: 'Montserrat', sans-serif;
  color: #4a6cf7;
}

.subtitle {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 300;
  margin-left: auto;
  margin-right: 2rem;
}

.sidebar-nav {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  padding: 0.75rem 2rem;
  overflow-x: auto;
  overflow-y: hidden;
  
  /* Improved scrollbar styling */
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

/* Webkit scrollbar styling */
.sidebar-nav::-webkit-scrollbar {
  height: 6px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
  transition: background 0.3s ease;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

/* Ensure nav items don't shrink */
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  transition: all 0.3s ease;
  border-radius: 8px;
  font-size: 0.875rem;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: fit-content;
}

.nav-item i {
  font-size: 1rem;
  flex-shrink: 0;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

/* Add padding to the end for better scroll UX */
.sidebar-nav::after {
  content: '';
  display: block;
  width: 2rem;
  flex-shrink: 0;
}

.sidebar-footer {
  display: none;
}

@media (min-width: 1024px) {
  .sidebar-nav {
    padding: 0.75rem 1.5rem !important;
  }
}

/* ==========================================
   NAVIGATION TOGGLE BUTTONS - DESKTOP
   ========================================== */

/* Desktop Nav Toggle (appears when nav is hidden) */
.desktop-nav-toggle {
  display: none;
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1001;
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, #10b981 0%, #3b82f6 100%);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(74, 108, 247, 0.4);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 0;
  transform: translateY(-20px);
  pointer-events: none;
}

.desktop-nav-toggle.visible {
  display: flex;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.desktop-nav-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 28px rgba(74, 108, 247, 0.5);
}

.desktop-nav-toggle:active {
  transform: scale(0.95);
}

.desktop-nav-toggle i {
  font-size: 1.5rem;
  color: #ffffff;
  transition: transform 0.3s ease;
}

.desktop-nav-toggle:hover i {
  transform: rotate(180deg);
}

/* Desktop Close Button (appears in sidebar header) */
.desktop-close-nav {
  display: none;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  opacity: 0;
  margin-left: auto;
  pointer-events: none;
}

.desktop-close-nav.visible {
  display: flex;
  opacity: 1;
  pointer-events: auto;
}

.desktop-close-nav:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: rotate(90deg);
}

.desktop-close-nav i {
  font-size: 1.25rem;
  color: #ffffff;
}

/* ==========================================
   MOBILE MENU TOGGLE
   ========================================== */

.mobile-menu-toggle {
  display: none;
  position: fixed !important;
  top: 1rem !important;
  left: 1rem !important;
  transform: none !important;
  z-index: 1100;
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #10b981 0%, #3b82f6 100%);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s ease;
}

.mobile-menu-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: #ffffff;
  border-radius: 2px;
  transition: all 0.3s ease;
}

.mobile-menu-toggle:active {
  transform: scale(0.95);
}

/* Hamburger animation when active */
.mobile-menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -6px);
}

/* ==========================================
   DESKTOP NAVIGATION STATES
   ========================================== */

@media (min-width: 1025px) {
  /* Hidden state - sidebar moves up out of view */
  .premium-sidebar.nav-hidden {
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
}

  /* Visible state - sidebar is shown */
  .premium-sidebar.nav-visible {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  /* Main content adjustments */
  .main-content {
    margin-top: 0;
    padding-top: 0;
    position: relative;
    z-index: 1;
    transition: margin-top 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  }

  /* When nav is hidden, remove top spacing */
  .premium-sidebar.nav-hidden ~ .main-content {
    margin-top: 0;
  }

  /* When nav is visible, add spacing */
  .premium-sidebar.nav-visible ~ .main-content {
    margin-top: 0;
  }
}

/* ==========================================
   MOBILE RESPONSIVE DESIGN
   ========================================== */

@media (max-width: 1024px) {
  /* Hide desktop buttons on tablet/mobile */
  .desktop-nav-toggle {
    display: none !important;
  }

  .desktop-close-nav {
    display: none !important;
  }

  /* Mobile sidebar - slides in from left */
  .premium-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    transform: translateX(-100%);
    overflow-y: auto;
    z-index: 1050;
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.3);
  }

  .premium-sidebar::-webkit-scrollbar {
    width: 6px;
  }

  .premium-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
  }

  /* Active state - sidebar slides in */
  .premium-sidebar.active {
    transform: translateX(0);
  }

  .sidebar-header {
    flex-direction: column;
    align-items: flex-start;
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  .logo-container {
    margin-bottom: 0.5rem;
  }

  .logo-container i {
    font-size: 2rem;
  }

  .logo-container h2 {
    font-size: 1.5rem;
  }

  .subtitle {
    margin-left: 0;
    margin-right: 0;
  }

  /* Vertical navigation on mobile */
  .sidebar-nav {
    flex-direction: column;
    align-items: stretch;
    padding: 1.5rem 0;
    overflow-x: visible;
  }

  .nav-item {
    padding: 0.875rem 2rem;
    border-radius: 0;
    border-left: 3px solid transparent;
  }

  .nav-item i {
    width: 20px;
    font-size: 1.1rem;
  }

  .nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-left-color: #4a6cf7;
  }

  .sidebar-footer {
    display: block;
    padding: 2rem;
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
  }

  .mobile-menu-toggle {
    display: flex;
  }

  /* Main content takes full width on mobile */
  .main-content {
    margin-top: 0 !important;
    margin-left: 0 !important;
    width: 100%;
  }

  .page-footer {
    margin-left: 0;
  }
}

/* ==========================================
   QUIZ-SPECIFIC ADJUSTMENTS
   ========================================== */

/* Ensure quiz hero section doesn't conflict with sidebar */

/* Floating progress stays visible above content */
.floating-progress {
  z-index: 998;
}

/* Performance card stays above regular content */
.performance-card {
  position: relative;
  z-index: 2;
}

/* Celebration overlay above everything except mobile menu */
.celebration-overlay {
  z-index: 10000;
}

/* Notifications visible but below celebration */
.notification {
  z-index: 9999;
}


/* ==========================================
   SMOOTH TRANSITIONS
   ========================================== */

@keyframes slideInFromLeft {
  from {
    transform: translateX(-100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOutToLeft {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(-100%);
    opacity: 0;
  }
}

@keyframes fadeInDown {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes fadeOutUp {
  from {
    transform: translateY(0);
    opacity: 1;
  }
  to {
    transform: translateY(-100%);
    opacity: 0;
  }
}

/* ==========================================
   ACCESSIBILITY IMPROVEMENTS
   ========================================== */

/* Focus styles for keyboard navigation */
.nav-item:focus,
.desktop-nav-toggle:focus,
.desktop-close-nav:focus,
.mobile-menu-toggle:focus {
  outline: 2px solid #4a6cf7;
  outline-offset: 2px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  .premium-sidebar,
  .nav-item,
  .desktop-nav-toggle,
  .mobile-menu-toggle {
    transition: none;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .premium-sidebar {
    border-bottom: 2px solid #ffffff;
  }
  
  .nav-item:hover {
    border: 2px solid #ffffff;
  }
}

/* ==========================================
   PRINT STYLES
   ========================================== */

@media print {
  .premium-sidebar,
  .desktop-nav-toggle,
  .mobile-menu-toggle {
    display: none !important;
  }
  
  .main-content {
    margin-top: 0 !important;
    margin-left: 0 !important;
  }
}