/* 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: 20rem;
  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;
}

/* Karatsuba-specific styles */
.algorithm-step {
  background: white;
  border-radius: 8px;
  padding: 1rem;
  margin: 0.5rem 0;
  border-left: 4px solid #6366f1;
  transition: all 0.3s ease;
}

.algorithm-step:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.algorithm-step.active {
  border-left-color: #22c55e;
  background: #f0fdf4;
}

.algorithm-step.completed {
  border-left-color: #e5e7eb;
  background: #f9fafb;
  opacity: 0.8;
}

.number-display {
  font-family: 'Courier New', monospace;
  font-size: 1.2rem;
  font-weight: bold;
  background: #f3f4f6;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  display: inline-block;
  margin: 0.25rem;
}

.number-split {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 1rem 0;
}

.split-part {
  background: #dbeafe;
  color: #1e40af;
  padding: 0.5rem;
  border-radius: 4px;
  font-family: monospace;
  font-weight: bold;
}

.split-part.high {
  background: #fef3c7;
  color: #92400e;
}

.split-part.low {
  background: #d1fae5;
  color: #065f46;
}

.recursive-call {
  background: #f5f3ff;
  border: 2px dashed #8b5cf6;
  border-radius: 8px;
  padding: 1rem;
  margin: 0.5rem 0;
  position: relative;
}

.recursive-call::before {
  content: "Recursive Call";
  position: absolute;
  top: -10px;
  left: 10px;
  background: #8b5cf6;
  color: white;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: bold;
}

.multiplication-result {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: white;
  padding: 1rem;
  border-radius: 8px;
  text-align: center;
  font-size: 1.25rem;
  font-weight: bold;
  margin: 1rem 0;
}

.complexity-comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 1rem 0;
}

.complexity-item {
  text-align: center;
  padding: 1rem;
  border-radius: 8px;
}

.complexity-classical {
  background: #fee2e2;
  color: #991b1b;
}

.complexity-karatsuba {
  background: #dcfce7;
  color: #166534;
}

.step-counter {
  position: sticky;
  top: 1rem;
  background: white;
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  z-index: 10;
}

.challenge-input {
  background: #fffbeb;
  border: 2px solid #f59e0b;
  border-radius: 6px;
  padding: 0.75rem;
  font-family: monospace;
  font-size: 1.1rem;
  width: 100%;
  transition: all 0.3s ease;
}

.challenge-input:focus {
  border-color: #d97706;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
  outline: none;
}

.challenge-feedback {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 6px;
  animation: slideIn 0.3s ease;
}

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

.challenge-feedback.correct {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #22c55e;
}

.challenge-feedback.incorrect {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #ef4444;
}

/* Animation for step transitions */
.step-transition {
  animation: fadeInUp 0.5s ease;
}

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

/* Responsive design for Karatsuba */
@media (max-width: 768px) {
  .floating-panel {
    max-width: 16rem;
    bottom: 6rem;
    right: 1rem;
  }
  
  .floating-button {
    width: 3rem;
    height: 3rem;
  }
  
  .floating-button.primary {
    bottom: 1.5rem;
    right: 1.5rem;
  }
  
  .floating-button.secondary {
    bottom: 5.5rem;
    right: 1.5rem;
  }
  
  .complexity-comparison {
    grid-template-columns: 1fr;
  }
  
  .number-display {
    font-size: 1rem;
    padding: 0.4rem 0.8rem;
  }
  
  .algorithm-step {
    padding: 0.75rem;
  }
}

@media (max-width: 640px) {
  .number-split {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .split-part {
    padding: 0.75rem;
    width: 100%;
    text-align: center;
  }
  
  .step-counter {
    position: static;
    margin-bottom: 1rem;
  }
}

/* Loading animation */
.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #6366f1;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Highlight important formulas */
.formula-highlight {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border-left: 4px solid #f59e0b;
  padding: 1rem;
  border-radius: 6px;
  margin: 1rem 0;
  font-family: monospace;
  font-weight: bold;
}

.formula-highlight .formula-title {
  color: #92400e;
  font-size: 0.875rem;
  font-weight: normal;
  margin-bottom: 0.5rem;
}