* {
  box-sizing: border-box;
}

body {
  background: linear-gradient(135deg, #0a0a0f 0%, #0f0f1a 50%, #0a0a0f 100%);
  background-attachment: fixed;
}

.header-gradient {
  background: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 50%, #ec4899 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.glass-card {
  background: rgba(26, 26, 46, 0.8);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

.input-glow:focus {
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.2);
}

.generate-btn {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 50%, #6d28d9 100%);
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.generate-btn:hover:not(:disabled) {
  box-shadow: 0 6px 25px rgba(139, 92, 246, 0.4);
}

/* Toggle Card Styling */
.toggle-card {
  background: rgba(255, 255, 255, 0.03);
  border: 2px solid rgba(255, 255, 255, 0.08);
  transition: all 0.3s ease;
}

.toggle-card-active {
  border-color: rgba(139, 92, 246, 0.5);
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(167, 139, 250, 0.05) 100%);
  box-shadow: 0 0 30px rgba(139, 92, 246, 0.15);
}

/* Toggle Switch Styling */
.toggle-switch {
  position: relative;
  width: 52px;
  height: 28px;
  border-radius: 9999px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  flex-shrink: 0;
}

.toggle-off {
  background: #3a3a4e;
}

.toggle-on {
  background: linear-gradient(135deg, #8b5cf6, #a78bfa);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.4);
}

.toggle-knob {
  position: absolute;
  top: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffffff 0%, #f0f0f0 100%);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toggle-knob-off {
  left: 3px;
}

.toggle-knob-on {
  left: 27px;
}

.toggle-sparkle {
  position: absolute;
  top: -8px;
  right: -8px;
  font-size: 16px;
  animation: sparkle-appear 0.6s ease-out forwards;
  pointer-events: none;
}

@keyframes sparkle-appear {
  0% {
    transform: scale(0) rotate(-45deg);
    opacity: 0;
  }
  50% {
    transform: scale(1.3) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: scale(1) rotate(15deg);
    opacity: 1;
  }
}

.sparkle-bounce {
  animation: knob-bounce 0.3s ease-out;
}

@keyframes knob-bounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* Transparency mode border */
.transparency-mode-border {
  position: relative;
}

.transparency-mode-border::before {
  content: '';
  position: absolute;
  inset: -2px;
  background: linear-gradient(90deg, rgba(139, 92, 246, 0.3), rgba(236, 72, 153, 0.3), rgba(139, 92, 246, 0.3));
  border-radius: 14px;
  z-index: -1;
  animation: subtle-glow 3s ease-in-out infinite;
}

@keyframes subtle-glow {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.checkerboard-bg {
  background-image: 
    linear-gradient(45deg, #2a2a3a 25%, transparent 25%),
    linear-gradient(-45deg, #2a2a3a 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #2a2a3a 75%),
    linear-gradient(-45deg, transparent 75%, #2a2a3a 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
  background-color: #1a1a2e;
}

.checkerboard-bg-small {
  background-image: 
    linear-gradient(45deg, #2a2a3a 25%, transparent 25%),
    linear-gradient(-45deg, #2a2a3a 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #2a2a3a 75%),
    linear-gradient(-45deg, transparent 75%, #2a2a3a 75%);
  background-size: 10px 10px;
  background-position: 0 0, 0 5px, 5px -5px, -5px 0px;
  background-color: #1a1a2e;
}

.generating-border {
  position: relative;
}

.generating-border::before {
  content: '';
  position: absolute;
  inset: -2px;
  background: linear-gradient(90deg, #8b5cf6, #ec4899, #8b5cf6);
  background-size: 200% 100%;
  border-radius: 14px;
  z-index: -1;
  animation: border-flow 2s linear infinite;
}

@keyframes border-flow {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

.loading-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid transparent;
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.confetti-particle {
  animation: confetti-fall 1.5s ease-out forwards;
}

@keyframes confetti-fall {
  0% {
    transform: translateY(-20px) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

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

.animate-slide-up {
  animation: slide-up 0.3s ease-out;
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #0a0a0f;
}

::-webkit-scrollbar-thumb {
  background: #2a2a3a;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #3a3a4a;
}

/* Focus states for accessibility */
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid #8b5cf6;
  outline-offset: 2px;
}

.toggle-switch:focus-visible {
  outline: 2px solid #8b5cf6;
  outline-offset: 2px;
}

/* Range input styling */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  background: #8b5cf6;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.4);
  transition: transform 0.2s;
}

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

/* Select styling */
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%239ca3af'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
}

/* Tooltip */
.tooltip-trigger {
  position: relative;
}

.tooltip-trigger:hover::after {
  content: attr(title);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #1a1a2e;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #9ca3af;
  font-size: 11px;
  padding: 8px 12px;
  border-radius: 8px;
  white-space: nowrap;
  max-width: 250px;
  white-space: normal;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .glass-card {
    padding: 1rem;
  }
  
  .header-gradient {
    font-size: 1.5rem;
  }
  
  .toggle-switch {
    width: 56px;
    height: 32px;
  }
  
  .toggle-knob {
    width: 26px;
    height: 26px;
  }
  
  .toggle-knob-on {
    left: 27px;
  }
}