:root {
  --bg-deep: #0d0d1a;
  --bg-panel: #141428;
  --bg-surface: #1a1a2e;
  --bg-elevated: #222244;
  --accent-blue: #00d4ff;
  --accent-purple: #7c3aed;
  --accent-coral: #ff6b6b;
  --accent-green: #10b981;
  --accent-yellow: #fbbf24;
  --text-primary: #e8e8f0;
  --text-secondary: #8888aa;
  --text-dim: #555577;
  --glass-bg: rgba(20, 20, 40, 0.75);
  --glass-border: rgba(255, 255, 255, 0.06);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Space Grotesk', sans-serif;
  background: var(--bg-deep);
  color: var(--text-primary);
  overflow: hidden;
  height: 100vh;
}

#root {
  height: 100vh;
}

/* Scrollbar styling */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-dim); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* Animations */
@keyframes fadeScaleIn {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes spinSlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0, 212, 255, 0.3); }
  50% { box-shadow: 0 0 20px 4px rgba(0, 212, 255, 0.15); }
}

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

@keyframes slideInLeft {
  from { transform: translateX(-20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

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

@keyframes toastIn {
  from { transform: translateY(30px) scale(0.9); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes toastOut {
  from { transform: translateY(0) scale(1); opacity: 1; }
  to { transform: translateY(30px) scale(0.9); opacity: 0; }
}

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

.widget-enter {
  animation: fadeScaleIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.gear-spin {
  animation: spinSlow 8s linear infinite;
  display: inline-block;
}

.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
}

.canvas-grid {
  background-image: radial-gradient(circle, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 24px 24px;
}

.palette-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.palette-item:active {
  transform: translateY(0);
}

.confetti-piece {
  position: fixed;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  animation: confettiFall 2s ease-in forwards;
  pointer-events: none;
  z-index: 9999;
}

.toast-notification {
  animation: toastIn 0.3s ease forwards;
}

.toast-notification.exiting {
  animation: toastOut 0.3s ease forwards;
}

.progress-animated {
  background: linear-gradient(90deg, var(--bar-color) 0%, rgba(255,255,255,0.3) 50%, var(--bar-color) 100%);
  background-size: 200% 100%;
  animation: progressPulse 1.5s linear infinite;
}

/* Dragging states */
.dragging-over {
  background: rgba(0, 212, 255, 0.05) !important;
  border: 2px dashed var(--accent-blue) !important;
}

.widget-selected {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .sidebar-left, .sidebar-right {
    position: fixed;
    z-index: 50;
    top: 60px;
    bottom: 48px;
    transition: transform 0.3s ease;
  }
  .sidebar-left {
    left: 0;
    transform: translateX(-100%);
  }
  .sidebar-left.open {
    transform: translateX(0);
  }
  .sidebar-right {
    right: 0;
    transform: translateX(100%);
  }
  .sidebar-right.open {
    transform: translateX(0);
  }
}

/* Toggle switch styling */
.toggle-track {
  transition: background-color 0.2s ease;
}
.toggle-thumb {
  transition: transform 0.2s ease;
}