/* Custom CSS for QwikQwiz Mobile Quiz Platform */

/* Root variables for consistent theming */
:root {
  --primary-50: #f0f9ff;
  --primary-100: #e0f2fe;
  --primary-500: #0ea5e9;
  --primary-600: #0284c7;
  --primary-700: #0369a1;
  --success-500: #22c55e;
  --warning-500: #f59e0b;
  --danger-500: #ef4444;
}

/* Base mobile-first styles */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Mobile navigation improvements */
.mobile-menu-button {
  transition: all 0.2s ease-in-out;
}

.mobile-menu-button:hover {
  transform: scale(1.05);
}

.mobile-menu {
  transition: all 0.3s ease-in-out;
}

.mobile-menu.hidden {
  display: none !important;
}

.mobile-menu:not(.hidden) {
  display: block !important;
}

/* Flash message animations */
.flash-message {
  animation: slideInDown 0.5s ease-out;
}

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

.flash-message.fade-out {
  animation: fadeOut 0.5s ease-out forwards;
}

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

/* Quiz option styling enhancements */
.quiz-option {
  transition: all 0.2s ease-in-out;
  position: relative;
}

.quiz-option:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.quiz-option.selected {
  border-color: var(--primary-500);
  background-color: var(--primary-50);
  box-shadow: 0 0 0 1px var(--primary-500);
}

.quiz-option input[type="radio"] {
  transition: all 0.2s ease-in-out;
}

/* Button hover effects */
.btn-hover-lift {
  transition: all 0.2s ease-in-out;
}

.btn-hover-lift:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Loading spinner */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Progress bar animations */
.progress-bar {
  transition: width 0.6s ease-in-out;
}

.progress-bar.animate {
  animation: progressFill 1.5s ease-out;
}

@keyframes progressFill {
  from {
    width: 0%;
  }
}

/* Leaderboard widget positioning */
.leaderboard-widget {
  position: fixed;
  top: 5rem;
  right: 1rem;
  z-index: 40;
  max-width: 280px;
  backdrop-filter: blur(10px);
  background-color: rgba(255, 255, 255, 0.95);
}

@media (max-width: 1024px) {
  .leaderboard-widget {
    display: none !important;
  }
}

/* Quiz navigation improvements */
.quiz-navigation {
  position: sticky;
  bottom: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(229, 231, 235, 0.8);
}

/* Card hover effects */
.card-hover {
  transition: all 0.3s ease-in-out;
}

.card-hover:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

/* Form input focus states */
.form-input {
  transition: all 0.2s ease-in-out;
}

.form-input:focus {
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
  border-color: var(--primary-500);
}

/* Modal animations */
.modal {
  transition: all 0.3s ease-in-out;
}

.modal.show {
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-50px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Touch-friendly improvements for mobile */
@media (max-width: 768px) {
  /* Larger touch targets */
  button, a, input[type="radio"], input[type="checkbox"] {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* Better spacing for mobile */
  .quiz-option {
    padding: 1rem;
    margin-bottom: 0.75rem;
  }
  
  /* Mobile-specific navigation */
  .mobile-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
  }
}

/* Dark mode support (if needed) */
@media (prefers-color-scheme: dark) {
  .dark-mode-support {
    /* Dark mode styles would go here */
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .quiz-option {
    border-width: 2px;
  }
  
  .quiz-option.selected {
    border-width: 3px;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Print styles */
@media print {
  .no-print {
    display: none !important;
  }
  
  .quiz-question {
    page-break-inside: avoid;
  }
}

/* Custom scrollbar for webkit browsers */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #a1a1a1;
}

/* Focus indicators for accessibility */
.focus-visible {
  outline: 2px solid var(--primary-500);
  outline-offset: 2px;
}

/* Skip link for accessibility */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: #000;
  color: #fff;
  padding: 8px;
  text-decoration: none;
  z-index: 1000;
}

.skip-link:focus {
  top: 6px;
}

/* Custom utility classes */
.text-shadow {
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.backdrop-blur {
  backdrop-filter: blur(4px);
}

.glass-effect {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Performance optimizations */
.will-change-transform {
  will-change: transform;
}

.hardware-accelerated {
  transform: translateZ(0);
}

/* Custom animations for specific elements */
.pulse-slow {
  animation: pulse 3s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.bounce-gentle {
  animation: bounce 2s infinite;
  animation-timing-function: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Trophy animation for leaderboard */
.trophy-glow {
  animation: trophyGlow 2s ease-in-out infinite alternate;
}

@keyframes trophyGlow {
  from {
    text-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
  }
  to {
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.8), 0 0 30px rgba(255, 215, 0, 0.6);
  }
}

/* Loading states */
.loading-skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Error states */
.error-shake {
  animation: shake 0.5s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* Success states */
.success-bounce {
  animation: successBounce 0.6s ease-out;
}

@keyframes successBounce {
  0% { transform: scale(0.9); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}
