/* Custom Animations */
@keyframes spin-slow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

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

@keyframes fade-in-scale {
  from { opacity: 0; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes bounce-in {
  0% { transform: scale(0); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

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

.animate-spin-slow {
  animation: spin-slow 3s linear infinite;
}

.animate-fade-in {
  animation: fade-in 0.5s ease-out forwards;
}

.animate-fade-in-scale {
  animation: fade-in-scale 0.4s ease-out forwards;
}

.animate-bounce-in {
  animation: bounce-in 0.5s ease-out forwards;
}

.animate-shake {
  animation: shake 0.4s ease-out;
}

/* Device Card Styles */
.device-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: white;
  border-width: 4px;
  border-radius: 0.75rem;
  overflow: hidden;
  transition: all 0.2s ease;
  cursor: pointer;
}

.device-card:hover:not(:disabled):not(.disabled) {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.device-card.selected {
  ring: 4px;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.5);
  transform: scale(1.05);
  z-index: 10;
}

.device-card.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.device-card img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
}

/* Card sizes */
.card-sm {
  width: 3.2rem;
  height: 4.2rem;
}

.card-md {
  width: 7rem;
  height: 9.5rem;
}

.card-lg {
  width: 9rem;
  height: 12rem;
}

@media (min-width: 768px) {
  .card-sm {
    width: 4rem;
    height: 5.2rem;
  }
  .card-md {
    width: 9rem;
    height: 12rem;
  }
  .card-lg {
    width: 11rem;
    height: 15rem;
  }
}

/* Line matching connector points */
.connector-point {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  border: 4px solid #d1d5db;
  background: white;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 20;
}

@media (min-width: 768px) {
  .connector-point {
    width: 2rem;
    height: 2rem;
  }
}

.connector-point:hover {
  transform: scale(1.25);
}

.connector-point.active {
  background: #6366f1;
  border-color: #a5b4fc;
  transform: scale(1.25);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
}

.connector-point.connected {
  background: #9ca3af;
  border-color: #9ca3af;
  cursor: default;
}

/* Drop zone */
.drop-zone {
  border: 4px dashed #d1d5db;
  border-radius: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f9fafb;
  transition: all 0.3s ease;
}

.drop-zone.filled {
  border-style: solid;
  border-color: transparent;
  background: transparent;
}

.drop-zone.highlight {
  border-color: #818cf8;
  background: #eef2ff;
}

/* Text card button */
.text-card-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 4px solid #e5e7eb;
  border-radius: 0.75rem;
  background: white;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.text-card-btn:hover {
  border-color: #a5b4fc;
  transform: scale(1.02);
}

.text-card-btn.selected {
  background: #4f46e5;
  color: white;
  border-color: #4f46e5;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
  transform: scale(1.05);
}

.text-card-btn.dim {
  opacity: 0.4;
}

/* Success overlay */
.success-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 1rem;
  z-index: 10;
  backdrop-filter: blur(4px);
}

/* Check mark for selected cards */
.check-badge {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  background: #6366f1;
  color: white;
  border-radius: 50%;
  width: 1.25rem;
  height: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: bold;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

@media (min-width: 768px) {
  .check-badge {
    top: 0.5rem;
    right: 0.5rem;
    width: 1.5rem;
    height: 1.5rem;
    font-size: 0.85rem;
  }
}

/* SVG line matching area */
.match-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

/* Page transition */
.page-enter {
  animation: fade-in 0.3s ease-out forwards;
}

/* Slot styles for page 10 */
.pattern-slot {
  width: 5rem;
  height: 5rem;
  border: 4px dashed #d1d5db;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f9fafb;
  font-weight: 700;
  font-size: 1.25rem;
  color: #d1d5db;
  transition: all 0.3s ease;
}

@media (min-width: 768px) {
  .pattern-slot {
    width: 8rem;
    height: 8rem;
    font-size: 1.5rem;
  }
}

.pattern-slot.filled {
  border-style: solid;
  border-color: #e5e7eb;
  background: white;
  color: inherit;
}

/* Speaker button */
.speak-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  border: 4px solid;
  border-radius: 1rem;
  cursor: pointer;
  transition: transform 0.2s ease;
  font-weight: 900;
}

.speak-btn:hover {
  transform: scale(1.05);
}

.speak-btn:active {
  transform: scale(0.95);
}
