/* 
 * MAVI Quiz Game - Contemporary Minimalism Theme
 * Gaming Premium Design System
 */

/* ====================================
   1. ROOT VARIABLES & COLOR SYSTEM
   ==================================== */

:root {
  /* Primary Palette - Dark Theme */
  --bg-primary: #0F172A;      /* slate-900 - Deep space background */
  --bg-secondary: #1E293B;    /* slate-800 - Card backgrounds */
  --bg-tertiary: #334155;     /* slate-700 - Elevated surfaces */
  
  /* Accent Colors - Cyan Gaming */
  --accent-primary: #06B6D4;  /* cyan-500 - CTAs and highlights */
  --accent-glow: #22D3EE;     /* cyan-400 - Hover states */
  --accent-dark: #0891B2;     /* cyan-600 - Active states */
  --accent-light: #67E8F9;    /* cyan-300 - Glow effects */
  
  /* Text Hierarchy */
  --text-primary: #F8FAFC;    /* slate-50 - Primary text */
  --text-secondary: #94A3B8;  /* slate-400 - Secondary text */
  --text-muted: #64748B;      /* slate-500 - Muted text */
  --text-inverse: #0F172A;    /* Dark text on light bg */
  
  /* Semantic Colors */
  --success: #10B981;         /* emerald-500 */
  --warning: #F59E0B;         /* amber-500 */
  --danger: #EF4444;          /* red-500 */
  --info: #3B82F6;            /* blue-500 */
  
  /* Effects & Overlays */
  --shadow-soft: 0 4px 16px rgba(0, 0, 0, 0.15);
  --shadow-medium: 0 8px 32px rgba(0, 0, 0, 0.2);
  --shadow-glow: 0 12px 48px rgba(6, 182, 212, 0.25);
  --shadow-hover: 0 16px 48px rgba(6, 182, 212, 0.3);
  
  /* Transitions */
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-medium: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Spacing System */
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 1.5rem;
  --spacing-lg: 2rem;
  --spacing-xl: 3rem;
  --spacing-2xl: 4rem;
  
  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;
}

/* ====================================
   2. TYPOGRAPHY SYSTEM
   ==================================== */

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

/* Base Typography */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text-primary);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Headings - Gaming Style */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Orbitron', sans-serif;
  color: var(--accent-primary);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.hero-title {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 700;
  background: linear-gradient(135deg, #06B6D4, #22D3EE, #67E8F9);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 2px 16px rgba(6, 182, 212, 0.3);
  margin-bottom: var(--spacing-xl);
  animation: titleGlow 3s ease-in-out infinite alternate;
}

@keyframes titleGlow {
  0% { filter: brightness(1); }
  100% { filter: brightness(1.2); }
}

.section-title {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--spacing-lg);
  position: relative;
  display: inline-block;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 0;
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-primary), transparent);
  border-radius: var(--radius-full);
}

/* ====================================
   3. LAYOUT SYSTEM
   ==================================== */

/* Main Background */
body {
  background: linear-gradient(135deg, #0F172A 0%, #1E293B 50%, #0F172A 100%);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Animated Background Pattern */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    radial-gradient(circle at 20% 50%, rgba(6, 182, 212, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(34, 211, 238, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 40% 20%, rgba(103, 232, 249, 0.03) 0%, transparent 50%);
  pointer-events: none;
  animation: backgroundPulse 20s ease-in-out infinite;
}

@keyframes backgroundPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Container System */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--spacing-lg);
}

.main-content {
  padding: var(--spacing-2xl) var(--spacing-lg);
  animation: fadeInUp 0.8s ease-out;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ====================================
   4. CARD SYSTEM - GLASS MORPHISM
   ==================================== */

.puzzle-card {
  background: rgba(30, 41, 59, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(6, 182, 212, 0.15);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  transition: all var(--transition-medium);
  box-shadow: 
    0 4px 16px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  overflow: hidden;
  position: relative;
}

/* Card Hover Effects */
.puzzle-card:hover {
  transform: translateY(-6px) scale(1.03);
  border-color: rgba(6, 182, 212, 0.4);
  box-shadow: 
    0 16px 48px rgba(6, 182, 212, 0.25),
    0 8px 24px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Card Glow Effect */
.puzzle-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, 
    transparent,
    rgba(6, 182, 212, 0.5),
    transparent
  );
  opacity: 0;
  transition: opacity var(--transition-medium);
}

.puzzle-card:hover::before {
  opacity: 1;
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Card Content */
.card-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.25rem;
  font-weight: 600;
  background: linear-gradient(135deg, #06B6D4, #22D3EE);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: var(--spacing-sm);
}

.card-description {
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.5;
  margin-bottom: var(--spacing-md);
}

.card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(34, 211, 238, 0.1));
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--spacing-md);
  transition: all var(--transition-medium);
}

.puzzle-card:hover .card-icon {
  transform: rotate(5deg) scale(1.1);
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.3), rgba(34, 211, 238, 0.2));
}

/* ====================================
   5. BUTTON SYSTEM
   ==================================== */

/* Primary Button - Gaming Style */
.btn-primary {
  background: linear-gradient(135deg, #06B6D4, #0891B2);
  border: none;
  border-radius: var(--radius-md);
  padding: 12px 28px;
  color: var(--text-inverse);
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  letter-spacing: 0.025em;
  transition: all var(--transition-medium);
  box-shadow: 
    0 4px 20px rgba(6, 182, 212, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.btn-primary::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.2) 0%, transparent 70%);
  transform: translate(-50%, -50%) scale(0);
  transition: transform 0.5s ease-out;
}

.btn-primary:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 
    0 8px 32px rgba(6, 182, 212, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.btn-primary:hover::before {
  transform: translate(-50%, -50%) scale(2);
}

.btn-primary:active {
  transform: translateY(0) scale(1.02);
}

/* Outline Button */
.btn-outline {
  background: transparent;
  border: 2px solid rgba(6, 182, 212, 0.5);
  border-radius: var(--radius-md);
  padding: 10px 24px;
  color: var(--accent-primary);
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  transition: all var(--transition-medium);
  backdrop-filter: blur(4px);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.btn-outline::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(6, 182, 212, 0.3), transparent);
  transition: left 0.5s ease-out;
}

.btn-outline:hover {
  background: rgba(6, 182, 212, 0.1);
  border-color: var(--accent-primary);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(6, 182, 212, 0.3);
}

.btn-outline:hover::before {
  left: 100%;
}

/* Ghost Button */
.btn-ghost {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 8px 16px;
  font-weight: 500;
  transition: all var(--transition-fast);
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.btn-ghost:hover {
  color: var(--accent-primary);
  background: rgba(6, 182, 212, 0.1);
}

/* ====================================
   6. LEADERBOARD SIDEBAR
   ==================================== */

.leaderboard-sidebar {
  background: rgba(30, 41, 59, 0.5);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(6, 182, 212, 0.1);
  border-radius: var(--radius-xl);
  padding: var(--spacing-lg);
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  position: sticky;
  top: var(--spacing-lg);
}

.leaderboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-lg);
  padding-bottom: var(--spacing-md);
  border-bottom: 1px solid rgba(6, 182, 212, 0.1);
}

.leaderboard-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.leaderboard-title i {
  color: var(--accent-primary);
  font-size: 1.25rem;
}

/* Leaderboard Items */
.leaderboard-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm);
  margin-bottom: var(--spacing-xs);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  animation: slideInRight 0.5s ease-out backwards;
  animation-delay: calc(var(--index) * 0.05s);
}

.leaderboard-item:hover {
  background: rgba(6, 182, 212, 0.1);
  transform: translateX(4px);
}

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

.leaderboard-rank {
  min-width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  border-radius: var(--radius-full);
  background: rgba(6, 182, 212, 0.1);
  color: var(--accent-primary);
}

.leaderboard-item:nth-child(1) .leaderboard-rank {
  background: linear-gradient(135deg, #FFD700, #FFA500);
  color: var(--text-inverse);
}

.leaderboard-item:nth-child(2) .leaderboard-rank {
  background: linear-gradient(135deg, #C0C0C0, #A8A8A8);
  color: var(--text-inverse);
}

.leaderboard-item:nth-child(3) .leaderboard-rank {
  background: linear-gradient(135deg, #CD7F32, #B87333);
  color: var(--text-inverse);
}

.leaderboard-name {
  flex: 1;
  font-weight: 500;
  color: var(--text-primary);
  font-size: 0.95rem;
}

.leaderboard-score {
  font-weight: 600;
  color: var(--accent-primary);
  font-size: 0.95rem;
}

/* ====================================
   7. GRID SYSTEM
   ==================================== */

.puzzle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-xl);
  animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Responsive Grid */
@media (max-width: 768px) {
  .puzzle-grid {
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .puzzle-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ====================================
   8. FORMS & INPUTS
   ==================================== */

.form-input {
  width: 100%;
  padding: 12px 16px;
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid rgba(6, 182, 212, 0.2);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: all var(--transition-fast);
  backdrop-filter: blur(4px);
}

.form-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  background: rgba(30, 41, 59, 0.7);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.1);
}

.form-input::placeholder {
  color: var(--text-muted);
}

/* ====================================
   9. ANIMATIONS & MICRO-INTERACTIONS
   ==================================== */

/* Pulse Animation for CTAs */
@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.9;
  }
}

.pulse-animation {
  animation: pulse 2s infinite;
}

/* Glow Animation */
@keyframes glow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(6, 182, 212, 0.3);
  }
  50% {
    box-shadow: 0 0 30px rgba(6, 182, 212, 0.5);
  }
}

.glow-animation {
  animation: glow 2s infinite;
}

/* Loading Spinner */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(6, 182, 212, 0.2);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* ====================================
   10. UTILITY CLASSES
   ==================================== */

/* Text Utilities */
.text-gradient {
  background: linear-gradient(135deg, #06B6D4, #22D3EE);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.text-glow {
  text-shadow: 0 0 20px rgba(6, 182, 212, 0.5);
}

/* Spacing Utilities */
.mt-xs { margin-top: var(--spacing-xs); }
.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }
.mt-xl { margin-top: var(--spacing-xl); }
.mt-2xl { margin-top: var(--spacing-2xl); }

.mb-xs { margin-bottom: var(--spacing-xs); }
.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }
.mb-xl { margin-bottom: var(--spacing-xl); }
.mb-2xl { margin-bottom: var(--spacing-2xl); }

/* Visibility Utilities */
.hidden { display: none !important; }
.invisible { visibility: hidden; }
.visible { visibility: visible; }

/* Flex Utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--spacing-sm); }
.gap-md { gap: var(--spacing-md); }
.gap-lg { gap: var(--spacing-lg); }

/* ====================================
   11. RESPONSIVE DESIGN
   ==================================== */

/* Mobile First Approach */
@media (max-width: 640px) {
  .hero-title {
    font-size: 2rem;
  }
  
  .section-title {
    font-size: 1.25rem;
  }
  
  .main-content {
    padding: var(--spacing-lg) var(--spacing-sm);
  }
  
  .puzzle-card {
    padding: var(--spacing-md);
  }
  
  .btn-primary,
  .btn-outline {
    width: 100%;
    padding: 14px;
  }
}

/* Tablet */
@media (min-width: 641px) and (max-width: 1024px) {
  .container {
    max-width: 100%;
    padding: 0 var(--spacing-md);
  }
}

/* Desktop Enhancement */
@media (min-width: 1025px) {
  .puzzle-card {
    transition: all var(--transition-medium);
  }
  
  .puzzle-card:hover {
    transform: translateY(-8px) scale(1.05);
  }
}

/* High Resolution */
@media (min-width: 1441px) {
  .container {
    max-width: 1600px;
  }
  
  .hero-title {
    font-size: 4.5rem;
  }
}

/* ====================================
   12. ACCESSIBILITY
   ==================================== */

/* Focus Styles */
*:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* Skip to Content */
.skip-to-content {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--accent-primary);
  color: var(--text-inverse);
  padding: 8px;
  z-index: 100;
  text-decoration: none;
  border-radius: var(--radius-sm);
}

.skip-to-content:focus {
  top: 0;
}

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

/* High Contrast Mode */
@media (prefers-contrast: high) {
  .puzzle-card,
  .leaderboard-sidebar {
    border-width: 2px;
  }
  
  .btn-primary,
  .btn-outline {
    border: 2px solid currentColor;
  }
}

/* Dark Mode Support (already implemented as default) */
@media (prefers-color-scheme: light) {
  /* Light theme overrides if needed */
}