/* Common styles for Virtual Labs experiments */

body {
  font-family: 'Poppins', sans-serif;
}

.gradient-bg {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
}

.card {
  transition: all 0.3s ease;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.btn {
  transition: all 0.2s;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0);
}

input[type="range"] {
  height: 0.5rem;
  cursor: pointer;
}

/* Floating action buttons & panels */
.floating-button {
  position: fixed;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.floating-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 14px rgba(0,0,0,0.25);
}

.floating-button:active {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.floating-button.primary {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
  bottom: 2rem;
  right: 2rem;
}

.floating-button.secondary {
  background: linear-gradient(135deg, #e879f9, #c084fc);
  color: white;
  bottom: 6.5rem;
  right: 2rem;
}

.floating-panel {
  position: fixed;
  max-width: 18rem;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  background: white;
  border-radius: 0.75rem;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  z-index: 99;
  bottom: 7rem;
  right: 2rem;
  transform-origin: bottom right;
  transform: scale(0);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 1.5rem;
}

.floating-panel.active {
  transform: scale(1);
  opacity: 1;
}

.floating-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.floating-panel-close {
  cursor: pointer;
  color: #6b7280;
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.floating-panel-content {
  max-height: calc(80vh - 3rem);
  overflow-y: auto;
}

.panel-title {
  font-weight: 600;
  font-size: 1.1rem;
  color: #1f2937;
  margin: 0;
}

/* Tower of Hanoi specific styles */
.game-container {
  position: relative;
  background: linear-gradient(135deg, #f8fafc, #e2e8f0);
  border-radius: 12px;
  padding: 16px;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
  width: 100%;
}

#gameCanvas {
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  cursor: grab;
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 2.2/1;
  max-height: 350px;
}

#gameCanvas:active {
  cursor: grabbing;
}

.game-status {
  display: flex;
  justify-content: space-around;
  margin-top: 16px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 8px;
  backdrop-filter: blur(10px);
}

.status-item {
  text-align: center;
}

.status-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: #1f2937;
  margin-top: 2px;
}

.move-history {
  overflow-y: auto;
  padding: 6px;
  background: white;
  border-radius: 4px;
  border: 1px solid #e5e7eb;
  font-size: 0.75rem;
}

.move-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2px 4px;
  margin: 1px 0;
  background: #f9fafb;
  border-radius: 3px;
  font-size: 0.75rem;
}

.move-number {
  font-weight: 600;
  color: #4f46e5;
  min-width: 30px;
}

.move-description {
  flex: 1;
  margin-left: 8px;
  color: #374151;
}

.move-time {
  font-size: 0.75rem;
  color: #6b7280;
}

/* Tower and disk styling */
.disk {
  transition: all 0.3s ease;
  cursor: pointer;
}

.disk:hover {
  filter: brightness(1.1);
}

.disk.invalid-move {
  animation: shake 0.5s ease-in-out;
}

@keyframes shake {
  0%, 20%, 40%, 60%, 80%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-3px); }
}

/* Animation effects */
.disk-moving {
  transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

/* Success animation */
.success-effect {
  animation: celebrate 2s ease-in-out;
}

@keyframes celebrate {
  0%, 100% { transform: scale(1); }
  25% { transform: scale(1.05) rotate(1deg); }
  50% { transform: scale(1.1) rotate(-1deg); }
  75% { transform: scale(1.05) rotate(1deg); }
}

/* Challenge dropdown styling */
#challengeSelect {
  min-width: 200px;
  background: linear-gradient(to bottom, #ffffff, #f9fafb);
  border: 2px solid #e5e7eb;
  transition: all 0.2s ease;
}

#challengeSelect:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

#challengeSelect:hover {
  border-color: #d1d5db;
}

/* Button group styling */
.btn-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-group .btn {
  flex: 1;
  min-width: 80px;
}

/* Responsive design */
@media (max-width: 1024px) {
  .grid.lg\\:grid-cols-4 {
    grid-template-columns: 1fr;
  }
  
  .lg\\:col-span-3 {
    grid-column: span 1;
  }
  
  #gameCanvas {
    aspect-ratio: 2/1;
  }
}

@media (max-width: 768px) {
  .game-container {
    padding: 10px;
  }
  
  #gameCanvas {
    width: 100%;
    height: auto;
    max-width: none;
  }
  
  .game-status {
    flex-direction: column;
    gap: 8px;
  }
  
  .status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  
  .status-label {
    display: inline;
    font-size: 0.875rem;
  }
  
  .status-value {
    display: inline;
    font-size: 1.25rem;
    margin-top: 0;
  }
}

@media (max-width: 640px) {
  .grid.md\\:grid-cols-3 {
    grid-template-columns: 1fr;
  }
  
  .grid.md\\:grid-cols-2 {
    grid-template-columns: 1fr;
  }
  
  .game-container {
    padding: 8px;
  }
  
  #gameCanvas {
    aspect-ratio: 1.5/1;
  }
}

/* Hasse Diagram specific styles */
#hasseCanvas {
  border-radius: 8px;
  background: linear-gradient(135deg, #f8fafc, #ffffff);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.05), 0 4px 8px rgba(0,0,0,0.1);
  cursor: crosshair;
  display: block;
  width: 100%;
  height: auto;
  min-height: 400px;
  max-height: 70vh;
  transition: all 0.3s ease;
}

#hasseCanvas:hover {
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.05), 0 6px 12px rgba(0,0,0,0.15);
}

/* Game container adjustments for Hasse diagrams */
.game-container {
  position: relative;
  background: linear-gradient(135deg, #f8fafc, #e2e8f0);
  border-radius: 12px;
  padding: 16px;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
  width: 100%;
}