/* Interactive Animation Styles */

/* Animation color variables - theme aware */
:root {
  /* Animation colors for dark theme */
  --anim-blue: #58a6ff;
  --anim-green: #7ee787;
  --anim-orange: #f78166;
  --anim-purple: #a371f7;
  --anim-cyan: #79c0ff;
  --anim-yellow: #e3b341;
  
  /* Grid and axis colors */
  --anim-grid: #21262d;
  --anim-axis: #30363d;
  --anim-axis-label: #8b949e;
  
  /* Glow colors */
  --anim-blue-glow: rgba(88, 166, 255, 0.3);
  --anim-green-glow: rgba(126, 231, 135, 0.3);
  --anim-orange-glow: rgba(247, 129, 102, 0.3);
}

[data-theme="light"] {
  /* Animation colors for light theme */
  --anim-blue: #2563eb;
  --anim-green: #16a34a;
  --anim-orange: #ea580c;
  --anim-purple: #7c3aed;
  --anim-cyan: #0891b2;
  --anim-yellow: #ca8a04;
  
  /* Grid and axis colors */
  --anim-grid: #e5e7eb;
  --anim-axis: #9ca3af;
  --anim-axis-label: #4b5563;
  
  /* Glow colors */
  --anim-blue-glow: rgba(37, 99, 235, 0.2);
  --anim-green-glow: rgba(22, 163, 74, 0.2);
  --anim-orange-glow: rgba(234, 88, 12, 0.2);
}

.animation-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin: var(--space-xl) 0;
  overflow: hidden;
}

.animation-container canvas {
  display: block;
  margin: 0 auto var(--space-md);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
}

.anim-controls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  align-items: center;
  justify-content: center;
  padding: var(--space-md) 0;
  border-top: 1px solid var(--border-color);
  margin-top: var(--space-md);
}

.anim-control {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  min-width: 150px;
}

.anim-control label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.anim-control .value {
  color: var(--accent-primary);
  font-weight: 600;
}

.anim-control input[type="range"] {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--bg-tertiary);
  appearance: none;
  cursor: pointer;
}

.anim-control input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent-primary);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.anim-control input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.anim-control input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent-primary);
  cursor: pointer;
  border: none;
}

.anim-btn {
  padding: 0.5rem 1.25rem;
  background: linear-gradient(135deg, var(--anim-blue), var(--anim-purple));
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(88, 166, 255, 0.3);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.anim-btn:hover {
  background: linear-gradient(135deg, var(--anim-purple), var(--anim-blue));
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(88, 166, 255, 0.4);
}

.anim-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(88, 166, 255, 0.3);
}

/* Light theme button adjustments */
[data-theme="light"] .anim-btn {
  background: linear-gradient(135deg, var(--anim-blue), var(--anim-purple));
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

[data-theme="light"] .anim-btn:hover {
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.anim-info {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md) var(--space-lg);
  justify-content: center;
  padding-top: var(--space-md);
  margin-top: var(--space-sm);
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.anim-info .info-item {
  background: var(--bg-tertiary);
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
}

.anim-info .info-item strong {
  color: var(--accent-primary);
}

/* Responsive adjustments */
@media (max-width: 600px) {
  .animation-container {
    padding: var(--space-md);
  }
  
  .animation-container canvas {
    max-width: 100%;
    height: auto;
  }
  
  .anim-controls {
    flex-direction: column;
    align-items: stretch;
  }
  
  .anim-control {
    min-width: 100%;
  }
}

/* Animation-specific styles */
.physics-demo {
  position: relative;
}

.physics-demo::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(88, 166, 255, 0.05), rgba(126, 231, 135, 0.05));
  pointer-events: none;
  border-radius: inherit;
}

/* Legend styles */
.anim-legend {
  display: flex;
  gap: var(--space-lg);
  justify-content: center;
  margin-top: var(--space-md);
  font-size: 0.85rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 2px;
}

.legend-color.blue { background: var(--anim-blue); }
.legend-color.green { background: var(--anim-green); }
.legend-color.orange { background: var(--anim-orange); }
.legend-color.purple { background: var(--anim-purple); }

/* Canvas text needs good contrast */
.animation-container canvas {
  color-scheme: inherit;
}

/* ============================================
   FULLSCREEN MODAL STYLES
   ============================================ */

/* Animation wrapper with header */
.animation-wrapper {
  position: relative;
}

.animation-header {
  display: flex;
  justify-content: flex-end;
  padding: 0 0 var(--space-sm) 0;
}

.anim-fullscreen-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.anim-fullscreen-btn:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-color: var(--accent-primary);
}

.anim-fullscreen-btn svg {
  flex-shrink: 0;
}

.anim-fullscreen-btn .fullscreen-icon-collapse {
  display: none;
}

/* Fullscreen overlay */
.animation-fullscreen-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(4px);
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.animation-fullscreen-overlay.active {
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
}

/* Fullscreen modal */
.fullscreen-modal {
  width: 95vw;
  max-width: 1400px;
  height: 90vh;
  max-height: 900px;
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalSlideIn 0.3s ease;
}

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

.fullscreen-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.fullscreen-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.fullscreen-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.fullscreen-close-btn:hover {
  background: #ef4444;
  border-color: #ef4444;
  color: white;
}

.fullscreen-content {
  flex: 1;
  overflow: auto;
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
}

/* Animation container in fullscreen mode */
.fullscreen-content .animation-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin: 0;
  max-height: 100%;
}

.fullscreen-content .animation-container canvas {
  flex: 1;
  max-height: calc(100% - 200px);
  width: auto !important;
  height: auto !important;
  object-fit: contain;
}

/* Body class when fullscreen is active */
body.animation-fullscreen-active {
  overflow: hidden;
}

/* Hide fullscreen button text on mobile */
@media (max-width: 600px) {
  .anim-fullscreen-btn .fullscreen-text {
    display: none;
  }

  .anim-fullscreen-btn {
    padding: 8px;
  }

  .fullscreen-modal {
    width: 100vw;
    height: 100vh;
    max-width: none;
    max-height: none;
    border-radius: 0;
  }

  .fullscreen-content {
    padding: var(--space-md);
  }
}

/* When in fullscreen, show collapse icon instead of expand */
.animation-wrapper.is-fullscreen .fullscreen-icon-expand {
  display: none;
}

.animation-wrapper.is-fullscreen .fullscreen-icon-collapse {
  display: block;
}

